I am using custom clusters on ZED that report attributes. I am able to read these values from the CLI on my coordinator.
I have modified the CLI (zigbee_cli_cmd_attr.c) to read attributes scheduled by a timer and setting all the parameters of the read macros to read the attributes on the clusters. The CLI no longer parses any commands.
Issue:
I am able to read these values via the method below, however I am limited to 10 attribute reads before the buffer has no more attributes to read. I would get a "Value type 0x%x unsupported" message for the default switch case of . zcl_attr_to_str() when requesting more than 10 attributes.
when requesting ~>13, results in a hard fault:
E7FE b 0x0000035E <HardFault_Handler>
--- ses_startup_nrf52840.s -- 73 ---------------------------
.thumb_func
.weak MemoryManagement_Handler
MemoryManagement_Handler:
b .
Most of the attributes are type U32. There is some type bool and s32 as well. I have tried briefly changing the types to see if that has any effect, and I have not noticed anything different.
Method of attribute reading:
I am using ZB_ZCL_GENERAL_INIT_READ_ATTR_REQ,
looping : ZB_ZCL_GENERAL_ADD_ID_READ_ATTR_REQ for all the attributes to report, and ending with
ZB_ZCL_GENERAL_SEND_READ_ATTR_REQ.
then using a loop as before for each attribute to report, containing:
ZB_ZCL_GENERAL_GET_NEXT_READ_ATTR_RES with zcl_attr_to_str(); to convert data to a string. zcl_attr_to_str() uses a 2d character array to store the attributes. I was not able to reuse this as a 1D array in a loop and reuse the buffer.
#define max_buffers (20) //this should be index for each attribute
#define max_buffer_len (40) //this should be the character array for each attribute.
char attr_buffers [max_buffers][max_buffer_len];
and then just reading it out for now : NRF_LOG_INFO("attribute %d: %s",i,attr_buffers[i]);
Thanks,
Anderw