LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
ndefrecord.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_NDEFRECORD_HPP
8#define LOGICALACCESS_NDEFRECORD_HPP
9
12
13namespace logicalaccess
14{
15enum TNF
16{
17 TNF_EMPTY = 0x00,
24 TNF_RESERVED = 0x07
25};
26
27class LLA_CORE_API NdefRecord : public XmlSerializable
28{
29 public:
31 : m_tnf(TNF::TNF_EMPTY)
32 {
33 }
34 virtual ~NdefRecord()
35 {
36 }
37
38 size_t getEncodedSize() const;
39 ByteVector encode(bool firstRecord, bool lastRecord);
40
41 virtual void init(TNF tnf, ByteVector type, ByteVector id, ByteVector payload);
42
43 void setTnf(TNF tnf)
44 {
45 m_tnf = tnf;
46 }
47 TNF getTnf() const
48 {
49 return m_tnf;
50 }
51
53 {
54 m_type = type;
55 }
57 {
58 return m_type;
59 }
60
61 void setPayload(ByteVector payload)
62 {
63 m_payload = payload;
64 }
66 {
67 return m_payload;
68 }
69
71 {
72 m_id = id;
73 }
75 {
76 return m_id;
77 }
78
79 void serialize(boost::property_tree::ptree &parentNode) override;
80 void unSerialize(boost::property_tree::ptree &node) override;
81 std::string getDefaultXmlNodeName() const override
82 {
83 return "NdefRecord";
84 }
85
86 protected:
87 unsigned char getTnfByte(bool firstRecord, bool lastRecord) const;
88 TNF m_tnf; // 3 bit
92};
93}
94
95#endif
Definition: ndefrecord.hpp:28
ByteVector & getPayload()
Definition: ndefrecord.hpp:65
void setId(ByteVector id)
Definition: ndefrecord.hpp:70
ByteVector & getType()
Definition: ndefrecord.hpp:56
void setTnf(TNF tnf)
Definition: ndefrecord.hpp:43
ByteVector m_payload
Definition: ndefrecord.hpp:90
void setType(ByteVector type)
Definition: ndefrecord.hpp:52
TNF m_tnf
Definition: ndefrecord.hpp:88
NdefRecord()
Definition: ndefrecord.hpp:30
virtual ~NdefRecord()
Definition: ndefrecord.hpp:34
std::string getDefaultXmlNodeName() const override
Get the default Xml Node name for this object.
Definition: ndefrecord.hpp:81
ByteVector & getId()
Definition: ndefrecord.hpp:74
TNF getTnf() const
Definition: ndefrecord.hpp:47
ByteVector m_type
Definition: ndefrecord.hpp:89
ByteVector m_id
Definition: ndefrecord.hpp:91
void setPayload(ByteVector payload)
Definition: ndefrecord.hpp:61
A Xml Serializable base class. Add Xml serialization to a class.
Definition: xmlserializable.hpp:54
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
TNF
Definition: ndefrecord.hpp:16
@ TNF_WELL_KNOWN
Definition: ndefrecord.hpp:18
@ TNF_ABSOLUTE_URI
Definition: ndefrecord.hpp:20
@ TNF_MIME_MEDIA
Definition: ndefrecord.hpp:19
@ TNF_UNCHANGED
Definition: ndefrecord.hpp:23
@ TNF_EXTERNAL_TYPE
Definition: ndefrecord.hpp:21
@ TNF_EMPTY
Definition: ndefrecord.hpp:17
@ TNF_RESERVED
Definition: ndefrecord.hpp:24
@ TNF_UNKNOWN
Definition: ndefrecord.hpp:22