CloudPOS SDK
  • CloudPOS SDK
    • EMV Develop Spec
    • Scanning Service Usage
    • API Specification
    • CloudPOS SDK AAR
    • Java API Samples
    • Permissions
    • Error code
    • MDB Communication Protocal
  • POS_Specs
  • FAQ
    • SDK Error Collection
      • Printer
      • PINPAD
      • Contactless Card
      • IC Card
      • MSR Card
    • Hardware/Repair
      • Recover a Tampered Terminal
      • Learning Tampered Events
      • Remotely Reactivate from Tamper
      • TF (Micro SD) Card Suggestion
      • Understand Tamper Reason
    • Printer
      • Verify Terminal Printer Status
      • Print Unsupported Character Sets
      • Use Terminal Bluetooth Printer
      • Print Images
      • Print QR Codes
      • Evaluate HTML Print Performance
      • Evaluate Print Performance
      • Print with TM T88IV
      • Replace HTML Print Font
      • Java API Printer Operations
      • Understanding Image Print Gaps
      • Print with JavaScript
      • Verify Printer Paper Status
    • USB/Serial Port
      • Install Terminal USB Drivers
      • Install UU Cable Driver
      • Reinstall Production Serial Drivers
      • Linux Serial Driver Installation
      • Serial Port Development
      • Add Linux Udev Rules
      • ReOpen Serial after Wake-up
      • Close Serial after Disconnect
      • Connect Accessory Mode
      • Detect UU Cable Connnected
      • Control Fan via Serial Port
      • List Connected USB Devices
      • Accessory Agent Service D22/Q3
    • Firmware
      • Update Firmware
      • Understand Firmware Naming
      • Compare Engineer/User Modes
      • Configure POS Home Settings
      • Configure POS System Settings
      • Prevent Accidental App Uninstallation
      • Troubleshoot "Agent Stopped" Error
      • Resolve Forgotten Lock Password
      • Utilize Q1 Buttons
      • Adapt Q1 4G
      • Customize Boot Logo/Animation
      • Set Wallpaper
      • Activate Startup Special Mode
      • Install Browsers
      • Understand Firmware External Access
      • Get Terminal Firmware Modes
      • Write Customer Serial Numbers
      • Enable Touch Screen Wake-Up
      • Set User System Properties
      • Update POS WebView
      • Disable File Explorer for TF/Pendrives
      • Manage Screen On/Off
    • Settings Menu
      • Perform Factory Data Reset
      • Understand Settings Menus
      • View Terminal Certificate List
      • Understand Merchant Self Test
      • Use Network Self-Test
      • Change System Language
      • Log in as Administrator
      • Change Administrator's Login Password
      • Update Terminal Time
      • Update Terminal Time Zone
      • Update Time Zone from IP
      • Enable Settings Menu Role Control
      • Update Role Passwords API
      • Disable Bluetooth/Wi Fi
      • Enable/Disable Auto Time Zone
      • Enable/Disable Automatic Time
      • Set Display Sleep
      • Grant Accessibility Permission Automatically
      • Disable Security Lock
      • Access Settings Sub Menu
      • Set Language API
    • Battery/Power
      • Understand Special Charging Indicator
      • Preserve Terminal Battery Life
      • Understand Q2 Low-voltage Shutdown
      • Understand Terminal Battery Performance
      • Understand Counter Mode
      • Turn Off Terminal API
    • SIM/Ethenet/WIFI
      • Disable POS Hotspot
      • Retrieve Terminal IMEI Number
      • Retrieve Terminal MEID Number
      • Understand Modem Bands
      • Troubleshoot Terminal SIM Signal
      • Resolve SIM Network Issues
      • Troubleshoot Network Search Error
      • Check eSIM Status
      • Ethernet Connectivity Usage
      • Set Communication Mode
      • Troubleshoot USSD Issues
      • Set Preferred Network Type API
      • Add APN API
      • Set Static Ethernet API
      • Enable/Disable Mobile Data API
      • Set Network Operators API
      • Activate eSIM
      • Enable/Disable Ethernet
    • Certificate
      • Apply App Certificates
      • Renew App Certificate
      • App Installation Controls
      • Install CA Certificates
      • Clear Terminal Certificates
      • Understand Certificate Visibility
    • Card
      • Contactless Card Distance
      • NFC Buffer Size Understanding
      • Use Contactless CPU Card
      • Use Felica Card
      • Use Mifare Card
      • Understand PSAM Card Exceptions
      • Optimal Tap Positioning Guide
    • FingerPrint
      • Fingerprint Module Usage Guide
      • Fingerprint DPI Specifications
      • Fingerprint Data Formats
    • Other Development
      • New Android Studio Versions
      • Setup ANDROID HOME
      • App Signing Process
      • Install POS Applications
      • Create First Android App
      • Retrieve Terminal Logs
      • Resolve APK Signature Conflict
      • Obtain Unfiltered Full Log
      • Obtain Terminal Current Location
      • Use Terminal Camera
      • Get Test APKs
      • Learn ADB Commands
      • Get Advanced Demos
      • Import Java SDK in C
      • Obtain Signal Strength
      • Get D3 Demos
      • Learn Kiosk Mode
      • Block Status Bar API
      • Display Full-Screen API
      • Display Full Screen Android API
      • Disable Home Key
      • Capture Power Button API
      • Retrieve Terminal Info
      • Save Files Locally
      • Set Default Launcher
      • Get Firmware Version
      • Get Firmware&EMV Version
      • Implement TLSv1.3
      • Auto-Run Post-Install
      • Understand Secure Connections
      • Use AnyDesk
      • Export Database to SD
      • Migrate App to Q2Premium
      • Auto-Run App Post-Boot
      • Integrate Java SDK in Flutter
      • Call AIDL Interface
      • Connect wirelessly
      • Get POS SN
      • UPT development-related
      • Q3 PDA Terminal Barcode Scanner
    • Key Injection
      • Inject Test Keys Remotely
      • Understand DUKPT
      • Understand Master&Session Keys
      • Use TMK KeyLoader POS
      • Understand Remote Key Injection
      • Resolve Serial Timeout
      • Import TMK Error: 74496
    • PINPAD
      • PINPAD Configuration Summary
      • Customize PINPAD GUI
    • TMS/Wizarview
      • TMS Overview
      • TMS User Guide
      • Register Terminal to WizarView
      • Accept TMS File Downloads
      • Handle User Locked Status
      • Apply WizarView Account
      • Batch Import Terminals
      • Unbind App Configuration
      • Remove App via TMS
      • Understand Agent Error Codes
      • Understand TMS IP Ports
      • Understand Update Scenarios
      • Understand App Binding Types
      • Apply RMA Maintenance Account
      • Update Firmware Remotely
      • Push APK to Specific Device
      • Set Agent Working Mode
      • Manage APK Prompt Installation
      • Network Control in Agent
      • Push Apps Using Tags
      • Deploy AID/CAPK via TMS
    • EMV
      • What's Tag91
      • What's CAPK
      • Set Issuer Scripts
      • Resolve Detection Priority Conflict
    • Advance SDK
      • Enable and Disable MTP
      • Disable notification badges
      • Scheduled Terminal Reboot Setup
      • Activate POS Hotspot
  • Wizarview Open API
