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.

CC2530: How use ACCESS_REPORTABLE?

Part Number: CC2530


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!!!!

  • Don't understand your question well. Can you elaborate what you mean how to use ACCESS_REPORTABLE?
  • I want to get report when zclSampleSw_OnOff change, how can do it?
  • SampleSwitch sends ON/OFF/Toggle command to SampleLight. There is no status on SampleSwitch. The status is on SampleLight.
  • yes, SampleSwitch sends ON/OFF/Toggle command to SampleLight, can SampleLight send report?
  • 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 );

    }