uFCoder 2.62
Loading...
Searching...
No Matches
Handling multiple readers

If you want to communicate and use multiple readers from an application, you have to follow the initial procedure for enumerating uFR compatible devices and getting their handles. More...

Functions

UFR_STATUS DL_API ReaderList_Add (UFR_HANDLE *DeviceHandle, uint32_t reader_type, c_string port_name, uint32_t port_interface, void *arg)
 This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method.
 
UFR_STATUS DL_API ReaderList_Destroy (UFR_HANDLE *DeviceHandle)
 Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution.
 
UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex (int32_t DeviceIndex, OUT char **Device_Description)
 Gets devices FTDI description based on the index of the device in the list.
 
UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex (int32_t DeviceIndex, OUT char **Device_Serial)
 Gets devices FTDI serial port number based on the index of the device in the list.
 
UFR_STATUS DL_API ReaderList_GetInformation (uint32_t DeviceIndex, VAR UFR_HANDLE *DeviceHandle, OUT c_string *DeviceSerialNumber, VAR int *DeviceType, OUT c_string *DeviceFWver, VAR int *DeviceCommID, VAR int *DeviceCommSpeed, OUT c_string *DeviceCommFTDISerial, OUT c_string *DeviceCommFTDIDescription, VAR int *DeviceIsOpened, VAR int *DeviceStatus)
 Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). This should be executed for each device based on number of devices found, providing valid index.
 
UFR_STATUS DL_API ReaderList_GetSerialByIndex (int32_t DeviceIndex, VAR uint32_t *lpulSerialNumber)
 Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list.
 
UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex (int32_t DeviceIndex, OUT uint8_t pSerialDescription[8])
 Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list.
 
UFR_STATUS DL_API ReaderList_GetTypeByIndex (int32_t DeviceIndex, VAR uint32_t *lpulReaderType)
 Gets devices reader type based on the index of the device in the list.
 
UFR_STATUS DL_API ReaderList_OpenByIndex (const int32_t DeviceIndex, VAR UFR_HANDLE *hndUFR)
 Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount().
 
UFR_STATUS DL_API ReaderList_OpenBySerial (VAR UFR_HANDLE *hndUFR, const char Device_SN[16])
 Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount().
 
UFR_STATUS DL_API ReaderList_UpdateAndGetCount (VAR int32_t *NumberOfDevices)
 This is the first function in the order for execution for the multi-reader support. The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. Each call to this method will close previously opened devices by this function, scan, and open everything found.
 

Detailed Description

If you want to communicate and use multiple readers from an application, you have to follow the initial procedure for enumerating uFR compatible devices and getting their handles.

Function Documentation

◆ ReaderList_Add()

UFR_STATUS DL_API ReaderList_Add ( UFR_HANDLE * DeviceHandle,
uint32_t reader_type,
c_string port_name,
uint32_t port_interface,
void * arg )

This method is used for manual addition of uFR devices to the list. Parameters used are the same as in ReaderOpenEx() method. Use this method if the device was not previously discovered by the ReaderList_UpdateAndGetCount() method.

Parameters
DeviceHandlethe handle that will be assigned for interacting with the specified reader on success.
reader_typeRefer to ReaderOpenEx() for detailed description of this parameter.
port_nameRefer to ReaderOpenEx() for detailed description of this parameter.
port_interfaceRefer to ReaderOpenEx() for detailed description of this parameter. arg Refer to ReaderOpenEx() for detailed description of this parameter.
argRefer to ReaderOpenEx() for detailed description of this parameter.
Returns
Operation status

◆ ReaderList_Destroy()

UFR_STATUS DL_API ReaderList_Destroy ( UFR_HANDLE * DeviceHandle)

Force handle deletion when you identify that the reader is no longer connected, and want to release the handle immediately. If the handle exists in the list of opened devices, function would try to close communication port and destroy the handle. When uFR reader is disconnected, ReaderList_UpdateAndGetCount() will do that (destroy) automatically in next execution.

Parameters
DeviceHandleThe handle that will be destroyed
Returns
Operation status

◆ ReaderList_GetFTDIDescriptionByIndex()

UFR_STATUS DL_API ReaderList_GetFTDIDescriptionByIndex ( int32_t DeviceIndex,
OUT char ** Device_Description )

Gets devices FTDI description based on the index of the device in the list.

Parameters
DeviceIndexIndex of the device
Device_DescriptionFTDI description as c_string
Returns
Operation status

◆ ReaderList_GetFTDISerialByIndex()

UFR_STATUS DL_API ReaderList_GetFTDISerialByIndex ( int32_t DeviceIndex,
OUT char ** Device_Serial )

Gets devices FTDI serial port number based on the index of the device in the list.

