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.

[Share]A way to make 2 Profiles run in One task.

find function "zdoSendStateChangeMsg" in file "ZDObject.c".

change this function like this

static void zdoSendStateChangeMsg(uint8 state, uint8 taskId, uint8 ep)
{
  osal_event_hdr_t *pMsg = (osal_event_hdr_t *)osal_msg_find(taskId, ZDO_STATE_CHANGE);

  if (NULL == pMsg)
  {
    if (NULL == (pMsg = (osal_event_hdr_t *)osal_msg_allocate(sizeof(osal_event_hdr_t))))
    {
      // Upon failure to notify any EndPoint of the state change, re-set the ZDO event to
      // try again later when more Heap may be available.
      osal_set_event(ZDAppTaskID, ZDO_STATE_CHANGE_EVT);
    }
    else
    {
      pMsg->event = ZDO_STATE_CHANGE;
      pMsg->status = state;

      (void)osal_msg_send(taskId, (uint8 *)pMsg);
    }
  }
  else
  {
    // Modify in place the status of an existing ZDO_STATE_CHANGE message to the EndPoint.
    pMsg->status = state;
  }
}

then ,change function "ZDO_UpdateNwkStatus" like this.

void ZDO_UpdateNwkStatus(devStates_t state)
{
  epList_t *pItem = epList;

  if(ZDO_MT_CB)
  {
    if ( zdpExternalStateTaskID == -1 )
    {
      zdpExternalStateTaskID = MT_TaskID;
    }
  }

  //ZDE task is higher than other app
  if(0xFF != ZDE_TaskID)
  {
    zdoSendStateChangeMsg(state, ZDE_TaskID,ZDO_EP);
  }
  
  while (pItem != NULL)
  {
    if (pItem->epDesc->endPoint != ZDO_EP)
    {
      zdoSendStateChangeMsg(state, *(pItem->epDesc->task_id),pItem->epDesc->endPoint);
    }

    pItem = pItem->nextDesc;
  }
  
  if ( zdpExternalStateTaskID != -1 )
  {  
    zdoSendStateChangeMsg( state, zdpExternalStateTaskID ,0xFF);
  }
  
  ZDAppNwkAddr.addr.shortAddr = NLME_GetShortAddr();
  (void)NLME_GetExtAddr();  // Load the saveExtAddr pointer.
}