Coap Client and Server

Dependencies:   DebugLib EthernetInterface cantcoap mbed-rtos

Dependents:   COAP coap

Fork of yeswecancoap by Sille Van Landschoot

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


All wikipages