Utility library to read and write Ndef messages from/to a Type4 NFC tag
Dependents: NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more
Fork of NDefLib by
NDEF NFC library
This library provides an abstract API to create NDEF formatted messages and records and to read/write them from/to a Type4 NFC Tag.
Implementations
At the moment, the NDEF API is implemented by X_NUCLEO_NFC01A1 and X_NUCLEO_NFC02A1 Dynamic NFC Tag libraries respectively driving the X-NUCLEO-NFC01A1 and X-NUCLEO-NFC02A1 boards.
Diff: RecordType/RecordURI.h
- Revision:
- 1:a0eeb478a45a
- Child:
- 4:eaf6c49a86e4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RecordType/RecordURI.h Tue Nov 24 14:33:06 2015 +0000 @@ -0,0 +1,104 @@ +/* + * RecordUri.h + * + * Created on: Nov 6, 2015 + * Author: giovanni visentini + */ + +#ifndef NDEFLIB_RECORDTYPE_RECORDURI_H_ +#define NDEFLIB_RECORDTYPE_RECORDURI_H_ +#include <map> +#include <string> +#include <NDefLib/Record.h> + +namespace NDefLib { + +class RecordURI: public Record { + +public: + + static RecordURI* parse(const Record::RecordHeader &header, + const uint8_t *buffer); + + typedef enum { + UNKNOWN=0X00, + HTTP_WWW =0X01, + HTTPS_WWW =0X02, + HTTP = 0X03, + HTTPS=0X04, + TEL=0x05, + MAIL=0X06, + FTP_ANONIMUS=0X07, + FTP_FTP=0X08, + FTPS=0X09, + SFTP=0X0A, + SMB=0X0B, + NFS=0X0C, + FTP=0X0d, + DAV=0X0E, + NEWS=0X0F, + TELNET=0X10, + IMAP=0X11, + RTSP=0X12, + URN=0X13, + POP=0X14, + SIP=0X15, + SIPS=0X016, + TFTP=0X017, + BTSPP=0x018, + BTL2CAP=0x019, + BTGOEP=0X01A, + TCPOBEX=0X1B, + IRDAOBEX=0X1C, + FILE=0X1D, + URN_EPC_ID=0X1E, + URN_EPC_TAG=0X1F, + URN_EPC_PAT=0X20, + URN_EPC_RAW=0X21, + URN_EPC=0X22, + URN_NFC=0X23 + } knowUriId_t; + + + + RecordURI(knowUriId_t uriId,const std::string &uriContent); + RecordURI(const std::string &uriType,const std::string &uriContent); + + virtual uint16_t write(uint8_t *buffer); + + virtual RecordType_t getType()const{ + return TYPE_URI; + }//getType + + knowUriId_t getUriId()const{ + return mUriTypeId; + } + + const std::string& getContent()const{ + return mContent; + } + + const std::string& getUriType()const{ + return mTypeString; + } + + virtual ~RecordURI(){}; + +protected: + static const uint8_t sNDEFUriIdCode; + +private: + + void setRecordHeader(); + + const knowUriId_t mUriTypeId; + const std::string mTypeString; + std::string mContent; + + + static const std::string sKnowUriPrefix[]; +}; + +} /* namespace NDefLib */ + +#endif /* NDEFLIB_RECORDTYPE_RECORDURI_H_ */