@@ -443,16 +443,10 @@ We will provide multiple helpers to make it easy to create and parse common reco
443
443
For instance, the `URI`'s class API is:
444
444
445
445
```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)
448
447
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;
456
450
```
457
451
458
452
** 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
467
461
468
462
``` cpp
469
463
void set_delegate (Delegate * delegate);
470
- void parse(const ac_buffer_t &data_buffer);
464
+ void parse(const Span< const uint8_t > &data_buffer);
471
465
```
472
466
473
467
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
478
472
virtual void on_parsing_started() { }
479
473
virtual void on_record_parsed(const Record &record) { }
480
474
virtual void on_parsing_terminated() { }
481
- virtual void on_parsing_error(error_t error) { }
475
+ virtual void on_parsing_error(MessageParser:: error_t error) { }
482
476
```
483
477
484
478
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
557
551
558
552
``` cpp
559
553
void set_delegate (Delegate * delegate);
560
- void parse(const ac_buffer_t &data_buffer);
554
+ void parse(const Span< const uint8_t > &data_buffer);
561
555
void add_record_parser(ndef::RecordParser * parser);
562
556
```
563
557
@@ -568,9 +562,9 @@ Clients of this class must implement this delegate. It receives events from the
568
562
```cpp
569
563
virtual void on_parsing_error(ndef::MessageParser::error_t error);
570
564
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);
574
568
virtual void on_unknown_record_parsed(const ndef::Record &record);
575
569
virtual void on_parsing_terminated();
576
570
```
@@ -581,7 +575,7 @@ The class `MessageBuilder` is used to map a record into an NDEF message. It incl
581
575
582
576
![ ndef_message_builder_diagram]
583
577
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 .
585
579
586
580
## HAL APIs
587
581
0 commit comments