blob: 98cd57e8ebc2bd125f65f5537399e9237fdbb51d [file] [log] [blame]
Iliyan Malchev678fa1f2016-09-22 15:53:53 -07001#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>
8namespace android {
9namespace hardware {
10namespace nfc {
11namespace V1_0 {
12namespace implementation {
13
14using ::android::hardware::nfc::V1_0::INfc;
15using ::android::hardware::nfc::V1_0::INfcClientCallback;
16using ::android::hardware::nfc::V1_0::nfc_data_t;
17using ::android::hardware::Return;
18using ::android::hardware::Void;
19using ::android::hardware::hidl_vec;
20using ::android::hardware::hidl_string;
21using ::android::sp;
22
23struct 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
52extern "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_