NFC library using PN532 to read/write NDEF Messages to NFC tags

Dependents:   Seeed_NFC_Shield_write Nucleo_test_nfc

Fork of PN532 by Yihui Xiong

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NdefMessage.h Source File

NdefMessage.h

00001 #ifndef NdefMessage_h
00002 #define NdefMessage_h
00003 
00004 #include <Ndef.h>
00005 #include <NdefRecord.h>
00006 
00007 #define MAX_NDEF_RECORDS 4
00008 
00009 class NdefMessage
00010 {
00011     public:
00012         NdefMessage(void);
00013         NdefMessage(const uint8_t *data, const int numuint8_ts);
00014         NdefMessage(const NdefMessage& rhs);
00015         ~NdefMessage();
00016         NdefMessage& operator=(const NdefMessage& rhs);
00017 
00018         int getEncodedSize(); // need so we can pass array to encode
00019         void encode(uint8_t *data);
00020 
00021         bool addRecord(NdefRecord& record);
00022         void addMimeMediaRecord(string mimeType, string payload);
00023         void addMimeMediaRecord(string mimeType, uint8_t *payload, int payloadLength);
00024         void addTextRecord(string text);
00025         void addTextRecord(string text, string encoding);
00026         void addUriRecord(string uri);
00027         void addEmptyRecord();
00028 
00029         unsigned int getRecordCount();
00030         NdefRecord getRecord(int index);
00031         NdefRecord operator[](int index);
00032 
00033         void print();
00034     private:
00035         NdefRecord _records[MAX_NDEF_RECORDS];
00036         unsigned int _recordCount;
00037 };
00038 
00039 #endif