General Function Modules

External USB Serial Devices

External USB Serial DeviceInstructions Document for USB、serial device 1. Brief introduction: peripheral interfaces: general communication interfaces such as LAN port, cash drawer port, usb2.0 port, serial port, headphone jack, etc. This text mainly introduces the usage mode of cash drawer port, usb port and serial port.

_images/1-1.png

Serial port(RJ11)

Serial serial port uses RJ11 port, The developers can control the peripherals.

by sending data from the serial port. The RJ11 of iMin equipment is four-wire and does not support hard-flow control (some peripherals turn on hardware-flow control by default, and these devices can not connect iMin mainframe through RJ11).

D1w, D3-505, D3 Premium, K1, K2, D4, S1, Swan 1: /dev/ttyS3

D2(Android 7.1), D3-504, D4 Pro, Swan 1 Pro, Crane 1 : /dev/ttyS1

D2(Android 11) series:/dev/ttyS7

Falcon 1 series:/dev/ttyS2

Serial port reference demo

_images/1-2.jpg

Communication document example: communication document for electronic scale at Jaynes serial port (different electronic scale communication agreements need to refer to the documents provided by every manufacturer)

CashBox(RJ12)

iMin’s desktop series models all support direct access to the cash box. The cash box uses the RJ12 interface. Developers can control the cash box by sending data to the RJ12 interface; Developers can open the money box by sending instructions directly. The money box has two operations: opening the money box and checking the status of the money box.

Download the IminLibs.jar package first, then reference it in the project, and obtain the specified value in the following way:

Demo downloads

  1. Import IminLib.jar and add IminLibs.jar to the libs directory in the app directory

_images/2-1.png
  1. Add the dependency of IminLib.jar and add the dependency in build.gradle in the app directory

_images/2-2.png
  1. Get cash drawer status (cash drawer support is required to return)

1//isCashBoxOpen- value:true  des:cashBox is opening
2//value:false des:cashBox is closing
3boolean isCashBoxOpen = IminSDKManager.isCashBoxOpen(Context context);
  1. Open the cash box

1IminSDKManager.opencashBox(Context context);

parameter:

context –> Application/Activity/Fragmen of context

Note

D4 Pro products must use IminSDKManager. OpencashBox (Context Context). The new way is compatible with old devices;IminSDKManager.opencashBox(); It can continue to be used on adapted devices.

USB Serial port

supports USB devices with USB2.0 agreement. USB communication developer documentation

iMin support list of USB to Serial port

List of USB to Serial: CH341, FT series, PL2303, CP210X series

● When used USB to Serial port, system will build the node: /dev/ttyUSBx   (like /dev/ttyUSB0,  /dev/ttyUSB1, etc.)

● Don’t use USB to debug system when you use USB to Serial port, it would make USB to Serial port not work

Obtain USB devices’ PID/VID:

Method 1: java code

 1UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
 2HashMap<String, UsbDevice> usbDeviceList = usbManager.getDeviceList();
 3for (UsbDevice usbDevice : usbDeviceList.values()) {
 4    int vid = usbDevice.getVendorId();
 5    int pid = usbDevice.getProductId();
 6
 7    // print VID and PID
 8    Log.d("USB Info", "Vendor ID (VID): " + vid);
 9    Log.d("USB Info", "Product ID (PID): " + pid);
10}

Method 2: adb command

1adb shell lsusb

Scanning

Scanner SDK Using Camera

For iMin devices, if you use the camera to scan the code, iMin provides a scan code Demo for developers to use, which can identify QR codes and barcodes faster.

Link Scan Demo downloads

Scanner Engine

Please refer to:《iMin Scanner Engine Documentation.pdf》 for scanner integration. This developer documentation is applicable to all models for reference.

iMin Swift 1、Swift 1 Pro、Crane 1、Lark 1, and other devices dedicated for scanning can be used in scenarios like catering, retail, healthcare, agricultural trading, law enforcement, and etc.

1. Supported codes

Different models of scanners support different types of codes. Some of the supported code types are listed in the table below:

Scanner | Code Types

Zebra scanner

EAN-13、EAN-8、QR、code 128、code 39、UPC-A、UPC-E、Codabar、ISBT 128、MSI PLESSEY、PDF417、code 93、Data Matrix

Totinfo scanner

EAN-13、EAN-8、QR、code 128、code 39、UPC-A、UPC-E、Han Xin、Codabar、Aztec、MSI PLESSEY、PDF417、code 93、Data Matrix

Users can select the supported codes based on their needs. The specific steps are as follows:

  1. Select “Supported code” in “Scanner settings”;

  2. Choose to enable or disable specific codes, with all codes enabled by default.

_images/19.png

2. Encoding Method

Users can set the output encoding in “Output Encoding format“. Four encoding formats are available: UTF-8, GBK, ISO-8859-1, and SHIFT-JIS. The default encoding format is UTF-8.

_images/26.png

3.Prompt Method

Users can configure the prompt method in “Prompt Method Settings.Sound and vibration prompts are enabled by default.

_images/35.png

4.Output Mode

Users can configure the output method of scan results in “Output Mode Settings.”. By default, the following options are selected: Analog keyboard output, Auto fill key, and enable broadcast output.

_images/45.png

5.Trigger Mode

Users can select the trigger mode in “Trigger Mode Settings.” By default, “Short Press Trigger” is selected, and the scanner will automatically turn off after a successful scan.

_images/54.png

6.Barcode Data Processing

Users can add prefixes or suffixes in “Barcode Data Processing.” Additionally, it supports removing first or last characters.

_images/63.png

7.Q&A

Common Questions:

  1. Q: How to integrate the scanner?

A: To make it easier for developers, iMin has designed the scanner as a development-free component. Scan data can be obtained without integration with the scanner.

If using broadcast notification method, the default parameters are as follows:

  • Broadcast name for scan results: com.imin.scanner.api.RESULT_ACTION

  • Key name:decode_data_str

  • Raw byte name:decode_data

2.Q: How to obtain the scan results?

A: There are three data output methods available:

1)Analog Keyboard: The scan result is simulated as key press events and automatically output to the focused text field. The scan result can be retrieved through the focused text field’s content or listening to the key events;

2)Direct Paste: The scan result is copied to the clipboard and automatically output to the focused text field. As compared to the analog keyboard output method, direct paste method offers faster output speed;

3)Broadcast Output: The scan result is sent as a broadcast message. Users can listen to the broadcast to obtain the scan result.

3.Q: Why is the scan result slow?

A: In keyboard emulation mode, the interval time between key presses will affect the output speed. Setting the interval to 0 will result in the fastest speed (default is 0).

4.Q: How to resolve garbled text when scanning a Chinese QR code?

A: For example, if the Chinese text “你好” in the QR code is encoded in UTF-8, the scanner’s output must also be configured to UTF-8 to display “你好” correctly. Otherwise, it will result in garbled text.

NFC

iMin Product NFC scan area

_images/nfc.png