Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

SDK Guide

of Android OnePass app

Abstract
This document provides the guide of the SDK for further development.
www.hfteco.com

Preface

Firstly, thank you for purchasing the product from HuiFan


Technology Co. We hope that our products provide the great
performance to meet the requirement by customer. For extending the
application of the product, the source code of the OnePass app is
provided to the customer for further development. This document is
writing for providing the brief introduction of the source code.

The main content of this manual is divided into several sections


based on the different modules of the product. The app is running on
the Android system, both Eclipse and Android Studio can be used as
IDE for editing the source code. In this guide, the source code is
opened by Android Studio 3.0.1.

Important Claim:
 Not all the functions in the source code can be applied to all
types of the product depending on the hardware of the device.
The update modules might cause the compatible problem.
 Although the SDK is provided freely, our company still hold
all the right of the source code.
 Without permission of our company, any individual,
companies and organizations cannot amend, copy or excerpt
content of the SDK.
 Any development of using the SDK should be legal under the
local law.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 1
www.hfteco.com

Contents
Preface................................................................................................... 1
Contents.............................................................................................. 2
1. Introduction...................................................................................... 3
2. The package of android................................................................... 4
2.1. The MtGpio class file in fpi........................................................4
2.2. scanner........................................................................................ 4
2.2.1. camera................................................................................... 5
2.2.2. common.................................................................................5
2.2.3. config.....................................................................................6
2.2.4. decode................................................................................... 6
2.2.5. view....................................................................................... 6
2.3. zyapi............................................................................................7
3. The package of android_serialport_api.......................................... 8
4. The package of com.fgtit..................................................................9
4.1. app...............................................................................................9
4.2. device........................................................................................11
4.3. fingermap..................................................................................11
4.4. fpcore........................................................................................ 13
4.5. net..............................................................................................14
4.6. printer........................................................................................14
4.7. service....................................................................................... 14
4.8. utils........................................................................................... 15
Appendix I. The table of the complete structure of the project.......... 16

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 2
www.hfteco.com

1. Introduction

The OnePass app is preinstalled in all the products which are


operating the Android system. The app demonstrates that how the
modules like fingerprint, card reader and code reader work. For
further development, the source code of the app is freely provided
after completing the purchase.
The source code is generated as a project by the Android Studio.
The project contains three main packages: android,
android_serialport_api and com.fgtit. Each package will be
introduced in the following sections. The complete structure of the
project can be found in the appendix I. The JNI Library files, which
are named with the filename extension ‘.so’, are also added into the
project.

Fig.1 The packages in the project Fig.2 The JNI library files

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 3
www.hfteco.com

2. The package of android

2.1. The MtGpio class file in fpi


In this class, all the functions are written for configurating
the GPIO ports of each module, which includes barcode
module, fingerprint sensor module and RF card reader
module. The native functions are called by loading the
mtgpio.so library file.

2.2. scanner
This file contains the main configurations for camera and
barcode scanner.
 AmbientLightManager: The class for detecting the
ambient light of the environment for considering
whether the flash LED should be turned on or off.

 BeepManager: The class for managing the beeps and


vibrations when capture image by camera.

 CaptureActivity: The class achieves the function of


scanning the barcode via using the camera.

 FinishListener: The simple listener to monitor the


app and exit the app when some cases occurred.

 InactivityTimer: Define a simple timer for counting


the time. Finish the activity when time is out without
any action detected for low power consumption.

 Intents: The variables that used for sending the Intent


to the barcode scanner are defined in this class. All

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 4
www.hfteco.com

the Strings are used effectively as API, so do not


change the content.

 IntentSource: The enumeration for Intent.

2.2.1. camera
 AutoFocusManager: Create a thread to keep calling the
system function of Camera.autoFocus().

 CameraConfigurationManager: A class that is used to


configurate the parameter for camera hardware.

 CameraManager: All the service based on the camera are


defined in this class file.

 FrontLightMode: Enumerates settings of the preference


