Zigbee系列(路由机制)
参考文档:
ug103-02-fundamentals-zigbee.pdf section4 zigbe routing concepts
docs-05-3474-21-0csg-zigbee-specification.pdf 3.6.3 Routing
Broadcast Routing
Broadcast routing is a mechanism to send a message to all devices in a network. Network-level broadcast options exist to send to routers only or also to send to sleeping end devices. A broadcast message is repeated by all router-capable devices in the network three times to ensure delivery to all devices. While a broadcast is a reliable means of sending a message, it should be used sparingly because of the impact on network performance. Repeated broadcasts can limit any other traffic that may be occurring in the network.
Broadcasts are also not a reliable means of delivery to a sleeping device because the parent device is responsible for buffering the message for the sleeping child but may drop the message before the end device wakes to receive it.
广播地址:
0xffff |
All devices in PAN |
0xfffe |
Reserved |
0xfffd |
macRxOnWhenIdle = TRUE |
0xfffc |
All routers and coordinator |
0xfffb |
Low power routers only |
0xfff8 - 0xfffa |
Reserved |
Source Address |
Sequence Number |
Expiration Time |
||
broadcast initiator |
A countdown timer indicating the number of seconds until this |
|||
entry expires; the initial value is nwkNetworkBroadcastDeliveryTime. |
广播报文主要是通过BTR记录检测邻居节点是否已收到报文,如果邻居节点已收到报文,当前节点不再重发报文;如果未收到,重发nwkMaxBroadcastRetries次。
中间路由节点根据radius距离值,判断是否继续转发。
Multicast Routing
Multicast routing provides a one-to-many routing option. A multicast is used when one device wants to send a message to a group of devices, such as a light switch sending an on command to a bank of 10 lights. Under this mechanism, all the devices are joined into a multicast group. Only those devices that are members of the group will receive messages, although other devices will route these multicast messages. A multicast is a filtered limited broadcast. It should be used only as necessary in applications, because over-use of broadcast mechanisms can degrade network performance. A multicast message is never acknowledged.
- 只有数据帧使用多播,nwk command frame不使用多播。
- 多播详细可以由end device发起,多播报文不能发往睡眠类end device
Member Mode:成员类型多播(广播方式)
按照广播的方式,根据BTT广播记录表,广播报文。
节点接收到邻居发送的member mode多播报文,查询BTT记录。如果之前已处理过该报文,丢弃。
查询nwkGroupIDTable表,如果当前节点的groupID与报文的groupID匹配,通知上层处理该报文;
使用广播转发该报文,不需要使用passive ACK,经过nwkPassiveAckTimeout之后,重发报文,共发送nwkMaxBroadcastRetries次。
demo 抓包报文
发送原始报文:
中间节点转发:
Non-Member Mode:非成员类型多播(单播方式)
检索路由表,查询groupID对应的下一跳地址,如果找到合法记录,发送(转发)报文。
如果没有记录,根据路由发现规则,建立新路由,单播转发报文。
查询nwkGroupIDTable表,如果当前节点的groupID与报文的groupID匹配,通知上层处理该报文;
直接发送
邻居节点不用查询路由表,报文直接发送。
2. Table Routing
Routes are formed when one node sends a route request to discover the path to another node. After a route is discovered between the two nodes, the source node sends its message to the first node in the route, as specified in the source node's routing table. Each intermediate node uses its own routing table to forward the message to the next node (that is hop) along the route until the message reaches its destination. If a route fails, a route error is sent back to the originator of the message who can then rediscover the route.
以A希望与D通信为例:
- A发送路由请求(广播),B,C节点广播路由请求,并将到A的路由保存到自己的路由表中
- D回应RouteReply,C、B根据自己的路由表,将报文转发到A
- A通过下一跳B节点,将数据发送到D,
RouteTable 格式:
Destination Address |
status |
No Route cache |
Many-to-one |
Route record required |
GroupID flag |
Next-hop address |
0:ACTIVE |
A flag indicating that the destination address is a Group ID. |
The 16-bit network address of the next hop on the way to the destination. |
The types of routing discussed below are:
• Table Routing
• Broadcast Routing
• Multicast Routing
• Many-to-One/Source Routing
Many-To-One routing/Source routing
协调器发送Many-To-One route request广播报文,各子设备通过此报文获取到协调器的路由(接收到了上一节点转发的Route request)。
子设备有数据发往协调器时,先发送route record报文,协调器通过该报文获取到子设备的路由。
协调器发报文到子设备时,报文可以带上转发路径,路径中的各节点根据路径转发,称为source routing。
这种方式,可节省中间节点的内存,中间节点不需要大量的路由表条目。
High/Low RAM concentrator (协议文档中的memory constrained concentrator)
Nodes communicating with high RAM concentrators will continue to send in the route record packet with every inbound message until they receive their first source-routed packet from the concentrator that uses that recorded route. This source routed packet is what tells the node that the source route worked. The APS acknowledgement, if these are turned on, will count as this source routed packet. Also, this route-record suppression is even true for messages routed through this node. Thus, if outlier A sends to concentrator C via many-to-one route A-B-C, the first source routed message from C to B to A will cause B (and A) to stop sending route records up to the concentrator.
Please note,that if the concentrator is also the trust center, communication with the trust center will always be as if it were a low ram concentrator, so route records will always be sent in this case.
High Ram concentrator: 子设备持续发送route record,直到concentrator通过route record记录的路径发送了报文到子设备。报文包括APS ACK报文。
Low ram concentrarot:子设备每次单播一个报文,都发送route record。增加了网络中的数据量。
实际应用中,MTTO routing模式下,为了让concentrator快速恢复到子设备的路由,可以在发送MTTO route request报文后,触发子设备发送报文到concentrator。并且需要发送route record报文。(我们的实现方式:发送MTTO route request, 设置报文中的标记为Low Ram Concentrator,广播子设备的IEEE地址查询,子设备回应地址查询报文,发送route record, 协调器获取最新的路由路径)
MTTO Low Ram Concentrator:
IEEE Address Request:
普通MTTO:
Zigbee系列(路由机制)的更多相关文章
- C#进阶系列——WebApi 路由机制剖析:你准备好了吗?
前言:从MVC到WebApi,路由机制一直是伴随着这些技术的一个重要组成部分. 它可以很简单:如果你仅仅只需要会用一些简单的路由,如/Home/Index,那么你只需要配置一个默认路由就能简单搞定: ...
- C#进阶系列——WebApi 路由机制剖析:你准备好了吗? 转载https://www.cnblogs.com/landeanfen/p/5501490.html
阅读目录 一.MVC和WebApi路由机制比较 1.MVC里面的路由 2.WebApi里面的路由 二.WebApi路由基础 1.默认路由 2.自定义路由 3.路由原理 三.WebApi路由过程 1.根 ...
- 迈向angularjs2系列(6):路由机制
目录1.angular-seed的路由2.路由机制的探索3.懒加载 一:angular-seed的路由 step1:安装种子项目 $ git clone --depth 1 https://gi ...
- 【C#】 WebApi 路由机制剖析
C#进阶系列——WebApi 路由机制剖析:你准备好了吗? 转自:https://blog.csdn.net/wulex/article/details/71601478 2017年05月11日 10 ...
- WebApi 路由机制剖析
阅读目录 一.MVC和WebApi路由机制比较 1.MVC里面的路由 2.WebApi里面的路由 二.WebApi路由基础 1.默认路由 2.自定义路由 3.路由原理 三.WebApi路由过程 1.根 ...
- Linux mips64r2 PCI中断路由机制分析
Linux mips64r2 PCI中断路由机制分析 本文主要分析mips64r2 PCI设备中断路由原理和irq号分配实现方法,并尝试回答如下问题: PCI设备驱动中断注册(request_irq) ...
- 走进AngularJs(八) ng的路由机制
在谈路由机制前有必要先提一下现在比较流行的单页面应用,就是所谓的single page APP.为了实现无刷新的视图切换,我们通常会用ajax请求从后台取数据,然后套上HTML模板渲染在页面上,然而a ...
- MVC5之路由机制
---恢复内容开始--- MVC是一种模式,是基于asp.net上的一种设计.路由机制不属于MVC,路由机制属于asp.net.因此,mvc的路由机制就是基于asp.net路由机制上的一种“自定制”. ...
- MVC路由机制
按照传统,在很多Web框架中(如经典的ASP.JSP.PHP.ASP.NET等之类的框架),URL代表的是磁盘上的物理文件.例如,当看到请求http://example.com/albums/li ...
- typecho路由机制详解
本文介绍的是typecho的路由机制,引自 不烦恼路由机制是typecho的核心,有很多功能都是基于路由功能设计的,理解并熟悉TE的路由机制将非常有助于插件的开发. 完整的路由表如下: array ( ...
随机推荐
- November 18th 2016 Week 47th Friday
Get a livelihood and then practise virtue. 先谋生,而后修身. If you can't earn a life, all the things you ha ...
- ZT pthread_cleanup_push()/pthread_cleanup_pop()的详解
pthread_cleanup_push()/pthread_cleanup_pop()的详解 分类: Linux 2010-09-28 16:02 1271人阅读 评论(1) 收藏 举报 async ...
- UI(一)
1.AfxWinMain 首先,MFC程序先执行到TheApp实例化对象也就是通过这句CTestApp the App来实例化对象的然后,调用CTestApp构造函数分配内存空间 然后,就调用了Afx ...
- XtraEditors一、总体介绍
一.所有编辑器的公共功能 全部都可以绑定数据: 全部都可以独立使用或用于由 Developer Express 提供的容器控件 (XtraGrid.XtraVerticalGrid.XtraTreeL ...
- UE4中动画蒙太奇的合成
在游戏中的技能施法动作是可以通过软件合成的,笔者在这里介绍一种用UE4合成多个动画的操作. 在UE4中角色的动作可以由多种方式达成,一种是混合空间,例如角色的跑动和跳跃,其中的动作是由状态机控制的,原 ...
- 【原创】uwsgi中多进程+多线程原因以及串行化accept() - thunder_lock说明
如有不对,请详细指正. 最近再研究uwsgi如何部署python app,看uwsgi的文档,里面有太多的参数,但每个参数的解释太苍白,作为菜鸟的我实在是不懂.想搞清楚uwsgi的工作原因以及里面的一 ...
- programming-languages学习笔记--第10部分
programming-languages学习笔记–第10部分 */--> pre.src {background-color: #292b2e; color: #b2b2b2;} pre.sr ...
- 有关linqtosql和EF的区别
LINQ to SQL和Entity Framework都是一种包含LINQ功能的对象关系映射技术.他们之间的本质区别在于EF对数据库架构和我们查询的类型实行了更好的解耦.使用EF,我们查询的对象不再 ...
- Sequelize-nodejs-10-Hooks
Hooks钩子 Hooks (also known as lifecycle events), are functions which are called before and after call ...
- python file的3中读法
f.read() 整个文件读入到内存,全部放入到一个string中 f.readlines() 文件全部内容解析成行列表,自带\n,需要print i, f.readline()一行一行,返回字符串 ...