⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nwk_leave.h

📁 ucos在NEC平台下的移植
💻 H
字号:
#ifndef NWK_LEAVE_H
#define  NWK_LEAVE_H
//-----------------the leave status----------------------------------
#define NWK_LEAVE_STATUS_ACTIVE  0
#define NWK_LEAVE_STATUS_FINISHED 1
//----------------------------------------------------------------

//-------------------------------------------------------------------------------------------------------
//wish to leave the network state machine

//Initial preparations
#define  NWK_WISH_TO_LEAVE_NETWORK_STATE_INITIALIZE    0
#define NWK_WISH_TO_LEAVE_NETWORK_STATE_SEND_COMMAND_TO_CHILDREN  1            
//Begin to remove the children of the device which is wishing to  leave the network
#define NWK_WISH_TO_LEAVE_NETWORK_STATE_SEND_COMMAND_TO_PARENT  2          
//Begin to remove itself from the network
#define NWK_WISH_TO_LEAVE_NETWORK_STATE_REMOVE_ALL_THE_CHILDREN_DEVICE 3        
//Finished,the device need to be reset
#define NWK_WISH_TO_LEAVE_NETWORK_STATE_FINISHED                  4

//-------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------
// forced to leave the network state machine

//Initial preparations
#define NWK_FORCED_TO_LEAVE_NETWORK_STATE_INITIALIZE                              0
//Send leave request command frame to the device whose address is the same as the parameter
//from the nlmeLeaveRequest.
#define NWK_FORCED_TO_LEAVE_NETWORK_STATE_SEND_COMMAND_TO_CHILD    1
//Begin to recursive leave operation
#define NWK_FORCED_TO_LEAVE_NETWORK_STATE_SEND_COMMAND_RECURSIVE   2
#define NWK_FORCED_TO_LEAVE_NETWORK_STATE_FINISHED                                  3

typedef struct {
 ADDRESS  deviceAddress;
 ZBOOL    removeChildren;
 ZBOOL    macSecurityEnable;
 BYTE     leaveStatus;
 BYTE     leaveReason;
TICK      leaveStartTime;  //used in the procedure :parent to force a child to leave its network
}NWK_LEAVE_INFO;

typedef struct{
BYTE   addrModes;
UINT16   srcPanId;
ADDRESS * pSrcAddr;
UINT16    destPanId;
ADDRESS * pDestAddr;
UINT8  msduLength;
BYTE    pMsdu[nwkcMaxPayloadSize+NWK_HEADER_LENGTH];
BYTE    msduHandle;
BYTE    txOptions;
}MCPS_DATA_INFO;

typedef struct{
BYTE deviceAddress[8];   //the 64-bit IEEE address of the device
BYTE disassociateReason;
ZBOOL securityEnable;
}MLME_DISASSOCIATE_INFO;
//---------------------------------------------------------------
//  void nwkWishToLeaveProcedure(void *nTask);
//   
//   DESCRIPTION:
//            If the device wish to leave the network,it will use this procedure to implement.
//   PARAMETER:
//            void *nTask,
//              Some information about this task.
//   RETURN-VALUE:
//            NO
//----------------------------------------------------------------
void nwkWishToLeaveProcedure(void *nTask);

//---------------------------------------------------------------
//   void nwkForcedToLeaveProcedure(void *nTask);
//   
//   DESCRIPTION:
//            If the device is forced to  leave the network,it will use this procedure to implement.
//   PARAMETER:
//            void *nTask,
//              Some information about this task.
//   RETURN-VALUE:
//            NO
//----------------------------------------------------------------
void nwkForcedToLeaveProcedure(void *nTask);

//----------------------------------------------------------------
//   void SendLeaveRequestCommandToChildren(ZBOOL removeChildren);
//
//    DESCRIPTION:
//           When the device wishes to leave the network,it should first request 
//            its children to leave itself.
//    PARAMETER:
//            ZBOOL removeChildren,
//            TRUE: the 'removeChildren' field of the leave request command frame
//                      will be set to 1;
//            FALSE:the 'removeChildren' field of the leave request command frame
//                      will be set to 0;
//   RETURN-VALUE:
//             NO
//   NOTE:use this function to wrap the 'send leave request command frame to children
//             'operation,use the parameter 'removeChildren' to correctly construct the
//             frame,this can save code and easily for reconstruct.
//------------------------------------------------------------------
void SendLeaveRequestCommandToChildren(ZBOOL removeChildren);

//------------------------------------------------------------------
//   void SendLeaveIndicationCommandToParent();
//
//    DESCRIPTION:
//         When a device wishes to leave the network,and when it has send leave
//         request command to its children,it should now send the leave indication
//         command to its parent.
//    PARAMETER:
//          NO
//    RETURN-VALUE:
//          NO
//------------------------------------------------------------------
void SendLeaveIndicationCommandToParent();
 #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -