Skip to main content
Associate II
Mar 6, 2024 11:51 AM UTC
Question

ZCL Data types - ZCL_DATATYPE_STRUCT

 

Hi,

 

I'm currently involved in implementing the transmission of variable-length data within Zigbee clusters. While I've successfully managed operations related to the String data type, I'm encountering challenges with the struct data type. I would appreciate it if you could review the provided code snippets and offer suggestions or corrections to address this issue.

 

// ZCL_DATATYPE_STRING_CHARACTER - This snippet worked fine
uint8_t myData[17] = " 123456789876543";

static struct ZbZclAttrT ZbZclAttrElecMeasAppendList[] =
{
{ZCL_OWN_ATTRIBUTE,
ZCL_DATATYPE_STRING_CHARACTER,
ZCL_ATTR_FLAG_WRITABLE,
32,
NULL, {0, 0xffff}, {0, 0}},
};

ZbZclAttrStringWriteShort(zigbee_app_info.elec_meas_server, ZCL_OWN_ATTRIBUTE, myData);

 

 

Encountered 0x86 error when I tried to do the same on Struct data type. Below, #1 and #2 none of them were worked for me. 

 

typedef struct {
 uint8_t A;
 uint16_t B;
 uint16_t C;
 uint16_t D;
 uint8_t E;
 uint32_t F;
} ZCL_MY_Attributes_t;

ZCL_MY_Attributes_t MY_SET = {0x01,
		0x1234,
		0x5678,
		0xABCD,
		0x00,
		0xEFABCDEF
};

static struct ZbZclAttrT ZbZclAttrElecMeasAppendList[] =
{
		{ZCL_OWN_ATTRIBUTE,
				ZCL_DATATYPE_STRUCT,
				ZCL_ATTR_FLAG_WRITABLE,
				15,
				NULL, {0, 0xffff}, {0, 0}},
};

// #1
//=====
ZbZclAttrStringWriteShort(zigbee_app_info.my_clus, ZCL_OWN_ATTRIBUTE, MY_SET);

// #2
// =====
ZbZclAttrWrite(zigbee_app_info.my_clus, NULL,
		 {ZCL_OWN_ATTRIBUTE, (const uint8_t *) MY_SET,
 	 	 15, ZCL_ATTR_FLAG_WRITABLE);

 

 

I'm seeking guidance on how to properly write data for the ZCL_DATATYPE_STRUCT. If you could provide insights or suggestions on the process, it would be greatly appreciated.

--

Naani Ch

This topic has been closed for replies.

1 reply

Roger SHIVELY
ST Employee
Mar 6, 2024 11:26 PM UTC

Hello @naanichilakalapudi,

Thank you for contacting STMicroelectronics.

Your post was escalated to ST Online Support Team for additional assistance.

Kind Regards,

Roger