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

Scan

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

NFC

iMin Product NFC scan area

_images/nfc.png