The present invention relates to a device control system that controls a device, a printer, and a control method of the device control system.
A device (such as a computer) used as a controller for controlling devices is conventionally part of a system that controls devices such as a keyboard and barcode scanner by means of a terminal connected to a network.
However, there is also a need to use devices such as above by means of a simple configuration.
The present invention is directed to the foregoing problem, and an object of the invention is to provide a device control system, a printer, and a control method of a device control system that can control devices by a terminal connected to a network.
To achieve the foregoing object, a device control system according to the invention has a device; a device control device including a connection unit configured to connect to the device, and a device control unit configured to control the device connected to the connection unit; and a terminal that runs a web browser executing a device application programming interface that connects to the device control device, displays a web application, and controls the device.
The invention enables controlling a device connected to a device control device through the web browser of a terminal.
In the invention, the device application programming interface has an object that supports the device; and the web application calls the object and sends a request to the device control device.
In another aspect of the invention, the device control device executes a device control script that controls the device; and the device control script connects to the object, receives the request sent by the terminal, and controls the device connected to the connection unit.
In another aspect of the invention, the device control script has a device connection object that sends and receives data with the device, and a client connection object that sends data to the device API.
In another aspect of the invention, the request is a start control request specifying the device connected to the device control device and instructing starting control of the device; the command is a start control command instructing starting control of the device; and when the terminal sends the start control request to the device control device, the device control device sends the start control command to the device specified by the start control request, and enables control of the device by the terminal.
Another aspect of the invention also has a second terminal running a web browser that executes a second device application programming interface that connects to the device control device, displays a second web application, and controls the device; the second the device application programming interface having a second object that supports the device.
In another aspect of the invention, when the device can be controlled by the terminal, the device control device exclusively locks the device, and if the second web application calls the second object and sends a second request to the device control device, does not allow control of the device in the second request.
In another aspect of the invention, if the second terminal sends the second request to the device control device when the device can be controlled by the terminal, the device control device sends a report indicating the device is busy to the second terminal.
In another aspect of the invention, the device is a printer configured to print; and if the second terminal sends the second request to the device control device when the printer can be controlled by the terminal, the device control device enables the second terminal to control the printer by the device control script based on the second request.
In another aspect of the invention, the web application of the terminal calls the object and sends a stop control request specifying the device and instructing ending control of the device to the device control device; and when the terminal sends the stop control request to the device control device, the device control device sends a second command instructing stopping control by the device control script to the device specified by the stop control request, and stops control of the device by the terminal.
In another aspect of the invention, when the second terminal sends the second request to the device control device after the device control device stops control of the device by the terminal, the device control device enables control by the second terminal of the device by the device control script based on the second request.
In another aspect of the invention, the device application programming interface detects connection of the object and the device control script of the device control device.
In another aspect of the invention, the object calls an event contained in the device control script.
In another aspect of the invention, the device is a display configured to display content; the request is a display request that specifies the display and requests displaying content on the display; and when the terminal sends the display request to the device control device, the device control device sends a display command requesting display by the device control script to the display specified by the display request.
In another aspect of the invention, the display request requests displaying time on the display.
In another aspect of the invention, the request is a registration request that specifies the device and requests registering image data in the device; and when the terminal sends the registration request to the device control device, the device control device sends a registration command instructing registering the image by the device control script to the device specified by the registration request.
The terminal also sends the image data to the device control device; and the device control script converts the image data to the raster image data.
The request is also an encryption request that specifies the device, and instructs whether or not to encrypt data sent and received between the device and the terminal.
Another aspect of the invention is a printer including: a connection unit configured to connect to a device; a device control unit configured to execute a device control script that controls a device, and to control the device connected to the connection unit; and a print unit configured to print.
Another aspect of the invention is a control method of a device control system, including: a terminal that runs a web browser, a device, and a device control device configured to connect to the device; calling an object supporting the device by a web application that runs on the web browser; sending a request to the device control device; executing a device control script that controls the device by the device control device; sending to the device a command that controls the device by the device control script based on the request received by the device control device; and establishing control of the device by the terminal.
The request is a start control request specifying the device connected to the device control device and instructing starting control of the device; and when the terminal sends the start control request to the device control device, the device control device sends the control command to the device, and starts control of the device by the terminal.
Objects of the invention are also met in a printer having: a communication interface configured to communicate with a first computing device that has access to a target-device application programming interface (API) that initiates a control object configured to control a target device; a connector configured to connect to the target device; and a controller configured as a command interface between the first computing device and the target device connected to the connector.
Preferably, the printer is further configured to receive instruction requests from the first computing device, the instruction requests being generated by the control object by use of the API for controlling the target device; and the controller applies commands via the connector to the target device for executing the received instruction requests and sends back to the first computing device any data responses received from the target device.
Additionally, the target device may be selected from among a plurality of periphery devices; the connector is configured to connect to each of the plurality of periphery devices; the controller executes a device control script that controls the target device; and the device control script connects to the control object, receives the instruction requests sent by the first computing device, and issues commands that control the target device connected to the connector in accordance with the received instruction requests.
Preferably, the connector includes a plurality of physical connection ports, each physical connection port being connected to a respective one of the plurality of periphery devices; and the device control script has a target-device connection object that sends and receives data to and from the target device, and has a client connection object that sends data to the target-device API.
Further preferably, one of the instruction requests may be a start-control request specifying the target device connected to the connector and instructing starting control of the target device; the command sent in accordance with the start-control request is a start-control command instructing starting control of the target device; and when the controller receives the start-control request from the first computing device, the controller sends the start-control command to the target device specified by the start-control request, and enables control of the target device by the first computing device.
Additionally, the controller may communicate with a second computing device that has access to a second target-device API that instantiates a second control object configured to control the target device, and the controller optionally functions as a command interface between the second computing device and the target device connected to the connector. In this case, the second computing device optionally controls the target device by using the second target-device API to cause the second control object to send second instruction requests to the controller, and the controller applies the received second instruction requests to the target device and sends back to the second computing device any data responses received from the target device.
In this case, if the target device is currently being controlled by the first computing device and the controller receives a second instruction request from the second control object requesting control of the target device, the controller does not allow control of the target device by the second computing device.
Preferably, if the controller receives a second instruction request for controlling the target device from the second computing device when the target device is being controlled by the first computing device, the controller sends to the second computing device a report indicating that the target device is busy.
The printer may further be designated a first printer. Additionally, the target device is a second printer configured to print. In this case, if the controller receives a second instruction request for controlling the second printer from the second computing device when the first printer is being controlled by the first computing device, then the controller enables the second computing device to control the second printer by the device control script based on the second instruction request.
Additionally, another of the instruction requests received by the controller from the first computing device may be a stop control request specifying the target device and instructing ending control of the target device. Preferably, in response to the first computing device sending the stop control request to the controller, the controller sends a second control command to the target device instructing stopping control of the target device by the first computing device, and stops control of the target device by the first computing device. Preferably, when the controller receives a second instruction request requesting control of the target device from the second computing device after the controller stops control of the target device by the first computing device, the controller enables control of the target device by the second computing device using the device control script.
Further preferably, the target device is a display configured to display content, and one of the instruction requests sent by the first computing device is a display request that specifies the display and requests displaying content on the display. When the controller receives the display request from the first computing device, the controller uses the device control script to send a display command requesting display of the content to the display specified by the display request.
Alternatively, one of the instruction requests sent by the first computing device is a registration request that specifies the target device and requests registering image data in the target device. In this case, when the controller receives the registration request from the first computing device, the controller uses the device control script to send a registration command to the target device specified by the registration request, wherein the registration command instructs registering the image.
Further preferably, the controller receives the image data from the first computing device; and the device control script converts the image data to a raster image data.
A preferred embodiment of the invention is described below with reference to the accompanying figures.
The device control system 100 includes the application server 2, a terminal 3, and a printer 5 (intelligent printer). In this device control system 100, the application server 2, terminal 3, and printer 5 are connected over a communication network. In the example shown in
A network printer 7, customer display 8, and barcode scanner 9 are connected to the printer 5 as controlled devices. The network printer 7 is connected to the printer 5 through a network. The customer display 8 and barcode scanner 9 are connected through a USB interface described below. These devices are generally called peripheral devices (peripherals), and are referred to below as devices.
Devices that connect to the printer 5 are not limited to the devices shown in
The terminal 3 has a network-connectable web browser, and devices connected to the printer 5 can be controlled through this web browser.
The terminal 3 can be any terminal with a network-connectable web browser, and a tablet computer known from the literature such as shown in
Operation of the device control system 100 is described next.
(1) Place a web application on the application server 2.
(2) Display the web application with the web browser of the terminal 3.
(3) The web browser of the terminal 3 sends a request message to the printer 5.
(4) The printer 5 receives the request message. Based on the received request message, the printer 5 sends data to a device that can be controlled by the printer 5.
(5) The network printer 7, customer display 8, and barcode scanner 9 connected to the printer 5 are controlled.
(6) The printer 5 returns a response to the web application.
Operation of this device control system 200 is described next.
(1) Place a web application on the application server 2.
(2) Display the web application with the web browser of the terminal 3.
(3) The web browser of the terminal 3 sends a request message to the printer 5.
(4) The printer 5 receives the request message. Based on the received request message, the printer 5 sends data to a device that can be controlled by the printer 5.
(5) The network printer 7, customer display 8, and barcode scanner 9 connected to the printer 5 are controlled.
(6) The printer 5 returns a response to the web application.
Operation of the device control system 300 is described next.
(1) Place a web application on the printer 5.
(2) Display the web application with the web browser of the terminal 3.
(3) The web browser of the terminal 3 sends a request message to the printer 5.
(4) The printer 5 receives the request message. Based on the received request message, the printer 5 sends data to a device that can be controlled by the printer 5.
(5) The network printer 7, customer display 8, and barcode scanner 9 connected to the printer 5 are controlled.
(6) The printer 5 returns a response to the web application.
In a system applying the invention, a terminal 3 with an installed web browser can thus display a web application and control a device connected to the printer 5.
The configuration of the printer 5 is described next.
The printer 5 has a CPU, RAM, flash ROM, nonvolatile memory, a video controller, an auxiliary storage device (SSD: solid state drive), interface, and a local printer (print unit). The printer 5 could also have a speaker. The local printer is a thermal printer that can print on 80 mm wide or 58 mm wide roll paper.
The printer 5 can be installed in a POS (point of sale) system. The operating system (OS) of the printer 5 is Windows® based, for example, and is stored in the auxiliary storage device.
A device control program, which is software for the terminal 3 to control devices connected to the printer 5, is installed to the printer 5. As a result, installing a driver program to the terminal 3 is not necessary.
The printer 5 also has a Windows® standard device driver program (APD), UPOS driver, OPOS driver, or other software for controlling devices and the local printer of the printer 5.
A web application can be installed to the printer 5. This enables using the printer 5 as an application server as shown in
The foregoing network printer 7, customer display 8, and barcode scanner 9 can be connected to the printer 5. A display 12, cash drawer 13, and keyboard 14 can also be connected to the printer 5.
A roll paper cover 51 is disposed to the top of the printer 5. The roll paper cover opens when the cover open button 52 is pressed, and roll paper can be loaded. A manual cutter 53 for manually cutting the roll paper, and a cutter cover 54, are disposed to the paper exit from which the roll paper is discharged after printing. The cutter cover 54 is opened when a paper jam occurs in the local printer of the printer 5, and when the roll paper cover 51 does not open. The blade of the manual cutter 53 returns to the home position when the cutter cover 54 opens. The printer 5 also has a power switch 56B, reset button 56A, LED display unit 57, and control panel 58. The LED display unit 57 includes a disc access LED indicating accessing the auxiliary storage device, and status LEDs. The status LEDs report the operating state of the OS, the standby mode of the OS, that the power is off, the OS start-up sequence, and a high CPU temperature warning.
The control panel 58 includes a power LED, error LED, roll paper LED, and paper feed button. The power LED lights when power is supplied. The error LED is off during normal operation, and lights when the printer resets and when the end of the roll paper is detected and printing stops. The paper LED is off when sufficient roll paper remains, lights steady when little paper is left, and blinks when the self-diagnostic test is running. Pressing the feed button advances the roll paper one line at a time or continuously.
A connector cover 59 is disposed to the back of the printer 5. Removing the connector cover 59 exposes the connector panel (connection panel) on the back of the printer 5.
The cash drawer 13 or an optional buzzer is connected to the drawer kick-out connector 61. The Ethernet connector 62 is connected to the network. The USB connector 63 has six USB ports. The customer display 8, barcode scanner 9, keyboard 14, and other devices are connected to the USB connector 63. The display 12 is connected to the VGA connector 64. A serial interface for serial communication devices connects to the COM connector 65. The line output 66 connects to an external speaker.
An embodiment of the invention is described in detail below using the device control system 100 as an example.
The web browser 31 of the terminal 3 displays a web application 32 provided by the application server 2. The web application 32 calls a device application programming interface (API) 33 of the web browser 31. The device API 33 is, for example, a Java® script, and as described below instantiates an object that controls a device connected to the printer 5. The web application 32 calls (APICall) an object of the device API 33. The device API 33 sends a request (Request) to the printer 5 by a function of the called object.
The device service interface 501 of the printer 5 receives the request, and controls a device control script 502. The device control script 502 controls a key input device 18 and serial communication device 19. The device control script 502 acquires data input by the key input device 18, and outputs data to the device service interface 501. The device control script 502 handles data communication with the serial communication device 19, and outputs data received from the serial communication device 19 to the device service interface 501. The key input device 18 in this example includes the keyboard 14, and the serial communication devices 19 include the barcode scanner 9 and cash drawer 13.
The device service interface 501 exchanges data with the local printer 55. The local printer 55 is the local print unit of the printer 5. The device service interface 501 also exchanges data with the network printer 7 and customer display 8. The device service interface 501 outputs device events (Event) and device responses (Response) to the device API 33. The device API 33 outputs a response (Callback) to the web application 32.
A terminal 3 controls a device connected to a printer 5 in the device control system 100 by the operation described above.
The invention is thus used to control devices (peripherals) connected to a printer 5 in a multi-platform environment. By using this system, devices can be controlled using a personal computer, smartphone, or tablet computer in which a web browser is installed.
The device API 33 has the following features.
The device API 33 also has the following features.
Building a device service interface 501 environment is described next.
1. Network Settings
Configure the system and printer 5 network. These settings can be made using the same procedure used for configuring a Windows® network.
2. Register Web Content
Register the web content in the printer 5 from the web browser.
The printer 5 can function as a web server to register web content. The registered web content can be viewed from the web browser 31 of the terminal 3.
The registered web content is compressed to a single file in ZIP format containing all content files. The name of the ZIP file can be specified as desired. The ZIP filename and subfolder names are written using ASCII characters.
Web content cannot be appended, and all files are registered by overwriting the old files. When accessing web content registered in the printer 5 from the terminal 3, for example, the URL that is accessed differs according to the folder structure of the ZIP file. Specific examples are shown in
3. Connect a Device to the Printer 5
Connect a device to the printer 5. As described above, connectable devices include the customer display 8, barcode scanner 9, display 12, cash drawer 13, and keyboard 14. Also included are devices that can be controlled by a HID driver standard to the OS, serial communication devices that can be operated using a serial communication driver standard to the OS, and USB devices that can be controlled in the same way as serial communication devices. The connection panel 60 in
4. Register Device Control Script
A device control script prepared by the user is registered in order for the printer 5 to control devices other than products with which the printer 5 is compatible. Registration is done from the web browser.
5. Register Device
Register the device connected to the printer 5 in the printer 5 software. Registration is done from the web browser.
The web browser used for steps 1 to 5 includes the web browser 31.
The method of registering web content in step 2 is described in detail.
The web content registration file is registered by the web browser displaying the TMNetWebConfig utility as shown in
The registration steps are as follow.
(1) Combine the web content to register in a single ZIP file.
(2) Turn the printer 5 power on.
(3) Start the web browser, and input the URL (http://IP address of printer 5/TMNetWebConfig/).
(4) The TMNetWebConfig utility starts. Click on [Web service settings]-[Update settings] in the window shown in
(5) The Web Content Update Settings screen is displayed. Click on [Browse] in the web content file field, and select the ZIP file containing the web content that was prepared in step (1).
(6) Click [Upload].
Registering a device control script in step 4 is described in detail.
The device control script prepared by the user is registered by the web browser displaying the TMNetWebConfig tool as shown in
The registration steps are as follow.
(1) Prepare a customized device control script.
(2) Turn the printer 5 power on.
(3) Start the web browser, and input the URL (http://IP address of printer 5/TMNetWebConfig/).
(4) Start the TMNetWebConfig utility. Click on [Web service settings]-[Register/delete] in the window shown in
(5) The Control Script screen is displayed. Click on [Browse] in the Control script to be registered field, and select the device control script to register.
(6) Click [Register]. The device control script is registered and listed in the Registered control scripts field in the bottom of the window.
Registering a device in step 5 is described in detail.
A device is registered by the web browser displaying the TMNetWebConfig tool as shown in
The registration steps are as follow.
(1) Start the web browser, and input the URL (http://IP address of printer 5/TMNetWebConfig/).
(2) Start the TMNetWebConfig utility. From [Web service settings]-[Device registration] in the window shown in
(3) A configuration screen is displayed for each device. The connected device is registered in the printer 5.
(3-1) To register a printer
Registration of the local printer incorporated in the printer 5 can be confirmed as follows.
(3-1-1) Check that “printer 5” is registered for the device ID “local_printer” in the Registered Printer field in the screen shown in
(3-1-2) Click on [Test printing]. Check that TEST_PRINT is printed by the local printer.
(3-1-3) Register the connected network printer 7.
Register the network printer 7 by the following steps.
(3-1-3-1) Set the items shown in
(3-1-3-2) After confirming the printer is added to the Registered Printer list, click [Test printing]. Confirm that TEST_PRINT is printed by the registered network printer 7.
(3-2) To register a display (customer display 8)
The device ID of the customer display is a constant, “local_display”. Register the connected customer display 8 by the following steps.
(3-2-1) Select Use in the screen shown in
(3-2-2) Set the items (communication settings, brightness settings) in
(3-2-3) Click [Test display]. Confirm that text is displayed on the customer display 8.
(3-3) To register a key input device 18
Register the connected key input device 18 by the following steps.
(3-3-1) Set the items (device ID, device name, control script) in
(3-3-2) After confirming the registered device was added to the Registered Key Input Device field, click [Operating test].
(3-3-3) A screen will be displayed by the web browser. Operate the key input device 18, and confirm that the result is displayed as operated.
(3-4) To register a serial communication device 19
Register the connected serial communication device 19 by the following steps.
(3-4-1) Set the items (device ID, device name, control script, communication speed, data bit, parity, stop bit, flow control) shown in
(3-4-2) Confirm that the device is added to the Registered Serial Communication Device field.
(3-5) To register another device
Register another connected device by the following steps.
(3-5-1) Set the items (device ID, control script) shown in
(3-5-2) Confirm that the device is added to the Registered Other Devices field.
The programming method for developing an application using the device API 33 is described next.
The device API 33 is embedded as follows.
The device API 33 is provided to enable using the device control function of this system from a client-side JavaScript. The device API 33 is written in JavaScript. An example of a filename is device-*.js.
First, embed the device-*.js file in the application for use.
In preparation, place the device-*.js file on the web server to use the device API 33.
Next, embed the script in the web page. Embed the script in the web page using the HTML <script> tag.
(Sample tag)
<scripttype=“text/javascript”src=“device-1.0.0.js”></script>
The programming flow is shown in
Applications in
1: Web application 32 sends the “newEpsonDevice( )” command, and a device object is instantiated.
2: Web application 32 sends the “Connect( )” command, and establishes a communication path to the device control function.
2.1: The device control function returns “Callback(OK)”.
3: Web application 32 sends the “CreateDevice(DEVICE_TYPE_PRINTER)” command.
3.1: Device service interface 501 sends the “Cmd( )” command to the device.
4: Device returns “Deviceopen”.
4.1: Device control function returns “callback(Object, ‘OK’)”.
Web application 32 gets a device object by steps 3 to 4.1.
5: Web application 32 registers a callback according to the device.
6: Web application 32 calls a method according to the device.
6.1: “Cmd( )” command is sent to the device.
6.1.1: Device executes the command.
5.1: Device returns the result of command execution.
5.2: Device control function returns “callback(‘success’)”.
7: Web application 32 sends “deleteDevice(Object)”, and releases the device object.
7.1: “Cmd( )” command is sent to the device.
8: Device returns device closed.
8.1: Device control function returns “callback(‘OK’)”.
9: Web application 32 sends “disconnect( )” command, closes communication link to device service interface 501.
The device API 33 is described in detail next.
The device API 33 provides the following objects.
The Device object is described in detail.
Constructor
Constructor of a Device object. Instantiates and initializes a Device object.
[Syntax]
Device( );
[Return value]
Device object
connect method
Establishes communication link to device service interface 501.
[Syntax]
connect (ipAddress, port, callback);
[Parameters]
ipAddress:object type: (String)
Specifies the IP address of□ printer 5.
port: object type: (Number)
Specifies 8008 (port number of device service interface 501).
callback: object type: (Function)
Specifies the callback that receives the process result. A string shown in
disconnect method
Closes the communication path established by the connect method.
[Syntax]
disconnect( );
isConnect method
Obtains the status of the communication path established by the connect method.
[Syntax]
isConnect( );
[Return value]
The return value is the status of the communication path as shown in
The deviceAP object is described in detail.
createDevice method
Gets a device object to act as the interface to the device.
When this method executes successfully, the specified device is exclusively locked, and DEVICE_IN_USE is returned when createDevice is called from another browser. Because the printer is not exclusively locked, a device object can be obtained by createDevice from plural browsers.
If createDevice is executed immediately during a return process after an ondisconnect event, DEVICE_IN_USE is returned. In this event, the createDevice method retries until a value other than DEVICE_IN_USE is obtained.
[Syntax]
createDevice (deviceId, deviceType, crypto, callback);
[Parameters]
deviceId: object type: (String)
Specifies the device ID.
Declare “local_display” when DEVICE_TYPE_DISPLAY is specified in the second parameter (deviceType).
deviceType: object type: (String)
Specifies any device type shown in
crypto: object type: (Boolean)
Specifies whether or not to encrypt communications data.
callback: object type: (Function)
Specifies the callback that receives the process result. If the second parameter of the callback is OK, the device object is returned in the first parameter. The second parameter is a string shown in
deleteDevice method
Releases a device for use by another client.
[Syntax]
deleteDevice (deviceObject, callback);
[Parameters]
deviceObject: object type: (Object)
Specifies the device object.
callback: object type: (Function)
Specifies the callback that receives the process result. The parameter of the callback is a string shown in
getAdmin method
Obtains the administrator set in the printer 5. (The administrator can be set using the TMNetWebConfig utility.
[Syntax]
getAdmin( );
[Return value]
String of administrator's name (String)
getLocation method
Gets the installation location value set in the printer 5. The location string can be set using the TMNetWebConfig utility.
[Syntax]
getLocation( );
[Return value]
String of the installation location (String)
ondisconnect event
Obtains failure of the reconnect process. When this event occurs, a process for handling the network disconnection, such as establishing a connection again, is executed.
[Syntax]
Function( )
The Common to Device Object object is described next.
callEvent method
Calls any event on the device control script 502 side corresponding to the device object. Details about device control script 502 events are described below in the description of the device control script 502.
[Syntax]
callEvent (eventName, data);
[Parameters]
eventName:object type: (String)
Specifies the event name on the device control script side.
data: object type: (Object)
Specifies the data passed to the called event.
Simple JSON data comprising a property name and value set can be declared.
The Display object is described next.
reset method
Adds the initialization settings of the customer display 8 to the command buffer. Initialization results in the following.
[Syntax]
reset( );
[Return value]
Display object
createWindow method
Adds window settings to the command buffer. Windows are defined to not overlap previously defined windows. A window size that fits in the size of the display (20 columns×20 rows) is specified.
[Syntax]
createWindow (number, x, y, width, height, scrollMode);
[Parameters]
number: object type: (Number)
Specifies a window number in the range 1 to 4.
x: object type: (Number)
Specifies the x-coordinate of the window origin on the display. Specify a value from 1 to 20.
y: object type: (Number)
Specifies the y-coordinate of the window origin on the display. Specify 1 or 2.
width: object type: (Number)
Specifies the width of the window.
height: object type: (Number)
Specifies the height of the window.
scrollMode: object type: (String)
Specifies the scrolling mode of the window. Select from the parameters shown in
[Return value]
Display object
destroyWindow method
Adds the destroy setting of a defined window to the command buffer.
[Syntax]
destroyWindow (number);
[Parameters]
number: object type: (Number)
Specifies the number of the window to destroy. Specify a number from 1 to 4.
[Return value]
Display object
setCurrentWindow method
Adds a setting to change the current window to the command buffer. Makes the specified window the current window, and then moves the cursor to the origin of the current window.
[Syntax]
setCurrentWindow (number);
[Parameters]
number: object type: (Number)
Specifies the number of the window to switch to. Specify a number from 1 to 4.
[Return value]
Display object
clearWindow method
Adds a command to clear the current window to the command buffer.
[Syntax]
clearWindow( );
[Return value]
Display object
setCursorPosition method
Adds a cursor position setting to the command buffer.
[Syntax]
setCursorPosition (x, y);
[Parameters]
x: object type: (Number)
Specifies the x-coordinate of the destination. Specify a value from 1 to 20.
y: object type: (Number)
Specifies the y-coordinate of the destination. Specify 1 or 2.
[Return value]
Display object
moveCursorPosition method
Adds the cursor position settings in the current window to the command buffer.
[Syntax]
moveCursorPosition (position);
[Parameters]
position: object type: (String)
Specifies the destination of the cursor in the current window. Select from the parameters shown in
[Return value]
Display object
setCursorType method
Adds the cursor display settings to the command buffer.
[Syntax]
setCursorType (type);
[Parameters]
type: object type: (String)
Specifies the cursor display method. Select from the parameters shown in
[Return value]
Display object
addText method
Adds string display to the command buffer.
[Syntax]
addText (data);
addText (data, lang);
addText (data, x, y);
addText (data, x, y, lang);
[Parameters]
data: object type: (String)
Specifies the string to be displayed.
lang: object type: (String)
Specifies the display language of the string. Select from the strings shown in
x: object type: (Number)
Specifies the x-coordinate of the display position. Specify a value from 1 to 20.
y: object type: (Number)
Specifies the y-coordinate of the display position. Specify 1 or 2.
[Return value]
Display object
addReverseText method
Adds reversed string display to the command buffer.
[Syntax]
addReverseText (data);
addReverseText (data, lang);
addReverseText (data, x, y);
addReverseText (data, x, y, lang);
[Parameters]
data: object type: (String)
Specifies the string to be displayed.
lang: object type: (String)
Specifies the display language of the string. Select from the strings shown in
x: object type: (Number)
Specifies the x-coordinate of the display position. Specify a value from 1 to 20.
y: object type: (Number)
Specifies the y-coordinate of the display position. Specify 1 or 2.
[Return value]
Display object
addMarquee method
Adds a marquee display to the command buffer. The marquee is displayed in the horizontal scroll mode on one line regardless of the scroll mode setting of the display window.
[Syntax]
addMarquee (data, format, unitWait, repeatWait, repeatCount, lang);
[Parameters]
data: object type: (String)
Specifies the string to be displayed.
format: object type: (String)
Specifies the string display method. Select from
unitWait: object type: (Number)
Specifies the display interval (ms) for each character. A value from 1 to 2000 can be set.
repeatWait: object type: (Number)
Specifies the interval (ms) for repeating the string display. A value from 1 to 2000 can be set.
repeatCount: object type: (Number)
Specifies the number of times to repeat the string display. A value from 0 to 127 can be set. Display repeats indefinitely if 0 is specified.
lang: object type: (String)
Specifies the display language of the string. Select from the strings shown in
[Return value]
Display object
setBlink method
Adds the screen blinking settings to the command buffer.
[Syntax]
setBlink (interval);
[Parameters]
interval: object type: (Number)
Specifies the blinking interval (ms). Specify a number from 0 to 12700. The specified setting is rounded in 50 ms increments. The display lights steady when 0 is specified.
[Return value]
Display object
setBrightness method
Adds the display brightness setting to the command buffer.
[Syntax]
setBrightness (brightness);
[Parameters]
brightness: object type: (Number)
Specifies the display brightness setting. Select from the parameters shown in
[Return value]
Display object
showClock method
Adds a clock display to the command buffer.
When the clock is displayed, all displayed strings are cleared. Clock display ends if another command is sent while the clock is displayed.
[Syntax]
showClock( );
[Return value]
Display object
addCommand method
Adds a command to the command buffer.
[Syntax]
addCommand (data);
[Parameters]
data: object type: (String)
Specifies an ESC/POS command as a string. The command string is separated by “¥x”. Example: “¥x1B¥x40”
[Return value]
Display object
send method
Sends the command in the command buffer.
[Syntax]
send( );
onreceive event
Receives the command execution results.
[Syntax]
Function (response);
[Parameters of the callback function]
response: object type: (Object)
Receives the result of command execution. The properties shown in
The Keyboard object is described next.
setPrefix method
Specifies the key code used to detect the beginning of a string when keyboard input is received as a batch of strings.
[Syntax]
setPrefix (data);
[Parameters]
data: object type: (Array)
Specifies the key code array. The key codes are as shown in the key code list in
onkeypress event
Receives a key press event.
[Syntax]
Function (data);
[Parameters of the callback function]
data: object type: (Object)
Receives the properties shown in
onstring event
Receives a string of character input starting with any character combination specified by setPrefix and ending when the Enter key is detected.
[Syntax]
Function (data);
[Parameters of the callback function]
data: object type: (Object)
Receives the properties shown in
The Printer object is described next.
addTextAlign method
Adds the text alignment setting to the command buffer.
This API setting also applies to barcodes and 2D symbols.
To set text rotation when the print mode is set to the page mode, use the addPageDirection method described below instead of this API.
[Syntax]
addTextAlign (align);
[Parameters]
align (Required parameter, object type: String)
Specifies the text alignment.
Constants are shown in
addTextLineSpace method
Adds the line feed distance setting to the command buffer.
[Syntax]
addTextLineSpace (linespc);
[Parameters]
linespc: (Required parameter, object type: Number)
Specifies the line feed distance (in dots). Specify an integer from 0 to 255.
The return value is shown in
addTextRotate method
Adds the text rotation setting to the command buffer.
This API setting also applies to barcodes and 2D symbols.
To set text rotation when the print mode is set to the page mode, use the addPageDirection method described below instead of this API.
[Syntax]
addTextRotate (rotate);
[Parameters]
rotate (Required parameter, object type: Boolean)
Specifies whether or not to rotate text.
Settings are shown in
addText method
Adds printing text to the command buffer.
To print content other than text after printing text, execute a line feed or paper feed.
In the page mode, characters are printed from the current character position referenced to the baseline dot of the character (see appendix on page 141).
[Syntax]
addText (data);
[Parameters]
data (Required parameter, object type: String)
Specifies a character string to be printed.
For the horizontal tab/line feed, use the escape sequences shown in
Return values are shown in
addTextLang method
Adds the language setting to the command buffer.
[Syntax]
addTextLang (lang);
[Parameters]
lang: (Required parameter, object type: String)
Specifies the target language as shown in
Return values are shown in
addTextFont method
Adds the character font setting to the command buffer.
[Syntax]
addTextFont (font);
[Parameters]
font: (Required parameter, object type: String)
Specifies the font as shown in
The return values are shown in
addTextSmooth method
Adds a text smoothing setting to the command buffer.
[Syntax]
addTextSmooth (smooth);
[Parameters]
smooth: (Required parameter, object type: Boolean)
Specifies whether to apply text smoothing.
The return values are shown in
addTextDouble method
Adds a double-size text setting to the command buffer.
[Syntax]
addTextDouble (dw, dh);
[Parameters]
dw: (Optional parameter, object type: Boolean)
Specifies the double-size width. Settings are shown in
dh (Optional parameter, object type: Boolean)
Specifies the double-size height.
When both dw and dh parameters are set to ture/1, double width and double height characters are printed. Settings are shown in
The return values are shown in
addTextSize method
Adds the text scaling setting to the command buffer.
[Syntax]
addTextSize (width, height);
[Parameters]
width: (Optional parameter, object type: Number)
Specifies the horizontal scaling. Settings are shown in
height (Optional parameter, object type: Number)
Specifies the vertical scaling. Settings are shown in
The return values are shown in
addTextStyle method
Adds a text styling setting to the command buffer.
[Syntax]
addTextStyle (reverse, ul, em, color);
[Parameters]
reverse: (Optional parameter, object type: Boolean)
Specifies black/white inversion for text. Settings are shown in
ul (Optional parameter, object type: Boolean)
Specifies underlining. Settings are shown in
em (Optional parameter, object type: Boolean)
Specifies bold text. Settings are shown in
color (Optional parameter, object type: String)
Specifies the text color. Settings are shown in
The return values are shown in
addTextPosition method
Adds the horizontal print start position to the command buffer.
[Syntax]
addTextPosition (x);
[Parameters]
x: (Required parameter, object type: Number)
Specifies the horizontal print start position (in dots). Specify an integer from 0 to 65535.
The return values are shown in
addFeedUnit method
Adds paper feeding in dot units to the command buffer.
[Syntax]
addFeedUnit (unit);
[Parameters]
unit: (Required parameter, object type: Number)
Specifies the paper feed distance (in dots). Specify an integer from 0 to 255.
The return values are shown in
addFeedLine method
Adds paper feeding in line units to the command buffer.
[Syntax]
addFeedLine (line);
[Parameters]
line: (Required parameter, object type: Number)
Specifies the paper feed distance (in lines). Specify an integer from 0 to 255.
The return values are shown in
addImage method
Adds raster image printing to the command buffer.
Prints graphics rendered in HTML5Canvas.
Converts the specified range in a RGBA full-color HTML5 Canvas image to raster image data according to the halftone property and brightness property settings. One pixel in an image equals one printer dot. When an image includes a transparent color, the background of the image is assumed to be white.
To print a raster image at high speed, specify ALIGN LEFT for the addTextAlign method described above, and set the width parameter of this API to a multiple of 8 not exceeding the paper width of the printer.
In page mode, a raster image is printed at the current print position referenced to the bottom left dot of the raster image. The print position does not move.
HTML5 Canvas images containing images downloaded from a different domain cannot be printed. A security error is returned in accordance with JavaScript's same-origin policy.
[Syntax]
addImage (context, x, y, width, height, color, mode);
[Parameters]
context: (Required parameter, object type: Context)
Specifies the HTML5Canvas 2D context.
x: (Required parameter, object type: Number)
Specifies the horizontal starting position of the print area. Specify an integer from 0 to 65535.
y: (Required parameter, object type: Number)
Specifies the vertical starting position of the print area. Specify an integer from 0 to 65535.
width: (Required parameter, object type: Number)
Specifies the width of the print area. Specify an integer from 0 to 65535.
height: (Required parameter, object type: Number)
Specifies the height of the print area. Specify an integer from 0 to 65535.
color: (Optional parameter, object type: String)
Specifies the color. Settings are shown in
mode (Optional parameter, object type: String)
Specifies the color mode. Settings are shown in
The return values are shown in
addLogo method
Adds printing a logo stored in nonvolatile memory to the command buffer.
Prints a logo stored in nonvolatile memory in the printer.
The logo is previously registered in the printer using a model-specific utility or a logo registration utility (TMFLogo).
In page mode, a logo is printed from the current printing position referenced to the bottom left dot of the logo.
[Syntax]
addLogo (key1, key2);
[Parameters]
key1 (Required parameter, object type: Number)
Specifies key code 1 of a logo in nonvolatile memory. Specify an integer from 0 to 255.
key2 (Required parameter, object type: Number)
Specifies key code 2 of a logo in nonvolatile memory. Specify an integer from 0 to 255.
The return values are shown in
addBarcode method
Adds barcode printing to the command buffer.
In page mode, the barcode is printed from the current print position referenced to the bottom left dot (except for HRI) of the barcode.
[Syntax]
addBarcode (data, type, hri, font, width, height);
[Parameters]
data (Required parameter, object type: String)
Specifies the barcode data as a string. Barcode types are shown in
To specify binary data that cannot be expressed by a character string, use the escape sequences in
type (Required parameter, object type: String)
Specifies the barcode type. Constants are shown in
hri (Optional parameter, object type: String)
Specifies the HRI position. Constants are shown in
font (Optional parameter, object type: String)
Specifies the HRI font. Constants are shown in
width (Optional parameter, object type: Number)
Specifies the width of one module in dots. Specify an integer from 2 to 6.
height (Optional parameter, object type: Number)
Specifies the barcode height in dots. Specify an integer from 1 to 255.
The return values are shown in
addSymbol method
Adds 2D symbol ping to the command buffer.
In page mode, the barcode is printed from the current printing position referenced to the bottom left dot of the 2D symbol.
[Syntax]
addSymbol (data, type, level, width, height, size);
[Parameters]
data (Required parameter, object type: String)
Specifies the 2D symbol data as a character string. 2D code types are shown in
Specifies an escape sequence shown in
type (Required parameter, object type: String)
Specifies the type of the two-dimensional symbol. Constants are shown in
level (Optional parameter, object type: String)
Specifies the error correction level. Constants are shown in
The error correction level is selected according to the type of two-dimensional symbol. LEVEL DEFAULT is selected for MaxiCode and two-dimensional GS1DataBar symbols.
width (Optional parameter, object type: Number)
Specifies the module width. Specify an integer from 0 to 255. This parameter is ignored for MaxiCode symbols.
height (Optional parameter, object type: Number)
Specifies the module height. Specify an integer from 0 to 255. This parameter is ignored for QRCode and MaxiCode symbols.
size (Optional parameter, object type: Number)
Specifies the maximum size of the two-dimensional symbol. Specify an integer from 0 to 65535. This parameter is ignored for QRCode and MaxiCode symbols.
The return values are shown in
addHLine method
Adds horizontal line printing to the command buffer. Draws horizontal lines. Cannot be used in page mode.
[Syntax]
addHLine (x1, x2, style);
[Parameters]
x1: (Required parameter, object type: Number)
Specifies the start position of the horizontal line (in dots). Specify an integer from 0 to 65535.
x2: (Required parameter, object type: Number)
Specifies the end position of the horizontal line (in dots). Specify an integer from 0 to 65535.
style: (Optional parameter, object type: String)
Specifies the type of line. Constants are shown in
The return values are shown in
addVLineBegin method
Adds the beginning of a vertical line to the command buffer. Starts drawing vertical lines. Cannot be used in page mode. Vertical lines are drawn until the end is specified by addVLineEnd. This API function is used together with the addVLineEnd method.
[Syntax]
addVLineBegin (x, style);
[Parameters]
x (Required parameter, object type: Number)
Specifies the start position of the vertical line (in dots). Specify an integer from 0 to 65535.
style (Optional parameter, object type: String)
Specifies the type of line. Constants are shown in
The return values are shown in
addVLineEnd method
Adds the end of a vertical line to the command buffer. Finishes drawing vertical lines. Cannot be used in page mode. This API is used together with the addVLineBegin method described above.
[Syntax]
addVLineEnd (x, style);
[Parameters]
x (Required parameter, object type: Number)
Specifies the end position of the vertical line (in dots). Specify an integer from 0 to 65535.
style (Optional parameter, object type: String)
Specifies the type of line to stop drawing. Constants are shown in
The return values are shown in
addPageBegin method
Adds starting the page mode to the command buffer. Page mode processing starts.
Vertical lines are processed in page mode until the page mode is ended by the PageEnd method described below. This API is used together with the PageEnd method.
[Syntax]
addPageBegin( );
The return values are shown in
addPageEnd method
Adds the end of the page mode to the command buffer. Processing in page mode ends. This API is used together with the addPageBegin method described above.
[Syntax]
addPageEnd( );
The return values are shown in
addPageArea method
Adds the page mode print area to the command buffer. Specifies the page mode print area (coordinates). After this API function, specify a print data API function such as the addText method.
The print area is specified according to the content to be printed. If the print data extends beyond the print area, the print data will not be completely printed in the printout. This API is used between the above addPageBegin method and the above PageEnd method.
[Syntax]
addPageArea (x, y, width, height);
[Parameters]
x (Required parameter, object type: Number)
Specifies the origin of the horizontal axis (in dots). Specify an integer from 0 to 65535. 0 is at the left edge of the printable area of the printer.
y (Required parameter, object type: Number)
Specifies the origin of the vertical axis (in dots). Specify an integer from 0 to 65535. 0 is the position without feeding the paper.
width (Required parameter, object type: Number)
Specifies the width of the print area (in dots). Specify an integer from 0 to 65535.
height (Required parameter, object type: Number)
Specifies the height of the print area (in dots). Specify an integer from 0 to 65535.
The width and height of the print area are determined according to the print direction setting. The print data may otherwise not be completely printed.
The return values are shown in
addPageDirection method
Adds the page mode print direction setting to the command buffer. Specifies the print direction in page mode. This function can be omitted if rotation is not required. This API is used between the above addPageBegin method and the PageEnd method.
[Syntax]
addPageDirection (dir);
[Parameters]
dir (Required parameter, object type: String)
Specifies the page mode print direction. Constants are shown in
The return values are shown in
addPagePosition method
Adds the print position setting area in the page mode to the command buffer. Specifies the print start position (coordinates) in the area specified by the addPageArea method. This API is used between the above addPageBegin method and the PageEnd method.
[Syntax]
addPagePosition (x, y);
[Parameters]
x: (Required parameter, object type: Number)
Specifies the print position on the horizontal axis (in dots). Specify an integer from 0 to 65535.
y: (Required parameter, object type: Number)
Specifies the print position on the vertical axis (in dots). Specify an integer from 0 to 65535.
The print start position (coordinates) is set according to the content to be printed. Refer to the following.
Specify the left end of the baseline for the first character. This can be omitted for left-aligned printing of standard-sized characters. To print double-sized height characters, specify a value equal to or greater than 42 for y.
Specify the bottom left of the symbol. Set y to the barcode height.
Specify the bottom left of the graphic data. Set y to the height of the graphic data.
Specify the top left of the symbol. This can be omitted when printing from the top left.
The return values are shown in
addPageLine method
Adds line drawing in page mode to the command buffer. Draws a line in page mode. Diagonal lines cannot be drawn. This API is used between the above addPageBegin method and the PageEnd method.
[Syntax]
addPageLine (x1, y1, x2, y2, style);
[Parameters]
x1 (Required parameter, object type: Number)
Specifies the start position on the horizontal axis (in dots). Specify an integer from 0 to 65535.
y1 (Required parameter, object type: Number) Specify an integer from 0 to 65535.
x2 (Required parameter, object type: Number)
Specifies the end position on the horizontal axis (in dots). Specify an integer from 0 to 65535.
y2 (Required parameter, object type: Number)
Specifies the end position on the vertical axis (in dots). Specify an integer from 0 to 65535.
style (Optional parameter, object type: String)
Specifies the line type. Constants are shown in
The return values are shown in
addPageRectangle method
Adds drawing a rectangle in the page mode. Draws a rectangle in the page mode. This API is used between the above addPageBegin method and the PageEnd method.
[Syntax]
addPageRectangle (x1, y1, x2, y2, style);
[Parameters]
x1 (Required parameter, object type: Number)
Specifies the start position on the horizontal axis (in dots). Specify an integer from 0 to 65535.
y1 (Required parameter, object type: Number)
Specifies the start position on the vertical axis (in dots). Specify an integer from 0 to 65535.
x2 (Required parameter, object type: Number)
Specifies the end position on the horizontal axis (in dots). Specify an integer from 0 to 65535.
y2 (Required parameter, object type: Number)
Specifies the end position on the vertical axis (in dots). Specify an integer from 0 to 65535.
style (Optional parameter, object type: String)
Specifies the line type. Constants are shown in
The return values are shown in
addCut method
Adds a paper cut to the command buffer. Sets the paper cut. Cannot be used in page mode.
[Syntax]
addCut (type);
[Parameters]
type (Optional parameter, object type: String)
Specifies the paper cutting method. Settings are shown in
The return values are shown in
addPulse method
Adds a drawer kick to the command buffer. Sets the drawer kick. Cannot be used in page mode. The drawer cannot be used with the buzzer.
[Syntax]
addPulse (drawer, time);
[Parameters]
drawer (Optional parameter, object type: String)
Specifies the drawer kick connector. Settings are shown in
time (Optional parameter, object type: String)
Specifies the ON time of the drawer kick signal. Settings are shown in
The return values are shown in
addSound method
Adds sounding the buzzer to the command buffer. Sets the buzzer.
Cannot be used in page mode.
The buzzer function cannot be used with the drawer.
This API cannot be used if the printer does not have a buzzer.
[Syntax]
addSound (pattern, repeat);
[Parameters]
pattern: (Optional parameter, object type: String)
Specifies the buzzer pattern. Settings are shown in
repeat (Optional parameter, object type: String)
Specifies the number of times the buzzer sounds. Settings are shown in
To stop the buzzer after setting the repeat parameter to 0, execute this API again and set the pattern parameter to PATTERN_NONE.
The return values are shown in
addCommand method
Adds commands to the command buffer. Sends ESC/POS commands.
When sending a command to the command buffer with the addCommand method, declare the command data strings using Ix as a separator.
Example: ¥x1B¥x40
[Syntax]
addCommand (data);
[Parameters]
data (Optional parameter, object type: String)
Specifies an ESC/POS command as a character string.
The return values are shown in
send method
Sends a command to the command buffer.
[Syntax]
send( );
print method
Prints an image rendered in HTML5 Canvas.
Converts the specified range in a RGBA full-color HTML5 Canvas image to raster image data according to the halftone property and brightness property settings. One image pixel equals one printer dot. When an image contains a transparent color, the background color of the image is assumed to be white.
HTML5 Canvas images containing images downloaded from a different domain cannot be printed. A security error is returned in accordance with JavaScript's same-origin policy.
[Syntax]
print (canvas, cut, mode);
[Parameters]
canvas (Required parameter, object type: canvas)
Specifies the HTML5 Canvas object to print.
cut (Optional parameter, object type: Boolean)
Specifies whether or not to cut the paper. Settings are shown in
mode (Optional parameter, object type: String)
Specifies the color mode. Settings are shown in
startMonitor method
Enables a status event. Reports the printer status as an event. Updates the status at the interval specified in the interval property.
[Syntax]
startMonitor( );
stopMonitor method
Disables a status event.
[Syntax]
stopMonitor( );
halftone property
Specifies the halftone processing method to apply to monochrome (two tone) printing. The default is HALFTONE DITHER.
object type: String
Settings are shown in
brightness property
Specifies brightness correction as a gamma value in the range 0.1 to 10.0. The default is 1.0.
object type: Number
timeout property
Specifies the timeout time (ms) of the message sent with the send method described above. The default value is 10,000.
object type: Number
interval property
Specifies the interval for updating the status.
object type: Number
[Description]
Specifies the interval for updating the status in milliseconds.
Default value: 3000 (3 second)
Minimum value: 1000 (1 second or more)
If an invalid value is specified, 3000 is used.
onreceive event
Registers a callback function and gets a response message receipt event.
[Syntax]
Function (response)
[Parameters of the callback function]
Parameters: response (see the response object property described below)
Name: response message
Object type: object
[Response object properties]
See the list of properties in
[Success value]
See the list of success values in
[Code value]
See the list of code values in
[Status values]
See the list of status values in
onerror event
Registers a callback function and gets a communication error event.
[Syntax]
Function (error)
[Parameters of the callback function]
Parameters: error (see the error object properties described below)
Name: communication error data
Object type: object
[Error object properties]
See the list of error object properties in
onstatuschange event
Registers a callback function and gets a status change event.
[Syntax]
Function (status)
[Parameters of the callback function]
Parameter: status
Name: status
Object type: Number
ononline event
Registers a callback function and gets an online event.
object type: Function( )
onoffline event
Registers a callback function and gets an offline event.
object type: Function( )
onpoweroff event
Registers a callback function and gets a no-response event.
object type: Function( )
oncoverok event
Registers a callback function and gets a cover-closed event.
object type: Function( )
oncoveropen event
Registers a callback function and gets a cover-open event.
object type: Function( )
onpaperok event
Registers a callback function and gets a paper-remaining event.
object type: Function( )
onpapernearend event
Registers a callback function and gets a paper near-end event.
object type: Function( )
onpaperend event
Registers a callback function and gets a paper end event.
object type: Function( )
ondrawerclosed event
Registers a callback function and gets a drawer-closed event.
object type: Function( )
ondraweropen event
Registers a callback function and gets a drawer-open event.
object type: Function( )
The Scanner object is described next.
ondata event
Receives a barcode information scanning event.
[Syntax]
Function (data);
[Parameters of the callback function]
data
Object type: (Object)
Receives the property shown in
The iSimpleSerial object is described next.
The specifications of this API can be customized by creating a device control script.
sendCommand
Sends a desired command.
[Syntax]
sendCommand (data);
[Parameters]
data
Object type: (String)
Specifies the command with a hexadecimal string.
Declare command strings using Ix as a separator.
<Example>
To send 0x020x1F0x03, declare the string ¥x02¥x1F¥x03.
oncommandreply event
Receives a response event from the device.
[Syntax]
Function (data);
[Parameters of the callback function]
data
Object type: (String)
Receives a hexadecimal string of response data.
The received hexadecimal string is separated with Ix.
Example: ¥x1B¥x40
The device control script 502 is described next.
Programming is described first.
By using a device control script 502 provided by the device control function of the invention, data processing by a device can be customized and new devices can be used from a web application. As shown in
When the createDevice method of the Device object described above is executed, an object is instantiated so that the device service interface 501 of the printer 5 can use the device control script corresponding to the requested device. The device can then be controlled through the instantiated object.
The objects shown in
Functions using objects of the device control script are described next.
The following functions can be used using device control script APIs.
The configuration of a device control script is described next.
A device control script is coded to meet the following conditions.
(Only one file can be registered when configuring a device using the TMNetWebConfig utility.)
(Example) file name: Keyboard_Generic.ver1.0.js→constructor name: Keyboard_Generic
(Example) exports. Keyboard_Generic=Keyboard_Generic;
DEVICE_TYPE property (object type: String)
A list of settings is shown in
DEVICE GROUP property (object type: String
A list of settings is shown in
The configuration of a sample device control script 502 is shown in
The device control script API is described next.
The following objects are provided in the device control script API.
The ClientConnection object is described next.
This object is passed to the first parameter of the constructor of the device control script 502.
The API “send” command sends data to a device object that runs on a browser.
[Syntax]
send (event, data);
[Parameters]
Sets the event name of the device object.
Specifies the data passed to the device object event.
An example is shown in
The DeviceConnection object is described next.
This object is passed to the second parameter of the constructor of the device control script 502.
The API “send” command sends data to a serial communication device.
Note that data is not sent to an input device that can be controlled by an HID driver.
[Syntax]
send (data);
[Parameters]
data: object type: (Buffer)
Specifies the data to send to the device.
The device control script Name object is described next.
onDeviceData event (input device that can operate with an HID driver)
This event receives data detected from a key input device.
Events are described in this format in a device control script 502 for a key input device.
[Syntax]
onDeviceData (event, keycode, ascii);
[Parameters]
event: object type: (Number)
Receives the direction of key operation. For a list of values, see
keycode: object type: (Number)
Receives the key code. For a list of key codes, see
ascii: object type: (String)
Receives the character corresponding to the operated key.
If no character corresponds to the key code (such as with the F1 key), undefined is returned.
onDeviceData event “(serial communication device)
This event receives data detected from a serial communication device.
Events are described in this format in a device control script 502 for serial communication.
[Syntax]
onDeviceData (data);
[Parameters]
data: object type: (Buffer)
Receives data received from a serial communication device.
Any event
This event is used to receive the results of API execution by a device object that runs on a browser.
[Syntax]
Name specified by callEvent (data);
[Parameters]
data: object type: (Object)
Receives the object specified by the callEvent parameter of the device object.
A sample program is described next.
The sample program described below enables use as a POS system. Sample code for a device API 33 can be created for each device.
The environment required to run the sample program is described below.
(1) Required devices (The sample program can be used without having all of the devices.)
(2) □ Required to operate the printer 5
(3) Other
The work flow for configuring the sample program environment is shown in
If the Windows Security screen appears while using the TMNet TMNetWebConfig utility, enter your username and password.
1. Connect LAN cable
2. Register sample program
3. Connect devices
4. Configure devices
Registering the sample program is described next.
Register the program using the following procedure.
1. Turn the printer 5 on.
2. Start the TMNet TMNetWebConfig using the shortcut on the desktop.
3. The “Web content update settings” screen is displayed as shown in the frame on the right side of
4. Next, click the [Upload] button indicated by [4] in
Configuring devices is described next.
Devices are configured using the TMNet TMNetWebConfig utility in this example.
Configuring the customer display is described next.
Register the display using the following procedure.
1. Start the TMNet TMNetWebConfig using the shortcut on the desktop.
2. The customer display settings screen shown in
Configuring a POS keyboard/barcode scanner is described next.
Register the devices using the following procedure.
1. Check that a POS keyboard/MSR/barcode scanner is connected to the printer 5.
2. Start the TMNet TMNetWebConfig using the shortcut on the desktop.
3. The Key Input device screen shown in
4. The registered device will be displayed in the [Registered key input device] field at [4] in
Starting the sample program is described next.
Start the sample program (device_API_UM_J_Sample.zip) as follows.
1. Start the web browser, and enter the IP address of the printer 5 to the address bar. The default IP address of the printer 5 is “192.168.192.168”.
2. The sample program is displayed. An example of the display is shown in
Using the Sample Program
The sample program includes the following items. Selecting an item goes to the corresponding screen. Details of each sample are described below.
The Customer Display Sample is described in detail next.
This sample program enables operating the customer display and generating sample code for the customer display.
This sample is used as follows.
1. Start the sample program. Select [Customer Display Sample] in
2. The Customer Display Sample screen shown in
There is no need to change the settings in the Device Setting frame. However, if the IP address, for example, has changed, change the setting in the Device Setting frame accordingly.
3. Select the function to use in the screen shown in
4. The source code of the function added in step 3 is displayed in the [Display Object Sample Code] frame in
5. When the [Send] button in the screen in
The Keyboard Sample is described in detail next.
This sample program enables acquiring input from a POS keyboard.
This sample is used as follows.
1. Start the sample program. Select [Keyboard Sample] in
2. The Keyboard Sample screen shown in
There is no need to change the settings in the Device Setting frame. However, if the IP address, for example, has changed, change the setting in the Device Setting frame accordingly.
3. Select the key used to determine the beginning of a string, and click the [Set] button.
This setting must first be made on the POS keyboard side.
Example: F1+specified string+Enter
4. When there is input from the POS keyboard, the input result is displayed in the ePOS Device API Keyboard Object shown in
The Printer Sample is described in detail next.
This sample program enables operating the printer and generating sample code for the printer.
The Printer Sample is used as follows.
1. Start the sample program. Select [Printer Sample] in
2. The Printer Sample screen in
There is no need to change the settings in the Device Setting frame. However, if the IP address, for example, has changed, change the setting in the Device Setting frame accordingly.
3. Select the function to use in the screen shown in
4. The source code of the function added in step 3 is displayed in the [printer-Print API Sample Code] frame in
5. When the [Send] button in the screen is clicked, a test print will be printed according to the function added in step 3.
The Barcode Scanner Sample is described in detail next.
This sample program enables acquiring input from a barcode scanner.
The Barcode Scanner Sample is used as follows.
1. Start the sample program. Select [Barcode Scanner Sample] in
2. The Barcode Scanner Sample screen in
There is no need to change the settings in the Device Setting frame. However, if the IP address, for example, has changed, change the setting in the Device Setting frame accordingly.
3. When there is input from the barcode scanner, the read information is displayed in the ePOS Device API Scanner Object shown in
The POS Terminal Sample is described in detail next.
This sample program enables operating like a POS system.
The POS Terminal Sample is used as follows.
Preparation is required first. In this preparation, start the sample program and configure each device.
1. Start the sample program. Select [POS Terminal Sample] in
2. The POS Terminal Sample screen in
3. The Settings screen in
Operation is described next.
The procedure from reading a product to issuing a receipt is described below.
1. Input a product from the barcode scanner or POS keyboard.
2. Enter the amount received in the screen shown in
3. The amount of change due is displayed as shown in
As described above, a device control system 100 according to this embodiment of the invention has an application server 2 that serves a web application 32; a terminal 3 that is connected to the application server 2 through a network and has a web browser 31 that displays the web application 32; and a printer 5 that has a connection panel 60 to which a device connects, and controls the device connected to the connection panel 60. By means of the web application 32, the terminal 3 calls an object that controls a device and is instantiated by the device API 33 to support the device, and sends a request to the printer 5 by the web application 32; and the printer 5 executes a device control script 502 that controls the device, receives requests sent through the device API 33, and controls the device connected to the connection panel 60.
The invention is not limited to device control system 100, and device control systems 200, 300 can be similarly configured. In device control system 300, the printer 5 has the functions of the application server 2 (
In device control system 100, the device control script 502 has a DeviceConnection object that sends/receives data with a device, and a ClientConnection object that sends data to the device control API.
In device control system 100, the terminal 3 specifies a device connected to the printer 5 and sends a request to start control of the device to the printer 5, and the printer 5 sends a command by the device control script 502 to the device specified by the request and enables controlling the device.
When the device control system 100 has a first terminal 3 and a second terminal 3, the first terminal 3 specifies a device connected to the printer 5, sends a request to start control of the device to the printer 5, and the printer 5 enables controlling the device specified in the request, the device is exclusively locked and cannot be controlled by a request sent by the second terminal 3.
In this configuration, the printer 5 reports to the second terminal 3 that the device is busy when the second terminal 3 calls an object corresponding to the device of the device API 33.
In the device control system 100, the device connected to the printer 5 is a local printer or a network printer 7, and when the printer 5 enables control of the device specified by the request, the local printer or the network printer 7 can be controlled by the device control script 502 according to the request sent by the second terminal 3.
In the device control system 100, the terminal 3 specifies a device connected to the printer 5 and sends a request instructing ending device control to the printer 5, and the printer 5 sends a command by the device control script 502 to the device specified by the request and terminates the state enabling control of the device.
In the device control system 100, the terminal 3 specifies a device connected to the printer 5 and sends a request instructing ending device control to the printer 5; the printer 5 sends a command by the device control script 502 to the device specified by the request and terminates the state enabling control of the device; and the device can be controlled by the printer 5 in response to a request sent by the second terminal 3.
In the device control system 100, the terminal 3 detects the connection status of an object instantiated by the device API 33 and the device control script 502 of the printer 5 by means of the device API 33.
In the device control system 100, the terminal 3 controls an object of the device API 33 by the web application 32, and calls an event of the device control script 502.
In the device control system 100, a customer display is connected to the printer 5 as a device, the terminal 3 sends a request to display on the customer display, and the printer 5 controls displaying on the customer display by the device control script 502 in response to the request.
In the device control system 100, a customer display is connected to the printer 5 as a device, the terminal 3 sends a request to display on the customer display, and the printer 5 displays the time on the customer display by the device control script 502 in response to the request, and stops displaying the time when a second request is sent while the time is displayed.
In the device control system 100, a printer is connected to printer 5 as a device, the terminal 3 sends a request to register image data in the printer by an object of the device control API, the printer 5 registers the image data in the printer specified by the request, and the printer prints the registered image data.
In the device control system 100, color image data rendered by HTML5 Canvas is converted to raster image data and registered in the printer according to a request sent by the terminal 3.
In the device control system 100, the terminal 3 specifies a device and sends a request instructing whether or not to encrypt data sent and received between the device and the terminal 3 by an object of the device control API.
The terminal 3 has an application server 2 that serves a web application 32, and a connection panel 60 to which devices connect, is connected through a network to a printer 5 that controls a device connected to the connection panel 60, has a web browser 31 that displays a web application 32, and through the web application 32 calls an object that controls a device and is instantiated by the device API 33 to support the device, sends a request to the printer 5, and causes the printer 5 to execute a device control script 502 that controls the device.
The foregoing embodiment obviously describes one example of the invention, and can be modified and adapted as desired within the scope of the accompanying claims.
This application is a continuation of, and claims priority under 35 U.S.C. § 120 on, application Ser. No. 14/702,362, filed May 1, 2015, which is a continuation of, application Ser. No. 14/140,268, filed Dec. 24, 2013, now, U.S. Pat. No. 9,052,853, issued Jun. 9, 2015, which claims priority under 35 U.S.C. § 119(e) on provisional application no. 61/748,232, filed Jan. 2, 2013. The content of each such related application is incorporated by reference herein in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
5594920 | Ebina et al. | Jan 1997 | A |
5707162 | Kasai et al. | Jan 1998 | A |
5752880 | Gabai et al. | May 1998 | A |
5794214 | Ebina et al. | Aug 1998 | A |
5927878 | Kasai et al. | Jul 1999 | A |
6022273 | Gabai et al. | Feb 2000 | A |
6075195 | Gabai et al. | Jun 2000 | A |
6128415 | Hultgren, III | Oct 2000 | A |
6289371 | Kumpf et al. | Sep 2001 | B1 |
6368177 | Gabai et al. | Apr 2002 | B1 |
6519048 | Tanaka | Feb 2003 | B1 |
7369257 | Enomoto et al. | May 2008 | B2 |
20010021669 | Gabai et al. | Sep 2001 | A1 |
20010031652 | Gabai et al. | Oct 2001 | A1 |
20020097408 | Chang et al. | Jul 2002 | A1 |
20040105126 | Minowa et al. | Jun 2004 | A1 |
20040266479 | Oak | Dec 2004 | A1 |
20050046887 | Shibata et al. | Mar 2005 | A1 |
20060164550 | Yoshimoto et al. | Jul 2006 | A1 |
20060279773 | Sakurai et al. | Dec 2006 | A1 |
20070058194 | Itoh et al. | Mar 2007 | A1 |
20070198999 | Ohhashi | Aug 2007 | A1 |
20070276763 | Kleinman et al. | Nov 2007 | A1 |
20080010389 | Iwata | Jan 2008 | A1 |
20080218777 | Matsuzawa | Sep 2008 | A1 |
20090188972 | Koakutsu | Jul 2009 | A1 |
20100027065 | Koakutsu | Feb 2010 | A1 |
20100085601 | Urakawa | Apr 2010 | A1 |
20100100606 | Nakamura et al. | Apr 2010 | A1 |
20100153225 | Ferro | Jun 2010 | A1 |
20100177343 | Shapiro et al. | Jul 2010 | A1 |
20110194123 | Sweet et al. | Aug 2011 | A1 |
20110292447 | Oak | Dec 2011 | A1 |
20130332520 | Nakamura et al. | Dec 2013 | A1 |
20140058869 | Argue et al. | Feb 2014 | A1 |
Number | Date | Country |
---|---|---|
1574843 | Feb 2005 | CN |
0991227 | Apr 2000 | EP |
2631808 | Aug 2013 | EP |
2000-500376 | Jan 2000 | JP |
2004-152256 | May 2004 | JP |
2006-135982 | May 2006 | JP |
2007-188468 | Jul 2007 | JP |
2007-328558 | Dec 2007 | JP |
2010-134906 | Jun 2010 | JP |
2011-124914 | Jun 2011 | JP |
2012-173910 | Sep 2012 | JP |
10-0172460 | Mar 1999 | KR |
Entry |
---|
Software Incompatibility; Retrieved by the Examiner on Mar. 6, 2018 from https://en.wikipedia.org/w/index.php?title=Software_incompatibility&diff=429333928&oldid=348596605. |
NPL—The Transport Layer Security (TLS) Protocol Version 1.2, Aug. 2008. |
Office Action dated Oct. 19, 2017 in related U.S. Appl. No. 15/269,172 (20 pgs.) |
Number | Date | Country | |
---|---|---|---|
20160110139 A1 | Apr 2016 | US |
Number | Date | Country | |
---|---|---|---|
61748232 | Jan 2013 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 14702362 | May 2015 | US |
Child | 14979291 | US | |
Parent | 14140268 | Dec 2013 | US |
Child | 14702362 | US |