DrandMSG.h.~1.10.~
上传用户:joranyuan
上传日期:2022-06-23
资源大小:3306k
文件大小:1k
- #ifndef DRAND_MSG_H
- #define DRAND_MSG_H
- #include "SClock.h"
- //#define ZMAC_DEBUG // for mac level debug
- #ifndef DEBUG
- #define DEBUG // for sodbg
- #endif
- #ifndef ES_DEBUG
- #define ES_DEBUG // for "essential" debug information
- #endif
- //#define HELLO_DEBUG // for hello world debug
- #define DRAND_DEBUG // for drand debug
- //#define REPORT_DEBUG // for report debug
- //#define FRAME_DEBUG // for frame debug
- //#define LDEBUG // for led debug
- enum {
- MAX_NBR = 30,
- MAX_ONE_HOP = 20
- };
- enum { // max number of times
- MAX_GRANT = 10,
- MAX_REQUEST = 10,
- MAX_FRAME = 10, // after 10 reXmit, stop sending frame
- MAX_REPORT = 10
- };
- enum {
- AM_HELLO = 31,
- AM_REQUEST = 32,
- AM_GRANT = 33,
- AM_RELEASE = 34,
- AM_REJECT = 35,
- AM_TWOHOP = 36,
- AM_REPORT = 37,
- AM_FRAME = 38
- };
- //can set the period of timeSync and hello (everything in ms)
- enum {
- HELLO_PERIOD = 60000L, //*(1/115200)sec
- HELLO_INTERVAL = 5000,
- GRANT_INTERVAL = 10,
- REPORT_INTERVAL = 1000,
- REPORT_PERIOD = 2000,
- FRAME_INTERVAL = 1000,
- FRAME_PERIOD = 2000,
- DRAND_PERIOD = 120000L
- };
- enum { //Each state
- HELLO_STATE,
- REQUEST_STATE,
- GRANT_STATE,
- IDLE_STATE2, // seems BMAC also has IDLE_STATE ;)
- RELEASE_STATE,
- REPORT_STATE,
- FRAME_STATE
- };
- enum{ // nodeInfo bit map masks
- ONE_HOP = 0x1,
- TWO_HOP = 0x2,
- GRANT_SENT = 0x4,
- REPORT_SENT = 0x8
- };
- enum{ // frame message types
- FRAME_REQUEST = 1,
- FRAME_REPLY = 0
- };
- #endif