Type 4 Tag procedures¶
This module provides functions to perform the NDEF detection procedure, which is used to retrieve the NDEF message from the data of a tag.
The full NDEF detection procedure consists of the following procedures:
NDEF tag application select.
Capability container (CC) select.
Capability container read.
NDEF select.
NDEF read or NDEF update.
After a successful NDEF detection procedure, you can also write data to the NDEF file. To do this, you must perform an NDEF update procedure.
This module uses three other modules:
APDU reader and writer for generating APDU commands
Parser for CC files for analyzing APDU responses payload and storing it within the structure that represents the Type 4 Tag content
ISO-DEP protocol for transferring data over ISO-DEP protocols
API documentation¶
include/nfc/t4t/hl_procedure.h
subsys/nfc/t4t/hl_procedure.c
-
group
nfc_t4t_hl_procedure
NFC T4T High Level Procedure API.
Enums
Functions
-
int
nfc_t4t_hl_procedure_on_data_received
(const uint8_t *data, size_t len)¶ Handle High Level Procedure received data.
Function for handling the received data. It should be called immediately upon receiving the ISO-DEP data.
- Parameters
[in] data
: Pointer to received data.[in] len
: Received data length.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_cb_register
(const struct nfc_t4t_hl_procedure_cb *cb)¶ Register High Level Procedure callback.
Function for register callback. It should be used to provides synchronization between NFC T4T operation.
- Parameters
[in] cb
: Pointer to callback structure.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_ndef_tag_app_select
(void)¶ Perform NDEF Tag Application Select Procedure.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_cc_select
(void)¶ Perform NDEF Tag Capability Container Select Procedure.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_cc_read
(struct nfc_t4t_cc_file *cc)¶ Perform Capability Container Read Procedure.
- Parameters
[out] cc
: Pointer to the Capability Cointainer descriptor.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_ndef_file_select
(uint16_t id)¶ Perform NDEF file Select Procedure.
- Parameters
[in] id
: File Identifier
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_ndef_read
(struct nfc_t4t_cc_file *cc, uint8_t *ndef_buff, uint16_t ndef_len)¶ Perform NDEF Read Procedure.
- Parameters
[inout] cc
: Pointer to Capability Containers descriptor.[out] ndef_buff
: Pointer to buffer where the NDEF file will be stored. The NDEF Read procedure is an asynchronous operation, the data buffer have to be keep until this procedure will be finished.[in] ndef_len
: Length of NDEF file buffer.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
int
nfc_t4t_hl_procedure_ndef_update
(struct nfc_t4t_cc_file *cc, uint8_t *ndef_data, uint16_t ndef_len)¶ Perform NDEF Update Procedure.
- Parameters
[in] cc
: Pointer to Capability Containers descriptor.[in] ndef_data
: Pointer to the NDEF file data. The NDEF Read procedure is an asynchronous operation, the data buffer have to be keep until this procedure will be finished.[in] ndef_len
: Length of NDEF file.
- Return Value
0
: If the operation was successful. Otherwise, a (negative) error code is returned.
-
struct
nfc_t4t_hl_procedure_cb
¶ - #include <hl_procedure.h>
NFC T4T High Level Procedure callback structure.
This structure is used to control command exchenge with NFC Type 4 Tag.
Public Members
-
void (*
selected
)(enum nfc_t4t_hl_procedure_select type)¶ HL Procedure selected callback.
The selection of applications or files is completed.
- Parameters
[in] type
: Type of selection command.
-
void (*
cc_read
)(struct nfc_t4t_cc_file *cc)¶ HL Procedure CC file read callback.
The CC file of Type 4 Tag read operation is completed successfully.
- Parameters
[in] cc
: Pointer to CC file data.
-
void (*
ndef_read
)(uint16_t file_id, const uint8_t *data, size_t len)¶ HL Procedure NDEF file read callback.
The NDEF file of Type 4 Tag read operation is completed successfully.
- Parameters
[in] file_id
: File Identifier[in] data
: Pointer to received NDEF file data. The data buffer is assigned by nfc_t4t_hl_procedure_ndef_read function.[in] len
: Received data length.
-
void (*
ndef_updated
)(uint16_t file_id)¶ HL Procedure NDEF file updated callback.
The NDEF file of Typ 4 Tag update operation is completed successfully.
- Parameters
[in] file
: id File Identifier.
-
void (*
-
int