Select your printer model
createDevice method
Acquires the device object acting as the device interface. The device object is passed to the callback function.
Syntax
createDevice(deviceId, deviceType, options, callback); |
createDevice(deviceId, deviceType, crypto, callback); |
Parameter
deviceId
Value |
Description |
---|---|
deviceId |
Specifies the device ID as a string. |
deviceType
Value |
Device type |
---|---|
DEVICE_TYPE_DISPLAY |
Customer display |
DEVICE_TYPE_KEYBOARD |
Keyboard |
DEVICE_TYPE_MSR |
MSR |
DEVICE_TYPE_PRINTER |
Printer |
DEVICE_TYPE_SCANNER |
Barcode scanner |
DEVICE_TYPE_SIMPLE_SERIAL |
Serial communication device |
DEVICE_TYPE_HYBRIDPRINTER2 |
Hybrid printers |
DEVICE_TYPE_DT |
TM-DT series |
DEVICE_TYPE_POSKEYBOARD |
POS keyboard |
DEVICE_TYPE_GFE |
German fiscal element (TSE) |
DEVICE_TYPE_OTHER_PERIPHERAL |
Other peripheral devices |
options
Specifies properties using object literals.
Property |
Description |
true/false |
---|---|---|
crypto (Boolean) |
Specifies whether or not to encrypt the communication data. |
true: Encrypts data. false: Does not encrypt data. |
buffer (Boolean) |
Specifies whether or not to send data which occurs while reconnection with the device is in progress after reconnection. |
true: Sends data. false: Does not send data. |
crypto
Property |
Description |
true/false |
---|---|---|
crypto (Boolean) |
Specifies whether or not to encrypt the communication data. |
true: Encrypts data. false: Does not encrypt data. |
callback
Specifies a callback function to receive the execution result.
The device object is passed to the first parameter and one of the following strings is returned in the second parameter to indicate the result.
String |
Description |
---|---|
"OK" |
Acquisition of the device object succeeded. |
"DEVICE_NOT_FOUND" |
The device was not found. |
"DEVICE_IN_USE" |
The device was in use. |
"DEVICE_OPEN_ERROR" |
Failed to open the device. |
"DEVICE_TYPE_INVALID" |
The device type is different. |
"PARAM_ERROR" |
A parameter error occurred. |
"SYSTEM_ERROR" |
An unknown error occurred. |
Supplementary explanation
- When the createDevice method is successfully run, devices except for the printer will be exclusively locked.
- When DEVICE_TYPE_DISPLAY is specified in deviceType, specify local_display in deviceId.
- When DEVICE_TYPE_DT is specified in deviceType, specify local_dt in deviceId.
- When the device object cannot be acquired, null instead of the device object will be passed to the first parameter.
- When the createDevice method is called by specifying an exclusively locked device, DEVICE_IN_USE will be returned.
- While returning from occurrence of ondisconnect event, calling the createDevice method may return DEVICE_IN_USE depending on the call timing. In this case, call the createDevice method repeatedly until a string other than DEVICE_IN_USE is returned.
- If the createDevice method is executed to the same device again after the createDevice method is executed, DEVICE_OPEN_ERROR may occur depending on the processing timing and the connection with the device may be terminated.
- This API will succeed regardless of the connection status of the TM printer (master) and peripheral devices.
- When controlling DM-D30 or DM-D70 from TM-m30 printer, and when controlling DM-D110 or DM-D30 or DM-D70 from TM-T88VI printer, DM-D110 or DM-D30 or DM-D70 is not exclusively locked. Even if the createDevice method is called from the other device specifying the DM-D110 or DM-D30 or DM-D70, “DEVICE_IN_USE” is not returned.
- The encryption function of communication data can be used in the TM-i series and TM-DT series.
- When the connect method is running in the system configuration of TM Printer + DM-D + barcode scanner model, do not enable the options parameter eposprint property.
- In the system configuration of TM Printer + DM-D + barcode scanner model, specify the following deviceId for the deviceType.
-
deviceType
deviceId
DEVICE_TYPE_PRINTER
local_printer
DEVICE_TYPE_DISPLAY
local_display
DEVICE_TYPE_SCANNER
local_scanner
DEVICE_TYPE_GFE
local_TSE
Quick Access
- [Name]
- [Format]
- [Range]
- [Description]
- [Notes]
- Introduction
- help
- ePOSDevice object
- Common to device objects
- OtherPeripheral object
- Display object
- createWindow method
- destroyWindow method
- setCurrentWindow method
- clearWindow method
- addCreateScreen method
- addCreateScreenCustom method
- createTextArea method
- destroyTextArea method
- setCurrentTextArea method
- clearTextArea method
- setCursorPosition method
- moveCursorPosition method
- setCursorType method
- addText method
- addReverseText method
- addMarquee method
- setBlink method
- setBrightness method
- addBackgroundColor method
- addStartSlideShow method
- addStopSlideShow method
- addDownloadImage method
- addRegisterDownloadImage method
- addNVImage method
- addClearImage method
- addSymbol method
- addClearSymbol method
- showClock method
- addCommand method
- send method
- reset method
- onreceive event
- Keyboard object
- POSKeyboard object
- MSR object
- Printer object
- addTextAlign method
- addTextLineSpace method
- addTextRotate method
- addText method
- addTextLang method
- addTextFont method
- addTextSmooth method
- addTextDouble method
- addTextSize method
- addTextStyle method
- addTextPosition method
- addTextVPosition method
- addFeedUnit method
- addFeedLine method
- addFeedPosition method
- addFeed method
- addImage method
- addLogo method
- addBarcode method
- addSymbol method
- addHLine method
- addVLineBegin method
- addVLineEnd method
- addPageBegin method
- addPageEnd method
- addPageArea method
- addPageDirection method
- addPagePosition method
- addPageLine method
- addPageRectangle method
- addRotateBegin method
- addRotateEnd method
- addCut method
- addPulse method
- addSound method
- addLayout method
- recover method
- addRecovery method
- reset method
- addReset method
- addCommand method
- send method
- print method
- getPrintJobStatus method
- startMonitor method
- stopMonitor method
- halftone property
- brightness property
- force property
- timeout property
- interval property
- drawerOpenLevel property
- message property
- onreceive event
- onstatuschange event
- onbatterystatuschange event
- ononline event
- onoffline event
- onpoweroff event
- oncoverok event
- oncoveropen event
- onpaperok event
- onpapernearend event
- onpaperend event
- ondrawerclosed event
- ondraweropen event
- onbatteryok event
- onbatterylow event
- HybridPrinter2 object
- lock method
- unlock method
- selectPaperType method
- waitInsertion method
- cancelInsertion method
- ejectPaper method
- sendData method
- print method
- readMicrData method
- cleanMicrReader method
- recover method
- reset method
- startMonitor method
- stopMonitor method
- setMessage method
- getMessage method
- halftone property
- brightness property
- force property
- paperType property
- interval property
- waitTime property
- enable40cplMode property
- onreceive event
- Scanner object
- SimpleSerial object
- GermanyFiscalElement object
- DeviceHubTerminal object
- CommBoxManager object
- CommBox object
- ePosDeviceConfiguration object
- Appendix
- Error Code List
- Key code list
- List of Supported Objects
- List of Supported APIs
- Printer-specific Support Information
- TM-m10
- TM-m30
- TM-m30II
- TM-m30II-H
- TM-m30II-NT
- TM-m30II-S
- TM-m30II-SL
- TM-m30III
- TM-m30III-H
- TM-m50
- TM-m50II
- TM-m50II-H
- TM-T20II
- TM-T20III
- TM-T82III
- TM-T88VI
- TM-T88VII
- TM-L100
- TM-T70
- TM-T70II
- TM-T88IV
- TM-T88V
- TM-U220
- TM-U220II
- TM-U330
- TM-P20
- TM-P20II
- TM-P60II (Receipt)
- TM-P60II (Peeler)
- TM-P80
- TM-P80II
- TM-H6000V
- TM-T20II-i
- TM-T70-i
- TM-T82II-i
- TM-T83II-i
- TM-T88V-i
- TM-T88VI-iHUB
- TM-U220-i
- TM-U220IIB-i
- TM-T70II-DT
- TM-T70II-DT2
- TM-T88V-DT
- TM-T88VI-DT2
- TM-H6000IV-DT
- TM-T20
- TM-T82II
- TM-T83II
- TM-T90
- TM-L90
- TM-H6000IV
- Usage restriction by firmware version