Select your printer model

Parameters are refined by the selected printer.

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]

Epson ePOS SDK includes patented or patent pending functions. The contents must not be disclosed to third parties.


Epson ePOS SDK for JavaScript

Jump to the top