2016-08-30 20:27:56 +02:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2016-07-30 00:05:03 +02:00
|
|
|
package android.hardware.nfc@1.0;
|
|
|
|
|
|
|
|
import INfcClientCallback;
|
|
|
|
|
|
|
|
interface INfc {
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-07-30 00:05:03 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If open() returns NfcStatus::OK, the NCI stack will wait for a
|
|
|
|
* NfcEvent.OPEN_CPLT before continuing.
|
2016-07-30 00:05:03 +02:00
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If open() returns NfcStatus::FAILED, the NCI stack will stop.
|
2016-07-30 00:05:03 +02:00
|
|
|
*
|
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@entry
|
|
|
|
@callflow(next={"write", "coreInitialized", "prediscover", "powerCycle", "controlGranted"})
|
2016-11-18 23:11:33 +01:00
|
|
|
open(INfcClientCallback clientCallback) generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-07-30 00:05:03 +02:00
|
|
|
* Performs an NCI write.
|
|
|
|
*
|
|
|
|
* This method may queue writes and return immediately. The only
|
|
|
|
* requirement is that the writes are executed in order.
|
2016-11-18 23:11:33 +01:00
|
|
|
*
|
|
|
|
* @return number of bytes written to the NFCC
|
2016-07-30 00:05:03 +02:00
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@callflow(next={"write", "prediscover", "coreInitialized", "close", "powerCycle",
|
|
|
|
"controlGranted"})
|
2016-11-18 23:11:33 +01:00
|
|
|
write(NfcData data) generates (uint32_t retval);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-11-18 23:11:33 +01:00
|
|
|
* coreInitialized() is called after the CORE_INIT_RSP is received from the
|
|
|
|
* NFCC. At this time, the HAL can do any chip-specific configuration.
|
2016-07-30 00:05:03 +02:00
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If coreInitialized() returns NfcStatus::OK, the NCI stack will wait for a
|
|
|
|
* NfcEvent.POST_INIT_CPLT before continuing.
|
2016-07-30 00:05:03 +02:00
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If coreInitialized() returns NfcStatus::FAILED, the NCI stack will
|
|
|
|
* continue immediately.
|
2016-07-30 00:05:03 +02:00
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@callflow(next={"write", "prediscover", "close"})
|
2016-11-18 23:11:33 +01:00
|
|
|
coreInitialized(NfcData data) generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-09-26 21:40:29 +02:00
|
|
|
* prediscover is called every time before starting RF discovery.
|
2016-07-30 00:05:03 +02:00
|
|
|
* It is a good place to do vendor-specific configuration that must be
|
|
|
|
* performed every time RF discovery is about to be started.
|
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If prediscover() returns NfcStatus::OK, the NCI stack will wait for a
|
|
|
|
* NfcEvent.PREDISCOVER_CPLT before continuing.
|
2016-07-30 00:05:03 +02:00
|
|
|
*
|
2016-11-18 23:11:33 +01:00
|
|
|
* If prediscover() returns NfcStatus::FAILED, the NCI stack will start
|
2016-07-30 00:05:03 +02:00
|
|
|
* RF discovery immediately.
|
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@callflow(next={"write", "close", "coreInitialized", "powerCycle", "controlGranted"})
|
2016-11-18 23:11:33 +01:00
|
|
|
prediscover() generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-07-30 00:05:03 +02:00
|
|
|
* Close the NFC controller. Should free all resources.
|
2016-11-18 23:11:33 +01:00
|
|
|
*
|
|
|
|
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
|
2016-07-30 00:05:03 +02:00
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@exit
|
2016-11-18 23:11:33 +01:00
|
|
|
close() generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-07-30 00:05:03 +02:00
|
|
|
* Grant HAL the exclusive control to send NCI commands.
|
2016-09-26 21:40:29 +02:00
|
|
|
* Called in response to NfcEvent.REQUEST_CONTROL.
|
2016-07-30 00:05:03 +02:00
|
|
|
* Must only be called when there are no NCI commands pending.
|
2016-09-26 21:40:29 +02:00
|
|
|
* NfcEvent.RELEASE_CONTROL will notify when HAL no longer needs exclusive control.
|
2016-11-18 23:11:33 +01:00
|
|
|
*
|
|
|
|
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
|
2016-07-30 00:05:03 +02:00
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@callflow(next={"write", "close", "prediscover", "coreInitialized", "powerCycle"})
|
2016-11-18 23:11:33 +01:00
|
|
|
controlGranted() generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
|
2017-03-28 23:40:58 +02:00
|
|
|
/**
|
2016-07-30 00:05:03 +02:00
|
|
|
* Restart controller by power cyle;
|
2016-09-26 21:40:29 +02:00
|
|
|
* NfcEvent.OPEN_CPLT will notify when operation is complete.
|
2016-11-18 23:11:33 +01:00
|
|
|
*
|
|
|
|
* @return NfcStatus::OK on success and NfcStatus::FAILED on error.
|
2016-07-30 00:05:03 +02:00
|
|
|
*/
|
2016-11-01 00:11:13 +01:00
|
|
|
@callflow(next={"write", "coreInitialized", "prediscover", "controlGranted", "close"})
|
2016-11-18 23:11:33 +01:00
|
|
|
powerCycle() generates (NfcStatus status);
|
2016-07-30 00:05:03 +02:00
|
|
|
};
|