18#include <zephyr/kernel.h>
21#define NFC_TNEP_EVENTS_NUMBER 2
24#define NFC_TNEP_TAG_MAX_WAIT_TIME 63
27#define NFC_TNEP_TAG_MAX_N_WAIT_TIME 15
39#define NFC_TNEP_TAG_APP_MSG_DEF(_name, _max_record_cnt) \
40 NFC_NDEF_MSG_DEF(_name, (_max_record_cnt + 1))
119#define NFC_TNEP_TAG_SERVICE_DEF(_name, _uri, _uri_length, \
120 _mode, _t_wait, _n_wait, \
127 BUILD_ASSERT(_t_wait <= NFC_TNEP_TAG_MAX_WAIT_TIME, \
128 "The Waiting time has to be equal or smaller than 63"); \
129 BUILD_ASSERT(_n_wait <= NFC_TNEP_TAG_MAX_N_WAIT_TIME, \
130 "The Waiting time extension count has to be equal or smaller than 15"); \
132 NFC_TNEP_SERVICE_PARAM_RECORD_DESC_DEF(_name, NFC_TNEP_VERSION, \
134 _mode, _t_wait, _n_wait, \
136 static const struct nfc_tnep_tag_service_cb _name##_cb = { \
137 .selected = _select_cb, \
138 .deselected = _deselect_cb, \
139 .message_received = _message_cb, \
140 .error_detected = _error_cb, \
143 const STRUCT_SECTION_ITERABLE(nfc_tnep_tag_service, _name##_svc) = \
144 NFC_TNEP_TAG_SERVICE(_name)
149#define NFC_TNEP_TAG_SERVICE(_name) \
152 &NFC_NDEF_TNEP_RECORD_DESC(_name), \
186 uint8_t *tx_swap_buff,
nfc_tnep_status_value
Service status - payload in TNEP Status Record.
Definition base.h:36
void nfc_tnep_tag_on_selected(void)
Handle NFC Tag selected event.
void nfc_tnep_tag_rx_msg_indicate(const uint8_t *rx_buffer, size_t len)
Indicate about new TNEP message available in buffer.
int nfc_tnep_initial_msg_encode(struct nfc_ndef_msg_desc *msg, const struct nfc_ndef_record_desc *records, size_t records_cnt)
Encode the Initial NDEF message.
int nfc_tnep_tag_init(struct k_poll_event *events, uint8_t event_cnt, nfc_payload_set_t payload_set)
Start communication using TNEP.
int nfc_tnep_tag_tx_msg_buffer_register(uint8_t *tx_buff, uint8_t *tx_swap_buff, size_t len)
Register TNEP message buffer.
int(* initial_msg_encode_t)(struct nfc_ndef_msg_desc *msg)
Callback type for encoding the Initial TNEP NDEF message.
Definition tag.h:170
int(* nfc_payload_set_t)(uint8_t *, size_t)
Definition tag.h:157
void nfc_tnep_tag_process(void)
Waiting for a signal to execute protocol logic.
int nfc_tnep_tag_tx_msg_app_data(struct nfc_ndef_msg_desc *msg, enum nfc_tnep_status_value status)
Add application data record to next message.
int nfc_tnep_tag_tx_msg_no_app_data(void)
Respond with no more application data.
size_t nfc_tnep_tag_svc_count_get(void)
Get the NFC Tag TNEP service count.
int nfc_tnep_tag_initial_msg_create(size_t max_record_cnt, initial_msg_encode_t msg_encode_cb)
Create the Initial TNEP NDEF message.
NDEF message descriptor.
Definition msg.h:29
NDEF record descriptor.
Definition record.h:89
Service Parameters in the TNEP's Initial NDEF message.
Definition tnep_rec.h:51
void(* selected)(void)
Function called when service was selected.
Definition tag.h:44
void(* message_received)(const uint8_t *data, size_t len)
Function called when new message was received.
Definition tag.h:55
void(* deselected)(void)
Function called when service deselected.
Definition tag.h:47
void(* error_detected)(int err)
Function called when an internal error in TNEP detected.
Definition tag.h:62
const struct nfc_tnep_tag_service_cb * callbacks
Definition tag.h:80
struct nfc_ndef_record_desc * ndef_record
Definition tag.h:77
struct nfc_ndef_tnep_rec_svc_param * parameters
Definition tag.h:74
Service structure.
Definition tag.h:72