blob: f003b2caf5921782c3c1a1231eb388ed40a353fe [file] [log] [blame]
Martijn Coenencbe590c2016-08-30 11:27:56 -07001/*
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 Hubera4831392016-07-29 15:05:03 -070017package android.hardware.nfc@1.0;
18
19import INfcClientCallback;
20
Andreas Hubera4831392016-07-29 15:05:03 -070021interface 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 Morelandcffe8d52016-09-26 12:40:29 -070030 * If open() returns 0, the NCI stack will wait for a NfcEvent.OPEN_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070031 * 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 Morelandcffe8d52016-09-26 12:40:29 -070044 write(NfcData data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070045
46 /*
Steven Morelandcffe8d52016-09-26 12:40:29 -070047 * coreInitialized() is called after the CORE_INIT_RSP is received from the NFCC.
Andreas Hubera4831392016-07-29 15:05:03 -070048 * At this time, the HAL can do any chip-specific configuration.
49 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070050 * If coreInitialized() returns 0, the NCI stack will wait for a NfcEvent.POST_INIT_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070051 * before continuing.
52 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070053 * If coreInitialized() returns any other value, the NCI stack will continue
Andreas Hubera4831392016-07-29 15:05:03 -070054 * immediately.
55 */
Steven Morelandcffe8d52016-09-26 12:40:29 -070056 coreInitialized(NfcData data) generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070057
58 /*
Steven Morelandcffe8d52016-09-26 12:40:29 -070059 * prediscover is called every time before starting RF discovery.
Andreas Hubera4831392016-07-29 15:05:03 -070060 * 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 Morelandcffe8d52016-09-26 12:40:29 -070063 * If prediscover() returns 0, the NCI stack will wait for a NfcEvent.PREDISCOVER_CPLT
Andreas Hubera4831392016-07-29 15:05:03 -070064 * before continuing.
65 *
Steven Morelandcffe8d52016-09-26 12:40:29 -070066 * If prediscover() returns any other value, the NCI stack will start
Andreas Hubera4831392016-07-29 15:05:03 -070067 * RF discovery immediately.
68 */
Steven Morelandcffe8d52016-09-26 12:40:29 -070069 prediscover() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070070
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 Morelandcffe8d52016-09-26 12:40:29 -070078 * Called in response to NfcEvent.REQUEST_CONTROL.
Andreas Hubera4831392016-07-29 15:05:03 -070079 * Must only be called when there are no NCI commands pending.
Steven Morelandcffe8d52016-09-26 12:40:29 -070080 * NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
Andreas Hubera4831392016-07-29 15:05:03 -070081 */
Steven Morelandcffe8d52016-09-26 12:40:29 -070082 controlGranted() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070083
84 /*
85 * Restart controller by power cyle;
Steven Morelandcffe8d52016-09-26 12:40:29 -070086 * NfcEvent.OPEN_CPLT will notify when operation is complete.
Andreas Hubera4831392016-07-29 15:05:03 -070087 */
Steven Morelandcffe8d52016-09-26 12:40:29 -070088 powerCycle() generates (int32_t retval);
Andreas Hubera4831392016-07-29 15:05:03 -070089};