hirotakaster / coap-simple-library Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Compiling fails for me with:
coap-simple.cpp: In member function bool Coap::loop()
coap-simple.cpp: 239:43: error: statement has no effect [-Werror=unused-value]
packet.options[optionIndex]
coap-simple.cpp: 267:55: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null]
urlname[packet.options[i].length] = NULL
coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t)
coap-simple.cpp: 298:1: error: no return statement in function returning non-void [-Werror=return-type]
coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t, char*)
coap-simple.cpp: 302:1: error: no return statement in function returning non-void [-Werror=return-type]
coap-simple.cpp: In member function uint16_t Coap::sendResponse(IPAddress, int, uint16_t, char*, int)
coap-simple.cpp: 306:1: error: no return statement in function returning non-void [-Werror=return-type]
cc1plus.exe*: some warnings being treated as errors
Error compiling libraries
I am running Visual Studio 2017 with vMicro, compiling for an ESP32 Dev Module.
Is that a known issue?
Best regards and thanks for your great work!
Keith
I ran into an issue using this library running on an ESP32, talking to a host application in Python using aiocoap. I am just starting with COAP, so I might be missing something, but I was able to fix it as follows:
Problem: aiocoap would keep sending a message and a reset because it could not associate the response from the ESP32 with a message it had sent. For my application, including the (packet.tokens, packet.tokenlen) in the call to sendResponse fixed the issue, but when the Python script requested an endpoint that I did not have on the ESP32 side, the problem persisted.
Suspected cause: aiocoap using tokens in a way not compatible with CoAP-simple
Work around/fix: I changed line 287/288 of coap-simple.cpp to read:
sendResponse(_udp->remoteIP(), _udp->remotePort(), packet.messageid, NULL, 0,COAP_NOT_FOUNT, COAP_NONE, packet.token, packet.tokenlen);
This way, when an unknown URI is requested, the response just also includes any tokens sent.
This fixed the problem. This did not happen when using Linux coap-client.
Hi, I'm using the code esp32.ino to connect to CoAP but when it's connected to WiFi it only shows Setup Callback Light text
Setup Response Callback on serial monitor and on Copper no server appears after entering the IP address even after I click discover and ping, what is the solution?
Hi,
I'm trying to use your library with the Arduino Uno and I get the error message:
Arduino: 1.8.13 (Linux), Board: "Arduino Uno"
In file included from /home/alex/arduino_sketchbook/libraries/CoAP_simple_library/examples/coapserver/coapserver.ino:6:0:
/home/alex/arduino_sketchbook/libraries/CoAP_simple_library/coap-simple.h:26:10: fatal error: functional: No such file or directory
#include <functional>
^~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any ideas?
I feel like I must be missing something really obvious! 👍
Regards,
Alex
I am just trying out your library! Thanks for your contribution. Any chance to see an implementation for service/resource discovery?
Hi,
Is it possible to extend the coap packet data size ?
It is set too 128 in coap-simple.h : COAP_BUF_MAX_SIZE 128
This is on an Arduino MKR NB 1500 using a uBlox SARA-R410M-02B modem.
On bigger packets send just returns 0 msgid.
The NB-IOT MTU seem to be 1600.
CoAP-simple-library/coap-simple.cpp
Line 123 in f3ab245
Need pass type, method, token,tokenlen to send function.
uint16_t Coap::send(IPAddress ip, int port, char *url, COAP_TYPE type, COAP_METHOD method, uint8_t *token, uint8_t tokenlen, uint8_t *payload, uint32_t payloadlen) { return this->send(ip, port, url, type, method, token, tokenlen, (uint8_t *)payload, payloadlen, COAP_NONE); }
I am trying to test esp32.ino file but i'm not able .
Arduino: 1.8.8 (Linux), Board: ""WeMos" WiFi&Bluetooth Battery, 80MHz, 921600, None"
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:26:0,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:102:19: error: variable or field 'coap_address_init' declared void
coap_address_init(coap_address_t *addr) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:102:19: error: 'coap_address_t' was not declared in this scope
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:102:35: error: 'addr' was not declared in this scope
coap_address_init(coap_address_t *addr) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:118:27: error: 'coap_address_t' does not name a type
coap_address_equals(const coap_address_t *a, const coap_address_t *b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:118:52: error: 'coap_address_t' does not name a type
coap_address_equals(const coap_address_t *a, const coap_address_t *b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h: In function 'int coap_address_equals(const int*, const int*)':
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:120:40: error: '_coap_address_equals_impl' was not declared in this scope
return _coap_address_equals_impl(a, b);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h: At global scope:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:130:26: error: 'coap_address_t' does not name a type
coap_address_isany(const coap_address_t *a) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h: In function 'int coap_address_isany(const int*)':
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:132:36: error: '_coap_address_isany_impl' was not declared in this scope
return _coap_address_isany_impl(a);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h: At global scope:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:147:21: error: 'coap_address_t' does not name a type
coap_is_mcast(const coap_address_t *a) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h: In function 'int coap_is_mcast(const int*)':
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/address.h:148:36: error: '_coap_is_mcast_impl' was not declared in this scope
return a && _coap_is_mcast_impl(a);
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:23:0,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:18,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:27,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_io.h: At global scope:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_io.h:50:3: error: 'coap_address_t' does not name a type
coap_address_t addr; /**< local interface address */
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_io.h:58:42: error: 'coap_address_t' does not name a type
coap_endpoint_t *coap_new_endpoint(const coap_address_t *addr, int flags);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_io.h:77:33: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_io.h:116:53: error: 'coap_address_t' has not been declared
void coap_packet_copy_source(coap_packet_t *packet, coap_address_t *target);
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:24:0,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:18,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:27,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:128:32: error: 'coap_time_lt' declared as an 'inline' variable
static inline int coap_time_lt(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:128:32: error: 'coap_tick_t' was not declared in this scope
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:128:47: error: 'coap_tick_t' was not declared in this scope
static inline int coap_time_lt(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:128:60: error: expression list treated as compound expression in initializer [-fpermissive]
static inline int coap_time_lt(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:128:62: error: expected ',' or ';' before '{' token
static inline int coap_time_lt(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:136:32: error: 'coap_time_le' declared as an 'inline' variable
static inline int coap_time_le(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:136:32: error: 'coap_tick_t' was not declared in this scope
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:136:47: error: 'coap_tick_t' was not declared in this scope
static inline int coap_time_le(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:136:60: error: expression list treated as compound expression in initializer [-fpermissive]
static inline int coap_time_le(coap_tick_t a, coap_tick_t b) {
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap_time.h:136:62: error: expected ',' or ';' before '{' token
static inline int coap_time_le(coap_tick_t a, coap_tick_t b) {
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:18:0,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:27,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:33:3: error: 'coap_tick_t' does not name a type
coap_tick_t t; /**< when to send PDU for the next time */
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:38:3: error: 'coap_address_t' does not name a type
coap_address_t remote; /**< remote address */
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:64:47: error: 'coap_address_t' does not name a type
const coap_address_t *remote,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:89:3: error: 'coap_tick_t' does not name a type
coap_tick_t sendqueue_basetime;
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:126:33: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:162:56: error: 'coap_tick_t' has not been declared
unsigned int coap_adjust_basetime(coap_context_t *ctx, coap_tick_t now);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:177:40: error: 'coap_address_t' does not name a type
coap_context_t *coap_new_context(const coap_address_t *listen_addr);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:223:38: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:263:28: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:287:34: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:308:30: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:328:32: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:348:21: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:390:32: error: 'coap_address_t' does not name a type
void coap_transaction_id(const coap_address_t *peer,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:453:37: error: 'coap_address_t' does not name a type
const coap_address_t *dst,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:471:17: error: variable or field 'coap_ticks' declared void
void coap_ticks(coap_tick_t *);
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:471:17: error: 'coap_tick_t' was not declared in this scope
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/net.h:471:30: error: expected primary-expression before ')' token
void coap_ticks(coap_tick_t *);
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:27:0,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:39:3: error: 'coap_tick_t' does not name a type
coap_tick_t created;
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:49:3: error: 'coap_address_t' does not name a type
coap_address_t peer; /**< the peer to notify */
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:86:21: error: 'coap_address_t' has not been declared
coap_address_t *peer,
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h: In function 'void coap_touch_async(coap_async_state_t*)':
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:140:58: error: 'coap_async_state_t {aka struct coap_async_state_t}' has no member named 'created'
coap_touch_async(coap_async_state_t *s) { coap_ticks(&s->created); }
^
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/async.h:140:65: error: 'coap_ticks' was not declared in this scope
coap_touch_async(coap_async_state_t *s) { coap_ticks(&s->created); }
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/resource.h:36:0,
from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:39,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/subscribe.h: At global scope:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/subscribe.h:57:18: error: field 'subscriber' has incomplete type 'coap_address_t'
coap_address_t subscriber; /**< address and port of subscriber */
^
In file included from /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/coap.h:32:0,
from /home/user/Arduino/libraries/CoAP-simple-library/examples/esp32/esp32.ino:3:
/home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/tools/sdk/include/coap/debug.h:71:8: note: forward declaration of 'struct coap_address_t'
struct coap_address_t;
^
esp32:9:24: error: variable or field 'callback_response' declared void
void callback_response(CoapPacket &packet, IPAddress ip, int port);
^
esp32:9:24: error: 'CoapPacket' was not declared in this scope
esp32:9:36: error: 'packet' was not declared in this scope
void callback_response(CoapPacket &packet, IPAddress ip, int port);
^
esp32:9:54: error: expected primary-expression before 'ip'
void callback_response(CoapPacket &packet, IPAddress ip, int port);
^
esp32:9:58: error: expected primary-expression before 'int'
void callback_response(CoapPacket &packet, IPAddress ip, int port);
^
esp32:12:21: error: variable or field 'callback_light' declared void
void callback_light(CoapPacket &packet, IPAddress ip, int port);
^
esp32:12:21: error: 'CoapPacket' was not declared in this scope
esp32:12:33: error: 'packet' was not declared in this scope
void callback_light(CoapPacket &packet, IPAddress ip, int port);
^
esp32:12:51: error: expected primary-expression before 'ip'
void callback_light(CoapPacket &packet, IPAddress ip, int port);
^
esp32:12:55: error: expected primary-expression before 'int'
void callback_light(CoapPacket &packet, IPAddress ip, int port);
^
esp32:16:1: error: 'Coap' does not name a type
Coap coap(udp);
^
esp32:22:21: error: variable or field 'callback_light' declared void
void callback_light(CoapPacket &packet, IPAddress ip, int port) {
^
esp32:22:21: error: 'CoapPacket' was not declared in this scope
esp32:22:33: error: 'packet' was not declared in this scope
void callback_light(CoapPacket &packet, IPAddress ip, int port) {
^
esp32:22:51: error: expected primary-expression before 'ip'
void callback_light(CoapPacket &packet, IPAddress ip, int port) {
^
esp32:22:55: error: expected primary-expression before 'int'
void callback_light(CoapPacket &packet, IPAddress ip, int port) {
^
Multiple libraries were found for "WiFi.h"
Used: /home/user/.arduino15/packages/esp32/hardware/esp32/1.0.1/libraries/WiFi
Not used: /opt/arduino-1.8.8/libraries/WiFi
exit status 1
variable or field 'callback_response' declared void
Hello,
I'm using the library with an esp8266 project. If I use just the client, ignoring all UDP input processing (i.e. not calling loop()
) everything works fine. However, when using loop()
sometimes the controller resets due to an exception accessing memory (stack trace and analysis below at the end).
The offending line seems to be
CoAP-simple-library/coap-simple.cpp
Line 276 in 1945070
More debugging revealed the following:
(COAP_HEADER_SIZE + packet.tokenlen < packetlen)
can be false, thus the branch at https://github.com/hirotakaster/CoAP-simple-library/blob/master/coap-simple.cpp#L245 is not executed. Therefore, packet.optionnum
is not initialised.https://github.com/hirotakaster/CoAP-simple-library/blob/master/coap-simple.cpp#L275 (for non ACK packets).
for
loop would attempt to parse options beyond the maximum expected.If I initialise the CoapPacket
fields to zero, the problem is fixed.
Another, unrelated problem (which I'm not sure deserves another issue) is that it seems my CoAP server (different system) replies with packets type=0 (CON) code=2.31 (success/continue). The code assumes that all non-ACK packets are GET/PUT/POST/DELETE, so it will reply to these packages sending COAP_NOT_FOUNT
. I'm new to CoAP so I'm not sure if what the other server is doing is really valid (maybe is doing this to keep checking the device?). However, I think the code could still be improved to avoid sending NOT_FOUND for non-request packets.
In summary, I think:
CoapPacket
class would fix the exception.Stacktrace:
Exception (3):
epc1=0x402026bc epc2=0x00000000 epc3=0x00000000 excvaddr=0x40000000 depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffff8f0 end: 3fffffc0 offset: 01a0
3ffffa90: feefeffe feefeffe feefeffe feefeffe
3ffffaa0: 9ec44340 feefeffe feefeffe feefeffe
3ffffab0: feefeffe feefeffe feefeffe feefeffe
3ffffac0: feefeffe feefeffe feefeffe feefeffe
3ffffad0: feefeffe feefeffe feefeffe feefeffe
3ffffae0: feefeffe feefeffe feefeffe feefeffe
3ffffaf0: feefeffe feefeffe feefeffe feefeffe
3ffffb00: feefeffe feefeffe feefeffe feefeffe
3ffffb10: feefeffe feefeffe feefeffe feefeffe
3ffffb20: feefeffe feefeffe feefeffe feefeffe
3ffffb30: feefeffe feefeffe feefeffe feefeffe
3ffffb40: feefeffe feefeffe feefeffe feefeffe
3ffffb50: feefeffe feefeffe feefeffe feefeffe
3ffffb60: feefeffe feefeffe feefeffe feefeffe
3ffffb70: feefeffe feefeffe feefeffe feefeffe
3ffffb80: feefeffe feefeffe feefeffe feefeffe
3ffffb90: 00000005 00000000 00000020 40100154
3ffffba0: feefeffe feefeffe 00000005 401013dc
3ffffbb0: 3ffe8ec5 40104693 3ffec950 feefeffe
3ffffbc0: 40101f77 3ffec950 feefeffe feefeffe
3ffffbd0: 0000000d 000160cb 3ffed38c 40102158
3ffffbe0: 3ffe974c 00000000 00000000 feefeffe
3ffffbf0: 00000002 00000000 0000000a 00000000
3ffffc00: 00000002 00000000 0000000a 00000000
3ffffc10: 00000001 00000080 feefeffe feefeffe
3ffffc20: 00000000 a0000000 00000000 0000001c
3ffffc30: 00002000 2c9f0300 00002000 00000000
3ffffc40: 3ffffda0 00000000 3ffffda0 40211bc2
3ffffc50: 0000a000 3ffffd43 00000016 ffffffff
3ffffc60: 400044ab 3fffc718 4020dc0d 00000003
3ffffc70: 3ffffda0 00000003 3ffffda0 40211bc2
3ffffc80: 3ffffd00 3ffffd40 3ffffcb0 00000000
3ffffc90: 402563c0 0000049c 003fe000 40211af8
3ffffca0: 3ffffda0 3ffffd40 3ffffd00 4020dd38
3ffffcb0: 00000003 80af1999 feefeffe 00000001
3ffffcc0: 3ffe8304 00000000 0000000a 40259db9
3ffffcd0: 3ffffd43 00000002 00000000 00000000
3ffffce0: 00000008 00000000 00000010 3ffe88e0
3ffffcf0: 00000000 3ffe88df 3ffffda0 40211ff3
3ffffd00: 00000000 ffffffff ffffffff 00000000
3ffffd10: 00000003 0000000d 00302064 0000001b
3ffffd20: 00004000 40239794 00004000 00000000
3ffffd30: 3ffffe90 00000000 3ffffe90 40211bc2
3ffffd40: 00303032 3ffffe33 3ffed29c 3ffef674
3ffffd50: 3ffe8b75 40103b15 00000000 00000002
3ffffd60: 3ffffe30 3ffffe20 00000018 3ffe8304
3ffffd70: 00000003 00000009 00000001 00000000
3ffffd80: 4010358b 00040000 00000000 3ffffeb8
3ffffd90: 3ffe8785 3fffff40 00000000 4020e3dc
3ffffda0: 3ffffec5 401024eb 7ffffff2 ffff0208
3ffffdb0: 3ffffeb8 7fffffff 00000010 40259da8
3ffffdc0: 3ffffe33 00000008 00000000 3fffc278
3ffffdd0: 4010233c 3fffc200 00000022 3ffe8900
3ffffde0: 00000000 3ffe88ff 3ffffe90 40211ff3
3ffffdf0: 00002030 ffffffff ffffffff 00000002
3ffffe00: 4020ba10 c801a8c0 3ffffe30 3ffffe20
3ffffe10: 0000270f 3ffee864 4020570c 3ffffe70
3ffffe20: 0000000c 0000000b 000000c0 000000a8
3ffffe30: 00000001 000000c8 3ffe8304 3ffffeb8
3ffffe40: 3ffe8785 3fffff40 3ffe87a1 4020241d
3ffffe50: 3ffe0200 00000000 00000000 3fffff80
3ffffe60: f42d000b 00000005 00000d03 3ffffeb8
3ffffe70: 3fff030b 3ffe8785 0000020b 3ffe8789
3ffffe80: 3fffff00 00000000 39303532 4020a2b1
3ffffe90: 3fffff00 3ffeea90 7fffffee ffff0208
3ffffea0: 3fff4300 00000000 3ffffe00 3ffeea90
3ffffeb0: c49e7ab4 3ffeea90 3ffffefb 40207ac0
3ffffec0: 40207ab4 3ffeea90 3ffffefb 40207d89
3ffffed0: 00000036 0000000a 3ffffefa 40207f69
3ffffee0: 3ffee7b8 0000270f 00000025 0000002f
3ffffef0: 3ffe8922 00000000 68000a0d 4020a2b1
3fffff00: 3ffe8922 00000000 3fff10bc 3ffeeb1c
3fffff10: 007a1200 8a1e9c00 3ffee700 80feeb1c
3fffff20: 4010505d 001ca730 3ffeeb78 00000000
3fffff30: 00000029 3ffffea0 3fffff14 3ffeeb1c
3fffff40: 3fffdad0 3ffeeb78 00000064 402092e3
3fffff50: 4020989d 00000064 3ffeeb1c 3ffeeb1c
3fffff60: 3fffdad0 3ffee7b8 3fffff80 4020147e
3fffff70: 00000000 00000000 3fffff80 0000000b <
3fffff80: 6574227b 223a226c 007d2231 4020ba10
3fffff90: c801a8c0 00000000 3ffeeadc 402013f5
3fffffa0: feefeffe 00000000 3ffeeadc 402093f8
3fffffb0: feefeffe feefeffe 3ffe8530 40100bcd
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1392, room 16
tail 0
chksum 0xd0
csum 0xd0
v3d128e5c
Analysis:
Exception Cause: 3 [LoadStoreError: Processor internal physical address or data error during load or store]
0x402026bc: Coap::loop() at ??:?
0x40000000: ?? ??:0
0x40100154: ets_post at ??:?
0x401013dc: pp_post at ??:?
0x40104693: lmacRxDone at ??:?
0x40101f77: rcReachRetryLimit at ??:?
0x40102158: rcReachRetryLimit at ??:?
0x40211bc2: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:233
0x400044ab: ?? ??:0
0x4020dc0d: _printf_i at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c:194 (discriminator 1)
0x40211bc2: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:233
0x402563c0: sleep_reset_analog_rtcreg_8266 at ??:?
0x40211af8: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:180
0x4020dd38: _printf_i at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c:246
0x40259db9: sleep_reset_analog_rtcreg_8266 at ??:?
0x40211ff3: _svfprintf_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:667
0x40239794: cnx_start_handoff_cb at ??:?
0x40211bc2: __ssputs_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:233
0x40103b15: lmacRecycleMPDU at ??:?
0x4010358b: lmacProcessTXStartData at ??:?
0x4020e3dc: sprintf at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/sprintf.c:646
0x401024eb: wDev_ProcessFiq at ??:?
0x40259da8: sleep_reset_analog_rtcreg_8266 at ??:?
0x4010233c: wDev_ProcessFiq at ??:?
0x40211ff3: _svfprintf_r at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf.c:667
0x4020ba10: __run_user_rf_pre_init() at ??:?
0x4020570c: WiFiUDP::beginPacket(IPAddress, unsigned short) at ??:?
0x4020241d: Coap::send(IPAddress, int, char*, COAP_TYPE, COAP_METHOD, unsigned char*, unsigned char, unsigned char*, unsigned int, COAP_CONTENT_TYPE) at ??:?
0x4020a2b1: uart_write at ??:?
0x40207ac0: HardwareSerial::write(unsigned char const*, unsigned int) at ??:?
0x40207ab4: HardwareSerial::write(unsigned char const*, unsigned int) at ??:?
0x40207d89: Print::write(char const*) at ??:?
0x40207f69: Print::printNumber(unsigned long, unsigned char) at ??:?
0x4020a2b1: uart_write at ??:?
0x4010505d: ets_timer_arm_new at ??:?
0x402092e3: esp_yield at ??:?
0x4020989d: __delay at ??:?
0x4020147e: loop at ??:?
0x4020ba10: __run_user_rf_pre_init() at ??:?
0x402013f5: setup at ??:?
0x402093f8: loop_wrapper() at core_esp8266_main.cpp:?
0x40100bcd: cont_wrapper at ??:?
0x4010f000: ?? ??:0
The fix for #20 was (apparently) to revert the changes for #18.
#18 added use of std::function
for the callback function (as opposed to C-style function pointers). This enabled use of CoAP-simple-library in C++ programs where you have your callback methods inside objects.
Apparently this broke for @al3xsh hence the std::function was reverted for #20.
So, now it is broken for my use case again:-)
A solution that works for both use cases may be to use an ifdef around the include/typedef, so that it works both for older compilers (using a function pointer) and newer ones (using a std::function). Maybe something like (untested):
#if __cplusplus >= 200103L
#include <functional>
std::function<void (CoapPacket &, IPAddress, int)>CoapCallback;
#else
typedef void (*CoapCallback)(CoapPacket &, IPAddress, int);
#endif
Hello! Anyone know if this coap library manages the coap observe option?
Hi guys! I was wondering if in this library is possible to set the confirmable parameters for the coap requests. Any suggestion?
A URL with an added query, for example : "ps/sensors/?clientid=test1&retain=true" is parsed incorrectly. The library doesn't detect that the path ends before the question mark, and that the following tokens should be parsed as a UriQuery.
Hi,
Is it possible to get the response code of a PUT request? If it is yes, then how?
Hi, would you be interested in using the GitHub Actions CI/CD to automatically test (compilation only) CoAP-simple-library?
I'm investigating it at the moment for my own projects, to do builds with both PlatformIO and Arduino, for multiple architectures.
If you're interested I could experiment with a fork of CoAP-simple-library in stead of with the Blink project (as I'm doing now) and I could give you a pull request when/if I get something working...
I don't know what is the problem but the Coap-simple-library is not working to send response to client:
if (LEDSTATE) {
digitalWrite(2, HIGH) ;
coap.sendResponse(ip, port, packet.messageid, "1");
} else {
digitalWrite(2, LOW) ;
coap.sendResponse(ip, port, packet.messageid, "0");
}
even using your example test the response doesn't work. I had tested creating a client and server with 100% javascript + node working fine in tests. But When I send a PUT to Esp32 the led turn on and off, and the response to client is not OK! I used the the Coap Client on Android to confirm the problem.
Hi,
I am able to run your client code successfully.
But it looks like it is wihout DTLS. Is there any support with DTLS for Coap for Arduino for both Wifi and Etherenet ?
Thanks,
Jyoti Raj Sharma
Description:
After calling CoAP::start()
on my Arduino MKR NB 1500 board, the program hangs and does not continue executing. I'm really not sure what is happening.
I have included the relevant code snippet below:
#include <MKRNB.h>
#include <coap-simple.h>
NBClient nbClient;
NBUDP udp;
GPRS gprsAccess;
NB nbAccess;
Coap coap(udp);
void setup()
{
// 9600 Baudrate
Serial.begin(9600);
// Waiting for Serial port to Connect
while (!Serial)
;
Serial.println("Hello from setup!");
coap.start(); // Program hangs here
Serial.println("Coap Has Started");
}
void loop()
{
// Code for taking sensor readings and sending data
}
there is a way to specify a particular request type (GET, POST, PUT) when we ad a callback method with coap.server ?
Running code on esp12E and example is ESP8266 following is the response i'm getting on loop.
WiFi connected
IP address:
192.168.1.28
��bL����@h���90��.�JC��.............
WiFi connected
IP address:
192.168.1.28
?�)���9�`�9����jGI|�d.............
WiFi connected
IP address:
192.168.1.28
���Ԏ���@h�����!K$hb�C.............
WiFi connected
IP address:
192.168.1.28
F�)�����@hʪ0ε�KG���d.............
while on terminal following is the response: $ping
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
64 bytes from 192.168.1.28: icmp_seq=13 ttl=255 time=28.324 ms
Request timeout for icmp_seq 14
Request timeout for icmp_seq 15
Request timeout for icmp_seq 16
Request timeout for icmp_seq 17
Request timeout for icmp_seq 18
Hi, could it be possible for the library to support CoRE Link Format? About the resource discovery after a GET Request on "/.well-known/core". As an Arduino server, I can't find a solution to set up the attributes. There's nothing implemented yet, right? Thanks in advance for every reply.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.