of controlling the front light.

 OpenCameraInterface: Detecting the number of cameras


that the device has. Open rear camera as default if there
are more than one camera.

 PreviewCallback: Sending preview message to the UI


thread.

2.2.2. common
 BitmapUtils: The utilization for dealing with the Bitmap.

 Runable: Make it compatible for executing the thread in


low version.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 5
www.hfteco.com

2.2.3. config
The package android.scanner.config is the class to define
the preferences of using the camera.
2.2.4. decode
 BitmapDecoder: The class is used for building a bitmap
decoder, and provides a method for getting the decoded
result.

 BitmapLuminanceSource: Convert the bitmap data from


int array into byte array. The class provides methods of
getting the converted data and the number of pixels in
specific row.

 CaptureActivityHandler: This class handles all the


messaging which comprises the state machine for
capturing.

 DecodeFormatManager: All the formats of the code are


defined in this class.

 DecodeHandler: Decode the code data captured by the


camera.

 DecodeThread: The multifarious work of decoding the


images is done in this thread.

2.2.5. view
 ViewfinderResultPointCallback: Override the method of
foundPossibleResultPoint.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 6
www.hfteco.com

 ViewfinderView: Generate the scanning view overlaid


on the camera preview interface.

2.3. zyapi
 CommonApi: The native methods of setting the GPIO
pins and the serial ports are defined in this class.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 7
www.hfteco.com

3. The package of android_serialport_api

 AsyncFingerprint: Configurate the fingerprint sensor module,


which includes the interface, the commands and function
achievement. The fingerprint enrolment, fingerprint data
generating, matching and recording are all include in this
class file.

 BarcodeReader: Setting serial port for controlling the barcode


reader.

 SerialPort: Control the device and using the native methods


from the JNI Library.

 SerialPortManager: The class file for managing the important


serial ports of the device which will be used in the app. The
three types of ports used for interfacing the different modules
are UART, SPI and USB. Configurate the correct serial port
for interfacing module based on the hardware specification.
The class provides the method for detecting the type of the
device and selecting the correct serial port automatically. The
pin settings are also included for each type of serial port.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 8
www.hfteco.com

4. The package of com.fgtit

All the functions achieved in the OnePass app are defined in this
package. The whole package contains nine files to separate it into
different fields. The following subsections introduce each field in
detailed.
4.1. app
 ActivityList: Creating an activitylist for managing the
activities in the system. The method of SaveConfig()
and LoadConfig() are used for initializing and changing
the configuration.

 AppDetail: The detailed information of the App is


defined in this class.

 UpdateApp: The class defines the method for updating


the app, which includes the dialog definitions, interface
design, update management.

4.2. data
 AdminItem: The information of the administrator is
defined in this class.

 Conversions: The class provides the native methods for


converting the template standard between ISO and
private standard based on the libconversions.so library
file.

 DeptItem: Define the information of the department in


the company.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 9
www.hfteco.com

 GlobalData: All the types of Item objects are managed


and edited in this class.

 HttpConnSoap/HttpConnSoap2: Both of classes are


used for applying the web service in the system.

 ImageSimpleAdapter: The class provides methods for


dealing with the image.

 JsonParase: Applying the Json Parse for managing the


UserItem.

 LineItem: Defining the item for line type and line name.

 RecordFile: Configurating the reading and writing on


file for recording the data.

 RecordItem: Defining the items that should be recorded.

 UserItem: Defining the item of the information of the


user.

 WebService: The configuration of the web service is


provided in this class, which includes methods of
updating, transferring the user data and fingerprint
matching on the server.

 WorkItem: Defining the item for work type and work


name.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 10
www.hfteco.com

 XmlParase: The class provides the methods for parsing


the XML document.

4.2. device
 BluetoothReader: This class provides the configuration
and commands for the external Bluetooth fingerprint
reader (HF-7000) when it is connected to the Android
device. If the development is based only on the built-in
modules of the device, there is no need to consider this
class.

 BluetoothReaderService: Configuration of the


