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.

CC2652P: Avoid ZDP Device Announce Command sent failed when device join into a Network

Part Number: CC2652P

When a Device join into a Network, ZDP Device Announce command will be broadcasted to all over the Network. It is an important message for Network Manager Device.

But  when many device are joining into a Network, broadcast message will be sent failed easily. So the Application layer should have chance to retry to send  ZDP Device Announce command.

void (*pZdoAnnounceNewAddrFailureCB)(uint8_t status) = NULL;

/*********************************************************************
 * @fn      ZDApp_AnnounceNewAddress()
 *
 * @brief   Send Device Announce and hold all transmissions for
 *          new address timeout.
 *
 * @param   none
 *
 * @return  none
 */
void ZDApp_AnnounceNewAddress( void )
{
  // Turn off data request hold
  APSME_HoldDataRequests( 0 );

  // new function to send ZDP Device Announce with AF confirm callback
  afStatus_t status = ZDP_DeviceAnnceEx( NLME_GetShortAddr(), NLME_GetExtAddr(),
                                         ZDO_Config_Node_Descriptor.CapabilityFlags, 0, ZDO_AnnounceNewAddrConfirmCB, NULL );
  // Trigger callback when Device Announce sent failed, add by luoyiming 2021-05-08
  if( status != ZSuccess && pZdoAnnounceNewAddrFailureCB )
  {
    pZdoAnnounceNewAddrFailureCB( status );
  }

  // Setup the timeout
  APSME_HoldDataRequests( ZDAPP_HOLD_DATA_REQUESTS_TIMEOUT );

  if ( ZSTACK_END_DEVICE_BUILD )
  {
    if ( zgChildAgingEnable == TRUE )
    {
      uint8_t coordExtAddr[Z_EXTADDR_LEN];

      // Send the message to parent
      NLME_GetCoordExtAddr( coordExtAddr );
      NLME_SendEndDevTimeoutReq( NLME_GetCoordShortAddr(), coordExtAddr,
                                 zgEndDeviceTimeoutValue,
                                 zgEndDeviceConfiguration );
    }
  }
}

/*********************************************************************
 * @fn      ZDO_AnnounceNewAddrConfirmCB
 *
 * @brief   Send Device Announce confirm callback
 *
 * @param   same with pfnAfCnfCB in af.h
 *
 * @return  none
 */
void ZDO_AnnounceNewAddrConfirmCB( uint8_t status, uint8_t endpoint, uint8_t transID, uint16_t clusterID, void* cnfParam )
{
  // Trigger callback when Device Announce sent failed, add by luoyiming 2021-05-08
  if( status != ZSuccess && pZdoAnnounceNewAddrFailureCB )
  {
    pZdoAnnounceNewAddrFailureCB( status );
  }
}