NFC library using PN532 to read/write NDEF Messages to NFC tags
Dependents: Seeed_NFC_Shield_write Nucleo_test_nfc
Fork of PN532 by
snep.h
00001 00002 00003 #ifndef __SNEP_H__ 00004 #define __SNEP_H__ 00005 00006 #include "llcp.h" 00007 00008 #define SNEP_DEFAULT_VERSION 0x10 // Major: 1, Minor: 0 00009 00010 #define SNEP_REQUEST_PUT 0x02 00011 #define SNEP_REQUEST_GET 0x01 00012 00013 #define SNEP_RESPONSE_SUCCESS 0x81 00014 #define SNEP_RESPONSE_REJECT 0xFF 00015 00016 /** 00017 * The SNEP class 00018 */ 00019 class SNEP { 00020 public: 00021 SNEP(PN532Interface &interface) : llcp(interface) { 00022 headerBuf = llcp.getHeaderBuffer(&headerBufLen); 00023 }; 00024 00025 /** 00026 * @brief write a SNEP packet, the packet should be less than (255 - 2 - 3) bytes 00027 * @param buf the buffer to contain the packet 00028 * @param len lenght of the buffer 00029 * @param timeout max time to wait, 0 means no timeout 00030 * @return >0 success 00031 * =0 timeout 00032 * <0 failed 00033 */ 00034 int8_t write(const uint8_t *buf, uint8_t len, uint16_t timeout = 0); 00035 00036 /** 00037 * @brief read a SNEP packet, the packet will be less than (255 - 2 - 3) bytes 00038 * @param buf the buffer to contain the packet 00039 * @param len lenght of the buffer 00040 * @param timeout max time to wait, 0 means no timeout 00041 * @return >=0 length of the packet 00042 * <0 failed 00043 */ 00044 int16_t read(uint8_t *buf, uint8_t len, uint16_t timeout = 0); 00045 00046 private: 00047 LLCP llcp; 00048 uint8_t *headerBuf; 00049 uint8_t headerBufLen; 00050 }; 00051 00052 #endif // __SNEP_H__
Generated on Tue Jul 12 2022 21:59:39 by 1.7.2