Coap Client and Server

Dependencies:   DebugLib EthernetInterface cantcoap mbed-rtos

Dependents:   COAP coap

Fork of yeswecancoap by Sille Van Landschoot

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

response.cpp

Committer:
sillevl
Date:
2015-11-17
Revision:
29:62113a57353b
Parent:
23:019c530468b4

File content as of revision 29:62113a57353b:

#include "response.h"


Response::Response() : CoapPDU()
{
       
}

Response::Response(uint8_t *pdu, int pduLength) : CoapPDU(pdu, pduLength)
{
    
}

Response::Response(uint8_t *buffer, int bufferLength, int pduLength) : CoapPDU(buffer, bufferLength, pduLength)
{
    
}

void Response::setContent(char* content, int length)
{
    CoapPDU::setCode(Response::COAP_CONTENT);
    setPayload(reinterpret_cast<uint8_t*>(content), length);
}

void Response::setCode(int code)
{
    CoapPDU::setCode((CoapPDU::Code) code);   
}