NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
NdefMessage.h@3:4189a10038e6, 2013-11-21 (annotated)
- Committer:
- yihui
- Date:
- Thu Nov 21 04:30:49 2013 +0000
- Revision:
- 3:4189a10038e6
sync with https://github.com/Seeed-Studio/PN532/releases/tag/v0.9.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 3:4189a10038e6 | 1 | #ifndef NdefMessage_h |
yihui | 3:4189a10038e6 | 2 | #define NdefMessage_h |
yihui | 3:4189a10038e6 | 3 | |
yihui | 3:4189a10038e6 | 4 | #include <Ndef.h> |
yihui | 3:4189a10038e6 | 5 | #include <NdefRecord.h> |
yihui | 3:4189a10038e6 | 6 | |
yihui | 3:4189a10038e6 | 7 | #define MAX_NDEF_RECORDS 4 |
yihui | 3:4189a10038e6 | 8 | |
yihui | 3:4189a10038e6 | 9 | class NdefMessage |
yihui | 3:4189a10038e6 | 10 | { |
yihui | 3:4189a10038e6 | 11 | public: |
yihui | 3:4189a10038e6 | 12 | NdefMessage(void); |
yihui | 3:4189a10038e6 | 13 | NdefMessage(const uint8_t *data, const int numuint8_ts); |
yihui | 3:4189a10038e6 | 14 | NdefMessage(const NdefMessage& rhs); |
yihui | 3:4189a10038e6 | 15 | ~NdefMessage(); |
yihui | 3:4189a10038e6 | 16 | NdefMessage& operator=(const NdefMessage& rhs); |
yihui | 3:4189a10038e6 | 17 | |
yihui | 3:4189a10038e6 | 18 | int getEncodedSize(); // need so we can pass array to encode |
yihui | 3:4189a10038e6 | 19 | void encode(uint8_t *data); |
yihui | 3:4189a10038e6 | 20 | |
yihui | 3:4189a10038e6 | 21 | bool addRecord(NdefRecord& record); |
yihui | 3:4189a10038e6 | 22 | void addMimeMediaRecord(string mimeType, string payload); |
yihui | 3:4189a10038e6 | 23 | void addMimeMediaRecord(string mimeType, uint8_t *payload, int payloadLength); |
yihui | 3:4189a10038e6 | 24 | void addTextRecord(string text); |
yihui | 3:4189a10038e6 | 25 | void addTextRecord(string text, string encoding); |
yihui | 3:4189a10038e6 | 26 | void addUriRecord(string uri); |
yihui | 3:4189a10038e6 | 27 | void addEmptyRecord(); |
yihui | 3:4189a10038e6 | 28 | |
yihui | 3:4189a10038e6 | 29 | unsigned int getRecordCount(); |
yihui | 3:4189a10038e6 | 30 | NdefRecord getRecord(int index); |
yihui | 3:4189a10038e6 | 31 | NdefRecord operator[](int index); |
yihui | 3:4189a10038e6 | 32 | |
yihui | 3:4189a10038e6 | 33 | void print(); |
yihui | 3:4189a10038e6 | 34 | private: |
yihui | 3:4189a10038e6 | 35 | NdefRecord _records[MAX_NDEF_RECORDS]; |
yihui | 3:4189a10038e6 | 36 | unsigned int _recordCount; |
yihui | 3:4189a10038e6 | 37 | }; |
yihui | 3:4189a10038e6 | 38 | |
yihui | 3:4189a10038e6 | 39 | #endif |