NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
NdefRecord.h
00001 #ifndef NdefRecord_h 00002 #define NdefRecord_h 00003 00004 #include <string> 00005 #include <Ndef.h> 00006 00007 using namespace std; 00008 00009 #define TNF_EMPTY 0x0 00010 #define TNF_WELL_KNOWN 0x01 00011 #define TNF_MIME_MEDIA 0x02 00012 #define TNF_ABSOLUTE_URI 0x03 00013 #define TNF_EXTERNAL_TYPE 0x04 00014 #define TNF_UNKNOWN 0x05 00015 #define TNF_UNCHANGED 0x06 00016 #define TNF_RESERVED 0x07 00017 00018 class NdefRecord 00019 { 00020 public: 00021 NdefRecord(); 00022 NdefRecord(const NdefRecord& rhs); 00023 ~NdefRecord(); 00024 NdefRecord& operator=(const NdefRecord& rhs); 00025 00026 int getEncodedSize(); 00027 void encode(uint8_t *data, bool firstRecord, bool lastRecord); 00028 00029 unsigned int getTypeLength(); 00030 int getPayloadLength(); 00031 unsigned int getIdLength(); 00032 00033 uint8_t getTnf(); 00034 void getType(uint8_t *type); 00035 void getPayload(uint8_t *payload); 00036 void getId(uint8_t *id); 00037 00038 // convenience methods 00039 string getType(); 00040 string getId(); 00041 00042 void setTnf(uint8_t tnf); 00043 void setType(const uint8_t *type, const unsigned int numuint8_ts); 00044 void setPayload(const uint8_t *payload, const int numuint8_ts); 00045 void setId(const uint8_t *id, const unsigned int numuint8_ts); 00046 00047 void print(); 00048 private: 00049 uint8_t getTnfuint8_t(bool firstRecord, bool lastRecord); 00050 uint8_t _tnf; // 3 bit 00051 unsigned int _typeLength; 00052 int _payloadLength; 00053 unsigned int _idLength; 00054 uint8_t *_type; 00055 uint8_t *_payload; 00056 uint8_t *_id; 00057 }; 00058 00059 #endif
Generated on Tue Jul 12 2022 21:59:39 by 1.7.2