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.

_images/image44.PNG

Figure 22 Picture with example device with fingerprint scanner, Temperature sensor and Motion Sensor functionality

  1. Temperature sensor

  2. Fingerprint sensor

  3. NFC scanner

  4. Motion sensor

  5. Camera

  6. Light

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.

  1. Configuration activity

    NCheck Android uses this activity to configure the Android service and read configuration details.

  2. Android service

    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

  1. Create a new Android application.

  2. Add NCheck Peripheral API Library module

    1. Open the project structure by File> Project Structure

    2. Select “Modules” from the left side menu

      _images/image46.PNG

      Figure 23 Project structure dialogue of Android Studio

    3. Click the “+” button in the top left to add a new module

    4. Select module type as “import JAR/AAR packages” from the Create new module dialog and select “Next” button

      _images/image48.PNG

      Figure 24 Select JAR/AAR packages from Create new module dialogue

    5. Select and Import the peripheralSDK.aar module

      _images/image50.PNG

      Figure 25 Import PeripheralSDK.aar from create new module diaglogue

  3. Add a configuration activity (MyScannerConfigurationActivity)

    Configuration activity should have all the peripheral service-related configuration

  4. 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.

    _images/image52.PNG

    Figure 26 Android manifest files changes to access from external peripheral configuration

  5. 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.

    In this code MyPeripheralService is the class name of the peripheral application Android service.

    _images/image54.PNG

    Figure 27 Code snippet to send the configuration information required to communicate with fingerprint scanner service

  6. Add new android service (MyPeripheralService) by extending CaptureDeviceService class from the API

  7. Implement following abstract methods in the new service class

    1. Public static CaptureDataType[] CaptureTypes

      Shadow method to replace supper class CaptureTypes static property

    2. public abstract String GetName()

      Implement this method to provide the name of the peripheral device service.

    3. public abstract CaptureDataType[] GetCaptureTypes()

      Implement this method to provide data type of the peripheral device. It should be CaptureDataType.FINGERPRINT or CaptureDataType.SENSOR

    4. 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.

    5. 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.

    6. 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

    7. 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.

    8. 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.

    9. 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

    10. public abstract void CancelCapture(CaptureDataType dataType)

      Implement this method to cancel current data capture operation. Data type parameter supports only FINGERPRINT.

    11. 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

      1. index

        Sensor index is reserved for future use.

      2. Range

        Possible range of data with min and max value.

      3. Precision

        Accuracy of data.

      4. Threshold

        Passing threshold of measuring data.

      5. StrMessage

        Textual message to display in NCheck Application

    12. 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.

  8. Configure Peripheral service in the Android manifest file as shown in Figure 28 .

    _images/image56.PNG

    Figure 28 Code snippet to configure Peripheral service in the Android manifest file

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.

_images/image58.PNG

Figure 29 Scanner service testing view