PN532 NFC shield of Adafruit based on PN532 of Seeed.
Fork of PN532 by
MifareClassic.h@11:e7bbcfa61859, 2016-11-17 (annotated)
- Committer:
- dwini
- Date:
- Thu Nov 17 11:32:02 2016 +0000
- Revision:
- 11:e7bbcfa61859
- Parent:
- 3:4189a10038e6
Fix use of DMSG instead of printf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yihui | 3:4189a10038e6 | 1 | #ifndef MifareClassic_h |
yihui | 3:4189a10038e6 | 2 | #define MifareClassic_h |
yihui | 3:4189a10038e6 | 3 | |
yihui | 3:4189a10038e6 | 4 | #include <PN532.h> |
yihui | 3:4189a10038e6 | 5 | #include <Ndef.h> |
yihui | 3:4189a10038e6 | 6 | #include <NfcTag.h> |
yihui | 3:4189a10038e6 | 7 | |
yihui | 3:4189a10038e6 | 8 | class MifareClassic |
yihui | 3:4189a10038e6 | 9 | { |
yihui | 3:4189a10038e6 | 10 | public: |
yihui | 3:4189a10038e6 | 11 | MifareClassic(PN532& nfcShield); |
yihui | 3:4189a10038e6 | 12 | ~MifareClassic(); |
yihui | 3:4189a10038e6 | 13 | NfcTag read(uint8_t *uid, unsigned int uidLength); |
yihui | 3:4189a10038e6 | 14 | bool write(NdefMessage& ndefMessage, uint8_t *uid, unsigned int uidLength); |
yihui | 3:4189a10038e6 | 15 | private: |
yihui | 3:4189a10038e6 | 16 | PN532* _nfcShield; |
yihui | 3:4189a10038e6 | 17 | int getBufferSize(int messageLength); |
yihui | 3:4189a10038e6 | 18 | int getNdefStartIndex(uint8_t *data); |
yihui | 3:4189a10038e6 | 19 | bool decodeTlv(uint8_t *data, int &messageLength, int &messageStartIndex); |
yihui | 3:4189a10038e6 | 20 | }; |
yihui | 3:4189a10038e6 | 21 | |
yihui | 3:4189a10038e6 | 22 | #endif |