cancel
Showing results for 
Search instead for 
Did you mean: 

otCoapSendResponse returns OT_ERROR_PARSE when adding a struct with a uint32_t non-null last element

I have a struct defined as:

struct sendIP_struct {
	char node_type[12];
	char description[8];
	uint32_t uid;
} msgSendMyIP = { .node_type = NODE_TYPE, .description = NODE_DESCRIPTION, .uid = 0 };

I take this struct and append it to a thread response message by calling otMessageAppend with no resulting errors. However, what I noticed is that if I pass this struct with .uid defined as anything but 0, otCoapSendResponse returns OT_ERROR_PARSE.

Per RFC 7252, section 5.2.1, I am trying to do a legal "piggybacked" response to a GET request.

After further testing, I found that it did work when I changed the last element in the struct from uint32_t to uint64_t.

struct sendIP_struct {
	char node_type[12];
	char description[8];
	uint64_t uid;
} msgSendMyIP = { .node_type = NODE_TYPE, .description = NODE_DESCRIPTION, .uid = 0 };

I set .uid to a value other than null and it all seemed to work just fine with the response being sent and no errors returned.

0 REPLIES 0