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. .. image:: ../images/GeneralFunctionModules/1-1.png :width: 800 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 `_ .. image:: ../images/GeneralFunctionModules/1-2.jpg :width: 800 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 .. image:: ../images/GeneralFunctionModules/2-1.png :width: 800 2) Add the dependency of IminLib.jar and add the dependency in build.gradle in the app directory .. image:: ../images/GeneralFunctionModules/2-2.png :width: 800 3) Get cash drawer status (cash drawer support is required to return) .. code-block:: java :linenos: :emphasize-lines: 1 //isCashBoxOpen- value:true des:cashBox is opening //value:false des:cashBox is closing boolean isCashBoxOpen = IminSDKManager.isCashBoxOpen(Context context); 4) Open the cash box .. code-block:: java :linenos: :emphasize-lines: 1 IminSDKManager.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 .. code-block:: xml :linenos: :emphasize-lines: 1 UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap usbDeviceList = usbManager.getDeviceList(); for (UsbDevice usbDevice : usbDeviceList.values()) { int vid = usbDevice.getVendorId(); int pid = usbDevice.getProductId(); // print VID and PID Log.d("USB Info", "Vendor ID (VID): " + vid); Log.d("USB Info", "Product ID (PID): " + pid); } Method 2: adb command .. code-block:: xml :linenos: :emphasize-lines: 1 adb 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 .. image:: ../images/GeneralFunctionModules/nfc.png :width: 800