mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
nfc interfaces in the new style.
Change-Id: I989828d51a2ac1c79906d865b5bdab227457d2e6 Signed-off-by: Iliyan Malchev <malchev@google.com>
This commit is contained in:
committed by
Iliyan Malchev
parent
91ec59bae1
commit
a48313947e
30
nfc/1.0/Android.mk
Normal file
30
nfc/1.0/Android.mk
Normal file
@@ -0,0 +1,30 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := android.hardware.nfc@1.0
|
||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
||||
|
||||
intermediates := $(local-generated-sources-dir)
|
||||
|
||||
GEN := \
|
||||
$(intermediates)/android/hardware/nfc/1.0/types.cpp \
|
||||
$(intermediates)/android/hardware/nfc/1.0/NfcAll.cpp \
|
||||
$(intermediates)/android/hardware/nfc/1.0/NfcClientCallbackAll.cpp \
|
||||
|
||||
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
|
||||
|
||||
$(GEN): PRIVATE_CUSTOM_TOOL = \
|
||||
hidl-gen -o $(PRIVATE_OUTPUT_DIR) android.hardware.nfc@1.0
|
||||
|
||||
$(GEN): $(LOCAL_PATH)/types.hal $(LOCAL_PATH)/INfc.hal $(LOCAL_PATH)/INfcClientCallback.hal
|
||||
$(transform-generated-source)
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(GEN)
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libhwbinder \
|
||||
libutils \
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
73
nfc/1.0/INfc.hal
Normal file
73
nfc/1.0/INfc.hal
Normal file
@@ -0,0 +1,73 @@
|
||||
package android.hardware.nfc@1.0;
|
||||
|
||||
import INfcClientCallback;
|
||||
|
||||
interface INfc {
|
||||
/*
|
||||
* Opens the NFC controller device and performs initialization.
|
||||
* This may include patch download and other vendor-specific initialization.
|
||||
*
|
||||
* If open completes successfully, the controller should be ready to perform
|
||||
* NCI initialization - ie accept CORE_RESET and subsequent commands through
|
||||
* the write() call.
|
||||
*
|
||||
* If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT
|
||||
* before continuing.
|
||||
*
|
||||
* If open() returns any other value, the NCI stack will stop.
|
||||
*
|
||||
*/
|
||||
open(INfcClientCallback clientCallback) generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* Performs an NCI write.
|
||||
*
|
||||
* This method may queue writes and return immediately. The only
|
||||
* requirement is that the writes are executed in order.
|
||||
*/
|
||||
write(nfc_data_t data) generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* core_initialized() is called after the CORE_INIT_RSP is received from the NFCC.
|
||||
* At this time, the HAL can do any chip-specific configuration.
|
||||
*
|
||||
* If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
|
||||
* before continuing.
|
||||
*
|
||||
* If core_initialized() returns any other value, the NCI stack will continue
|
||||
* immediately.
|
||||
*/
|
||||
core_initialized(vec<uint8_t> data) generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* pre_discover is called every time before starting RF discovery.
|
||||
* It is a good place to do vendor-specific configuration that must be
|
||||
* performed every time RF discovery is about to be started.
|
||||
*
|
||||
* If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
|
||||
* before continuing.
|
||||
*
|
||||
* If pre_discover() returns any other value, the NCI stack will start
|
||||
* RF discovery immediately.
|
||||
*/
|
||||
pre_discover() generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* Close the NFC controller. Should free all resources.
|
||||
*/
|
||||
close() generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* Grant HAL the exclusive control to send NCI commands.
|
||||
* Called in response to HAL_REQUEST_CONTROL_EVT.
|
||||
* Must only be called when there are no NCI commands pending.
|
||||
* HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
|
||||
*/
|
||||
control_granted() generates (int32_t retval);
|
||||
|
||||
/*
|
||||
* Restart controller by power cyle;
|
||||
* HAL_OPEN_CPLT_EVT will notify when operation is complete.
|
||||
*/
|
||||
power_cycle() generates (int32_t retval);
|
||||
};
|
||||
15
nfc/1.0/INfcClientCallback.hal
Normal file
15
nfc/1.0/INfcClientCallback.hal
Normal file
@@ -0,0 +1,15 @@
|
||||
package android.hardware.nfc@1.0;
|
||||
|
||||
interface INfcClientCallback {
|
||||
/*
|
||||
* The callback passed in from the NFC stack that the HAL
|
||||
* can use to pass events back to the stack.
|
||||
*/
|
||||
sendEvent(nfc_event_t event, nfc_status_t event_status);
|
||||
|
||||
/*
|
||||
* The callback passed in from the NFC stack that the HAL
|
||||
* can use to pass incomming data to the stack.
|
||||
*/
|
||||
sendData(nfc_data_t data);
|
||||
};
|
||||
23
nfc/1.0/types.hal
Normal file
23
nfc/1.0/types.hal
Normal file
@@ -0,0 +1,23 @@
|
||||
package android.hardware.nfc@1.0;
|
||||
|
||||
enum nfc_event_t : uint32_t {
|
||||
HAL_NFC_OPEN_CPLT_EVT = 0,
|
||||
HAL_NFC_CLOSE_CPLT_EVT = 1,
|
||||
HAL_NFC_POST_INIT_CPLT_EVT = 2,
|
||||
HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3,
|
||||
HAL_NFC_REQUEST_CONTROL_EVT = 4,
|
||||
HAL_NFC_RELEASE_CONTROL_EVT = 5,
|
||||
HAL_NFC_ERROR_EVT = 6
|
||||
};
|
||||
|
||||
enum nfc_status_t : uint32_t {
|
||||
HAL_NFC_STATUS_OK = 0,
|
||||
HAL_NFC_STATUS_FAILED = 1,
|
||||
HAL_NFC_STATUS_ERR_TRANSPORT = 2,
|
||||
HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3,
|
||||
HAL_NFC_STATUS_REFUSED = 4
|
||||
};
|
||||
|
||||
struct nfc_data_t {
|
||||
vec<uint8_t> data;
|
||||
};
|
||||
Reference in New Issue
Block a user