LEER TAG

Dependents:   NFC_HTM_READ EMULAR_TAGS Escribir_tag NFC_HTM_READ-WRITE

Committer:
mauroar211
Date:
Fri Apr 24 19:02:44 2015 +0000
Revision:
1:a549ef8b142a
Parent:
0:b805b487fbef
SE RESTAURARON LOS ARCHIVO DE LA LIBRER?A;

Who changed what in which revision?

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