Package: android.hardware.nfc@1.0

INfc

interface INfc

Methods

open

open (INfcClientCallback clientCallback)
generates (NfcStatus status)

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.

Details
Parameters
clientCallback
Generates
status
Annotations
entry
callflow
next= { "write" , "coreInitialized" , "prediscover" , "powerCycle" , "controlGranted" }

write

write (NfcData data)
generates (uint32_t retval)

Performs an NCI write.

This method may queue writes and return immediately.The only requirement is that the writes are executed in order.

Details
Parameters
data
Generates
retval
number of bytes written to the NFCC
Annotations
callflow
next= { "write" , "prediscover" , "coreInitialized" , "close" , "powerCycle" , "controlGranted" }

coreInitialized

coreInitialized (NfcData data)
generates (NfcStatus status)

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.

Details
Parameters
data
Generates
status
Annotations
callflow
next= { "write" , "prediscover" , "close" }

prediscover

prediscover ()
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.

Details
Generates
status
Annotations
callflow
next= { "write" , "close" , "coreInitialized" , "powerCycle" , "controlGranted" }

close

close ()
generates (NfcStatus status)

Close the NFC controller.Should free all resources.

Details
Generates
status
NfcStatus::OK on success and NfcStatus::FAILED on error.
Annotations
exit

controlGranted

controlGranted ()
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.

Details
Generates
status
NfcStatus::OK on success and NfcStatus::FAILED on error.
Annotations
callflow
next= { "write" , "close" , "prediscover" , "coreInitialized" , "powerCycle" }

powerCycle

powerCycle ()
generates (NfcStatus status)

Restart controller by power cyle;NfcEvent.OPEN_CPLT will notify when operation is complete.

Details
Generates
status
NfcStatus::OK on success and NfcStatus::FAILED on error.
Annotations
callflow
next= { "write" , "coreInitialized" , "prediscover" , "controlGranted" , "close" }