Skip to content

Commit c71b66d

Browse files
author
Donatien Garnier
committed
Address @AnotherButler's comments
1 parent 6d46bc3 commit c71b66d

File tree

1 file changed

+68
-66
lines changed

1 file changed

+68
-66
lines changed

docs/design-documents/nfc/nfc_design.md

Lines changed: 68 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22

33
## Table of contents
44

5-
1. [Near-field communication in Mbed OS](#near-field-communication-in-mbed-os).
6-
1. [Table of contents](#table-of-contents).
7-
1. [Revision history](#revision-history).
8-
1. [Introduction](#introduction).
9-
1. [Overview and background](#overview-and-background).
10-
1. [Use cases](#use-cases).
11-
1. [Commissioning](#commissioning).
12-
1. [Identification](#identification).
13-
1. [Transport](#transport).
14-
1. [BLE pairing](#ble-pairing).
15-
1. [System architecture and high-level design](#system-architecture-and-high-level-design).
16-
1. [Compliance with NFC Forum specifications](#compliance-with-nfc-forum-specifications).
17-
1. [User-facing API](#user-facing-api).
18-
1. [Phase 1: MicroNFC stack integration](#phase-1-micronfc-stack-integration).
19-
1. [Phase 2: NFC host/controller split, NCI and NFC HAL API](#phase-2-nfc-hostcontroller-split-nci-and-nfc-hal-api).
20-
1. [Detailed design](#detailed-design).
21-
1. [User-facing APIs](#user-facing-apis).
22-
1. [NFC controller](#nfc-controller).
23-
1. [Endpoints](#endpoints).
24-
1. [NFC Remote Endpoint](#nfc-remote-endpoint).
25-
1. [NFC NDEF Capable](#nfc-ndef-capable).
26-
1. [NFC Remote Initiator](#nfc-remote-initiator).
27-
1. [NFC Target](#nfc-target).
28-
1. [NFC EEPROM](#nfc-eeprom).
29-
1. [NFC Remote Target](#nfc-remote-target).
30-
1. [NDEF API](#ndef-api).
31-
1. [Common objects](#common-objects).
32-
1. [Parsing](#parsing).
33-
1. [ndef::MessageParser](#ndefmessageparser).
34-
1. [ndef::MessageParser::Delegate](#ndefmessageparserdelegate).
35-
1. [NDEF record parsing](#ndef-record-parsing).
36-
1. [ndef::RecordParser](#ndefrecordparser).
37-
1. [ndef::RecordParserChain](#ndefrecordparserchain).
38-
1. [ndef::GenericRecordParser<ParserImplementation, ParsingResult>](#ndefgenericrecordparserparserimplementation-parsingresult).
39-
1. [ndef::GenericRecordParser<ParserImplementation, ParsingResult>::Delegate](#ndefgenericrecordparserparserimplementation-parsingresultdelegate).
40-
1. [Common parsers](#common-parsers).
41-
1. [Simple parser](#simple-parser).
42-
1. [Delegate](#delegate).
43-
1. [Serialization](#serialization).
44-
1. [HAL APIs](#hal-apis).
45-
1. [NFC EEPROM API](#nfc-eeprom-api).
46-
1. [NCI driver APIs](#nci-driver-apis).
47-
1. [Testing strategy](#testing-strategy).
48-
1. [NFC Forum compliance](#nfc-forum-compliance).
49-
1. [Interoperability](#interoperability).
50-
1. [HAL testing](#hal-testing).
51-
1. [Dependencies](#dependencies).
5+
- [Near-field communication in Mbed OS](#near-field-communication-in-mbed-os)
6+
- [Table of contents](#table-of-contents)
7+
- [Revision history](#revision-history)
8+
- [Introduction](#introduction)
9+
- [Overview and background](#overview-and-background)
10+
- [Use cases](#use-cases)
11+
- [Commissioning](#commissioning)
12+
- [Identification](#identification)
13+
- [Transport](#transport)
14+
- [BLE pairing](#ble-pairing)
15+
- [System architecture and high-level design](#system-architecture-and-high-level-design)
16+
- [Compliance with NFC forum specifications](#compliance-with-nfc-forum-specifications)
17+
- [User-facing API](#user-facing-api)
18+
- [Phase 1: MicroNFC stack integration](#phase-1-micronfc-stack-integration)
19+
- [Phase 2: NFC host/controller split, NCI and NFC HAL API](#phase-2-nfc-hostcontroller-split-nci-and-nfc-hal-api)
20+
- [Detailed design](#detailed-design)
21+
- [User-facing APIs](#user-facing-apis)
22+
- [NFC controller](#nfc-controller)
23+
- [Endpoints](#endpoints)
24+
- [NFC remote endpoint](#nfc-remote-endpoint)
25+
- [NFC NDEF capable](#nfc-ndef-capable)
26+
- [NFC remote initiator](#nfc-remote-initiator)
27+
- [NFC target](#nfc-target)
28+
- [NFC EEPROM](#nfc-eeprom)
29+
- [NFC remote target](#nfc-remote-target)
30+
- [NDEF API](#ndef-api)
31+
- [Common objects](#common-objects)
32+
- [Parsing](#parsing)
33+
- [ndef::MessageParser](#ndefmessageparser)
34+
- [ndef::MessageParser::Delegate](#ndefmessageparserdelegate)
35+
- [NDEF record parsing](#ndef-record-parsing)
36+
- [ndef::RecordParser](#ndefrecordparser)
37+
- [ndef::RecordParserChain](#ndefrecordparserchain)
38+
- [ndef::GenericRecordParser<ParserImplementation, ParsingResult>](#ndefgenericrecordparserparserimplementation-parsingresult)
39+
- [ndef::GenericRecordParser<ParserImplementation, ParsingResult>::Delegate](#ndefgenericrecordparserparserimplementation-parsingresultdelegate)
40+
- [Common parsers](#common-parsers)
41+
- [Simple parser](#simple-parser)
42+
- [Delegate](#delegate)
43+
- [Serialization](#serialization)
44+
- [HAL APIs](#hal-apis)
45+
- [NFC EEPROM API](#nfc-eeprom-api)
46+
- [NCI driver APIs](#nci-driver-apis)
47+
- [Testing strategy](#testing-strategy)
48+
- [NFC forum compliance](#nfc-forum-compliance)
49+
- [Interoperability](#interoperability)
50+
- [HAL testing](#hal-testing)
51+
- [Dependencies](#dependencies)
5252

5353
## Revision history
5454

@@ -88,7 +88,7 @@ If the NFC controller can emulate a smartcard, no handover is necessary, and the
8888

8989
### BLE pairing
9090

91-
You can use a specifically crafted NDEF message to facilitate out-of-band pairing wth man-in-the-middle protection as specified in the [Bluetooth® Secure Simple Pairing Using NFC](https://members.nfc-forum.org/apps/group_public/download.php/18688/NFCForum-AD-BTSSP_1_1.pdf) document.
91+
You can use a specifically crafted NDEF message to facilitate out-of-band pairing with man-in-the-middle protection as specified in the [Bluetooth® Secure Simple Pairing Using NFC](https://members.nfc-forum.org/apps/group_public/download.php/18688/NFCForum-AD-BTSSP_1_1.pdf) document.
9292

9393
# System architecture and high-level design
9494

@@ -107,7 +107,7 @@ The NFC API exposed to the user should provide high-level, object-oriented C++ A
107107

108108
## Phase 1: MicroNFC stack integration
109109

110-
The first step toward integrating NFC in Mbed OS is the integration of the MicroNFC stack, which has drivers for the PN512 and derivatives.
110+
The first step toward adding NFC to Mbed OS is the integration of the MicroNFC stack, which has drivers for the PN512 and derivatives.
111111

112112
Architecture:
113113

@@ -133,7 +133,7 @@ Examples of NCI-compliant controllers:
133133
- ST ST21NFC.
134134
- NXP PN7120 and PN7150.
135135

136-
Examples of NCI-compliant transceivers that are *not* NCI-compliant:
136+
Examples of transceivers that are *not* NCI-compliant:
137137

138138
- NXP PN512.
139139
- NXP PN5180.
@@ -158,7 +158,7 @@ Class diagram:
158158

159159
The `NFCController` class is the entrypoint into NFC for the user.
160160

161-
When NCI integration is complete (phase 2), this class has to be provided with an `NCIDriver` instance. For now, the one controller we support is the PN512, which implements the `NFCControllerDriver` class. This class is specific to the current MicroNFC release.
161+
When NCI integration is complete (phase 2), this class will be able to drive a `NCIDriver` instance. For now, the one controller we support is the PN512, which implements the `NFCControllerDriver` class. This class is specific to the current MicroNFC release.
162162

163163
It offers the following methods:
164164

@@ -246,7 +246,7 @@ void on_nfc_target_discovered(const mbed::SharedPtr<NFCRemoteTarget>& nfc_target
246246

247247
These methods called when a remote initiator (the local controller is acting as a target) or a remote target (the local controller is acting as an initiator) is detected.
248248

249-
Shared pointers are used, so the user does not have to maintain the lifetime of these objects. The `NFCController` instance releases its reference when the endpoint is lost (see below).
249+
These methods use shared pointers, so the user does not have to maintain the lifetime of these objects. The `NFCController` instance releases its reference when the endpoint is lost (see below).
250250

251251
### Endpoints
252252

@@ -272,13 +272,13 @@ Drop the connection with the remote endpoint.
272272
bool is_connected() const;
273273
```
274274

275-
Set to true when the connection to this endpoint has been activated and is currently selected by the controller.
275+
Set to true when the remote endpoint activates the connection and selects it.
276276

277277
```cpp
278278
bool is_disconnected() const;
279279
```
280280

281-
Set to true when this endpoint has been lost and the controlled instance has released the reference to the shared pointer.
281+
Set to true when the remote endpoint is lost and the `NFCController` instance releases its reference to the shared pointer.
282282

283283
```cpp
284284
nfc_rf_protocols_bitmask_t rf_protocols() const;
@@ -292,25 +292,25 @@ List the RF protocols that have been activated to communicate with that endpoint
292292
virtual void on_connected();
293293
```
294294

295-
This is called when a connection to this endpoint has been succesfully established.
295+
This is called when a connection to this endpoint is succesfully established.
296296

297297
```cpp
298298
virtual void on_disconnected();
299299
```
300300

301-
This is called when this endpoint has been lost and the controller instance is about to release the reference to the shared pointer.
301+
This is called when this endpoint is lost and the controller instance is about to release the reference to the shared pointer.
302302

303303
#### NFC NDEF capable
304304

305-
This class is inherited by all endpoints that have the capability of handling NDEF data.
305+
This class is the ancestor class for all endpoints which have the capability of handling NDEF data.
306306

307307
User-facing API:
308308

309309
```cpp
310310
NFCNDEFCapable(uint8_t* buffer, size_t buffer_size);
311311
```
312312
313-
The instance needs to be constructed using a stratch buffer, which will be used to encode and/or decode NDEF messages.
313+
The class is constructed using a scratch buffer which is used to encode and/or decode NDEF messages.
314314
315315
```cpp
316316
bool is_ndef_supported() const;
@@ -334,7 +334,7 @@ The instance receives requests to encode and decode NDEF messages, and the user
334334
void parse_ndef_message(const uint8_t* buffer, size_t size);
335335
```
336336

337-
The encoded NDEF message is passed to the user for processing.
337+
The user receives the encoded NDEF message for processing.
338338

339339
```cpp
340340
size_t build_ndef_message(uint8_t* buffer, size_t capacity);
@@ -361,14 +361,16 @@ enum nfc_tag_type_t {
361361
nfc_tag_type_t nfc_tag_type();
362362
```
363363

364-
Additionally, the type of NFC tag (1 to 5) being emulated can be recovered. Type 4 can be implemented on top of two technologies; therefore, it is separated into type 4a and type 4b.
364+
Additionally, the user can recover the type of NFC tag (1 to 5) being emulated. Type 4 is implemented on either one of two technologies; therefore, this enum both includes type 4a and type 4b to identify the underlying technology.
365+
366+
*Note: This is initially out of scope for the initial release*
365367

366368
```cpp
367369
bool is_iso7816_supported();
368370
void add_iso7816_application(ISO7816App* app);
369371
```
370372
371-
If supported by the underlying technology (ISO-DEP), a contactless smartcard can be emulated, and ISO7816-4 applications can be registered using this API.
373+
If the underlying technology supports it (ISO-DEP), the user can emulate a contactless smartcard and register ISO7816-4 applications using this API.
372374
373375
**Delegate**
374376
@@ -391,7 +393,7 @@ void erase_ndef_message();
391393
void read_ndef_message();
392394
```
393395

394-
Calling these functions triggers the appropriate NDEF parsing/building process if handlers are registered in the `NFCNDEFCapable` instance.
396+
The user can trigger the appropriate NDEF parsing/building process using these methods if handlers are registered in the `NFCNDEFCapable` instance.
395397

396398
**Delegate**
397399

@@ -403,7 +405,7 @@ void on_ndef_message_read(nfc_err_t result);
403405
404406
#### NFC EEPROM
405407
406-
The `NFCEEPROM` class derives from `NFCTarget` and shares the same API. A pointer to a `NFCEEPROMDriver` instance (see below) must be passed in the constructor.
408+
The `NFCEEPROM` class derives from `NFCTarget` and shares the same API. The user must pass a pointer to a `NFCEEPROMDriver` instance (see below) in the constructor.
407409
408410
#### NFC remote target
409411
@@ -576,15 +578,15 @@ For convenience, serialization functions for common types are provided, as well
576578

577579
### NFC EEPROM API
578580

579-
The one HAL API that vendors have to implement to implement a `NFCEEPROMDriver` driver are the following virtual methods.
581+
To create the hardware-specific APIs to add support for a new NFC EEPROM, vendors need to derive from `NFCEEPROMDriver` and implement its virtual methods.
580582

581-
From the upper layer's point of view, the EEPROM is a byte array that can be read from or written to. Long operations (reads, writes, erasures) must happen asynchronously. Booleans indicate whether a particular operation was succesful. The upper layer is handled by encoding.
583+
From the upper layer's point of view, the EEPROM is a byte array that can be read from or written to. Long operations (reads, writes, erasures) must happen asynchronously. Booleans indicate whether a particular operation was succesful.
582584

583585
Address 0 means the start of the NDEF buffer (not necessarily at address 0 in the EEPROM).
584586

585587
When a buffer is passed to the backend, the reference remains valid until the corresponding event is called.
586588

587-
The `set_size()` command is called to change the size of the buffer (within the limits set by `get_max_size()`). Inversely, that buffer size can be read using `get_size()`.
589+
The `set_size()` command is called to change the size of the NDEF buffer (within the limits set by `get_max_size()`). Inversely, that buffer size can be read using `get_size()`.
588590

589591
`start_session()` and `end_session()` are used before a series of memory operations to allow the driver to lock or unlock the RF interface during these operations to avoid having concurrent access to the memory.
590592

0 commit comments

Comments
 (0)