@@ -188,25 +188,62 @@ virtual void on_lost();
188
188
189
189
This is called when this endpoint has been lost and the reference to the shared pointer is about to be released by the controller instance.
190
190
191
+ #### NFC NDEF Capable
192
+
193
+ This class is inherited by all endpoints that have the capability of handling NDEF data.
194
+
195
+ User-facing API:
196
+ ``` cpp
197
+ bool is_ndef_supported () const ;
198
+
199
+ void set_ndef_message_parser (ndef::MessageParser* parser) const;
200
+ void set_ndef_message_builder(ndef::MessageBuilder* builder) const;
201
+ ```
202
+
203
+ The user can select which parser/builder (see below) should be used to handle read/write requests.
204
+
205
+ API used by descendant classes:
206
+ ```cpp
207
+ void set_ndef_support(bool supported);
208
+
209
+ ndef::MessageParser* ndef_message_parser();
210
+ ndef::MessageBuilder* ndef_message_builder();
211
+ ```
212
+
191
213
#### NFC Remote Initiator
192
214
193
- This class derives from the base ` NFCEndpoint ` class .
215
+ This class derives from the base ` NFCEndpoint ` and ` NFCNDEFCapable ` classes .
194
216
195
217
``` cpp
196
218
bool is_ndef_supported ();
197
- size_t nfc_tag_type ();
198
219
199
220
void set_ndef_message (const NDEFMessage& message);
200
221
void clear_ndef_message();
201
222
NDEFMessage get_ndef_message();
202
223
```
203
224
These methods provide access to the NDEF message that we are exposing to the remote initiator.
204
225
226
+
227
+ ```cpp
228
+ enum nfc_tag_type_t {
229
+ nfc_tag_type_1,
230
+ nfc_tag_type_2,
231
+ nfc_tag_type_3,
232
+ nfc_tag_type_4a,
233
+ nfc_tag_type_4b,
234
+ nfc_tag_type_5
235
+ };
236
+ ```
237
+
238
+ ``` cpp
239
+ nfc_tag_type_t nfc_tag_type ();
240
+ ```
241
+
205
242
Additionally the type of NFC tag (1 to 5) which is being emulated can be recovered.
206
243
207
244
``` cpp
208
245
bool is_iso7816_supported ();
209
- void add_iso7816_application(const ISO7816App& app);
246
+ void add_iso7816_application (ISO7816App* app);
210
247
```
211
248
212
249
If supported by the underlying technology (ISO-DEP), a contactless smartcard can be emulated and ISO7816-4 applications can be registered using this API.
@@ -235,18 +272,22 @@ This is the base class for NFC targets that can be of two types:
235
272
236
273
Apart from the actual transport (Wired or NFC), the usage is very similar which explains why these methods are shared across these devices types.
237
274
275
+ This class derives from ` NFCNDEFCapable ` .
276
+
238
277
``` cpp
239
- void write_ndef_message (const NDEFMessage& message)
240
- void erase_ndef_message()
241
- void read_ndef_message()
278
+ void write_ndef_message ();
279
+ void erase_ndef_message ();
280
+ void read_ndef_message ();
242
281
```
243
282
283
+ Calling these functions will trigger the appropriate NDEF parsing/building process if handlers are registered in the ` NFCNDEFCapable ` instance.
284
+
244
285
** Delegate**
245
286
246
287
``` cpp
247
- void on_ndef_message_written (nfc_err_t result)
248
- void on_ndef_message_erased (nfc_err_t result)
249
- void on_ndef_message_read(nfc_err_t result, NDEFMessage* message)
288
+ void on_ndef_message_erased (nfc_err_t result);
289
+ void on_ndef_message_written (nfc_err_t result);
290
+ void on_ndef_message_read(nfc_err_t result);
250
291
```
251
292
252
293
#### NFC EEPROM
0 commit comments