Interfacing with Biometric Devices from POS applications
Support for Biometric devices (such as fingerprint readers) was added to the Unified POS specification and incorporated into Microsoft’s POS for .NET in version 1.10. This device category allows applications to interface with such devices and is helpful in capturing and verifying biometric data (such as a finger print). This blog will attempt to describe one possible way to interface with this device using POS for .NET. As always, the developer should first carefully read and understand the Unified POS specification for this device category before attempting to interface with the device (See chapter 5 of Unified POS specification v1.13). Also, before you interface with a physical device, you must install a .NET Service Object for the device (contact the hardware vendor to get the .NET service object). Note that legacy OPOS based service objects are not supported for this device category, one must have a .NET Service Object for this device.
First, an application will want to know what biometric devices are available. This can be done using the PosExplorer class. For example, to get an ArrayList of all Biometric devices, one would do the following:
// Create an instance of an explorer synchronizes events to the main form's thread.
explorer = new PosExplorer(this);
// Create a list of all available biometric devices and bind them to the list box
biometricList = new ArrayList(explorer.GetDevices(DeviceType.Biometrics));
Next, an application may want to register for the DeviceAddedEvent and the DeviceRemovedEvent. Doing so will allow the application to respond to plug-n-play events for the device. Once the application has a device, it will need to do the normal open, claim, and enable as well as subscribe to the required events. This can be done as follows:
// Create an instance of the device, open and claim it.
activeBiometricDevice = (Biometrics)explorer.CreateInstance(selectedDevice);
// Enable the device, subscribe to date events, and enable data events
activeBiometricDevice.DeviceEnabled = true;
activeBiometricDevice.DataEvent += new DataEventHandler(activeDevice_DataEvent);
activeBiometricDevice.ErrorEvent += new DeviceErrorEventHandler(activeBiometric_ErrorEvent);
activeBiometricDevice.DataEventEnabled = true;
activeBiometricDevice.StatusUpdateEvent += new StatusUpdateEventHandler(BiometricsStatusUpdateEvent);
The above snippet will open, claim, and enable the device. It will then subscribe to desired events and will enable data events. Once this is done one can use the device as desired. Typically, one will use the beginEnrollCapture() method in order to capture biometric data for a given user. This method customarily results in a series of biometric data captures aggregated together returned in the final form of a BIR (see “beginEnrollCapture” method in the UPOS specification for more detail). Status update events may be provided to instruct the user what actions are required during this process. Status information may include indications such as:
· StatusSensorReady – typically indicates that the device is ready for the user to swipe their finger or provide other biometric data
· StatusSensorComplete – indicates that the biometric data has been captured
· StatusMoveSlower – Indicates that the user needs to move slower
After issuing a beginEnrollCapture method one will wish to save the data in the BiometricsInformationRecord property that is available after a data event. This data is associated with the user providing the biometric input and will be used to identify the person when attempting to verify the user. In order to identify a person, one needs to issue a BeginVerifyCapture command to the device. Again Status update events may be provided as well as a data event (if desired, one can end the operation by issuing an EndCapture command). In response to the data event, the application can then pass a list of BiometricsInformationRecord data to the service object via the IdentifyMatch() method to determine if the biometric data provided by the user matches any contained within the list. This can be done as follows:
List<BiometricsInformationRecord> birs = /* Your list of BIR data */
int order =
activeBiometricDevice.IdentifyMatch(50, 0, true,
activeBiometricDevice.BiometricsInformationRecord /* current biometric data to match */,
birs /* list of biometric data to check for match*/ );
Where order is a list that identifies all users where the biometric data provided matches within the criteria range specified. Well, that is pretty much all that is needed in order to get biometric data from a user (in the form of a BIR) and then to later verify that the biometric data matches a previously provided BIR.