Library for handling subset of coap functionality by radio transmitter.
Dependencies: nRF24L01P cantcoap
Diff: coapServer.h
- Revision:
- 1:1d936c763440
- Parent:
- 0:6a6f97ca5572
- Child:
- 2:c3ca8b8526e0
--- a/coapServer.h Fri Jan 18 14:12:24 2019 +0000 +++ b/coapServer.h Sun Jan 20 13:48:02 2019 +0000 @@ -2,8 +2,8 @@ // Created by Kamil Mykitiuk on 2019-01-18. // -#ifndef COAPSERVER_H -#define COAPSERVER_H +#ifndef SLAVE_COAPSERVER_H +#define SLAVE_COAPSERVER_H #include "cantcoap.h" #include "radioWrapper.h" @@ -13,8 +13,6 @@ public: enum ERROR { - SERVER_RESPONSE_AMBIGOUS = -1, - SERVER_TIMED_OUT = -2, SMALL_BUFFER = -3, RADIO_NOT_WORKING = -4, UNKNOWN_URI = -5 @@ -26,22 +24,24 @@ }; private: - RadioWrapper radioWrapper; uint16_t lastMessageId; uint8_t lastMessageToken[4]; int listeningTimeout; - std::string **uris; + 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); - int urisNumber(); - void prepareAckPDU(CoapPDU& coapPDU); }; -#endif //COAPSERVER_H +#endif //SLAVE_COAPSERVER_H