Open reader communication port in several different ways. Can be used for establishing communication with COM port too. There is enumeration in uFCoder.h file called E_READER_TYPE with values: enum E_READER_TYPE { AUTO = 0, UFR_TYPE = 1, UFR_RS232_TYPE = 2, BASEHD_UFR_TYPE = 3, UFR_ONLINE_TYPE = 4 }; Values in this enumeration you can pass into ReaderOpenEx function as reader_type parameter. For example, if you pass 4 as reader_type it will only work with µFR Online Series devices, and then as port_name you can pass devices IP address or serial number (ex: “192.168.1.123” or “ON101390”), for port_interface you can pass ‘U’ for UDP, ‘T’ for TCP or 0. If you pass 0, it will automatically search for reader working mode (UDP or TCP) and open it. For argument you can pass 0 or µFR Nano device serial number to open it on 1Mbit/s (ex: “UN123456”). More examples for port open are given in the “Reader Open Examples” document: https://www.d-logic.com/code/nfc-rfid-reader-sdk/ufr-doc/blob/master/Reader_Open_Examples.pdf Examples: ReaderOpenEx(1, “COM1”, 0, 0) This example will open communication with µFR device attached to COM1 port on 1Mbit/s ReaderOpenEx(1, 0, 0, 0) This example will automatically find COM port and open communication with first µFR device on 1Mbit/s ReaderOpenEx(2, 0, 0, 0) This example will automatically find COM port and open communication with first µFR RS232 device on 115200 bit/s ReaderOpenEx(4, “ON123456”, ‘U’, 0) This example will open communication with µFR Online reader with serial number ON123456 on UDP protocol. ReaderOpenEx(4, “ON123456”, ‘T’, 0) This example will open communication with µFR Online reader with serial number ON123456 on TCP protocol. ReaderOpenEx(4, “192.168.1.123”, ‘U’, 0) This example will open communication with µFR Online reader with IP address 192.168.1.123 on UDP protocol. ReaderOpenEx(4, “192.168.1.123”, ‘T’, 0) This will open communication with µFR Online reader with IP address 192.168.1.123 on TCP protocol. ReaderOpenEx(4, “192.168.1.123”, 0, 0) It will open communication with µFR Online reader with IP address 192.168.1.123 based on its working protocol (UDP or TCP), because we passed 0 as port_interface ReaderOpenEx(4, “ON123456”, 0, 0) It will open communication with µFR Online reader with serial number ON123456 based on its working protocol (UDP or TCP), because we passed 0 as port_interface ReaderOpenEx(4, “ON123456”, 0, “UN654321”) It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with serial number ON123456 ReaderOpenEx(4, “192.168.1.123”, 0, “UN654321”) It will open communication with µFR Nano reader on 1Mbit/s with serial number UN654321 which is attached to µFR Online device with IP address 192.168.1.123
- Parameters
-
reader_type | 0 : auto - same as call ReaderOpen() 1 : uFR type (1 Mbps) 2 : uFR RS232 type (115200 bps) 3 : BASE HD uFR type (250 Kbps) When uFR Online reader works in BT serial mode or transparent mode, reader_type must be set to 1. |
port_name | is c-string type used to open port by given serial name. If you provide NULL or empty string that is AUTO MODE which calls ReaderOpenEx() and all available ports on the system. serial port name, identifier, like "COM3" on Windows or "/dev/ttyS0" on Linux or "/dev/tty.serial1" on OS X or if you select FTDI, reader serial number like "UN123456", if reader have integrated FTDI interface When the UDP interface type is selected, port_name must be provided in “address:port” format. Like "192.168.1.162:8881" IP for UDP I/F |
port_interface | type of communication interfaces (define interface which we use while connecting to the printer), supported value's: 0 : auto - first try FTDI than serial if port_name is not defined 1 : try serial / virtual COM port / interfaces 2 : try only FTDI communication interfaces 10 : try to open Digital Logic Shields with RS232 uFReader on Raspberry Pi (serial interfaces with GPIO reset) 84 ('T') : TCP/IP interface 85 ('U') : UDP interface 102 ('B'): BT serial interface. Android library only. 114 ('L'): BLE interface. Android library only. When uFR Online reader works in BT serial mode, port_interface must be set to 0 (Except Android). arg C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps |
arg | C-string with additional settings delimited with new lines. Settings C-string constant: “UNIT_OPEN_RESET_DISABLE” : do not reset the reader when opening “UNIT_OPEN_RESET_FORCE” : force reset the reader when opening “UNIT_OPEN_RESET_ONLY”: only resets the device and will not send additional commands that are used when establishing communication with the reader. "READER_ACTIVE_ON_RTS_LOW" : (default) Reset the reader when RTS is high - the reader works when RTS is low "READER_ACTIVE_ON_RTS_HIGH" : Reset the reader when RTS is low - the reader works when RTS is high "RTS_ALWAYS_HIGH" : not implemented yet "RTS_ALWAYS_LOW" : not implemented yet "RTS_DISCONNECTED" : disconnect RTS (RTS is not initiate nor use) When uFR Online reader works in BT serial mode or transparent mode, arg must be set to “UNIT_OPEN_RESET_DISABLE”. Custom baud rates from library version 5.0.28. For all RS232 devices and USB devices from firmware version 5.0.31 "BR_1000000" : 1 Mbps "BR_115200" : 115200 bps "BR_250000" : 250000 bps "BR_9600" : 9600 bps "BR_19200" : 19200 bps "BR_38400" : 38400 bps "BR_57600" : 57600 bps "BR_230400" : 234000 bps "BR_460800" : 460800 bps "BR_500000" : 500000 bps |
- Returns
- Operation status