In attrTbl[] I have the following definition: for (custom) ZCL_ATTRID_KEYPAD1:
{ ZCL_ATTRID_KEYPAD1, ZCL_DATA_TYPE_ARRAY, ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE, (u8*)&g_zcl_keypadAttrs.keypad1},
and attribute defined:
u8 keypad1[3];
When I try to read this attribute I don t get any value. In the response, after data type array 0x48 I get nothing, just a message ending 0xAA.
Is it something in the Gateway processing and converting response to zbhci or device sending wrong data?
Edit:
After checking, in Gateway, sampleGW_zclReadRspCmd(), dataLen for array data type received = 0.
Trying to write an array 0x01 0x02 0x03 using ZGC Tool I get this ZBHCI message sent to the gateway:
23-03-21 06:41:32.363122 send-->:55 01 01 00 0e 6b 02 7e 21 01 02 01 04 00 00 06 01 40 31 48 aa
There is no array data included in the message!
I tried to put data in different way - 0x01 0x02 0x03/ 01 02 03/ 0x010203 - but nothing works. And there is nothing in the send msg that shows an error, as it is in different messages showing cc for incorrect value.
So does reading or writing of data type array (0x48) works?
No related topics |
HI,
It is need you to modify code to match your arry lenghts,because the length of arry is variable,can not fixed.
Well,
You can get the size of array using sizeof(variable_array), can t you?
What about other data types: ZCL_DATA_TYPE_CHAR_STR, ZCL_DATA_TYPE_OCTET_STR, ZCL_DATA_TYPE_LONG_OCTET_STR, ZCL_DATA_TYPE_LONG_CHAR_STR, ZCL_DATA_TYPE_STRUCT?
All this has to be modified?
1. ZGC Tool doesn t work with array. I didn t check any other data types. Who can fix this?
2. ZBHCI_CMD_ZCL_ATTR_WRITE - I can modify gateway command ZBHCI_CMD_ZCL_ATTR_WRITE.
I send ZBHCI message data type (48) and 3 bytes of data
5501010011FE02A1640102010400000601403148111213AA
the response I get is:
55820000090002A164010200060049AA
558101000A24A16402016E000600FFFFAA
So what is this response?
The device, in app_zclWriteReqCmd() receives correct attrId and correct dataType. But there is no data!
Here is what I get when I read data - pInHdlrMsg->pData
843b08: 31 40 48 00 00 00 00 00 00 00
There is only attrTd and dataType
So what is wrong?
3. ZBHCI_CMD_ZCL_ATTR_READ. Respond to this command in the device is not in the code of the app. It is somewhere in the SDK. I don t know what I would have to modify and where?
Here is message sent:
550100000DBB02A16401020104000006014031AA
Response received:
55820000090302A16401020006004AAA
558100000C1AA16402016F00060140310048AA
Edit:
I had a look in ZCL.c in function zcl_getAttrSize() and noticed that there is no ZCL_DATA_TYPE_ARRAY.
So I added
}else if(dataType == ZCL_DATA_TYPE_ARRAY){
dataLen = *pData + 1; //array length + 1 for length field
For the Gateway:
In zbhci_zclHandler.c in function zbhci_clusterCommonCmdHandle()I had to add
if( (pWriteRec->dataType != ZCL_DATA_TYPE_LONG_CHAR_STR) && (pWriteRec->dataType != ZCL_DATA_TYPE_LONG_OCTET_STR) && (pWriteRec->dataType != ZCL_DATA_TYPE_CHAR_STR) && (pWriteRec->dataType != ZCL_DATA_TYPE_OCTET_STR) && (pWriteRec->dataType != ZCL_DATA_TYPE_STRUCT) && (pWriteRec->dataType != ZCL_DATA_TYPE_ARRAY) ){
ZB_LEBESWAP(pBuf, attrDataLen); }
Now, when I send ZBHCI message to write attribute I had to add the size of array in the message after 0x48 - dataType 5501010011FE02A164010201040000060140314803111213AA
Sending data like this I receive in the device correct data.
For the device,
If I add the same line in ZCL.c, my attribute array would have to include as first byte size of array - i.e
{0x03, 0x11, 0x12, 0x13}
I am not sure if that is a correct way of doing things!