to colorize a colorful pixel with a simple touch using nfc technology
Dependencies: Chainable_RGB_LED mbed
use Arch, NFC Shield and Grove - Chainable RGB LED to DIY a touch pixel. Then use an Android with NFC support to colorize it.
The project is on https://github.com/Seeed-Studio/TouchPixel
nfc/NdefMessage.h@0:88960f3eeb2c, 2013-12-27 (annotated)
- Committer:
- yihui
- Date:
- Fri Dec 27 01:46:32 2013 +0000
- Revision:
- 0:88960f3eeb2c
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 0:88960f3eeb2c | 1 | #ifndef NdefMessage_h |
yihui | 0:88960f3eeb2c | 2 | #define NdefMessage_h |
yihui | 0:88960f3eeb2c | 3 | |
yihui | 0:88960f3eeb2c | 4 | #include <Ndef.h> |
yihui | 0:88960f3eeb2c | 5 | #include <NdefRecord.h> |
yihui | 0:88960f3eeb2c | 6 | |
yihui | 0:88960f3eeb2c | 7 | #define MAX_NDEF_RECORDS 4 |
yihui | 0:88960f3eeb2c | 8 | |
yihui | 0:88960f3eeb2c | 9 | class NdefMessage |
yihui | 0:88960f3eeb2c | 10 | { |
yihui | 0:88960f3eeb2c | 11 | public: |
yihui | 0:88960f3eeb2c | 12 | NdefMessage(void); |
yihui | 0:88960f3eeb2c | 13 | NdefMessage(const uint8_t *data, const int numuint8_ts); |
yihui | 0:88960f3eeb2c | 14 | NdefMessage(const NdefMessage& rhs); |
yihui | 0:88960f3eeb2c | 15 | ~NdefMessage(); |
yihui | 0:88960f3eeb2c | 16 | NdefMessage& operator=(const NdefMessage& rhs); |
yihui | 0:88960f3eeb2c | 17 | |
yihui | 0:88960f3eeb2c | 18 | int getEncodedSize(); // need so we can pass array to encode |
yihui | 0:88960f3eeb2c | 19 | void encode(uint8_t *data); |
yihui | 0:88960f3eeb2c | 20 | |
yihui | 0:88960f3eeb2c | 21 | bool addRecord(NdefRecord& record); |
yihui | 0:88960f3eeb2c | 22 | void addMimeMediaRecord(string mimeType, string payload); |
yihui | 0:88960f3eeb2c | 23 | void addMimeMediaRecord(string mimeType, uint8_t *payload, int payloadLength); |
yihui | 0:88960f3eeb2c | 24 | void addTextRecord(string text); |
yihui | 0:88960f3eeb2c | 25 | void addTextRecord(string text, string encoding); |
yihui | 0:88960f3eeb2c | 26 | void addUriRecord(string uri); |
yihui | 0:88960f3eeb2c | 27 | void addEmptyRecord(); |
yihui | 0:88960f3eeb2c | 28 | |
yihui | 0:88960f3eeb2c | 29 | unsigned int getRecordCount(); |
yihui | 0:88960f3eeb2c | 30 | NdefRecord getRecord(int index); |
yihui | 0:88960f3eeb2c | 31 | NdefRecord operator[](int index); |
yihui | 0:88960f3eeb2c | 32 | |
yihui | 0:88960f3eeb2c | 33 | void print(); |
yihui | 0:88960f3eeb2c | 34 | private: |
yihui | 0:88960f3eeb2c | 35 | NdefRecord _records[MAX_NDEF_RECORDS]; |
yihui | 0:88960f3eeb2c | 36 | unsigned int _recordCount; |
yihui | 0:88960f3eeb2c | 37 | }; |
yihui | 0:88960f3eeb2c | 38 | |
yihui | 0:88960f3eeb2c | 39 | #endif |