Hello all,
Greeting for the day,
i am using zstack HA 1.20 sample temp sensor and sample thermostat project for testing.
1) my aim is to transfer array data from temp sensor to thermostat side(array has say 5 element).
i am successfully able to transfer char string from temp to thermostat but i am not able to transfer array data from one end to other end over zigbee. below is my code which i used for sending and receiving array.... anyone plz tell me how can i achieve my task...
MY CODE :-
Temp side =>
int i = 0; // local variable for loop
int8 newarr[] = {1,2,3,4,5,6,7} ; //my array
if(pReportCmd != NULL)
{
pReportCmd->numAttr = 1;
pReportCmd->attrList[0].attrID = ATTRID_MS_TEMPERATURE_ARRAY_VALUE;
pReportCmd->attrList[0].dataType = ZCL_DATATYPE_ARRAY;
for( i = 0; i< 7; i++) // for loop for sending each array element sequentially
{
pReportCmd->attrList[0].attrData = (void *)(&newarr [i]);
zcl_SendReportCmd( SAMPLETEMPERATURESENSOR_ENDPOINT, &zclSampleTemperatureSensor_DstAddr,
ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
pReportCmd, ZCL_FRAME_SERVER_CLIENT_DIR, TRUE, zclSampleTemperatureSensorSeqNum++ );
}
}
Note -> i tried same code with and without for loop and with some minor change like -> instead of (void *)(&newarr[i]) i used (void *)(&newarr)
Thermostat Side =>
if ( pInTempSensorReport->attrList[0].attrID == ATTRID_MS_TEMPERATURE_ARRAY_VALUE )
{
if (pInTempSensorReport->attrList[0].dataType==ZCL_DATATYPE_ARRAY)
{
for(i = 0; i<7; i++)
{
UARTprintf("received Data is %d\n", (pInTempSensorReport->attrList[0].attrData[i]));
}
}
}
in thermostat side i am just trying to print array data but i am getting garbage value only....
i am not able to receive data which i am sending from temp side...
i am able to transmit and receive char string properly but i dont know why array is not working.....
anyone plz check my above code and suggest me what i am doing wrong or what changes i need to do to transmit and receive array data properly.
anyone plz help me to solve my above issue.....
Thanks & Regards,
Maneesh singh