Z-Stack Home 1.2.2a.44539:
Now use switch project , i want get Report when zclSampleSw_OnOff change.How use ACCESS_REPORTABLE? ,please provide demo.
Thank you!!!!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Yes.
You can refer to the following codes in red.
static void zclSampleLight_OnOffCB( uint8 cmd )
{
zclReportCmd_t rptcmd;
// Turn on the light
if ( cmd == COMMAND_ON )
zclSampleLight_OnOff = LIGHT_ON;
// Turn off the light
else if ( cmd == COMMAND_OFF )
zclSampleLight_OnOff = LIGHT_OFF;
// Toggle the light
else
{
if ( zclSampleLight_OnOff == LIGHT_OFF )
zclSampleLight_OnOff = LIGHT_ON;
else
zclSampleLight_OnOff = LIGHT_OFF;
}
// In this sample app, we use LED4 to simulate the Light
if ( zclSampleLight_OnOff == LIGHT_ON )
HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
else
HalLedSet( HAL_LED_4, HAL_LED_MODE_OFF );
rptcmd.numAttr = 1;
rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
rptcmd.attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;
zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT, 0,
ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd,
ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );
}