Revert "Revert "Revert "nfc: reflect style guide."""
This reverts commit 106bc9d27a271b316ce3b4237d59a908c23a4ec0.
Change-Id: Ie2e0ad4aeaa58c45bab05234615bd7fa02b84c1a
diff --git a/nfc/1.0/Android.mk b/nfc/1.0/Android.mk
index 07775e9..b6840bc 100644
--- a/nfc/1.0/Android.mk
+++ b/nfc/1.0/Android.mk
@@ -13,9 +13,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
-# Build types.hal (NfcEvent)
+# Build types.hal (nfc_data_t)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/NfcEvent.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_data_t.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -23,16 +23,16 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.NfcEvent
+ android.hardware.nfc@1.0::types.nfc_data_t
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (NfcStatus)
+# Build types.hal (nfc_event_t)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/NfcStatus.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_event_t.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -40,7 +40,24 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.NfcStatus
+ android.hardware.nfc@1.0::types.nfc_event_t
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (nfc_status_t)
+#
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_status_t.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.nfc@1.0::types.nfc_status_t
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
@@ -99,9 +116,9 @@
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
#
-# Build types.hal (NfcEvent)
+# Build types.hal (nfc_data_t)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/NfcEvent.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_data_t.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -109,16 +126,16 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.NfcEvent
+ android.hardware.nfc@1.0::types.nfc_data_t
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
#
-# Build types.hal (NfcStatus)
+# Build types.hal (nfc_event_t)
#
-GEN := $(intermediates)/android/hardware/nfc/1.0/NfcStatus.java
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_event_t.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
@@ -126,7 +143,24 @@
$(GEN): PRIVATE_CUSTOM_TOOL = \
$(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
-Ljava -randroid.hardware:hardware/interfaces \
- android.hardware.nfc@1.0::types.NfcStatus
+ android.hardware.nfc@1.0::types.nfc_event_t
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (nfc_status_t)
+#
+GEN := $(intermediates)/android/hardware/nfc/1.0/nfc_status_t.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava -randroid.hardware:hardware/interfaces \
+ android.hardware.nfc@1.0::types.nfc_status_t
$(GEN): $(LOCAL_PATH)/types.hal
$(transform-generated-source)
diff --git a/nfc/1.0/INfc.hal b/nfc/1.0/INfc.hal
index f003b2c..88fd39a 100644
--- a/nfc/1.0/INfc.hal
+++ b/nfc/1.0/INfc.hal
@@ -27,7 +27,7 @@
* NCI initialization - ie accept CORE_RESET and subsequent commands through
* the write() call.
*
- * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT
+ * 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.
@@ -41,32 +41,32 @@
* This method may queue writes and return immediately. The only
* requirement is that the writes are executed in order.
*/
- write(NfcData data) generates (int32_t retval);
+ write(nfc_data_t data) generates (int32_t retval);
/*
- * coreInitialized() is called after the CORE_INIT_RSP is received from the NFCC.
+ * 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 coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT
+ * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
* before continuing.
*
- * If coreInitialized() returns any other value, the NCI stack will continue
+ * If core_initialized() returns any other value, the NCI stack will continue
* immediately.
*/
- coreInitialized(NfcData data) generates (int32_t retval);
+ core_initialized(vec<uint8_t> data) generates (int32_t retval);
/*
- * prediscover is called every time before starting RF discovery.
+ * 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 prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT
+ * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
* before continuing.
*
- * If prediscover() returns any other value, the NCI stack will start
+ * If pre_discover() returns any other value, the NCI stack will start
* RF discovery immediately.
*/
- prediscover() generates (int32_t retval);
+ pre_discover() generates (int32_t retval);
/*
* Close the NFC controller. Should free all resources.
@@ -75,15 +75,15 @@
/*
* Grant HAL the exclusive control to send NCI commands.
- * Called in response to NfcEvent.REQUEST_CONTROL.
+ * Called in response to HAL_REQUEST_CONTROL_EVT.
* Must only be called when there are no NCI commands pending.
- * NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
+ * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
*/
- controlGranted() generates (int32_t retval);
+ control_granted() generates (int32_t retval);
/*
* Restart controller by power cyle;
- * NfcEvent.OPEN_CPLT will notify when operation is complete.
+ * HAL_OPEN_CPLT_EVT will notify when operation is complete.
*/
- powerCycle() generates (int32_t retval);
+ power_cycle() generates (int32_t retval);
};
diff --git a/nfc/1.0/INfcClientCallback.hal b/nfc/1.0/INfcClientCallback.hal
index a56cc09..f10062e 100644
--- a/nfc/1.0/INfcClientCallback.hal
+++ b/nfc/1.0/INfcClientCallback.hal
@@ -21,11 +21,11 @@
* The callback passed in from the NFC stack that the HAL
* can use to pass events back to the stack.
*/
- sendEvent(NfcEvent event, NfcStatus status);
+ 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(NfcData data);
+ sendData(nfc_data_t data);
};
diff --git a/nfc/1.0/types.hal b/nfc/1.0/types.hal
index a266178..738dfd9 100644
--- a/nfc/1.0/types.hal
+++ b/nfc/1.0/types.hal
@@ -16,22 +16,24 @@
package android.hardware.nfc@1.0;
-enum NfcEvent : uint32_t {
- OPEN_CPLT = 0,
- CLOSE_CPLT = 1,
- POST_INIT_CPLT = 2,
- PRE_DISCOVER_CPLT = 3,
- REQUEST_CONTROL = 4,
- RELEASE_CONTROL = 5,
- ERROR = 6
+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 NfcStatus : uint32_t {
- OK = 0,
- FAILED = 1,
- ERR_TRANSPORT = 2,
- ERR_CMD_TIMEOUT = 3,
- REFUSED = 4
+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
};
-typedef vec<uint8_t> NfcData;
+struct nfc_data_t {
+ vec<uint8_t> data;
+};