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.

sth about about binding api

Other Parts Discussed in Thread: Z-STACK

hi,guys

I really can not understand somthing in the  serialapp project-------the bind mode.

    if ( keys & HAL_KEY_SW_2 )
    {
      // Initiate an End Device Bind Request for the mandatory endpoint
      ZDApp_SendEndDeviceBindReq( GenericApp_epDesc.endPoint );
    }

and
    if ( keys & HAL_KEY_SW_4 )
    {
      // Initiate a Match Description Request (Service Discovery)
      //  for the mandatory endpoint
      ZDApp_AutoFindDestination( GenericApp_epDesc.endPoint );
    }e

1. does  the fuction"ZDApp_SendEndDeviceBindReq(  );' can only do the bind for end device?or it can make the binding between other types of devices,for example the binding of two routers?

2.what is  "Match Description Request" exactly,after my reading of the document ,it seems that  the action of "HAL_KEY_SW_4 "have no effect of the binding?

i use the z-stack  1.4.2

thanks for your reply

  • 1. The nomenclature "End Device Bind Req" is misleading. This doesn't just apply to end devices... but rather puts the binding logic of matching clusters between two devices that wish to bind on the coordinator. When this function is invoked, assuming all devices
    that wish to use this service have REFLECTOR turned on, here is what happens:

    a. (Bind Req) Device 1 --> Coordinator <--- Device 2 (Bind Req)

    Coordinator looks at the cluster contained in the bind req, compares the IEEE of each device, and if the clusters match, and no binding table already exists for these IEEEs then it will send a bind response back to each device.

    After step a, you will see in the packet sniffer, step b:

    b. Device 1 <--- NWK Addr Req ------ Coordinator ------- NWK addr Req ----> Device 2

    c. Device 1 ----> NWK Addr Rsp ---> Coordinator <---- NWK addr Rsp <--- Device 2

    d. Device 1 <----- Bind Rsp <----- Coordinator -----> Bind Rsp ----> Device 2

    2. Match descriptor is a way of putting the smarts of service discovery on the source device. What happens in this case is the following. NO coordinator involvement is necessary

    Device 1 ----> Match Descriptor request (broadcast or unicast) Device 2
    Device 1 <---- Match Descriptor response (if clusters, application profile id match) that includes src endpoint, src address <---- Device 2

    Device 1 then has to keep a local record of the src endpiont, src address. If this needs to be persistent, then they have to save this in NV memory using the OSAL NV apis.

    Most applications end up using method 2.

  • Hi all,

    Now i have the co-ordinator and router. I can send a data from router and is received by the co-ordinator. This i did using AF and ZDO interface commands, bcoz further i need to use clusters, endpoints. Now i'm sending and receiving by mentioning ClusterID as 0x0000. 

    Now what i need to do is: I have 2 sensors, i need to send a each sensor report from router to co-ordinator periodically. How can i send a report of 2 sensors using endpoints and clusters??  How to select the clusterId's? In order to send a data i know i can use corresponding endpoints. In order use different endpoints weather i need to register again using AF_REGISTER with different endpoint.......??

    Pls tell me how to develop the application using clusterId and endpoints?? How clusterId related to EndPoints?? Till i have not used clusters and endpoints, sorry if any question is wrong? Till now i worked with only SAPI, SYS and CFG commands.............

     

    Thanks for any suggestions,

    P

  • Hi pandit,

    Now, I am developing using clusterID and endpoints. but I don't help your question yet.  because I am beginner for hadling clusterID and endpoints process.

    but maybe if you try to use sample switch/light application using ZDP, I think you have a help what you need.

    Anybody has experience for developing the applcation using ZCL???

    It would be appricieated for me that anyone  tell me how to develop the app.

  • Hi, Double 0. Thanks for the explanation for Match descriptor here. It verified my thoughts. But my code works quite unexpectedly. The clusters, application profile id both match but match description request failed.

    I am using Generic App. Originally the zb_OutCmdList and zb_InCmdList have same cluster id, i.e. GENERICAPP_CLUSTERID

    Now I defined the following instead:

     

    const cId_t zb_InCmdList[NUM_IN_CMD_SENSOR] =

    {

      ASK_STATUS_CMD_ID   //#define ASK_STATUS_CMD_ID         3

    };

     

    const cId_t zb_OutCmdList[NUM_OUT_CMD_SENSOR] =

    {

      SENSOR_REPORT_CMD_ID    //#define SENSOR_REPORT_CMD_ID        2

    };

     

    Above is for end device, and for the coordinator, I swap zb_InCmdList and zb_OutCmdList above so that inlist matches outlist and outlist matches inlist.

    in handlekeys under key 4, I wrote the following for both coordinator and end device:

     

          dstAddr.addrMode = AddrBroadcast;

          dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR;

          ZDP_MatchDescReq( &dstAddr, NWK_BROADCAST_SHORTADDR,

                            GENERICAPP_PROFID,

                            GENERICAPP_MAX_CLUSTERS, (cId_t *)zb_InCmdList,

                            GENERICAPP_MAX_CLUSTERS, (cId_t *)zb_OutCmdList,

                            FALSE );

     

    In this way, match description request does not work and LCD shows 'match desc req non matched'. 

    It only works when  ASK_STATUS_CMD_ID and  SENSOR_REPORT_CMD_ID are both defined to be 2. In this case the program resembles the original GenericApp.

     

    I also verified above in Daintree SNA and two screenshots for match description request from coordinator and end device respectively are shown below.

     

     

     

    Could you please point out where I am wrong? thanks very much.

  • Hi Pandit ,

    I also want to do the same with sensors. In order to me one sensor need to send report to Router and one another sensor need to send report to coordinator. I thought of using match request. So how can i handle match response from two different devices do you know that.
  • Hi Double O,

    I am sending match descriptor request to two different devices(two different ZR). Both are sending response in same time both are different endpoints and different short address .So how can i differentiate these two responses.