Martijn Coenen | cbe590c | 2016-08-30 11:27:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 17 | package android.hardware.nfc@1.0; |
| 18 | |
| 19 | import INfcClientCallback; |
| 20 | |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 21 | interface INfc { |
| 22 | /* |
| 23 | * Opens the NFC controller device and performs initialization. |
| 24 | * This may include patch download and other vendor-specific initialization. |
| 25 | * |
| 26 | * If open completes successfully, the controller should be ready to perform |
| 27 | * NCI initialization - ie accept CORE_RESET and subsequent commands through |
| 28 | * the write() call. |
| 29 | * |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 30 | * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 31 | * before continuing. |
| 32 | * |
| 33 | * If open() returns any other value, the NCI stack will stop. |
| 34 | * |
| 35 | */ |
| 36 | open(INfcClientCallback clientCallback) generates (int32_t retval); |
| 37 | |
| 38 | /* |
| 39 | * Performs an NCI write. |
| 40 | * |
| 41 | * This method may queue writes and return immediately. The only |
| 42 | * requirement is that the writes are executed in order. |
| 43 | */ |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 44 | write(NfcData data) generates (int32_t retval); |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 45 | |
| 46 | /* |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 47 | * coreInitialized() is called after the CORE_INIT_RSP is received from the NFCC. |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 48 | * At this time, the HAL can do any chip-specific configuration. |
| 49 | * |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 50 | * If coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 51 | * before continuing. |
| 52 | * |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 53 | * If coreInitialized() returns any other value, the NCI stack will continue |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 54 | * immediately. |
| 55 | */ |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 56 | coreInitialized(NfcData data) generates (int32_t retval); |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 57 | |
| 58 | /* |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 59 | * prediscover is called every time before starting RF discovery. |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 60 | * It is a good place to do vendor-specific configuration that must be |
| 61 | * performed every time RF discovery is about to be started. |
| 62 | * |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 63 | * If prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 64 | * before continuing. |
| 65 | * |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 66 | * If prediscover() returns any other value, the NCI stack will start |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 67 | * RF discovery immediately. |
| 68 | */ |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 69 | prediscover() generates (int32_t retval); |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 70 | |
| 71 | /* |
| 72 | * Close the NFC controller. Should free all resources. |
| 73 | */ |
| 74 | close() generates (int32_t retval); |
| 75 | |
| 76 | /* |
| 77 | * Grant HAL the exclusive control to send NCI commands. |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 78 | * Called in response to NfcEvent.REQUEST_CONTROL. |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 79 | * Must only be called when there are no NCI commands pending. |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 80 | * NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control. |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 81 | */ |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 82 | controlGranted() generates (int32_t retval); |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 83 | |
| 84 | /* |
| 85 | * Restart controller by power cyle; |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 86 | * NfcEvent.OPEN_CPLT will notify when operation is complete. |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 87 | */ |
Steven Moreland | cffe8d5 | 2016-09-26 12:40:29 -0700 | [diff] [blame^] | 88 | powerCycle() generates (int32_t retval); |
Andreas Huber | a483139 | 2016-07-29 15:05:03 -0700 | [diff] [blame] | 89 | }; |