1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.nfc@1.0;
import INfcClientCallback;
interface INfc {
/*
* Opens the NFC controller device and performs initialization.
* This may include patch download and other vendor-specific initialization.
*
* If open completes successfully, the controller should be ready to perform
* NCI initialization - ie accept CORE_RESET and subsequent commands through
* the write() call.
*
* If open() returns NfcStatus::OK, the NCI stack will wait for a
* NfcEvent.OPEN_CPLT before continuing.
*
* If open() returns NfcStatus::FAILED, the NCI stack will stop.
*
*/
@entry
@callflow(next={"write", "coreInitialized", "prediscover", "powerCycle", "controlGranted"})
open(INfcClientCallback clientCallback) generates (NfcStatus status);
/*
* Performs an NCI write.
*
* This method may queue writes and return immediately. The only
* requirement is that the writes are executed in order.
*
* @return number of bytes written to the NFCC
*/
@callflow(next={"write", "prediscover", "coreInitialized", "close", "powerCycle",
"controlGranted"})
write(NfcData data) generates (uint32_t retval);
/*
* coreInitialized() 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 NfcStatus::OK, the NCI stack will wait for a
* NfcEvent.POST_INIT_CPLT before continuing.
*
* If coreInitialized() returns NfcStatus::FAILED, the NCI stack will
* continue immediately.
*/
@callflow(next={"write", "prediscover", "close"})
coreInitialized(NfcData data) generates (NfcStatus status);
/*
* prediscover 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 NfcStatus::OK, the NCI stack will wait for a
* NfcEvent.PREDISCOVER_CPLT before continuing.
*
* If prediscover() returns NfcStatus::FAILED, the NCI stack will start
* RF discovery immediately.
*/
@callflow(next={"write", "close", "coreInitialized", "powerCycle", "controlGranted"})
prediscover() generates (NfcStatus status);
/*
* Close the NFC controller. Should free all resources.
*
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@exit
close() generates (NfcStatus status);
/*
* Grant HAL the exclusive control to send NCI commands.
* Called in response to NfcEvent.REQUEST_CONTROL.
* Must only be called when there are no NCI commands pending.
* NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
*
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@callflow(next={"write", "close", "prediscover", "coreInitialized", "powerCycle"})
controlGranted() generates (NfcStatus status);
/*
* Restart controller by power cyle;
* NfcEvent.OPEN_CPLT will notify when operation is complete.
*
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
*/
@callflow(next={"write", "coreInitialized", "prediscover", "controlGranted", "close"})
powerCycle() generates (NfcStatus status);
};
|