📄 nwk_join.h
字号:
#ifndef NWK_JOIN_H
#define NWK_JOIN_H
typedef struct
{
ADDRESS deviceAddress; //the 64-bit IEEE address of the device
BYTE capabilityInformation;
}NWK_DIRECT_JOIN_INFO;
//-------------------------------------------------------------------------------------------------------
// join in the network state machine
//Initial preparations
#define NWK_JOIN_NETWORK_STATE_INITIALIZE 0
//Begin active scan(if implemented)or passive scan
#define NWK_JOIN_NETWORK_STATE_JOIN 1
//Deal with the beacon notification
#define NWK_JOIN_NETWORK_STATE_REJOIN 2
#define NWK_JOIN_NETWORK_STATE_MAC_ASSOCIATE_START 3
//optional if the device will operation in the network as a router
#define NWK_JOIN_NETWORK_STATE_START_ROUTER_START 4
//Finished
#define NWK_JOIN_NETWORK_STATE_FINISHED 5
//-------------------------------------------------------------------------------------------------------
//rejoin in the network state machine
#define NWK_REJOIN_NETWORK_STATE_INITIALIZE 0
#define NWK_REJOIN_NETWORK_STATE_FINISHED 1
//-----------------------------------------------------------------------------
// The join status returned to nlmeJoinRequest(...)
typedef enum {
NWK_JOIN_STATUS_ACTIVE,
NWK_JOIN_STATUS_FINISHED
} NWK_JOIN_STATUS;
//the joinAsRouters status
typedef enum
{
NWK_JOIN_AS_ROUTERS_STATUS_ACTIVE,
NWK_JOIN_AS_ROUTERS_FINISHED
}NWK_JOIN_AS_ROUTERS_STATUS;
#define NWK_MINIMUM_JOIN_LQI 3
#define MAINS_ENERGY 0x01
#define OTHER_ENERGY 0x00
typedef struct
{
UINT16 panID;
ZBOOL joinAsRouter;
ZBOOL rejoinNetwork;
DWORD scanChannels;
UINT8 scanDuration;
UINT8 powerSource;
UINT8 rxOnWhenIdle;
UINT8 macSecurity;
volatile NWK_JOIN_STATUS status; //used to flag the join state
BYTE state;
volatile NWK_JOIN_AS_ROUTERS_STATUS joinAsRouterStatus;
}NWK_JOIN_INFO;
typedef struct
{
BYTE logicalChannel;
BYTE coordAddrMode;
UINT16 coordPANId;
ADDRESS coordAddress;
BYTE capabilityInformation;
ZBOOL securityEnable;
}MAC_ASSOCIATE_INFO; //store some information about the parametres of mlmeAssociateRequest().
typedef struct
{
ADDRESS deviceAddress;
UINT16 assocShortAddress;
MAC_ENUM status;
ZBOOL securityEnable;
}MAC_ASSOCIATE_RESPONSE_INFO;
typedef struct
{
ADDRESS deviceAddress;
BYTE capabilityInformation;
ZBOOL securityUse;
UINT8 aclEntry;
}MAC_ASSOCIATE_INDICATION_INFO;
typedef struct
{
UINT16 assocShortAddress;
MAC_ENUM status;
}MAC_ASSOCIATE_CONFIRM_INFO;
#define INVALID_MAC_PAN_ID 0xFFFF
typedef enum
{
ASSOCIATION_SUCCESS = 0x00,
ASSOCIATION_PAN_AT_CAPACITY = 0x01,
ASSOCIATION_PAN_ACCESS_DENIED = 0x02
} MAC_ASSOCIATION_STATUS_VALUES;
//----------------------------------------------------------------
//void nwkJoinProcedure(STACK_TASK_INFO *nTask);
//
//DESCRIPTION:
// Implement the functionality:the device joins the network.
//PARAMETER:
// STACK_TASK_INFO *nTask
// some information about the task.
//RETURN-VALUE:
// NO
//-----------------------------------------------------------------
void nwkJoinProcedure(void *nTask);
//----------------------------------------------------------------
//void nwkRejoinProcedure(STACK_TASK_INFO *nTask);
//
//DESCRIPTION:
// Implement the functionality:the device rejoins the network.
//PARAMETER:
// STACK_TASK_INFO *nTask
// some information about the task.
//RETURN-VALUE:
// NO
//-----------------------------------------------------------------
void nwkRejoinProcedure(void *nTask);
//----------------------------------------------------------------
//void nwkJoinAsRouterProcedure(STACK_TASK_INFO *nTask);
//
//DESCRIPTION:
// Implement the functionality:the device joins or rejoins the network as router.
//PARAMETER:
// STACK_TASK_INFO *nTask
// some information about the task.
//RETURN-VALUE:
// NO
//-----------------------------------------------------------------
void nwkJoinAsRouterProcedure(void *nTask);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -