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.

Z-stack

Hi! All

We are using MSP430 +cc2520 for our application. we configured one device as a router and another device as a coordinator . When i power off the coordinator, router still sending data to coordinator.

our problem is that

Is there any method to know that a device is not connected to its parent (coordinator in this case) ?

Please reply

Shivraj

  • Always start with a sample application provided with the Z-Stack installer - take for example GenericApp and study the GenericApp.c module:

    You see the data periodically sent here after pressing toggle switch to the left (i.e. Key press 4):

      if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
                           GENERICAPP_CLUSTERID,
                           (byte)osal_strlen( theMessageData ) + 1,
                           (byte *)&theMessageData,
                           &GenericApp_TransID,
                           AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )

     

    And in your simplistic one-hop network with the next hop destination device gone, you will already be getting the failure notification here:

            case AF_DATA_CONFIRM_CMD:
              // This message is received as a confirmation of a data packet sent.
              // The status is of ZStatus_t type [defined in ZComDef.h]
              // The message fields are defined in AF.h
              afDataConfirm = (afDataConfirm_t *)MSGpkt;
              sentEP = afDataConfirm->endpoint;
              sentStatus = afDataConfirm->hdr.status;
              sentTransID = afDataConfirm->transID;
              (void)sentEP;
              (void)sentTransID;

              // Action taken when confirmation is received.
              if ( sentStatus != ZSuccess )
              {
                // The data wasn't delivered -- Do something
              }
              break;

    And the failure will be for MAC No-ACK.

    But in a realistic network, when the destination address is two or more hops away, you will have to add to the options requested when making the data request:

     if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
                           GENERICAPP_CLUSTERID,
                           (byte)osal_strlen( theMessageData ) + 1,
                           (byte *)&theMessageData,
                           &GenericApp_TransID,
                           AF_DISCV_ROUTE | AF_ACK_REQUEST, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )

     

     

     

  • Thanks Harry.

    This was really helpful.