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

Committer:
sillevl
Date:
Tue Nov 17 16:44:39 2015 +0000
Revision:
29:62113a57353b
Parent:
7:1bed29e1b0a4
added method to get the ip address

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sillevl 1:ab04e3d36ade 1 #include "request.h"
sillevl 1:ab04e3d36ade 2
sillevl 5:1924c60356d0 3 Request::Request() : CoapPDU()
sillevl 3:e03960f91763 4 {
sillevl 3:e03960f91763 5
sillevl 3:e03960f91763 6 }
sillevl 3:e03960f91763 7
sillevl 5:1924c60356d0 8 Request::Request(uint8_t *pdu, int pduLength) : CoapPDU(pdu, pduLength)
sillevl 1:ab04e3d36ade 9 {
sillevl 5:1924c60356d0 10
sillevl 3:e03960f91763 11 }
sillevl 3:e03960f91763 12
sillevl 5:1924c60356d0 13 Request::Request(uint8_t *buffer, int bufferLength, int pduLength) : CoapPDU(buffer, bufferLength, pduLength)
sillevl 3:e03960f91763 14 {
sillevl 5:1924c60356d0 15
sillevl 3:e03960f91763 16 }
sillevl 3:e03960f91763 17
sillevl 7:1bed29e1b0a4 18 char* Request::getContent()
sillevl 7:1bed29e1b0a4 19 {
sillevl 7:1bed29e1b0a4 20 return reinterpret_cast<char*>(CoapPDU::getPayloadPointer());
sillevl 7:1bed29e1b0a4 21 }
sillevl 7:1bed29e1b0a4 22
sillevl 7:1bed29e1b0a4 23 int Request::getContentLength()
sillevl 7:1bed29e1b0a4 24 {
sillevl 7:1bed29e1b0a4 25 return CoapPDU::getPayloadLength();
sillevl 7:1bed29e1b0a4 26 }
sillevl 7:1bed29e1b0a4 27
sillevl 7:1bed29e1b0a4 28 int Request::hasContent()
sillevl 7:1bed29e1b0a4 29 {
sillevl 7:1bed29e1b0a4 30 return CoapPDU::getPayloadLength();
sillevl 7:1bed29e1b0a4 31 }
sillevl 7:1bed29e1b0a4 32
sillevl 7:1bed29e1b0a4 33