blob: e596495c3655c52f93d4b9ccda541654b445feb0 [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;
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070016using ::android::hardware::Return;
17using ::android::hardware::Void;
18using ::android::hardware::hidl_vec;
19using ::android::hardware::hidl_string;
20using ::android::sp;
21
22struct Nfc : public INfc {
23 Nfc(nfc_nci_device_t* device);
24 ::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override;
Steven Moreland9dd5e8e2016-09-26 12:41:23 -070025 ::android::hardware::Return<int32_t> write(const hidl_vec<uint8_t>& data) override;
26 ::android::hardware::Return<int32_t> coreInitialized(const hidl_vec<uint8_t>& data) override;
27 ::android::hardware::Return<int32_t> prediscover() override;
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070028 ::android::hardware::Return<int32_t> close() override;
Steven Moreland9dd5e8e2016-09-26 12:41:23 -070029 ::android::hardware::Return<int32_t> controlGranted() override;
30 ::android::hardware::Return<int32_t> powerCycle() override;
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070031
Steven Moreland9dd5e8e2016-09-26 12:41:23 -070032 static void eventCallback(uint8_t event, uint8_t status) {
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070033 if (mCallback != nullptr) {
34 mCallback->sendEvent(
Steven Moreland9dd5e8e2016-09-26 12:41:23 -070035 (::android::hardware::nfc::V1_0::NfcEvent) event,
36 (::android::hardware::nfc::V1_0::NfcStatus) status);
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070037 }
38 }
Steven Moreland9dd5e8e2016-09-26 12:41:23 -070039 static void dataCallback(uint16_t data_len, uint8_t* p_data) {
40 hidl_vec<uint8_t> data;
41 data.setToExternal(p_data, data_len);
Iliyan Malchev678fa1f2016-09-22 15:53:53 -070042 if (mCallback != nullptr) {
43 mCallback->sendData(data);
44 }
45 }
46 private:
47 static sp<INfcClientCallback> mCallback;
48 const nfc_nci_device_t* mDevice;
49};
50
51extern "C" INfc* HIDL_FETCH_INfc(const char* name);
52
53} // namespace implementation
54} // namespace V1_0
55} // namespace nfc
56} // namespace hardware
57} // namespace android
58
59#endif // HIDL_GENERATED_android_hardware_nfc_V1_0_Nfc_H_