PROTOCOLS
Device
Defined in fuchsia.hardware.nfc/nfc.fidl
Device protocol used to connect to an NFC device.
The data sent by clients to Write
and returned by Read
are NCI commands, responses and
and data messages. The detailed format is defined in NFC Controller Interface(NCI)
specification https://nfc-forum.org/our-work/specification-releases/.
The device is only capable of operating if there are pending Read calls with
available VMOs to receive data. Otherwise, data loss might occur.
CoreInitialize
Initialize or perform any required setup before reading/writing to the device.
The API should be called only once after connecting to the protocol. Calling it twice will return INVALID_STATE. Error means that the specific initialization wasn't carried out.
Request
<EMPTY>
Response
Name | Type |
---|---|
payload |
Device_CoreInitialize_Result
|
FactoryReset
Performs a factory reset, which will erase any user data and returns the device to default settings.
Error means that the factory reset failed.
Request
<EMPTY>
Response
Name | Type |
---|---|
payload |
Device_FactoryReset_Result
|
HciNetworkReset
Resets the session ids of all the Secure Elements in the HCI network.
Returns UNSPECIFIED
when the operation fails.
Request
<EMPTY>
Response
Name | Type |
---|---|
payload |
Device_HciNetworkReset_Result
|
Read
Reads NCI responses or data from device into vmo pointed by vmo_id
.
This call will not return until data is read into the vmo. Clients can have
multiple calls to Read
queued up to a maximum of MAX_NUMBER_OF_OUTSTANDING_READS
.
Returns the number of bytes read on success.
Returns:
TOO_MANY_OUTSTANDING_READS
when too many Read
calls are queued.
VMO_ALREADY_IN_USE
when the client queues more than 1 Read
on the same vmo_id.
Request
Name | Type |
---|---|
vmo_id |
VmoId
|
Response
Name | Type |
---|---|
payload |
Device_Read_Result
|
RegisterVmos
Registers multiple vmos nfc_vmos
each with a vmo_id
with an internal
vmo manager.
Success means the provided vmo list is registered successfully
and Read/Write can be performed.
Error means that no vmos were registered.
Returns:
VMO_NOT_FOUND
when the provided vmo is not valid or found.
VMO_ALREADY_EXISTS
when trying to register an already existing vmo.
INVALID_ARGS
if the input parameters are invalid.
Request
Name | Type |
---|---|
nfc_vmos |
vector<NfcVmoRequest>:32
|
Response
Name | Type |
---|---|
payload |
Device_RegisterVmos_Result
|
Reset
Performs a reset of the device.
CoreInitialize
should be called after a Reset
.
Error means that the HW was not reset properly, client should request
reset again.
Request
<EMPTY>
Response
Name | Type |
---|---|
payload |
Device_Reset_Result
|
SetMode
Sets Nfc device to mode
.
Error means that the device may not be in the intended mode
.
Request
Name | Type |
---|---|
mode |
NfcMode
|
Response
Name | Type |
---|---|
payload |
Device_SetMode_Result
|
UnregisterVmos
Unregisters multiple vmos nfc_vmos
each with a vmo_id
.
Any subsequent read/writes to the vmos will fail until RegisterVmos
is called
with that vmo_id
.
Error means that no vmos were unregistered, so client should try UnregisterVmos again.
Request
Name | Type |
---|---|
nfc_vmos |
vector<VmoId>:32
|
Response
Name | Type |
---|---|
payload |
Device_UnregisterVmos_Result
|
WatchEvents
WatchEvents
is a hanging get API which will return only if there is an event to
report.
The events will be delivered only if there is a hanging watcher. The client should attach the watcher again whenever the event is delivered, to continue getting events.
Request
<EMPTY>
Response
Name | Type |
---|---|
payload |
Device_WatchEvents_Result
|
Write
Writes length
bytes of NCI commands or data in the vmo pointed by vmo_id
to device.
Success means that the data was written to the HW device. If the payload
contains a command requiring a response, a subsequent response to Read will
contain the response. Multiple Write
calls can be queued up to a maximum of
MAX_NUMBER_OF_OUTSTANDING_WRITES, but each call should be on a different vmo_id
.
Writes are queued and executed in order.
On Error, the data provided was not written to the HW device.
Returns:
OUT_OF_RANGE
when the data provided was too large.
UNSPECIFIED
in specific cases.
IO_NOT_PRESENT
when device is unavailable.
REFUSED
for example, when performing a write to a read only vmo.
TOO_MANY_OUTSTANDING_WRITES
when too many Write
calls are queued.
Request
Name | Type |
---|---|
length |
uint64
|
vmo_id |
VmoId
|
Response
Name | Type |
---|---|
payload |
Device_Write_Result
|
STRUCTS
Device_CoreInitialize_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_FactoryReset_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_HciNetworkReset_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_Read_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
Field | Type | Description | Default |
---|---|---|---|
length |
uint64
|
No default |
Device_RegisterVmos_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_Reset_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_SetMode_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_UnregisterVmos_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
Device_Write_Response
Defined in fuchsia.hardware.nfc/nfc.fidl
<EMPTY>
NfcVmoRequest resource
Defined in fuchsia.hardware.nfc/nfc.fidl
Field | Type | Description | Default |
---|---|---|---|
vmo_id |
uint32
|
No default | |
vmo |
NfcVmo
|
No default |
ENUMS
Error flexible
Type: uint32
Defined in fuchsia.hardware.nfc/nfc.fidl
NFC specific error values
Name | Value | Description |
---|---|---|
INVALID_PARAMS |
1 |
Invalid parameters to fidl |
UNSPECIFIED |
2 |
Catch all error that is context specific. |
OUT_OF_RANGE |
3 |
Data transfer was too large to be handled by the transport. |
IO_NOT_PRESENT |
4 |
IO device not found. |
REFUSED |
5 |
Request was refused, because client is trying to perform an invalid/illegal operation. |
INVALID_STATE |
6 |
NFC is in not in the correct state. |
VMO_NOT_FOUND |
7 |
The VMO ID passed to Write()/UnregisterVmo() was not found. |
VMO_ALREADY_EXISTS |
8 |
The VMO ID passed to RegisterVmo() is already in use. |
TOO_MANY_OUTSTANDING_READS |
9 |
Too many outstanding |
VMO_ALREADY_IN_USE |
10 |
Vmo already in use by the driver. |
TOO_MANY_OUTSTANDING_WRITES |
11 |
Too many outstanding |
NfcMode flexible
Type: uint32
Defined in fuchsia.hardware.nfc/nfc.fidl
Name | Value | Description |
---|---|---|
ACTIVE |
1 |
Nfc device is in active mode. |
PASSIVE |
2 |
Nfc device is in passive mode. |
POWER_OFF |
3 |
Powers off the device. |
UNIONS
Device_CoreInitialize_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_CoreInitialize_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_FactoryReset_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_FactoryReset_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_HciNetworkReset_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_HciNetworkReset_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_Read_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_Read_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_RegisterVmos_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_RegisterVmos_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_Reset_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_Reset_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_SetMode_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_SetMode_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_UnregisterVmos_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_UnregisterVmos_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
Device_WatchEvents_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
NfcEvent
|
|
3 |
framework_err |
internal
|
Device_Write_Result strict
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
response |
Device_Write_Response
|
|
2 |
err |
Error
|
|
3 |
framework_err |
internal
|
NfcEvent flexible
Defined in fuchsia.hardware.nfc/nfc.fidl
Asynchronous events sent by the driver when something goes wrong in the HW or state machine.
error
is signalled when an internal error like a HW error occurs
which could be used by client to reset the HW and get it back into a good state.
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
error |
Error
|
NfcVmo flexible resource
Defined in fuchsia.hardware.nfc/nfc.fidl
Ordinal | Variant | Type | Description |
---|---|---|---|
1 |
write_vmo |
handle<vmo>
|
|
2 |
read_vmo |
handle<vmo>
|
CONSTANTS
Name | Value | Type | Description |
---|---|---|---|
MAX_NUMBER_OF_OUTSTANDING_READS |
10
|
uint32 |
The maximum number of outstanding reads allowed. |
MAX_NUMBER_OF_OUTSTANDING_WRITES |
10
|
uint32 |
The maximum number of outstanding writes allowed. |
MAX_VMOS |
32
|
uint32 |
The maximum number of vmos that is registered with the driver for read/write. |
ALIASES
Name | Value | Description |
---|---|---|
VmoId |
uint32 |
SERVICES
Service
Defined in fuchsia.hardware.nfc/nfc.fidl
Name | Type | Transport |
---|---|---|
device |
fuchsia.hardware.nfc/Device
|
Channel |