Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: PN532_write_tag PN532_read_tag PN532_P2P P2P_temp
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 class SNEP { 00017 public: 00018 SNEP(PN532Interface &interface) : llcp(interface) { 00019 headerBuf = llcp.getHeaderBuffer(&headerBufLen); 00020 }; 00021 00022 /** 00023 * @brief write a SNEP packet, the packet should be less than (255 - 2 - 3) bytes 00024 * @param buf the buffer to contain the packet 00025 * @param len lenght of the buffer 00026 * @param timeout max time to wait, 0 means no timeout 00027 * @return >0 success 00028 * =0 timeout 00029 * <0 failed 00030 */ 00031 int8_t write(const uint8_t *buf, uint8_t len, uint16_t timeout = 0); 00032 00033 /** 00034 * @brief read a SNEP packet, the packet will be less than (255 - 2 - 3) bytes 00035 * @param buf the buffer to contain the packet 00036 * @param len lenght of the buffer 00037 * @param timeout max time to wait, 0 means no timeout 00038 * @return >=0 length of the packet 00039 * <0 failed 00040 */ 00041 int16_t read(uint8_t *buf, uint8_t len, uint16_t timeout = 0); 00042 00043 private: 00044 LLCP llcp; 00045 uint8_t *headerBuf; 00046 uint8_t headerBufLen; 00047 }; 00048 00049 #endif // __SNEP_H__
Generated on Sat Jul 23 2022 01:57:57 by
1.7.2
Seeed NFC Shield V2.0