- 1、本文档共19页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
tinyOS消息格式
Mote节点之间传送消息的包格式
文档说明:本文档主要介绍Mote节点之间传送消息的包格式,包括mote节点发往sink节点的数据包格式和sink节点发往mote节点的数据包格式。
修改:2010-5-25,加入xmesh_header;2010-5-26:加入XCommand组件的消息包格式;
2010-5-27,定义命令消息格式;2010-5-28,增加了命令消息的具体细节;
2010-6-8,加入发送命令帧结构,经多天分析实验得到,能够实现控制远端节点LED亮和灭,至此上下行基本消息包格式都以得到;
2010-6-10,加入AM_TYPE类型;
撰写人:张伟军
日期:2010-5-20;
TinyOS消息格式:
TinyOS的消息包头格式
在安装目录\Crossbow\cygwin\opt\MoteWorks\tos\types下的AM.h里面typedef struct TOS_Msg{??/* The following fields are transmitted/received on the radio. */ uint16_t addr;? ??? //发送地址??uint8_t type;? ? //发送数据类型??uint8_t group;? ? //组id??uint8_t length;? ?//消息长度??int8_t data[TOSH_DATA_LENGTH];//数据长度??uint16_t crc;//数据冗余校验位??/* The following fields are not actually transmitted or received? ?* on the radio! They are used for internal accounting only.? ?* The reason they are in this structure is that the AM interface? ?* requires them to be part of the TOS_Msg that is passed to? ?* send/receive operations.? ?*/这部分是用于Mac层的,从Mac层传输下来的uint16_t strength;??uint8_t ack;??uint16_t time;??uint8_t sendSecurityMode;??uint8_t receiveSecurityMode;} TOS_Msg;
The addr field specifies the destination address (a moteID or the broadcast address). The group field specifies a channel for motes on a network. If a mote receives a packet with a different group ID, the packet is dropped. The type field specifies which handler to be called at the AM level when a packet is received. The length field specifies the length of the data portion of the TOS_Msg. Packets have a maximum payload of 29 bytes. The data portion consists of an array of 29 bytes (as specified by TOSH_DATA_LENGTH). The unsigned two byte field crc follows. When sending, the crc is incrementally calculated as each byte of the packet is transmitted.????? So, the maximum length of a transmitted TOS_Msg is 36 bytes (addr(2 bytes) + type(1 bytes) + group(1 bytes) + length(1 bytes) + data(29 bytes) + crc(2 bytes) = 36 bytes).????? 虽然最大长度是36个字节,但是除去各种开销,有效字节只有29个。
以上是TinyOS的传输消息用的数据格式,图示如下:
addr type gr
文档评论(0)