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

📄 sasha.h

📁 主要用于无线传感网络的编写的书籍.对于初学者有着很大的用处
💻 H
字号:
/* Sasha Header (All combined) *//* Written by Kin Sun Ho (ksho@cse) *//* Last Modified: 30 August 2005 */#ifndef  TOSH_DATA_LENGTH#define  TOSH_DATA_LENGTH  29 #endif/* Sasha General Definitions */ enum {  ANYCAST         = 0,  // handler ID for Anycast  IDLE            = 0,  // state for Mote  TRAINING        = 1,  // state for MN/Mote  MARZULLO        = 2,  // state for MN  VERIFY          = 3,   // state for MN  //WAIT            = 4,  // MN wait for verify result from mote  SLEEP           = 5,  JOIN            = 0x01, // request join tree  DATA            = 0x02, // data packets  INTERVAL        = 0x03,  FAULT           = 0x04};/* Mote CLNN definitions */enum {  MAX_EPOCH      = 100,  NUM_UNITS      = 10,  NEGDIST        = -1,  INTERVALS      = 5,  MAX_TRAIN      = 10*NUM_UNITS,  SENSOR_PERIOD  = 50, // 100 = 0.1 sec  M_START        = -1,  M_END          = 1,  M_MID          = 0,  PACKET_TO_SEND = 2         };/* Sasha Sink Definitions */enum {  UART_QUEUE_LEN  = 12,  RADIO_QUEUE_LEN = 12,  DISCOVERY       = 15000, // Discovery Broadcast 15s  REPEAT_MSG      = 3,  TIMEOUT         =  30000, // 1min  marzullo timeout  TEN_MIN         = 900000, // 15 min packet timeout  VERIFY_DELAY    = 1, //300000, // Verify delay  MAX_MOTES       = 10  //number of faulty nodes we can tolerate before retraining};/* Sasha/Anycast Mote Definitions *//* Time for valid table entry = TABLE_EXIST*TABLE_TIMER */enum {  ROUTING_TABLE  = 2,  // number of entries in routing table  TABLE_EXIST    = 5,  // number of ticks in timer before a entry is invalid  TABLE_TIMER    = 5000, // 5s  SLEEP_TIMER    = 30000,  // 30s  SENSOR_TIMER   = 5000,  // 5s  NUM_DATA       = 10,  MAX_SEQ        = 240,  MAX_FAULTS     = 500 //maximum faulty readind is a row a mote can tolerate};/* Mote routing table */typedef struct Mrouting {  uint16_t sinkID;  uint16_t parent;  uint8_t seqNum;  uint8_t hop;  uint8_t timer;  bool empty;} Mrouting;/* Anycast Default Msg */typedef struct Anycast {  uint8_t  type;     // what type of message is this  uint16_t src;      // where did packet originates  uint16_t parent;   // parent of this mote  uint8_t seqNum;    // sequence number of the packet  uint8_t  hop;      // tree depth  uint16_t from;     // which is the last hop  uint8_t  request;  // base issue request field  uint16_t min;      // min value for verify  uint16_t max;      // max value for verify  uint16_t min1;   uint16_t max1;     // space for 4 intervals  uint16_t min2;  uint16_t max2;  uint16_t min3;  uint16_t max3;  uint8_t  nintervals; // nintervals} Anycast;/* CLNN Msg */typedef struct CLNNMsg{  uint8_t  type;               // what type of message is this  uint16_t src;                // where did packet originates  uint16_t training;  uint16_t min;  uint16_t max;  uint16_t f;  uint16_t percent;  uint16_t mean;  uint16_t limit;  uint16_t trust;  uint32_t s2;} CLNNMsg;/* CLNN Structure */typedef struct clnn {  int16_t weights[NUM_UNITS][NUM_UNITS];  int16_t clusters[NUM_UNITS][3];  uint16_t min;  uint16_t max;  uint16_t f;  uint16_t percent;  uint16_t mean;  uint16_t limit;  uint32_t s2;} clnn;/* Marzullo structure */typedef struct Marzullo {  uint16_t endpt;  int8_t   type; // -1 for start, 0 for mean, +1 for end} Marzullo;/* Information recv from a mote */typedef struct Mote{  uint16_t mote;  uint16_t min;  uint16_t max;  uint16_t percent;  uint32_t s2;  bool fail;} Mote;/////////////////////////////////////////////////////////////////////////// Below is for Tatiana's Implmentationtypedef struct Cluster_Msg{  uint8_t  type;      // what type of message is this  uint16_t train;     // number of training  uint16_t src;       // where did packet orignates  uint16_t win1;      // times win  uint16_t win2;      // times win  uint16_t win3;      // times win  uint16_t win4;      // times win  uint16_t min1;      // min boundary  uint16_t min2;      // min boundary  uint16_t min3;      // min boundary  uint16_t min4;      // min boundary  uint16_t max1;      // max boundary  uint16_t max2;      // max boundary  uint16_t max3;      // max boundary  uint16_t max4;      // max boundary} Cluster_Msg;typedef struct Interval {  uint8_t  type;  uint16_t pt1;  uint16_t pt2;  uint32_t prob;} Interval;

⌨️ 快捷键说明

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