Sasha Levitskiy | a747c06 | 2014-03-24 16:14:42 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H |
| 18 | #define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H |
| 19 | |
| 20 | #define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0) |
| 21 | #define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint" |
| 22 | |
| 23 | typedef enum fingerprint_msg { |
| 24 | FINGERPRINT_ERROR = -1, |
| 25 | FINGERPRINT_NO_MATCH = 0, |
| 26 | FINGERPRINT_MATCH = 1, |
| 27 | FINGERPRINT_TEMPLATE_COLLECTING = 2, |
| 28 | FINGERPRINT_TEMPLATE_REGISTERED = 3, |
| 29 | FINGERPRINT_TEMPLATE_DELETED = 4 |
| 30 | } fingerprint_msg_t; |
| 31 | |
| 32 | typedef enum fingerprint_error { |
| 33 | FINGERPRINT_ERROR_HW_UNAVAILABLE = 1, |
| 34 | FINGERPRINT_ERROR_BAD_CAPTURE = 2 |
| 35 | } fingerprint_error_t; |
| 36 | |
| 37 | /* Synchronous operation */ |
| 38 | typedef struct fingerprint_device { |
| 39 | struct hw_device_t common; |
| 40 | |
| 41 | /* |
| 42 | * Figerprint enroll request: records and stores a fingerprint template. |
| 43 | * Timeout after temeout_sec seconds. |
| 44 | * |
| 45 | * Function return: |
| 46 | * - Machine state: error, collected or registered. |
| 47 | * - Data is interpreted as error code, collection percentage |
| 48 | * or fingerprint id. |
| 49 | */ |
| 50 | fingerprint_msg_t (*enroll)(unsigned timeout_sec, unsigned *data); |
| 51 | |
| 52 | /* |
| 53 | * Figerprint remove request: deletes a fingerprint template. |
| 54 | * |
| 55 | * Function return: |
| 56 | * - Delete result: error or success. |
| 57 | */ |
| 58 | fingerprint_msg_t (*remove)(unsigned fingerprint_id); |
| 59 | |
| 60 | /* |
| 61 | * Figerprint match request: Collect a fingerprint and |
| 62 | * match against stored template with fingerprint_id. |
| 63 | * Timeout after temeout_sec seconds. |
| 64 | * |
| 65 | * Function return: |
| 66 | * - Match, no match or error. |
| 67 | */ |
| 68 | fingerprint_msg_t (*match)(unsigned fingerprint_id, unsigned timeout_sec); |
| 69 | |
| 70 | /* Reserved for future use. Must be NULL. */ |
| 71 | void* reserved[8 - 3]; |
| 72 | } fingerprint_device_t; |
| 73 | |
| 74 | typedef struct fingerprint_module { |
| 75 | struct hw_module_t common; |
| 76 | } fingerprint_module_t; |
| 77 | |
| 78 | /* For asyncronous mode - as a possible API model |
| 79 | typedef void (*fingerprint_callback)(int request_id, fingerprint_msg msg, data); |
| 80 | */ |
| 81 | |
| 82 | #endif /* ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H */ |