Coap Client and Server
Dependencies: DebugLib EthernetInterface cantcoap mbed-rtos
Fork of yeswecancoap by
YesWeCanCoap
Is a small coap client and server library for mbed based on the cantcoap library.
Import librarycantcoap
This is CoAP library with a focus on simplicity. It offers minimal CoAP PDU construction and decoding to and from byte buffers.
yeswecancoap server enables easy implementation of coap resources, each with a dedicated function. When the function is registered by the server, it will do the rest.
Coap server example
Repository: YesWeCanCoap-example
Coap client example
under construction
Diff: server.cpp
- Revision:
- 27:22436933025a
- Parent:
- 23:019c530468b4
- Child:
- 28:4f71d9d10011
--- a/server.cpp Wed Oct 21 17:15:23 2015 +0000 +++ b/server.cpp Thu Oct 22 08:09:13 2015 +0000 @@ -54,17 +54,17 @@ res->setToken(token,4); switch(req->getType()){ - case Response::COAP_NON_CONFIRMABLE: - res->setType(Response::COAP_NON_CONFIRMABLE); + case CoapPDU::COAP_NON_CONFIRMABLE: + res->setType(CoapPDU::COAP_NON_CONFIRMABLE); break; - case Response::COAP_CONFIRMABLE: - res->setType(Response::COAP_ACKNOWLEDGEMENT); + case CoapPDU::COAP_CONFIRMABLE: + res->setType(CoapPDU::COAP_ACKNOWLEDGEMENT); } - res->setCode(Response::COAP_NOT_FOUND); + res->setCode(CoapPDU::COAP_NOT_FOUND); if(resourceIndex != -1){ - res->setCode(Response::COAP_NOT_IMPLEMENTED); + res->setCode(CoapPDU::COAP_NOT_IMPLEMENTED); resources[resourceIndex].function((Request*)req, (Response*)res); }