How to Develop Serial Port for Terminals: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
== | == Introduction: == | ||
This guide provides a demonstration on how to develop an application that utilizes serial ports, using both Java and C APIs. Included are sources for a serial port test tool and downloadable demo applications. | |||
== Demo and Tool Downloads: == | |||
# '''SerialPortDemo Application:''' | |||
#* Download the [http://ftp.wizarpos.com/advanceSDK/SerialPortOpen.zip SerialPortDemo] for practical insights into application development. | |||
# '''Serial Port Test Tool:''' | |||
#* Download the [http://ftp.wizarpos.com/advanceSDK/SerialPortTest-1.6_230918.zip Source APP] and [http://ftp.wizarpos.com/advanceSDK/serialport_test_230918.apk APK] for a serial port testing tool. | |||
== API Usage: == | |||
# '''Java API for Serial Port:''' | |||
* SerialPortDevice.ID_USB_SLAVE_SERIAL : works for USB serial port in slave mode. | #* When opening a serial port using the Java API, set the logic ID of the serial port as a parameter. | ||
* SerialPortDevice.ID_USB_HOST_SERIAL : works for USB serial port in master mode. | #** SerialPortDevice.ID_USB_SLAVE_SERIAL : works for USB serial port in slave mode. | ||
* SerialPortDevice.ID_SERIAL_EXT : works for internal fiscal/ other serial port module. | #** SerialPortDevice.ID_USB_HOST_SERIAL : works for USB serial port in master mode. | ||
* SerialPortDevice.ID_USB_CDC: works for USB Communication Device Class. | #** SerialPortDevice.ID_SERIAL_EXT : works for internal fiscal/ other serial port module. | ||
* SerialPortDevice.ID_USB_GPRINTER: works for USB GPRINTER. | #** SerialPortDevice.ID_USB_CDC: works for USB Communication Device Class. | ||
* SerialPortDevice.ID_USB_SLAVE_SERIAL_ACM: works for ACM without Qualcomm driver. | #** SerialPortDevice.ID_USB_GPRINTER: works for USB GPRINTER. | ||
#** SerialPortDevice.ID_USB_SLAVE_SERIAL_ACM: works for ACM without Qualcomm driver. | |||
# '''C API for Serial Port:''' | |||
When using the | #* When using the C API to open a serial port, the device name of the serial port must be specified as a parameter. | ||
'''Device Name''': | '''Device Name''': | ||
{|class="wizarpostable" | {|class="wizarpostable" | ||
Line 37: | Line 36: | ||
** '''USB_CDC''': works for USB Communication Device Class. | ** '''USB_CDC''': works for USB Communication Device Class. | ||
|} | |} | ||
== Cable Connection Guidelines: == | |||
'''For Model Q4:''' | |||
* Refer to Picture 2 and Picture 3 for connecting using a USB to DB9 cable. | |||
* Alternatively, refer to Picture 4 for connection using a UU cable. | |||
== Cable Connection== | * Please ensure all connections and API parameters are correctly set for successful communication with the serial port. | ||
* | |||
[[File:Otg_usb_1.jpg|frameless|left|thumb|OTG to USB Host TypeA Female]] | [[File:Otg_usb_1.jpg|frameless|left|thumb|OTG to USB Host TypeA Female]] | ||
[[File:Usb_db9_1.jpg|frameless|left|thumb|USB to Serial port cable, USB TypeA Male to DB9 Female]] | [[File:Usb_db9_1.jpg|frameless|left|thumb|USB to Serial port cable, USB TypeA Male to DB9 Female]] | ||
[[File:Usb_db9_2.jpg|frameless|left|thumb|USB to Serial port cable, USB TypeA Male to DB9 Male]] | [[File:Usb_db9_2.jpg|frameless|left|thumb|USB to Serial port cable, USB TypeA Male to DB9 Male]] | ||
[[File:UUCable.jpg|frameless|left|thumb|caUU cable, 2 USB Serial port cable cross connected togetherption]] | [[File:UUCable.jpg|frameless|left|thumb|caUU cable, 2 USB Serial port cable cross connected togetherption]] |
Revision as of 18:48, 24 December 2023
Introduction:
This guide provides a demonstration on how to develop an application that utilizes serial ports, using both Java and C APIs. Included are sources for a serial port test tool and downloadable demo applications.
Demo and Tool Downloads:
- SerialPortDemo Application:
- Download the SerialPortDemo for practical insights into application development.
- Serial Port Test Tool:
- Download the Source APP and APK for a serial port testing tool.
API Usage:
- Java API for Serial Port:
- When opening a serial port using the Java API, set the logic ID of the 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.
- SerialPortDevice.ID_USB_GPRINTER: works for USB GPRINTER.
- SerialPortDevice.ID_USB_SLAVE_SERIAL_ACM: works for ACM without Qualcomm driver.
- When opening a serial port using the Java API, set the logic ID of the serial port as a parameter.
- C API for Serial Port:
- When using the C API to open a serial port, the device name of the serial port must be specified 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
|
Cable Connection Guidelines:
For Model Q4:
- Refer to Picture 2 and Picture 3 for connecting using a USB to DB9 cable.
- Alternatively, refer to Picture 4 for connection using a UU cable.
- Please ensure all connections and API parameters are correctly set for successful communication with the serial port.