PN532 customized
Fork of PN532 by
MifareClassic.h@10:2fcf2448d199, 2016-02-11 (annotated)
- Committer:
- stanvn
- Date:
- Thu Feb 11 11:56:00 2016 +0000
- Revision:
- 10:2fcf2448d199
- Parent:
- 7:a26fa6ef10eb
Working code for reading type-a and type-b cards
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: |
stanvn | 7:a26fa6ef10eb | 11 | MifareClassic(PN532& nfcShield, uint8_t tag_type); |
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); |
stanvn | 7:a26fa6ef10eb | 20 | string type; |
yihui | 3:4189a10038e6 | 21 | }; |
yihui | 3:4189a10038e6 | 22 | |
yihui | 3:4189a10038e6 | 23 | #endif |