Skip to main content

connect

connect​

Starts communication with the printer.

Parameters​

timeout (optional)​

  • number

Specifies the maximum time (in milliseconds) to wait for communication with the printer to be established.

ValueDescriptionDefault
1000 to 300000Maximum wait time before an error is returned (in milliseconds).15000

Returns​

Promise<void>

Errors​

Error statusDescription
ERR_PARAMAn invalid parameter was passed.
ERR_CONNECTFailed to open the device.
ERR_TIMEOUTFailed to communicate with the devices within the specified time.
ERR_ILLEGALTried to start communication with a printer with which communication had been already established. Tried to start communication with a printer during reconnection process.
ERR_MEMORYNecessary memory could not be allocated.
ERR_FAILUREAn unknown error occurred.
ERR_PROCESSINGCould not run the process.
ERR_NOT_FOUNDThe printer could not be found.
ERR_IN_USEThe device was in use.
ERR_TYPE_INVALIDThe device type is different.
ERR_RECOVERY_FAILUREFailed to recover the printer.

Supplementary explanation​

Android:

  • When communication with the printer is no longer necessary, be sure to call disconnect to terminate it.
  • If you are using DHCP to assign the IP address of the printer, specify the MAC address or host name of the printer as the identifier.
  • When connecting through the USB, the identifiers that can be specified differ depending on the shape of the USB connector. When the identifier is omitted, Android OS connects with the USB device found first. When the Android terminal is set to the developer mode, you may not be able to connect through USB- A - Device Charging.
  • Devices other than printers are exclusively locked.
  • If error with status ERR_RECOVERY_FAILURE occurs, restart the printer.

iOS:

  • When communication with the printer is no longer necessary, be sure to call disconnect to terminate it.
  • For TM-DT series, MAC address cannot be specified.
  • When connecting with the printer using Bluetooth, complete pairing before calling the connect command.
  • Depending on the project settings, Bluetooth communication may be disconnected if the application runs in the background.
  • If Bluetooth and USB are used simultaneously, priority is given to the USB.
  • Devices other than printers are exclusively locked.
  • If error with status ERR_RECOVERY_FAILURE occurs, restart the printer.
  • Since it takes time to send and receive a large amount of data with BLE connection, the following APIs not recommended be used. (addImage)