Parameters
DeviceIndexIndex of the device
Device_SerialContains FTDI serial number as c_string
Returns
Operation status

◆ ReaderList_GetInformation()

UFR_STATUS DL_API ReaderList_GetInformation ( uint32_t DeviceIndex,
VAR UFR_HANDLE * DeviceHandle,
OUT c_string * DeviceSerialNumber,
VAR int * DeviceType,
OUT c_string * DeviceFWver,
VAR int * DeviceCommID,
VAR int * DeviceCommSpeed,
OUT c_string * DeviceCommFTDISerial,
OUT c_string * DeviceCommFTDIDescription,
VAR int * DeviceIsOpened,
VAR int * DeviceStatus )

Used to retrieve information about a reader found & connected via ReaderList_UpdateAndGetCount(). This should be executed for each device based on number of devices found, providing valid index.

Parameters
DeviceIndexindex of the device in the readers list
DeviceHandleassigned Handle
DeviceSerialNumberdevice serial number
DeviceTypedevice type - device identification in AIS database
DeviceFWverversion of firmware
DeviceCommIDdevice identification number (master)
DeviceCommSpeedcommunication speed
DeviceCommFTDISerialFTDI COM port identification
DeviceCommFTDIDescriptionFTDI COM port description
DeviceIsOpenedis Device opened
DeviceStatusactual device status
Returns
Operation status
Parameters
DeviceSerialNumber/ assigned Handle
DeviceType/ device serial number
DeviceFWver/ device type - device identification in AIS database
DeviceCommID/ version of firmware
DeviceCommSpeed/ device identification number (master)
DeviceCommFTDISerial/ communication speed
DeviceCommFTDIDescription/ FTDI COM port identification
DeviceIsOpened/ FTDI COM port description
DeviceStatus/ is Device opened/ actual device status

◆ ReaderList_GetSerialByIndex()

UFR_STATUS DL_API ReaderList_GetSerialByIndex ( int32_t DeviceIndex,
VAR uint32_t * lpulSerialNumber )

Gets reader’s reader serial number as a pointer to 4 byte value, based on the index of the device in the list.

Parameters
DeviceIndexIndex of the device
lpulSerialNumberContains reader serial number as a 4 byte value (uint32_t)
Returns
Operation status

◆ ReaderList_GetSerialDescriptionByIndex()

UFR_STATUS DL_API ReaderList_GetSerialDescriptionByIndex ( int32_t DeviceIndex,
OUT uint8_t pSerialDescription[8] )

Gets reader’s descriptive name as a array of 8 chars, based on the index of the device in the list.

Parameters
DeviceIndexIndex of the device
pSerialDescriptionContains reader serial number as array of 8 chars
Returns
Operation status

◆ ReaderList_GetTypeByIndex()

UFR_STATUS DL_API ReaderList_GetTypeByIndex ( int32_t DeviceIndex,
VAR uint32_t * lpulReaderType )

Gets devices reader type based on the index of the device in the list.

Parameters
DeviceIndexIndex of the device
lpulReaderTypeContains reader type as 4 byte value (uint32_t)
Returns
Operation status

◆ ReaderList_OpenByIndex()

UFR_STATUS DL_API ReaderList_OpenByIndex ( const int32_t DeviceIndex,
VAR UFR_HANDLE * hndUFR )

Tries to re-open the device based on the device index. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount().

Parameters
DeviceIndexIndex of the device
hndUFRhandle of the uFR device
Returns
Operation status

◆ ReaderList_OpenBySerial()

UFR_STATUS DL_API ReaderList_OpenBySerial ( VAR UFR_HANDLE * hndUFR,
const char Device_SN[16] )

Tries to re-open the device based on the serial number of the device. This method should be called when you use ReaderCloseM() to close the communication with the reader opened by ReaderList_UpdateAndGetCount().

Parameters
hndUFRhandle of the uFR device
Device_SNSerial number of the device contained as char array
Returns
Operation status

◆ ReaderList_UpdateAndGetCount()

UFR_STATUS DL_API ReaderList_UpdateAndGetCount ( VAR int32_t * NumberOfDevices)

This is the first function in the order for execution for the multi-reader support. The function prepares the list of connected uF-readers to the system and returns the number of list items - number of connected uFR devices. ReaderList_UpdateAndGetCount() scans all communication ports for compatible devices, probes open readers if still connected, if not close and marks their handles for deletion. If some device is disconnected from the system this function should remove its handle. As of uFCoder version 5.0.73, this function probes both FTDI & COM devices and tries to open them. Each call to this method will close previously opened devices by this function, scan, and open everything found.


Parameters
NumberOfDeviceshow many compatible devices are connected to the system
Returns
Operation status