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.

The question about samplelight and sampleswitch Code

Hi All 

        i have  a question  about  the ezmode data of the samplelight and sampleswitch

        

  if ( events & SAMPLELIGHT_START_EZMODE_EVT )
  {
    // Invoke EZ-Mode
    zclEZMode_InvokeData_t ezModeData;

    ...
ezModeData.initiator = FALSE; // OnOffLight is a target ezModeData.numActiveOutClusters = 0; ezModeData.pActiveOutClusterIDs = NULL; ezModeData.numActiveInClusters = 0; ezModeData.pActiveOutClusterIDs = NULL; zcl_InvokeEZMode( &ezModeData ); return ( events ^ SAMPLELIGHT_START_EZMODE_EVT ); }

     why does  ezModeData.numActiveOutClusters and  ezModeData.numActiveInClusters  of  samplelight  keep  0  

     while  those parameters of sampleswitch   is different with it

     and  they are OK  to  using EZMODE to binding each other ?

    

#ifdef ZCL_EZMODE
    {
      zclEZMode_InvokeData_t ezModeData;
      static uint16 clusterIDs[] = { ZCL_CLUSTER_ID_GEN_ON_OFF };   // only bind on the on/off cluster

      // Invoke EZ-Mode
      ezModeData.endpoint = SAMPLESW_ENDPOINT; // endpoint on which to invoke EZ-Mode
      if ( (zclSampleSw_NwkState == DEV_ZB_COORD) ||
               (zclSampleSw_NwkState == DEV_ROUTER)   ||
               (zclSampleSw_NwkState == DEV_END_DEVICE) )
      {
        ezModeData.onNetwork = TRUE;      // node is already on the network
      }
      else
      {
        ezModeData.onNetwork = FALSE;     // node is not yet on the network
      }
      ezModeData.initiator = TRUE;        // OnOffSwitch is an initiator
      ezModeData.numActiveOutClusters = 1;   // active output cluster
      ezModeData.pActiveOutClusterIDs = clusterIDs;
      ezModeData.numActiveInClusters = 0;  // no active input clusters
      ezModeData.pActiveInClusterIDs = NULL;
      zcl_InvokeEZMode( &ezModeData );

      ...
    }

       why does smaplelight should not be like below :

    ezModeData.initiator = FALSE;          // OnOffLight is a target
    ezModeData.numActiveOutClusters = 0;
    ezModeData.pActiveOutClusterIDs = NULL;
    ezModeData.numActiveInClusters = 1;
    ezModeData.pActiveOutClusterIDs = clusterIDs;

  • EZ-mode uses match request to do binding so only sender needs to give output clusters. The SampleLight already has ON/OFF cluster defined in incluster of its simple description.
  • Hi  Yikai

    do  you mean this array  in the  XXX_data.c

    const cId_t zclSampleLight_InClusterList[] =
    {
      ZCL_CLUSTER_ID_GEN_BASIC,
      ZCL_CLUSTER_ID_GEN_IDENTIFY,  
      ZCL_CLUSTER_ID_GEN_ON_OFF
    #ifdef ZCL_SCENES
    , ZCL_CLUSTER_ID_GEN_SCENES 
    #endif
    #ifdef ZCL_GROUPS
    , ZCL_CLUSTER_ID_GEN_GROUPS
    #endif  
    #ifdef ZCL_LEVEL_CTRL
      , ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL
    #endif
    };

    But  sampleswitch  always  has ON/OFF cluster defined in Outcluster

    const cId_t zclSampleSw_OutClusterList[] =
    {
      ZCL_CLUSTER_ID_GEN_ON_OFF,
      ZCL_CLUSTER_ID_GEN_IDENTIFY,
    #ifdef ZCL_LEVEL_CTRL
      ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL,
    #endif
      0
    };

    why does it  need to  add  ON/OFF cluster in the EZMODE data :

          ezModeData.initiator = TRUE;        // OnOffSwitch is an initiator
          ezModeData.numActiveOutClusters = 1;   // active output cluster
          ezModeData.pActiveOutClusterIDs = clusterIDs;
          ezModeData.numActiveInClusters = 0;  // no active input clusters
          ezModeData.pActiveInClusterIDs = NULL;
          zcl_InvokeEZMode( &ezModeData );

  • EZ-mode doesn't use simple descriptor to send match request so you have to assign it when you want to trigger EZ-mode to do binding.
  • So i am confuse about why does  samplelight  do not need  to assign  on/off cluster in  the EZMODE data ?

    below  code  is  samplelight  EZMODE  data setting

     
    if ( events & SAMPLELIGHT_START_EZMODE_EVT )
    
    {
    
      // Invoke EZ-Mode
    
      zclEZMode_InvokeData_t ezModeData;
    
    
     
      ...
    
      ezModeData.initiator = FALSE;          // OnOffLight is a target
    
      ezModeData.numActiveOutClusters = 0;
    
      ezModeData.pActiveOutClusterIDs = NULL;
    
      ezModeData.numActiveInClusters = 0;
    
      ezModeData.pActiveOutClusterIDs = NULL;
    
      zcl_InvokeEZMode( &ezModeData );
    
    
    
      return ( events ^ SAMPLELIGHT_START_EZMODE_EVT );
    
    }
     

    or  does the  target  do not need  to assign any cluster  while trigger the EZMODE?

  • When a device broadcasts match request, any node receives it would check its incluster of its simple description. If there is matched cluster, it would do match response. It use match request in EZ mode to do binding so the receiver would check its incluster of its simple description.
  • hi  Yikai :

    So when device  is a target  (  ezModeData.initiator = FALSE;  )

    it  does not need to assign  any  clusters in  the Ez-Mode data, just put its own clusters (in and out)  in its simple description 。

    and  if  there is  one cluster  in  its incluster  is same with  the one be assigned in the Ezmode_OutClusters of  initiator  

    they will be OK to bind with each other

    BR!

  • Yes, that's it.