nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
poller.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NFC_TNEP_POLLER_
8#define NFC_TNEP_POLLER_
9
17#ifdef _cplusplus
18extern "C" {
19#endif
20
21#include <nfc/ndef/msg.h>
22#include <nfc/ndef/tnep_rec.h>
23#include <nfc/tnep/base.h>
24
29
32
35};
36
46
50 const struct nfc_ndef_msg_desc *msg;
51};
52
74 int (*ndef_read)(uint8_t *ndef_buf, uint16_t ndef_len);
75
88 int (*ndef_update)(const uint8_t *ndef_buf, uint16_t ndef_len);
89};
90
105 void (*svc_selected)(const struct nfc_ndef_tnep_rec_svc_param *param,
106 const struct nfc_tnep_poller_msg *msg,
107 bool timeout);
108
112 void (*svc_deselected)(void);
113
126 void (*svc_received)(const struct nfc_ndef_tnep_rec_svc_param *param,
127 const struct nfc_tnep_poller_msg *msg,
128 bool timeout);
129
143 void (*svc_sent)(const struct nfc_ndef_tnep_rec_svc_param *param,
144 const struct nfc_tnep_poller_msg *rsp_msg,
145 bool timeout);
146
152 void (*error)(int err);
153
154 sys_snode_t node;
155};
156
160 uint8_t *data;
161
163 size_t size;
164};
165
173int nfc_tnep_poller_init(const struct nfc_tnep_buf *tx_buf);
174
182
197 enum nfc_tnep_tag_type tag_type);
198
215 struct nfc_ndef_tnep_rec_svc_param *param,
216 uint8_t *cnt);
217
234int nfc_tnep_poller_svc_select(const struct nfc_tnep_buf *svc_buf,
235 const struct nfc_ndef_tnep_rec_svc_param *svc,
236 uint32_t max_ndef_area_size);
237
247
259int nfc_tnep_poller_svc_read(const struct nfc_tnep_buf *svc_buf);
260
276 const struct nfc_tnep_buf *resp_buf);
277
289int nfc_tnep_poller_on_ndef_read(const uint8_t *data, size_t len);
290
300
307
308#ifdef _cplusplus
309}
310#endif
311
316#endif /* NFC_TNEP_POLLER_ */
nfc_tnep_status_value
Service status - payload in TNEP Status Record.
Definition: base.h:37
int nfc_tnep_poller_svc_read(const struct nfc_tnep_buf *svc_buf)
Read the TNEP Service data.
void nfc_tnep_poller_cb_register(struct nfc_tnep_poller_cb *cb)
Register TNEP Poller callbacks.
int nfc_tnep_poller_on_ndef_read(const uint8_t *data, size_t len)
Indicate NDEF data read.
nfc_tnep_tag_type
NFC TNEP Tag Type.
Definition: poller.h:26
@ NFC_TNEP_TAG_TYPE_UNSUPPORTED
Definition: poller.h:28
@ NFC_TNEP_TAG_TYPE_T4T
Definition: poller.h:34
@ NFC_TNEP_TAG_TYPE_T2T
Definition: poller.h:31
int nfc_tnep_poller_svc_write(const struct nfc_ndef_msg_desc *msg, const struct nfc_tnep_buf *resp_buf)
Write the TNEP Service data.
const struct nfc_ndef_tnep_rec_svc_param * active_service_get(void)
Get the selected/active service.
int nfc_tnep_poller_api_set(const struct nfc_tnep_poller_ndef_api *api, enum nfc_tnep_tag_type tag_type)
Set NDEF API for the NFC TNEP Poller Device.
int nfc_tnep_poller_svc_deselect(void)
Deselect the TNEP Service.
int nfc_tnep_poller_init(const struct nfc_tnep_buf *tx_buf)
Initialize the NFC TNEP Poller Device.
int nfc_tnep_poller_on_ndef_write(void)
Indicate NDEF data write operation finish.
int nfc_tnep_poller_svc_search(const struct nfc_ndef_msg_desc *ndef_msg, struct nfc_ndef_tnep_rec_svc_param *param, uint8_t *cnt)
Search if NDEF Message contains TNEP Service Parameters Records.
int nfc_tnep_poller_svc_select(const struct nfc_tnep_buf *svc_buf, const struct nfc_ndef_tnep_rec_svc_param *svc, uint32_t max_ndef_area_size)
Select the TNEP Service.
NDEF message descriptor.
Definition: msg.h:30
Service Parameters in the TNEP's Initial NDEF message.
Definition: tnep_rec.h:51
size_t size
Definition: poller.h:163
uint8_t * data
Definition: poller.h:160
TNEP Poller buffer structure.
Definition: poller.h:158
void(* error)(int err)
Function called when an internal error in TNEP Poller library was detected.
Definition: poller.h:152
void(* svc_selected)(const struct nfc_ndef_tnep_rec_svc_param *param, const struct nfc_tnep_poller_msg *msg, bool timeout)
Function called when TNEP Service was selected.
Definition: poller.h:105
void(* svc_received)(const struct nfc_ndef_tnep_rec_svc_param *param, const struct nfc_tnep_poller_msg *msg, bool timeout)
Function called when TNEP Service was read.
Definition: poller.h:126
sys_snode_t node
Definition: poller.h:154
void(* svc_deselected)(void)
Function called when current active TNEP Service was deselected.
Definition: poller.h:112
void(* svc_sent)(const struct nfc_ndef_tnep_rec_svc_param *param, const struct nfc_tnep_poller_msg *rsp_msg, bool timeout)
Function called when TNEP Service was written.
Definition: poller.h:143
TNEP Poller callback structure.
Definition: poller.h:92
const struct nfc_ndef_msg_desc * msg
Definition: poller.h:50
enum nfc_tnep_status_value status
Definition: poller.h:45
TNEP Poller Message structure.
Definition: poller.h:43
int(* ndef_update)(const uint8_t *ndef_buf, uint16_t ndef_len)
Function used to write the NDEF Message.
Definition: poller.h:88
int(* ndef_read)(uint8_t *ndef_buf, uint16_t ndef_len)
Function used to read the NDEF Message.
Definition: poller.h:74
TNEP Poller API structure.
Definition: poller.h:60