mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			NFC design doc: Update NDEF diagrams.
							parent
							
								
									8e75802044
								
							
						
					
					
						commit
						a0b356bfc8
					
				
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 50 KiB  | 
| 
						 | 
				
			
			@ -3,12 +3,15 @@
 | 
			
		|||
package ndef {
 | 
			
		||||
 | 
			
		||||
class MessageBuilder { 
 | 
			
		||||
    +MessageBuilder(uint8_t* buffer, size_t capacity)
 | 
			
		||||
    +MessageBuilder(const Span<uint8_t> &buffer)
 | 
			
		||||
    +~MessageBuilder()
 | 
			
		||||
    +bool append_record(const RecordType& type, const RecordPayload* payload, bool is_last_record = false)
 | 
			
		||||
    +bool append_record(const Record& record)
 | 
			
		||||
    +const uint8_t* get_data() const;
 | 
			
		||||
    +size_t get_data_size() const;
 | 
			
		||||
    +bool append_record(const RecordType &type, const RecordPayload &payload = RecordPayload(), bool is_last_record = false)
 | 
			
		||||
    +bool append_record(const RecordType &type, const PayloadBuilder &builder, bool is_last_record = false)
 | 
			
		||||
    +bool append_record(const Record &record, const PayloadBuilder *builder = NULL)
 | 
			
		||||
    +void reset();
 | 
			
		||||
    +void reset(const Span<uint8_t> &buffer);
 | 
			
		||||
    +bool is_message_complete() const
 | 
			
		||||
    +Span<const uint8_t> get_message() const
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Record { 
 | 
			
		||||
| 
						 | 
				
			
			@ -23,41 +26,40 @@ class RecordPayload{
 | 
			
		|||
class RecordID{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface MessageBuilder::PayloadBuilder { 
 | 
			
		||||
    +{abstract} size_t size() const
 | 
			
		||||
    +{abstract} void build(const Span<uint8_t> &buffer) const
 | 
			
		||||
    # ~PayloadBuilder()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Record *-- RecordType
 | 
			
		||||
Record *-- "0..1" RecordPayload
 | 
			
		||||
Record *-- "0..1" RecordID
 | 
			
		||||
 | 
			
		||||
Record - MessageBuilder: insert >
 | 
			
		||||
MessageBuilder - MessageBuilder::PayloadBuilder: < build payload at insertion
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
package common { 
 | 
			
		||||
 | 
			
		||||
class SimpleMessageBuilder { 
 | 
			
		||||
    +SimpleMessageBuilder(uint8_t* buffer, size_t capacity)
 | 
			
		||||
    +~SimpleMessageBuilder()
 | 
			
		||||
    +bool append_uri(const URI&)
 | 
			
		||||
    +bool append_text(const Text&)
 | 
			
		||||
    +bool append_mime(const Mime&)
 | 
			
		||||
} 
 | 
			
		||||
 | 
			
		||||
class URI { 
 | 
			
		||||
+friend bool append_record(ndef::MessageBuilder&, const URI&)
 | 
			
		||||
+bool append_as_record(ndef::MessageBuilder &builder, bool is_last_record) const
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Text { 
 | 
			
		||||
+friend bool append_record(ndef::MessageBuilder&, const Text&)
 | 
			
		||||
+bool append_as_record(ndef::MessageBuilder &builder, bool is_last_record) const
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Mime { 
 | 
			
		||||
+friend bool append_record(ndef::MessageBuilder&, const Mime&)
 | 
			
		||||
+bool append_as_record(ndef::MessageBuilder &builder, bool is_last_record) const
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SimpleMessageBuilder --|> MessageBuilder
 | 
			
		||||
 | 
			
		||||
URI -- SimpleMessageBuilder: wrap >
 | 
			
		||||
Text -- SimpleMessageBuilder: wrap >
 | 
			
		||||
Mime -- SimpleMessageBuilder: wrap >
 | 
			
		||||
URI -- MessageBuilder: uses >
 | 
			
		||||
Text -- MessageBuilder: uses >
 | 
			
		||||
Mime -- MessageBuilder: uses >
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB  | 
| 
						 | 
				
			
			@ -4,13 +4,13 @@ package ndef {
 | 
			
		|||
 | 
			
		||||
class MessageParser { 
 | 
			
		||||
    +MessageParser()
 | 
			
		||||
    +void set_delegate(Delegate* delegate)
 | 
			
		||||
    +void parse(const ac_buffer_t& data_buffer)
 | 
			
		||||
    +void set_delegate(Delegate *delegate)
 | 
			
		||||
    +void parse(const Span<const uint8_t> &data_buffer)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface MessageParser::Delegate { 
 | 
			
		||||
    +{abstract} void on_parsing_started()
 | 
			
		||||
    +{abstract} void on_record_parsed(const Record& record)
 | 
			
		||||
    +{abstract} void on_record_parsed(const Record &record)
 | 
			
		||||
    +{abstract} void on_parsing_terminated()
 | 
			
		||||
    +{abstract} void on_parsing_error(error_t error)
 | 
			
		||||
    # ~Delegate()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB  | 
| 
						 | 
				
			
			@ -48,26 +48,26 @@ package common {
 | 
			
		|||
class SimpleMessageParser { 
 | 
			
		||||
    + SimpleMessageParser()
 | 
			
		||||
    + ~SimpleMessageParser()
 | 
			
		||||
    + void set_delegate(Delegate* delegate)
 | 
			
		||||
    + void parse(const ac_buffer_t& data_buffer)
 | 
			
		||||
    + void add_record_parser(ndef::RecordParser* parser)
 | 
			
		||||
    + void set_delegate(Delegate *delegate)
 | 
			
		||||
    + void parse(const Span<const uint8_t> &data_buffer)
 | 
			
		||||
    + void add_record_parser(ndef::RecordParser *parser)
 | 
			
		||||
    - void on_parsing_error(ndef::MessageParser::error_t error)
 | 
			
		||||
    - void on_parsing_started()
 | 
			
		||||
    - void on_record_parsed(const ndef::Record& record)
 | 
			
		||||
    - void on_record_parsed(const ndef::Record &record)
 | 
			
		||||
    - void on_parsing_terminated()
 | 
			
		||||
    - void on_record_parsed(const URI& uri, const ndef::RecordID* id)
 | 
			
		||||
    - void on_record_parsed(const Text& uri, const ndef::RecordID* id)
 | 
			
		||||
    - void on_record_parsed(const Mime& uri, const ndef::RecordID* id)
 | 
			
		||||
    - void on_record_parsed(const URI &uri, const ndef::RecordID &id)
 | 
			
		||||
    - void on_record_parsed(const Text &uri, const ndef::RecordID &id)
 | 
			
		||||
    - void on_record_parsed(const Mime &uri, const ndef::RecordID &id)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface SimpleMessageParser::Delegate {     
 | 
			
		||||
    + {abstract} void on_parsing_error(ndef::MessageParser::error_t error)
 | 
			
		||||
    + {abstract} void on_parsing_started() 
 | 
			
		||||
    + {abstract} void on_text_parsed(const Text& text, const ndef::RecordID* id)
 | 
			
		||||
    + {abstract} void on_mime_parsed(const Mime& text, const ndef::RecordID* id)
 | 
			
		||||
    + {abstract} void on_uri_parsed(const URI& uri, const ndef::RecordID* id)
 | 
			
		||||
    + {abstract} void on_unknown_record_parsed(const ndef::Record& record)
 | 
			
		||||
    + {abstract} void on_text_parsed(const Text &text, const ndef::RecordID &id)
 | 
			
		||||
    + {abstract} void on_mime_parsed(const Mime &text, const ndef::RecordID &id)
 | 
			
		||||
    + {abstract} void on_uri_parsed(const URI &uri, const ndef::RecordID &id)
 | 
			
		||||
    + {abstract} void on_unknown_record_parsed(const ndef::Record &record)
 | 
			
		||||
    + {abstract} void on_parsing_terminated()
 | 
			
		||||
    + {abstract} void on_parsing_error(ndef::MessageParser::error_t error)    
 | 
			
		||||
    # ~Delegate()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue