blob: f5451dc7d84e73734456666e35214e0ab3e9c159 [file] [log] [blame]
Chris Phoenixdadccd32016-07-07 14:49:20 -07001version 1.0;
2package android.hardware.nfc;
3
4
5import android.hardware.nfc.INfcClientCallback;
6
7interface INfc {
8 enum nfc_event_t : uint32_t {
9 HAL_NFC_OPEN_CPLT_EVT = 0,
10 HAL_NFC_CLOSE_CPLT_EVT = 1,
11 HAL_NFC_POST_INIT_CPLT_EVT = 2,
12 HAL_NFC_PRE_DISCOVER_CPLT_EVT = 3,
13 HAL_NFC_REQUEST_CONTROL_EVT = 4,
14 HAL_NFC_RELEASE_CONTROL_EVT = 5,
15 HAL_NFC_ERROR_EVT = 6
16 };
17
18 enum nfc_status_t : uint32_t {
19 HAL_NFC_STATUS_OK = 0,
20 HAL_NFC_STATUS_FAILED = 1,
21 HAL_NFC_STATUS_ERR_TRANSPORT = 2,
22 HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 3,
23 HAL_NFC_STATUS_REFUSED = 4
24 };
25
26 struct nfc_data_t {
27 vec<uint8_t> data;
28 };
29
30 /*
31 * Opens the NFC controller device and performs initialization.
32 * This may include patch download and other vendor-specific initialization.
33 *
34 * If open completes successfully, the controller should be ready to perform
35 * NCI initialization - ie accept CORE_RESET and subsequent commands through
36 * the write() call.
37 *
38 * If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT
39 * before continuing.
40 *
41 * If open() returns any other value, the NCI stack will stop.
42 *
43 */
44 open(INfcClientCallback clientCallback) generates (int32_t retval);
45
46 /*
47 * Performs an NCI write.
48 *
49 * This method may queue writes and return immediately. The only
50 * requirement is that the writes are executed in order.
51 */
52 write(nfc_data_t data) generates (int32_t retval);
53
54 /*
55 * core_initialized() is called after the CORE_INIT_RSP is received from the NFCC.
56 * At this time, the HAL can do any chip-specific configuration.
57 *
58 * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT
59 * before continuing.
60 *
61 * If core_initialized() returns any other value, the NCI stack will continue
62 * immediately.
63 */
64 core_initialized(vec<uint8_t> data) generates (int32_t retval);
65
66 /*
67 * pre_discover is called every time before starting RF discovery.
68 * It is a good place to do vendor-specific configuration that must be
69 * performed every time RF discovery is about to be started.
70 *
71 * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT
72 * before continuing.
73 *
74 * If pre_discover() returns any other value, the NCI stack will start
75 * RF discovery immediately.
76 */
77 pre_discover() generates (int32_t retval);
78
79 /*
80 * Close the NFC controller. Should free all resources.
81 */
82 close() generates (int32_t retval);
83
84 /*
85 * Grant HAL the exclusive control to send NCI commands.
86 * Called in response to HAL_REQUEST_CONTROL_EVT.
87 * Must only be called when there are no NCI commands pending.
88 * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control.
89 */
90 control_granted() generates (int32_t retval);
91
92 /*
93 * Restart controller by power cyle;
94 * HAL_OPEN_CPLT_EVT will notify when operation is complete.
95 */
96 power_cycle() generates (int32_t retval);
97};