This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
Dependencies: NDefLib X_NUCLEO_NFC01A1 mbed
Fork of X-MBED-NFC1 by
This application provides a set of demos with X-NUCLEO-NFC01A1 expansion board.
The available demos are:
- SAMPLE_WRITE_URL: write a tag with the ST home page URL
- SAMPLE_COUNT_CLICK: create a custom tag to count and report the user button clicks.
- SAMPLE_WRITE_AND_CHANGE_ALL: write a tag with all the supported records and update the tag contents when the user button is pressed.
- SAMPLE_LOCK_TAG_CONTENT: use the M24SR component API to set the NFC tag as read-only.
To enable the different demos comment/uncomment the SAMPLE_* macros provided in main.cpp .
Type4NfcTag.h@0:674813bd5ec9, 2015-11-19 (annotated)
- Committer:
- giovannivisentini
- Date:
- Thu Nov 19 08:50:18 2015 +0000
- Revision:
- 0:674813bd5ec9
first commit,
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| giovannivisentini | 0:674813bd5ec9 | 1 | /* |
| giovannivisentini | 0:674813bd5ec9 | 2 | * Type4NfcTag.h |
| giovannivisentini | 0:674813bd5ec9 | 3 | * |
| giovannivisentini | 0:674813bd5ec9 | 4 | * Created on: Nov 5, 2015 |
| giovannivisentini | 0:674813bd5ec9 | 5 | * Author: giovanni visentini |
| giovannivisentini | 0:674813bd5ec9 | 6 | */ |
| giovannivisentini | 0:674813bd5ec9 | 7 | |
| giovannivisentini | 0:674813bd5ec9 | 8 | #ifndef TYPE4NFCTAG_H_ |
| giovannivisentini | 0:674813bd5ec9 | 9 | #define TYPE4NFCTAG_H_ |
| giovannivisentini | 0:674813bd5ec9 | 10 | |
| giovannivisentini | 0:674813bd5ec9 | 11 | #include "NDefLib/Message.h" |
| giovannivisentini | 0:674813bd5ec9 | 12 | |
| giovannivisentini | 0:674813bd5ec9 | 13 | class Type4NfcTag { |
| giovannivisentini | 0:674813bd5ec9 | 14 | public: |
| giovannivisentini | 0:674813bd5ec9 | 15 | |
| giovannivisentini | 0:674813bd5ec9 | 16 | virtual bool openSession(bool force=false)=0; |
| giovannivisentini | 0:674813bd5ec9 | 17 | virtual bool closeSession()=0; |
| giovannivisentini | 0:674813bd5ec9 | 18 | |
| giovannivisentini | 0:674813bd5ec9 | 19 | bool write(NDefLib::Message &msg){ |
| giovannivisentini | 0:674813bd5ec9 | 20 | const uint16_t length = msg.getByteLenght(); |
| giovannivisentini | 0:674813bd5ec9 | 21 | uint8_t *buffer = new uint8_t[length]; |
| giovannivisentini | 0:674813bd5ec9 | 22 | msg.write(buffer); |
| giovannivisentini | 0:674813bd5ec9 | 23 | bool retValue = writeByte(buffer,length); |
| giovannivisentini | 0:674813bd5ec9 | 24 | delete [] buffer; |
| giovannivisentini | 0:674813bd5ec9 | 25 | return retValue; |
| giovannivisentini | 0:674813bd5ec9 | 26 | } |
| giovannivisentini | 0:674813bd5ec9 | 27 | |
| giovannivisentini | 0:674813bd5ec9 | 28 | virtual bool read(void*)=0; |
| giovannivisentini | 0:674813bd5ec9 | 29 | |
| giovannivisentini | 0:674813bd5ec9 | 30 | virtual ~Type4NfcTag(){}; |
| giovannivisentini | 0:674813bd5ec9 | 31 | |
| giovannivisentini | 0:674813bd5ec9 | 32 | protected: |
| giovannivisentini | 0:674813bd5ec9 | 33 | virtual bool writeByte(uint8_t *buffer,uint16_t lenght)=0; |
| giovannivisentini | 0:674813bd5ec9 | 34 | |
| giovannivisentini | 0:674813bd5ec9 | 35 | }; |
| giovannivisentini | 0:674813bd5ec9 | 36 | |
| giovannivisentini | 0:674813bd5ec9 | 37 | #endif /* TYPE4NFCTAG_H_ */ |
| giovannivisentini | 0:674813bd5ec9 | 38 |
