Skip to content

Commit 09ed420

Browse files
committed
NFC design doc: Update NDEF part of the design document.
1 parent a0b356b commit 09ed420

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

docs/design-documents/nfc/nfc_design.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -443,16 +443,10 @@ We will provide multiple helpers to make it easy to create and parse common reco
443443
For instance, the `URI`'s class API is:
444444
445445
```cpp
446-
uri_prefix_t uri_prefix() const
447-
void set_uri_prefix(uri_prefix_t prefix)
446+
void set_uri(uri_identifier_code_t id, const Span<const uint8_t> &uri_field)
448447
449-
bool get_uri(char *uri, size_t max_sz) const
450-
size_t uri_size() const
451-
void set_uri(const char* uri)
452-
453-
bool get_full_uri(char *uri, size_t max_sz) const
454-
size_t full_uri_size() const
455-
void set_full_uri(const char *uri)
448+
uri_identifier_code_t get_id() const;
449+
Span<const uint8_t> get_uri_field() const;
456450
```
457451

458452
**Note:** These types can be replaced by user defined ones if parsing and serialization logic is provided.
@@ -467,7 +461,7 @@ A `MessageParser`, which produces `Record` instances to its client, parses messa
467461

468462
```cpp
469463
void set_delegate(Delegate *delegate);
470-
void parse(const ac_buffer_t &data_buffer);
464+
void parse(const Span<const uint8_t> &data_buffer);
471465
```
472466
473467
It is important to note that the data_buffer in the entry of the parse function must contain the entire NDEF message.
@@ -478,7 +472,7 @@ It is important to note that the data_buffer in the entry of the parse function
478472
virtual void on_parsing_started() { }
479473
virtual void on_record_parsed(const Record &record) { }
480474
virtual void on_parsing_terminated() { }
481-
virtual void on_parsing_error(error_t error) { }
475+
virtual void on_parsing_error(MessageParser::error_t error) { }
482476
```
483477

484478
The delegate is notified by the parser when the parsing starts or ends, when an error is encountered or when an NDEF `Record` has been parsed.
@@ -557,7 +551,7 @@ Clients of the class can register a delegate, parse a message or add a new `Reco
557551

558552
```cpp
559553
void set_delegate(Delegate *delegate);
560-
void parse(const ac_buffer_t &data_buffer);
554+
void parse(const Span<const uint8_t> &data_buffer);
561555
void add_record_parser(ndef::RecordParser *parser);
562556
```
563557
@@ -568,9 +562,9 @@ Clients of this class must implement this delegate. It receives events from the
568562
```cpp
569563
virtual void on_parsing_error(ndef::MessageParser::error_t error);
570564
virtual void on_parsing_started();
571-
virtual void on_text_parsed(const Text& text, const ndef::RecordID *id);
572-
virtual void on_mime_parsed(const Mime& text, const ndef::RecordID *id);
573-
virtual void on_uri_parsed(const URI& uri, const ndef::RecordID *id);
565+
virtual void on_text_parsed(const Text& text, const ndef::RecordID &id);
566+
virtual void on_mime_parsed(const Mime& text, const ndef::RecordID &id);
567+
virtual void on_uri_parsed(const URI& uri, const ndef::RecordID &id);
574568
virtual void on_unknown_record_parsed(const ndef::Record &record);
575569
virtual void on_parsing_terminated();
576570
```
@@ -581,7 +575,7 @@ The class `MessageBuilder` is used to map a record into an NDEF message. It incl
581575

582576
![ndef_message_builder_diagram]
583577

584-
For convenience, serialization functions for common types are provided, as well as a specialized `MessageBuilder` named `SimpleMessageBuilder` that exposes them in an object oriented fashion.
578+
For convenience, serialization functions for common types are provided in the common types we provide.
585579

586580
## HAL APIs
587581

0 commit comments

Comments
 (0)