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

Committer:
yihui
Date:
Fri Dec 27 01:46:32 2013 +0000
Revision:
0:88960f3eeb2c
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yihui 0:88960f3eeb2c 1 #ifndef NdefRecord_h
yihui 0:88960f3eeb2c 2 #define NdefRecord_h
yihui 0:88960f3eeb2c 3
yihui 0:88960f3eeb2c 4 #include <string>
yihui 0:88960f3eeb2c 5 #include <Ndef.h>
yihui 0:88960f3eeb2c 6
yihui 0:88960f3eeb2c 7 using namespace std;
yihui 0:88960f3eeb2c 8
yihui 0:88960f3eeb2c 9 #define TNF_EMPTY 0x0
yihui 0:88960f3eeb2c 10 #define TNF_WELL_KNOWN 0x01
yihui 0:88960f3eeb2c 11 #define TNF_MIME_MEDIA 0x02
yihui 0:88960f3eeb2c 12 #define TNF_ABSOLUTE_URI 0x03
yihui 0:88960f3eeb2c 13 #define TNF_EXTERNAL_TYPE 0x04
yihui 0:88960f3eeb2c 14 #define TNF_UNKNOWN 0x05
yihui 0:88960f3eeb2c 15 #define TNF_UNCHANGED 0x06
yihui 0:88960f3eeb2c 16 #define TNF_RESERVED 0x07
yihui 0:88960f3eeb2c 17
yihui 0:88960f3eeb2c 18 class NdefRecord
yihui 0:88960f3eeb2c 19 {
yihui 0:88960f3eeb2c 20 public:
yihui 0:88960f3eeb2c 21 NdefRecord();
yihui 0:88960f3eeb2c 22 NdefRecord(const NdefRecord& rhs);
yihui 0:88960f3eeb2c 23 ~NdefRecord();
yihui 0:88960f3eeb2c 24 NdefRecord& operator=(const NdefRecord& rhs);
yihui 0:88960f3eeb2c 25
yihui 0:88960f3eeb2c 26 int getEncodedSize();
yihui 0:88960f3eeb2c 27 void encode(uint8_t *data, bool firstRecord, bool lastRecord);
yihui 0:88960f3eeb2c 28
yihui 0:88960f3eeb2c 29 unsigned int getTypeLength();
yihui 0:88960f3eeb2c 30 int getPayloadLength();
yihui 0:88960f3eeb2c 31 unsigned int getIdLength();
yihui 0:88960f3eeb2c 32
yihui 0:88960f3eeb2c 33 uint8_t getTnf();
yihui 0:88960f3eeb2c 34 void getType(uint8_t *type);
yihui 0:88960f3eeb2c 35 void getPayload(uint8_t *payload);
yihui 0:88960f3eeb2c 36 void getId(uint8_t *id);
yihui 0:88960f3eeb2c 37
yihui 0:88960f3eeb2c 38 // convenience methods
yihui 0:88960f3eeb2c 39 string getType();
yihui 0:88960f3eeb2c 40 string getId();
yihui 0:88960f3eeb2c 41
yihui 0:88960f3eeb2c 42 void setTnf(uint8_t tnf);
yihui 0:88960f3eeb2c 43 void setType(const uint8_t *type, const unsigned int numuint8_ts);
yihui 0:88960f3eeb2c 44 void setPayload(const uint8_t *payload, const int numuint8_ts);
yihui 0:88960f3eeb2c 45 void setId(const uint8_t *id, const unsigned int numuint8_ts);
yihui 0:88960f3eeb2c 46
yihui 0:88960f3eeb2c 47 void print();
yihui 0:88960f3eeb2c 48 private:
yihui 0:88960f3eeb2c 49 uint8_t getTnfuint8_t(bool firstRecord, bool lastRecord);
yihui 0:88960f3eeb2c 50 uint8_t _tnf; // 3 bit
yihui 0:88960f3eeb2c 51 unsigned int _typeLength;
yihui 0:88960f3eeb2c 52 int _payloadLength;
yihui 0:88960f3eeb2c 53 unsigned int _idLength;
yihui 0:88960f3eeb2c 54 uint8_t *_type;
yihui 0:88960f3eeb2c 55 uint8_t *_payload;
yihui 0:88960f3eeb2c 56 uint8_t *_id;
yihui 0:88960f3eeb2c 57 };
yihui 0:88960f3eeb2c 58
yihui 0:88960f3eeb2c 59 #endif