fuchsia.hardware.nfc

Added: HEAD

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

NameType
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

NameType
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

NameType
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

NameType
vmo_id VmoId

Response

NameType
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

NameType
nfc_vmos vector<NfcVmoRequest>:32

Response

NameType
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

NameType
payload Device_Reset_Result

SetMode

Sets Nfc device to mode.

Error means that the device may not be in the intended mode.

Request

NameType
mode NfcMode

Response

NameType
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

NameType
nfc_vmos vector<VmoId>:32

Response

NameType
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

NameType
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

NameType
length uint64
vmo_id VmoId

Response

NameType
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

FieldTypeDescriptionDefault
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

FieldTypeDescriptionDefault
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

NameValueDescription
1

Invalid parameters to fidl

2

Catch all error that is context specific.

3

Data transfer was too large to be handled by the transport.

4

IO device not found.

5

Request was refused, because client is trying to perform an invalid/illegal operation.

6

NFC is in not in the correct state.

7

The VMO ID passed to Write()/UnregisterVmo() was not found.

8

The VMO ID passed to RegisterVmo() is already in use.

9

Too many outstanding Read calls.

10

Vmo already in use by the driver.

11

Too many outstanding Write calls.

NfcMode flexible

Type: uint32

Defined in fuchsia.hardware.nfc/nfc.fidl

NameValueDescription
1

Nfc device is in active mode.

2

Nfc device is in passive mode.

3

Powers off the device.

UNIONS

Device_CoreInitialize_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_CoreInitialize_Response
err Error
framework_err internal

Device_FactoryReset_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_FactoryReset_Response
err Error
framework_err internal

Device_HciNetworkReset_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_HciNetworkReset_Response
err Error
framework_err internal

Device_Read_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_Read_Response
err Error
framework_err internal

Device_RegisterVmos_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_RegisterVmos_Response
err Error
framework_err internal

Device_Reset_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_Reset_Response
err Error
framework_err internal

Device_SetMode_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_SetMode_Response
err Error
framework_err internal

Device_UnregisterVmos_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_UnregisterVmos_Response
err Error
framework_err internal

Device_WatchEvents_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response NfcEvent
framework_err internal

Device_Write_Result strict

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
response Device_Write_Response
err Error
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.

OrdinalVariantTypeDescription
error Error

NfcVmo flexible resource

Defined in fuchsia.hardware.nfc/nfc.fidl

OrdinalVariantTypeDescription
write_vmo handle<vmo>
read_vmo handle<vmo>

CONSTANTS

NameValueTypeDescription
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

NameValueDescription
VmoId uint32

SERVICES

Service

Defined in fuchsia.hardware.nfc/nfc.fidl

NameTypeTransport
device fuchsia.hardware.nfc/Device Channel