Esempio n. 1
0
File: protocol.c Progetto: cuu/weiyi
void delete_asso( uint8 index)
{
    uint8 i;
    AddrMgrEntry_t addrEntry;
    NLME_LeaveReq_t req;
  
        addrEntry.user = ADDRMGR_USER_DEFAULT;
        addrEntry.index = index;
        
        if (AddrMgrEntryGet( &addrEntry ))
        {
          for (i = 0; i < Z_EXTADDR_LEN; i++ )
          {
             if ( addrEntry.extAddr != 0 ){ break;}
          }
        }
        if(i < Z_EXTADDR_LEN){
          // Remove device
          req.extAddr = addrEntry.extAddr;
          req.removeChildren = TRUE;
          req.rejoin = TRUE;
          req.silent = FALSE;

          NLME_LeaveReq( &req );
        }else{
          AssocRemove(addrEntry.extAddr);
          ZDApp_NVUpdate();
        } 
}
Esempio n. 2
0
/***************************************************************************************************
 * @fn      MT_NlmeSetRequest
 *
 * @brief   Set Request
 *
 * @param   pBuf - pointer to the received buffer
 *
 * @return  void
 ***************************************************************************************************/
void MT_NlmeSetRequest(uint8 *pBuf)
{
  uint8 retValue = ZFailure;
  uint8 cmdId;

  /* parse header */
  cmdId = pBuf[MT_RPC_POS_CMD1];
  pBuf += MT_RPC_FRAME_HDR_SZ;

  retValue = NLME_SetRequest((ZNwkAttributes_t)pBuf[0], pBuf[1], &pBuf[2]);

  /* Update NV */
  ZDApp_NVUpdate();

  /* Build and send back the response */
  MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_NWK), cmdId, 1, &retValue );
}