Iliyan Malchev | 678fa1f | 2016-09-22 15:53:53 -0700 | [diff] [blame^] | 1 | #ifndef HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_ |
| 2 | #define HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_ |
| 3 | |
| 4 | #include <android/hardware/nfc/1.0/INfc.h> |
| 5 | #include <hidl/Status.h> |
| 6 | #include <hardware/hardware.h> |
| 7 | #include <hardware/nfc.h> |
| 8 | namespace android { |
| 9 | namespace hardware { |
| 10 | namespace nfc { |
| 11 | namespace V1_0 { |
| 12 | namespace implementation { |
| 13 | |
| 14 | using ::android::hardware::nfc::V1_0::INfc; |
| 15 | using ::android::hardware::nfc::V1_0::INfcClientCallback; |
| 16 | using ::android::hardware::nfc::V1_0::nfc_data_t; |
| 17 | using ::android::hardware::Return; |
| 18 | using ::android::hardware::Void; |
| 19 | using ::android::hardware::hidl_vec; |
| 20 | using ::android::hardware::hidl_string; |
| 21 | using ::android::sp; |
| 22 | |
| 23 | struct Nfc : public INfc { |
| 24 | Nfc(nfc_nci_device_t* device); |
| 25 | ::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override; |
| 26 | ::android::hardware::Return<int32_t> write(const nfc_data_t& data) override; |
| 27 | ::android::hardware::Return<int32_t> core_initialized(const hidl_vec<uint8_t>& data) override; |
| 28 | ::android::hardware::Return<int32_t> pre_discover() override; |
| 29 | ::android::hardware::Return<int32_t> close() override; |
| 30 | ::android::hardware::Return<int32_t> control_granted() override; |
| 31 | ::android::hardware::Return<int32_t> power_cycle() override; |
| 32 | |
| 33 | static void event_callback(uint8_t event, uint8_t status) { |
| 34 | if (mCallback != nullptr) { |
| 35 | mCallback->sendEvent( |
| 36 | (::android::hardware::nfc::V1_0::nfc_event_t) event, |
| 37 | (::android::hardware::nfc::V1_0::nfc_status_t) status); |
| 38 | } |
| 39 | } |
| 40 | static void data_callback(uint16_t data_len, uint8_t* p_data) { |
| 41 | nfc_data_t data; |
| 42 | data.data.setToExternal(p_data, data_len); |
| 43 | if (mCallback != nullptr) { |
| 44 | mCallback->sendData(data); |
| 45 | } |
| 46 | } |
| 47 | private: |
| 48 | static sp<INfcClientCallback> mCallback; |
| 49 | const nfc_nci_device_t* mDevice; |
| 50 | }; |
| 51 | |
| 52 | extern "C" INfc* HIDL_FETCH_INfc(const char* name); |
| 53 | |
| 54 | } // namespace implementation |
| 55 | } // namespace V1_0 |
| 56 | } // namespace nfc |
| 57 | } // namespace hardware |
| 58 | } // namespace android |
| 59 | |
| 60 | #endif // HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_ |