Bluetooth connection is defined in this class.

 FullReader: The use of fingerprint module, NFC


module and barcode module are configurated in this
class.

4.3. fingermap
This file contains all the activities that achieving the
functions in the app. The interfaces of the App are
configurating to each activity.
 AboutActivity: Configurate the interface of showing
the information about the App, which includes the icon,
name and version of the App.

 AdminActivity: The interface of setting the password


for logging in the system.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 11
www.hfteco.com

 CameraActivity/CameraExActivity: The interface of


using the camera for capturing the picture or reading
the barcode information. The events of saving photos
and controlling camera are defined as methods in the
class.

 DeviceListActivity: This Activity appears as a dialog.


It lists any paired devices and devices detected in the
area after discovery. When a device is chosen by the
user, the MAC address of the device is sent back to the
parent Activity in the result Intent.

 EmployeeActivity/EmployeesActivity: The two


Activities are used for defining the variables of saving
the information of the employees and manage the
information of the employees.

 EnrollActivity: Design the enrolment interface for


enrolling the information. The information includes the
basic info of the user, the fingerprint, the info of card
and the barcode. In this activity, the fingerprint sensor
module, NFC module and camera are applied to capture
the data that required.

 FingerprintActivity: This activity is used for providing


the function of capturing the fingerprint from the sensor.

 LoginActivity: The login interface is defined in this


Activity. The main work of this activity is checking the
password.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 12
www.hfteco.com

 MainActivity: The initialization work of this App is


defined in this activity. And the main interface is linked
to this activity.

 MenuActivity: The main menu of the App is defined in


this activity.

 RecordsActivity: The activity provides the way for


recording the user information.

 SettingsActivity: The interface of Settings and set


functions are achieved in this activity.

 SignOffActivity: The activity provides the function of


Signing Off from the time attendance system.

 SignOnActivity: The activity provides the function of


Signing On to the time attendance system.

 SystemActivity: The system setting listed in the main


menu is defined in this activity. It provides the setting
of password, network and the link to the device system
setting.

 UtilitiesActivity: This activity provides the interface for


user to develop the method of uploading and
downloading the attendance data.

4.4. fpcore
 FPMatch: The matching of the fingerprint template is
achieved in this class. The class provides the native
Headquarter: Chongqing Huifan Technology Co., Ltd
Branch: Shenzhen Bio I/E Co., Ltd. Page: 13
www.hfteco.com

methods which defines libfgtitalg.so and libfpcore.so in


the JNI library.

4.5. net
 HttpConnSoap/ HttpConnSoap2: Both of class are used
for applying the web service in the system.

 SocketClient: Link the client to the server for sending


and receiving the data.

 SocketServer: Nothing defined in this class.

4.6. printer
 PrinterApi: The interface and configuration of the
printer are defined in this class.

 PrinterCmd: All the commands for controlling the


printer are defined in this class.

4.7. service
 ConnectService: Monitoring the USB connection.

 ThreadReadWriterIOSocket: Provides the thread for


reading and writing of the buffer stream.

 UsbBroadcastReceiver: Configure the broadcast when


USB connection is detected.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 14
www.hfteco.com

4.8. utils
 DataUtils: The class provides the interconversions of
different data types, which includes 16-based String
with byte array and 16-based String with String.

 DialogFactory: The class for managing the progress


dialog.

 ExtApi: Dealing with the data and save it into file.

 FileFilterEx: Override the method accept in FileFilter


class.

 MD5Util: Utilizing the MD5 code and configurate in


this class.

 ToastUtil: Configure the Toast that used to show the


message in the app.

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 15
www.hfteco.com

Appendix I. The table of the complete structure of the project

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 16
www.hfteco.com

Headquarter: Chongqing Huifan Technology Co., Ltd


Branch: Shenzhen Bio I/E Co., Ltd. Page: 17

You might also like