How to Develop Serial Port for Terminals: Difference between revisions

From wizarPOS
No edit summary
No edit summary
Line 3: Line 3:


== Open ==
== Open ==
=== Java API ===
When using the '''Java API''' to open a serial port, you need to set the logic ID of a serial port as a parameter.
When using the '''Java API''' to open a serial port, you need to set the logic ID of a serial port as a parameter.
* SerialPortDevice.ID_USB_SLAVE_SERIAL : works for USB serial port in slave mode.  
* SerialPortDevice.ID_USB_SLAVE_SERIAL : works for USB serial port in slave mode.  
Line 9: Line 10:
* SerialPortDevice.ID_USB_CDC: works for USB Communication Device Class.
* SerialPortDevice.ID_USB_CDC: works for USB Communication Device Class.


=== C API ===
When using the '''C API''' to open a serial port, you need to set the device name of a serial port as a parameter.  
When using the '''C API''' to open a serial port, you need to set the device name of a serial port as a parameter.  


Line 28: Line 30:
** '''USB_HOST_SERIAL''' or '''USB_SERIAL''': works for USB serial port in master mode. For example, terminal connect an USB2Serial convertor or use UU cable.
** '''USB_HOST_SERIAL''' or '''USB_SERIAL''': works for USB serial port in master mode. For example, terminal connect an USB2Serial convertor or use UU cable.
** '''SERIAL_EXT''': works for internal fiscal/other serial port module.
** '''SERIAL_EXT''': works for internal fiscal/other serial port module.
** '''USB_CDC''': works for USB Communication Device Class.
|}
|}


Line 34: Line 37:


== Cable Connection==  
== Cable Connection==  
Please check follow pictures
Please check follow pictures
* Q4: use picture 2 and picture 3, the Usb to DB9 cable ; or picture 4 the UU cable
* Q4: use picture 2 and picture 3, the Usb to DB9 cable ; or picture 4 the UU cable



Revision as of 07:31, 30 August 2021

Demo

Here is a demo about how to develop an app using Java API, please download SerialPortDemo

Open

Java API

When using the Java API to open a serial port, you need to set the logic ID of a serial port as a parameter.

  • SerialPortDevice.ID_USB_SLAVE_SERIAL : works for USB serial port in slave mode.
  • SerialPortDevice.ID_USB_HOST_SERIAL : works for USB serial port in master mode.
  • SerialPortDevice.ID_SERIAL_EXT : works for internal fiscal/ other serial port module.
  • SerialPortDevice.ID_USB_CDC: works for USB Communication Device Class.

C API

When using the C API to open a serial port, you need to set the device name of a serial port as a parameter.

Device Name:

Parameters
device name The alias for serial port. Available values: DB9, GS0_01, WIZARHANDQ1, Q1_USB_SERIAL, USB_SERIAL, SERIAL_EXT, USB_SLAVE_SERIAL, USB_HOST_SERIAL
  • in W1/W1V2:
    • DB9: works for DB9 port at the back side of the terminal.
    • GS0_Q1: works for USB host port at the right side of terminal to connect with Q1 via USB cable in master mode.
  • in Q1 3g:
    • WIZARHANDQ1: works for USB serial port in slave mode.
    • Q1_USB_SERIAL or USB_SERIAL: works for USB serial port in master mode.
    • SERIAL_EXT: works for internal fiscal/other serial port module.
  • in Q1 4g and Q2(K2, M2, M3, QD4/5), Q3 series and others:
    • USB_SLAVE_SERIAL: works for USB serial port in slave mode. For example, terminal use USB OTG cable connect the PC directly.
    • USB_HOST_SERIAL or USB_SERIAL: works for USB serial port in master mode. For example, terminal connect an USB2Serial convertor or use UU cable.
    • SERIAL_EXT: works for internal fiscal/other serial port module.
    • USB_CDC: works for USB Communication Device Class.



Cable Connection

Please check follow pictures

  • Q4: use picture 2 and picture 3, the Usb to DB9 cable ; or picture 4 the UU cable

Cables

caption


caption



caption




caption