?? message.h
字號:
/*
****************************************************************************
* 寧波中科集成電路設計中心 版權所有 Copyright 2005
* http:\\www.nbicc.com
*文件名: message.h
*程序員: 夏鵬 xpsonny@nbicc.com
*主要內容 數據包定義
*如有問題或BUG,請登錄www.wsn.net.cn 提問或用郵件和作者聯系
****************************************************************************
*/
#ifndef _MSG_H
#define _MSG_H
#include "type.h"
//-------------------------------------------------------------------------------
//---------------------------------------------------------------------------
#define MAX_PKT_LEN 60
#define MIN_PKT_LEN 7
#define MAC_HEADER_LEN 7
#define OS_DEFAULT_GROUP 1
#define MAC_CTRL_LEN 7
enum PACKETTYPE {
BROADCAST = 4,
SENSOR = 3
};
typedef struct{
uint8_t length; // 包總長度
uint8_t type; // 包類型
uint8_t toAddr; // 目的地址
uint8_t fromAddr; // 源地址
uint8_t group; // 群號
int8_t data[MAX_PKT_LEN - MAC_HEADER_LEN]; // MAC包數據部分
int16_t crc; // CRC16
} OSMACMsg;
typedef OSMACMsg* OSMACMsgPtr;
typedef struct SHopMsg {
uint8_t type;
uint16_t seq;
uint8_t lifetime;
uint8_t data[1];
} SHopMsg;
typedef SHopMsg *SHopMsgPtr;
enum {
SHOP_HEADER_LEN = (size_t )& ((SHopMsg *)0)->data,
};
typedef struct{
uint8_t length;
uint8_t type;
uint8_t toAddr;
uint8_t fromAddr;
uint8_t group;
uint8_t ack;
int16_t crc;
} OSMACCtrlMsg; // ACK 幀
typedef OSMACCtrlMsg* OSMACCtrlMsgPtr;
#define APP_PKT_LEN 21 // < MAX_PKT_LEN - MAC_HEADER_LEN - 1
#define BUFFER_LEN 10
typedef struct{
uint8_t seqNo;
int16_t data[BUFFER_LEN];
}SensorMsg;
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -