forked from Seeed-Shield/NFC_Shield_DEV
-
Notifications
You must be signed in to change notification settings - Fork 12
/
NdefMessage.h
40 lines (32 loc) · 1.14 KB
/
NdefMessage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#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 numBytes);
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);
// TODO encode(uint8_t* data, int numberBytes); ???
boolean 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();
uint8_t getRecordCount();
NdefRecord getRecord(uint8_t index);
NdefRecord operator[](uint8_t index);
void print();
private:
NdefRecord _records[MAX_NDEF_RECORDS];
uint8_t _recordCount;
};
#endif