PERIPHERAL INTEGRATION API¶
Android device manufacturers add various data input and output devices such as fingerprint sensors, temperature sensor in to their devices to use in various industrial applications. By using such peripherals integrated or attached to Android devices can be used in attendance applications. For this kind of devices, manufacturers provide their own API to access those devices. Following image shows basic device with integrated sensors.
NCheck supports integrating third party fingerprint scanners by using NCheck SDK capture device service API. NCheck SDK capture device service API provides and API interface to develop a module and integrate with NCheck Android to control and capture fingerprint using third party fingerprint scanners. This document describes the procedure to develop a fingerprint scanner module to integrate a fingerprint scanner with NCheck.
Third Party sensor Integration with Android Standard client¶
Scanner integration application is used to configure and control the third-party fingerprint scanner device.
Components of the application¶
It should have following components.
NCheck Android uses this activity to configure the Android service and read configuration details.
An Android service developed by using the CaptureDeviceInterface (See API documentation) abstract class. This service connects, control and capture from fingerprint device.
Create Scanner integration application¶
Create a new Android application.
Add NCheck Peripheral API Library module
Open the project structure by File> Project Structure
Select “Modules” from the left side menu
Click the “+” button in the top left to add a new module
Select module type as “import JAR/AAR packages” from the Create new module dialog and select “Next” button
Select and Import the peripheralSDK.aar module
Add a configuration activity (MyScannerConfigurationActivity)
Configuration activity should have all the peripheral service-related configuration
Configure Activity in the Android manifest file to access from NCheck External peripheral configuration as follows
As shown in Figure 26 , in this configuration, the action name (ex: MyPeripheral) is the unique identification for NCheck Android to find the configuration activity of peripheral integration application.
Add coding to send configuration information to NCheck android. Override onBackPressed method of the configuration activity as shown in Listing 3.2. Then it will send the configuration information required to communicate with fingerprint scanner service.
Add new android service (MyPeripheralService) by extending CaptureDeviceService class from the API
Implement following abstract methods in the new service class
Public static CaptureDataType CaptureTypes
Shadow method to replace supper class CaptureTypes static property
public abstract String GetName()
Implement this method to provide the name of the peripheral device service.
public abstract CaptureDataType GetCaptureTypes()
Implement this method to provide data type of the peripheral device. It should be CaptureDataType.FINGERPRINT or CaptureDataType.SENSOR
public abstract Point GetImageSizes()
Implement this method to provide possible image resolutions in case of a fingerprint reader. It supports only one resolution. Multiple resolutions are for future use only.
public abstract void Start()
Implement this method to start the communication status. Before starting, Status of the peripheral device service is DISCONNECTED. It should notify the status change by using SendStatus method of CaptureDeviceService class. When Start method is called, the peripheral device service should change the status to NOT_READY. It should make attempt to establish the communication with the peripheral device in background. Once communication is established, the service status should be changed to READY and should be ready to capture data from the device.
public abstract void Stop()
Implement this method to stop communication with the hardware and return the status to DISCONENCTED. If capture request made before getting ready, the device should start capture immediately and change the status to CAPTURING. current capturing and
public abstract void ShowMessage(DisplayMessageType type, String msg)
Implement this method to display messages from NCheck bio attendance, if there is a display. Call to this method will send the type of the message and message text. Depend on the device capabilities, it can process the message. If the display, LED indicators or beepers are not available, it can do nothing. As an example, if there are three color LEDs, it can process only the type of the messages like green for INFO, yellow for WARNING and red for ERROR.
public abstract void ShowResults(String name, int inout, String time1, String time2)
Implement this method to display check in check out results in the peripheral device. This is useful on in the cases where display or user notification functionalities are available in the device. This method sends the full name of the user, event type , user check in time and user check out time.
public abstract boolean Capture(CaptureDataType dataType, Point resolution)
Implement this system to receive capture start. When it receive the call, it should start capture immediately if the peripheral service can communicate with the peripheral device. If it is in not ready to communicate with peripheral device, it should wait until establishing the communication with the hardware and start capture immediately after establishing the communication with the hardware. Capture method can specify the capture data type and image resolution When capture is enabled, Peripheral service can send captured data to NCheck Bio Attendance client by using SenCapturedData method. SendCaptureData can send raw image data as a Bitmap, textual data as a String or extracted template data as a byte array. For peripheral device service, the captured data should have only raw image data as a Bitmap
public abstract void CancelCapture(CaptureDataType dataType)
Implement this method to cancel current data capture operation. Data type parameter supports only FINGERPRINT.
public abstract Sense(int index)
Implement this method to start reading sensor data operation. . Parameter index is for future us and need to provide 0. Service should start reading sensor data and call sendSensorDataUpdate method to send sensor data to NCheck. Sensor data should include
Sensor index is reserved for future use.
Possible range of data with min and max value.
Accuracy of data.
Passing threshold of measuring data.
Textual message to display in NCheck Application
public abstract void CancelSense(int index)
Implement this method to cancel current reading sensor data operation. Parameter index is for future us and need to provide 0.
Configure Peripheral service in the Android manifest file as shown in Figure 28 .
Testing scanner service¶
API provides a test activity called CaptureDeviceServiceTest. You can also launch this service activity by using LaunchTestActivity static method of the CaptureDeviceService class.