mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 17:31:58 +00:00
nfc: update default implementation to match style. am: 6b6381cb58
am: 36108aadd4
Change-Id: Iac25d37c46c04aa18357c77ace08c810f67ccf72
This commit is contained in:
@@ -19,19 +19,19 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) {
|
|||||||
// Methods from ::android::hardware::nfc::V1_0::INfc follow.
|
// Methods from ::android::hardware::nfc::V1_0::INfc follow.
|
||||||
::android::hardware::Return<int32_t> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
|
::android::hardware::Return<int32_t> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
|
||||||
mCallback = clientCallback;
|
mCallback = clientCallback;
|
||||||
return mDevice->open(mDevice, event_callback, data_callback);
|
return mDevice->open(mDevice, eventCallback, dataCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
::android::hardware::Return<int32_t> Nfc::write(const nfc_data_t& data) {
|
::android::hardware::Return<int32_t> Nfc::write(const hidl_vec<uint8_t>& data) {
|
||||||
return mDevice->write(mDevice, data.data.size(), &data.data[0]);
|
return mDevice->write(mDevice, data.size(), &data[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
::android::hardware::Return<int32_t> Nfc::core_initialized(const hidl_vec<uint8_t>& data) {
|
::android::hardware::Return<int32_t> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
|
||||||
hidl_vec<uint8_t> copy = data;
|
hidl_vec<uint8_t> copy = data;
|
||||||
return mDevice->core_initialized(mDevice, ©[0]);
|
return mDevice->core_initialized(mDevice, ©[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
::android::hardware::Return<int32_t> Nfc::pre_discover() {
|
::android::hardware::Return<int32_t> Nfc::prediscover() {
|
||||||
return mDevice->pre_discover(mDevice);
|
return mDevice->pre_discover(mDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,11 +39,11 @@ Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device) {
|
|||||||
return mDevice->close(mDevice);
|
return mDevice->close(mDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
::android::hardware::Return<int32_t> Nfc::control_granted() {
|
::android::hardware::Return<int32_t> Nfc::controlGranted() {
|
||||||
return mDevice->control_granted(mDevice);
|
return mDevice->control_granted(mDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
::android::hardware::Return<int32_t> Nfc::power_cycle() {
|
::android::hardware::Return<int32_t> Nfc::powerCycle() {
|
||||||
return mDevice->power_cycle(mDevice);
|
return mDevice->power_cycle(mDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ namespace implementation {
|
|||||||
|
|
||||||
using ::android::hardware::nfc::V1_0::INfc;
|
using ::android::hardware::nfc::V1_0::INfc;
|
||||||
using ::android::hardware::nfc::V1_0::INfcClientCallback;
|
using ::android::hardware::nfc::V1_0::INfcClientCallback;
|
||||||
using ::android::hardware::nfc::V1_0::nfc_data_t;
|
|
||||||
using ::android::hardware::Return;
|
using ::android::hardware::Return;
|
||||||
using ::android::hardware::Void;
|
using ::android::hardware::Void;
|
||||||
using ::android::hardware::hidl_vec;
|
using ::android::hardware::hidl_vec;
|
||||||
@@ -23,23 +22,23 @@ using ::android::sp;
|
|||||||
struct Nfc : public INfc {
|
struct Nfc : public INfc {
|
||||||
Nfc(nfc_nci_device_t* device);
|
Nfc(nfc_nci_device_t* device);
|
||||||
::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override;
|
::android::hardware::Return<int32_t> open(const sp<INfcClientCallback>& clientCallback) override;
|
||||||
::android::hardware::Return<int32_t> write(const nfc_data_t& data) override;
|
::android::hardware::Return<int32_t> write(const hidl_vec<uint8_t>& data) override;
|
||||||
::android::hardware::Return<int32_t> core_initialized(const hidl_vec<uint8_t>& data) override;
|
::android::hardware::Return<int32_t> coreInitialized(const hidl_vec<uint8_t>& data) override;
|
||||||
::android::hardware::Return<int32_t> pre_discover() override;
|
::android::hardware::Return<int32_t> prediscover() override;
|
||||||
::android::hardware::Return<int32_t> close() override;
|
::android::hardware::Return<int32_t> close() override;
|
||||||
::android::hardware::Return<int32_t> control_granted() override;
|
::android::hardware::Return<int32_t> controlGranted() override;
|
||||||
::android::hardware::Return<int32_t> power_cycle() override;
|
::android::hardware::Return<int32_t> powerCycle() override;
|
||||||
|
|
||||||
static void event_callback(uint8_t event, uint8_t status) {
|
static void eventCallback(uint8_t event, uint8_t status) {
|
||||||
if (mCallback != nullptr) {
|
if (mCallback != nullptr) {
|
||||||
mCallback->sendEvent(
|
mCallback->sendEvent(
|
||||||
(::android::hardware::nfc::V1_0::nfc_event_t) event,
|
(::android::hardware::nfc::V1_0::NfcEvent) event,
|
||||||
(::android::hardware::nfc::V1_0::nfc_status_t) status);
|
(::android::hardware::nfc::V1_0::NfcStatus) status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void data_callback(uint16_t data_len, uint8_t* p_data) {
|
static void dataCallback(uint16_t data_len, uint8_t* p_data) {
|
||||||
nfc_data_t data;
|
hidl_vec<uint8_t> data;
|
||||||
data.data.setToExternal(p_data, data_len);
|
data.setToExternal(p_data, data_len);
|
||||||
if (mCallback != nullptr) {
|
if (mCallback != nullptr) {
|
||||||
mCallback->sendData(data);
|
mCallback->sendData(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user