From 6b6381cb58aba593951f0718f9beecef0b49e284 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 26 Sep 2016 12:41:23 -0700 Subject: [PATCH] nfc: update default implementation to match style. Test: make android.hardware.nfc@1.0-impl Change-Id: Ib76d663fcf28816bd2ba57f5fbd5ae0033b620f5 --- nfc/1.0/default/Nfc.cpp | 14 +++++++------- nfc/1.0/default/Nfc.h | 23 +++++++++++------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp index b836adad8a..d3868c1309 100644 --- a/nfc/1.0/default/Nfc.cpp +++ b/nfc/1.0/default/Nfc.cpp @@ -19,19 +19,19 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) { // Methods from ::android::hardware::nfc::V1_0::INfc follow. ::android::hardware::Return Nfc::open(const sp& clientCallback) { mCallback = clientCallback; - return mDevice->open(mDevice, event_callback, data_callback); + return mDevice->open(mDevice, eventCallback, dataCallback); } -::android::hardware::Return Nfc::write(const nfc_data_t& data) { - return mDevice->write(mDevice, data.data.size(), &data.data[0]); +::android::hardware::Return Nfc::write(const hidl_vec& data) { + return mDevice->write(mDevice, data.size(), &data[0]); } -::android::hardware::Return Nfc::core_initialized(const hidl_vec& data) { +::android::hardware::Return Nfc::coreInitialized(const hidl_vec& data) { hidl_vec copy = data; return mDevice->core_initialized(mDevice, ©[0]); } -::android::hardware::Return Nfc::pre_discover() { +::android::hardware::Return Nfc::prediscover() { return mDevice->pre_discover(mDevice); } @@ -39,11 +39,11 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) { return mDevice->close(mDevice); } -::android::hardware::Return Nfc::control_granted() { +::android::hardware::Return Nfc::controlGranted() { return mDevice->control_granted(mDevice); } -::android::hardware::Return Nfc::power_cycle() { +::android::hardware::Return Nfc::powerCycle() { return mDevice->power_cycle(mDevice); } diff --git a/nfc/1.0/default/Nfc.h b/nfc/1.0/default/Nfc.h index 98cd57e8eb..e596495c36 100644 --- a/nfc/1.0/default/Nfc.h +++ b/nfc/1.0/default/Nfc.h @@ -13,7 +13,6 @@ namespace implementation { using ::android::hardware::nfc::V1_0::INfc; using ::android::hardware::nfc::V1_0::INfcClientCallback; -using ::android::hardware::nfc::V1_0::nfc_data_t; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -23,23 +22,23 @@ using ::android::sp; struct Nfc : public INfc { Nfc(nfc_nci_device_t* device); ::android::hardware::Return open(const sp& clientCallback) override; - ::android::hardware::Return write(const nfc_data_t& data) override; - ::android::hardware::Return core_initialized(const hidl_vec& data) override; - ::android::hardware::Return pre_discover() override; + ::android::hardware::Return write(const hidl_vec& data) override; + ::android::hardware::Return coreInitialized(const hidl_vec& data) override; + ::android::hardware::Return prediscover() override; ::android::hardware::Return close() override; - ::android::hardware::Return control_granted() override; - ::android::hardware::Return power_cycle() override; + ::android::hardware::Return controlGranted() override; + ::android::hardware::Return powerCycle() override; - static void event_callback(uint8_t event, uint8_t status) { + static void eventCallback(uint8_t event, uint8_t status) { if (mCallback != nullptr) { mCallback->sendEvent( - (::android::hardware::nfc::V1_0::nfc_event_t) event, - (::android::hardware::nfc::V1_0::nfc_status_t) status); + (::android::hardware::nfc::V1_0::NfcEvent) event, + (::android::hardware::nfc::V1_0::NfcStatus) status); } } - static void data_callback(uint16_t data_len, uint8_t* p_data) { - nfc_data_t data; - data.data.setToExternal(p_data, data_len); + static void dataCallback(uint16_t data_len, uint8_t* p_data) { + hidl_vec data; + data.setToExternal(p_data, data_len); if (mCallback != nullptr) { mCallback->sendData(data); }