Skip to content

Commit

Permalink
Add debug print outs
Browse files Browse the repository at this point in the history
  • Loading branch information
rosetree committed Dec 9, 2019
1 parent aec61ba commit 06e7c1a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions saul_coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static ssize_t _saul_type_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, voi

cbor_err = cbor_encoder_create_array(&encoder, &aryEncoder, CborIndefiniteLength);
if (cbor_err != CborNoError) {
puts("Couldn’t create an cbor array");
return gcoap_response(pdu, buf, len, COAP_CODE_INTERNAL_SERVER_ERROR);
}

Expand All @@ -217,6 +218,10 @@ static ssize_t _saul_type_handler(coap_pkt_t* pdu, uint8_t *buf, size_t len, voi
memcpy(pdu->payload, cbor_buf, buf_size);
resp_len += buf_size;
} else {
puts("Could not reply with the cbor data.");
if (cbor_err != CborNoError) puts("CborError occured");
if (buf_size <= 0) puts("Buffer size is <= 0");
if (pdu->payload_len < buf_size) puts("Payload length is to short for buffer");
resp_len = gcoap_response(pdu, buf, len, COAP_CODE_INTERNAL_SERVER_ERROR);
}

Expand Down

0 comments on commit 06e7c1a

Please sign in to comment.