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
response.cpp@29:62113a57353b, 2015-11-17 (annotated)
- Committer:
- sillevl
- Date:
- Tue Nov 17 16:44:39 2015 +0000
- Revision:
- 29:62113a57353b
- Parent:
- 23:019c530468b4
added method to get the ip address
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sillevl | 4:34a62b7cb2f9 | 1 | #include "response.h" |
sillevl | 4:34a62b7cb2f9 | 2 | |
sillevl | 4:34a62b7cb2f9 | 3 | |
sillevl | 4:34a62b7cb2f9 | 4 | Response::Response() : CoapPDU() |
sillevl | 4:34a62b7cb2f9 | 5 | { |
sillevl | 5:1924c60356d0 | 6 | |
sillevl | 5:1924c60356d0 | 7 | } |
sillevl | 5:1924c60356d0 | 8 | |
sillevl | 5:1924c60356d0 | 9 | Response::Response(uint8_t *pdu, int pduLength) : CoapPDU(pdu, pduLength) |
sillevl | 5:1924c60356d0 | 10 | { |
sillevl | 4:34a62b7cb2f9 | 11 | |
sillevl | 5:1924c60356d0 | 12 | } |
sillevl | 5:1924c60356d0 | 13 | |
sillevl | 5:1924c60356d0 | 14 | Response::Response(uint8_t *buffer, int bufferLength, int pduLength) : CoapPDU(buffer, bufferLength, pduLength) |
sillevl | 5:1924c60356d0 | 15 | { |
sillevl | 4:34a62b7cb2f9 | 16 | |
sillevl | 6:0c477f5b79ff | 17 | } |
sillevl | 6:0c477f5b79ff | 18 | |
sillevl | 6:0c477f5b79ff | 19 | void Response::setContent(char* content, int length) |
sillevl | 6:0c477f5b79ff | 20 | { |
sillevl | 7:1bed29e1b0a4 | 21 | CoapPDU::setCode(Response::COAP_CONTENT); |
sillevl | 6:0c477f5b79ff | 22 | setPayload(reinterpret_cast<uint8_t*>(content), length); |
sillevl | 23:019c530468b4 | 23 | } |
sillevl | 23:019c530468b4 | 24 | |
sillevl | 23:019c530468b4 | 25 | void Response::setCode(int code) |
sillevl | 23:019c530468b4 | 26 | { |
sillevl | 23:019c530468b4 | 27 | CoapPDU::setCode((CoapPDU::Code) code); |
sillevl | 4:34a62b7cb2f9 | 28 | } |