Jim Miller | a34dc46 | 2015-05-07 18:52:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 FINGERPRINT_DAEMON_PROXY_H_ |
| 18 | #define FINGERPRINT_DAEMON_PROXY_H_ |
| 19 | |
| 20 | #include "IFingerprintDaemon.h" |
| 21 | #include "IFingerprintDaemonCallback.h" |
| 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | class FingerprintDaemonProxy : public BnFingerprintDaemon { |
| 26 | public: |
| 27 | static FingerprintDaemonProxy* getInstance() { |
| 28 | if (sInstance == NULL) { |
| 29 | sInstance = new FingerprintDaemonProxy(); |
| 30 | } |
| 31 | return sInstance; |
| 32 | } |
| 33 | |
| 34 | // These reflect binder methods. |
| 35 | virtual void init(const sp<IFingerprintDaemonCallback>& callback); |
| 36 | virtual int32_t enroll(const uint8_t* token, ssize_t tokenLength, int32_t groupId, int32_t timeout); |
| 37 | virtual uint64_t preEnroll(); |
Sasha Levitskiy | 7ded579 | 2015-06-25 15:53:41 -0700 | [diff] [blame] | 38 | virtual int32_t postEnroll(); |
Jim Miller | a34dc46 | 2015-05-07 18:52:53 -0700 | [diff] [blame] | 39 | virtual int32_t stopEnrollment(); |
| 40 | virtual int32_t authenticate(uint64_t sessionId, uint32_t groupId); |
| 41 | virtual int32_t stopAuthentication(); |
| 42 | virtual int32_t remove(int32_t fingerId, int32_t groupId); |
| 43 | virtual uint64_t getAuthenticatorId(); |
| 44 | virtual int32_t setActiveGroup(int32_t groupId, const uint8_t* path, ssize_t pathLen); |
| 45 | virtual int64_t openHal(); |
| 46 | virtual int32_t closeHal(); |
| 47 | |
| 48 | private: |
| 49 | FingerprintDaemonProxy(); |
| 50 | virtual ~FingerprintDaemonProxy(); |
| 51 | void binderDied(const wp<IBinder>& who); |
Sasha Levitskiy | 53afac0 | 2015-06-09 16:47:09 -0700 | [diff] [blame] | 52 | void notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length); |
| 53 | static void hal_notify_callback(const fingerprint_msg_t *msg); |
Jim Miller | a34dc46 | 2015-05-07 18:52:53 -0700 | [diff] [blame] | 54 | |
| 55 | static FingerprintDaemonProxy* sInstance; |
| 56 | fingerprint_module_t const* mModule; |
| 57 | fingerprint_device_t* mDevice; |
| 58 | sp<IFingerprintDaemonCallback> mCallback; |
| 59 | }; |
| 60 | |
| 61 | } // namespace android |
| 62 | |
| 63 | #endif // FINGERPRINT_DAEMON_PROXY_H_ |