Powered by GitBook
On this page
  • Introduction:
  • Demo and Tool Downloads:
  • Best Practices for Reading Data from a Serial Port:
  • API Usage:
  • Cable Connection Guidelines:
  1. FAQ
  2. USB/Serial Port

Serial Port Development

PreviousLinux Serial Driver InstallationNextAdd Linux Udev Rules

Last updated 5 months ago

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:

  1. Serial Port Test Tool:

    • Download the and for a serial port testing tool.

Best Practices for Reading Data from a Serial Port:

  • Known Data Length:

    • If the length of the data (len) is known, set the receive buffer to this length (len).

    • Set the timeout to forever. The SDK will return once it has received the specified length of data.

  • Unknown Data Length:

    • Set the receive buffer to 1 byte and the timeout to forever.

    • When data is received, continue reading in a loop.

    • Set the buffer to 256 bytes (or another length) and the timeout to 200ms to receive all data.

  • Good Practice - Define a Data Packet Protocol:

    • Define a packet header (e.g., 3 bytes) that includes the data length.

    • Set the receive buffer to 3 bytes and the timeout to forever.

    • After receiving the header, set the buffer to the parsed data length (len) and the timeout to forever to receive all data.

API Usage:

  1. 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.

  2. 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

  • 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 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.

Cable pictures:

Source APP
APK
picture 1(otg-usb cable)
picture 2(usb db9)
picture 3(usb db9)
picture 4(UU cable)