NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
Diff: NdefMessage.h
- Revision:
- 3:4189a10038e6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NdefMessage.h Thu Nov 21 04:30:49 2013 +0000 @@ -0,0 +1,39 @@ +#ifndef NdefMessage_h +#define NdefMessage_h + +#include <Ndef.h> +#include <NdefRecord.h> + +#define MAX_NDEF_RECORDS 4 + +class NdefMessage +{ + public: + NdefMessage(void); + NdefMessage(const uint8_t *data, const int numuint8_ts); + NdefMessage(const NdefMessage& rhs); + ~NdefMessage(); + NdefMessage& operator=(const NdefMessage& rhs); + + int getEncodedSize(); // need so we can pass array to encode + void encode(uint8_t *data); + + bool addRecord(NdefRecord& record); + void addMimeMediaRecord(string mimeType, string payload); + void addMimeMediaRecord(string mimeType, uint8_t *payload, int payloadLength); + void addTextRecord(string text); + void addTextRecord(string text, string encoding); + void addUriRecord(string uri); + void addEmptyRecord(); + + unsigned int getRecordCount(); + NdefRecord getRecord(int index); + NdefRecord operator[](int index); + + void print(); + private: + NdefRecord _records[MAX_NDEF_RECORDS]; + unsigned int _recordCount; +}; + +#endif