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