Library for handling subset of coap functionality by radio transmitter.
Dependencies: nRF24L01P cantcoap
coapServer.h
- Committer:
- Ka_myk
- Date:
- 2019-01-20
- Revision:
- 2:c3ca8b8526e0
- Parent:
- 1:1d936c763440
- Child:
- 4:9f635ab44d8e
File content as of revision 2:c3ca8b8526e0:
// // Created by Kamil Mykitiuk on 2019-01-18. // #ifndef SLAVE_COAPSERVER_H #define SLAVE_COAPSERVER_H #include "cantcoap.h" #include "radioWrapper.h" #include <string> class CoapServer { public: enum ERROR { SMALL_BUFFER = -3, RADIO_NOT_WORKING = -4, UNKNOWN_URI = -5, COAP_ERROR = -5 }; enum METHOD { GET = 1, POST = 2 }; private: uint16_t lastMessageId; uint8_t lastMessageToken[1]; int listeningTimeout; RadioWrapper radioWrapper; int urisNumber; std::string* uris; public: CoapServer(int timeout, std::string* uris, int urisNumber, int channel, unsigned long long rx_address, unsigned long long tx_address); int listen(uint8_t* buffer, int len, METHOD* requestMethod, int* uriNumber); int respond(int uri, uint8_t* buffer, int len, CoapPDU::Code responseCode); void prepareAckPDU(CoapPDU& coapPDU); }; #endif //SLAVE_COAPSERVER_H