Home/Support/Support Forum/Using ZDO/ZCL to format messages

Using ZDO/ZCL to format messages

0 votes
Hi,

I would like to use the ZCL structs like

zcl_attribute_base_t
zcl_attribute_full_t
etc

to formulate a message but send it on a timer. I'm just not sure how to string it all together. On another processor I did this:
Code:
char xbeeTransmitHeader [] = { 0x11, /* extended transmit */ 0x01, /* frame id 1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* coordinator */ 0xff, 0xfe, /* network address = broadcast */ 0x40, /* source endpoint */ 0x40, /* dest endpoint */ 0x00, 0x00, /* cluster id, big endian */ 0xDE, 0xED, /* profile id, big endian */ 0x00, /* max hops unlimited */ 0x00, /* transmit options */ /* ZCL Header */ 0x10, /* frame control, disable default response */ 0x01, /* transaction sequence number */ 0x0A, /* command id = report attributes */ }; struct Payload { uint16_t attributeId; uint8_t type; float value; } __attribute((__packed__))__;



That basically defines an extended transmit request. In this new case, what I'd like to do is basically the same thing but it seems like the zcl library in the sdk should do most of the work for me, and I should be able to define a
Code:
zcl_attribute_base_t object_descrs = { 0, ZCL_ATTRIB_FLAG<NONE, ZCL_TYPE_FLOAT_SINGLE, &value1 }, ... };

then at some point do something like:
Code:
zcl_send_now( clusterId, object_descrs ) ;

Does anybody have any examples of how to string this together?
asked Oct 28, 2014 in XBee Programmable Development by wz2b New to the Community (36 points)

Please log in or register to answer this question.

2 Answers

0 votes
I'm not sure what you mean by this. The Read Attributes command takes an entire list of attribute identifiers - you can read as many as will fit into a frame.

What I was really asking was for a way to format a message so that I can send it myself (unsolicited). This ties into my other question (about pubsub). What I am going to do is to have an implied subscription on the end device, so that it sends a "Report Attributes message (ZCL command 0x0A) periodically, with the destination being the coordinator.

I know how to formulate the message manually and just issue an "extended transmit' ... but I would like to learn how to use the ZCL library to specify the message so that I can work with the API structures and not have to generate the payload (byte[]) manually. I think the library can do that ... I just am having trtouble finding examples.
answered Oct 28, 2014 by wz2b New to the Community (36 points)
–1 vote
ZCL is designed so that you can only issue or query one command at a time. That means you need to break them up into separate requests.
answered Oct 28, 2014 by mvut Veteran of the Digi Community (11,392 points)
...