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.
Dependencies: DebugLib EthernetInterface cantcoap mbed-rtos
Fork of yeswecancoap by
You are viewing an older revision! See the latest version
Homepage
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¶
Coap server example with get /hello resource
#include "mbed.h"
#include "coap.h"
void get_hello(Request* req, Response* res)
{
res->setContent("Hello world\r\n", 13);
}
int main() {
Server server;
server.enableBroadcast();
server.add("/hello", &get_hello, GET);
while(1)
{
server.waitForRequest();
};
}
Coap client example¶
under construction
