后一修订版 | 前一修订版 |
digi:rf-wireless:gateway:tcp_zigbee_dynamic_mapping [2020/11/13 11:06] – 创建 robin | digi:rf-wireless:gateway:tcp_zigbee_dynamic_mapping [2021/07/07 10:19] (当前版本) – robin |
---|
====Zigbee和TCP的数据互通例程==== | ==== Zigbee和TCP的数据互通例程 ==== |
| |
这个例程有两个源文件,其中table_namer.py是用来生成节点列表给真正的程序用的,只需在部署时运行一次即可,主程序就是tcp_zigbee_dynamic_mapping.py。 | 这个例程有两个源文件,其中table_namer.py是用来生成节点列表给真正的程序用的,只需在部署时运行一次即可,主程序就是tcp_zigbee_dynamic_mapping.py。 |
| |
你测试步骤: | 请根据python版本选择例程(一两个库函数略有区别): |
| |
* <font 11.0pt/inherit;;#1f497d;;inherit>打开网关,并给</font> <font 11.0pt/inherit;;#1f497d;;inherit>xbee</font> <font 11.0pt/inherit;;#1f497d;;inherit>上电,接好</font> <font 11.0pt/inherit;;#1f497d;;inherit>XCTU</font> <font 11.0pt/inherit;;#1f497d;;inherit>,设法使该</font> <font 11.0pt/inherit;;#1f497d;;inherit>xbee</font> <font 11.0pt/inherit;;#1f497d;;inherit>加入网关(通常退一下网就可以,即</font> <font 11.0pt/inherit;;#1f497d;;inherit>atnr</font> <font 11.0pt/inherit;;#1f497d;;inherit>)这样使网关的</font> <font 11.0pt/inherit;;#1f497d;;inherit>web</font> <font 11.0pt/inherit;;#1f497d;;inherit>上能查到节点</font> <font 11.0pt/inherit;;#1f497d;;inherit>,</font> <font 11.0pt/inherit;;#1f497d;;inherit>设置</font> <font 11.0pt/inherit;;#1f497d;;inherit>XBee</font> <font 11.0pt/inherit;;#1f497d;;inherit>的</font> <font 11.0pt/inherit;;#1f497d;;inherit>NI</font> <font 11.0pt/inherit;;#1f497d;;inherit>为</font> <font 11.0pt/inherit;;#1f497d;;inherit>node1</font> <font 11.0pt/inherit;;#1f497d;;inherit>。</font> | x2e ,industrial gateway等用:[[http://gitlab.eccee.com:11080/digirobin/zigbee2tcp-x2e|http://gitlab.eccee.com:11080/digirobin/zigbee2tcp-x2e]] |
* <font 11.0pt/inherit;;#1f497d;;inherit>上传这两个源文件,网关上如有其它程序,可以删除,并取消自动启动程序(如果原来有的话)</font> | |
* <font 11.0pt/inherit;;#1f497d;;inherit>手动上传例程的两个程序</font> | X4等老网关用:官方例程:[[https://www.digi.com/resources/documentation/digidocs/90001537/default.htm#references/r_tcp_to_zigbee_dynamic_name.htm|https://www.digi.com/resources/documentation/digidocs/90001537/default.htm#references/r_tcp_to_zigbee_dynamic_name.htm]] |
* <font 11.0pt/inherit;;#1f497d;;inherit>telnet或ssh到网关</font> <font 11.0pt/inherit;;#1f497d;;inherit>,运行</font> <font 11.0pt/inherit;;#1f497d;;inherit>python table_namer.py,</font> <font 11.0pt/inherit;;#1f497d;;inherit>它会生成节点列表,</font> <font 11.0pt/inherit;;#1f497d;;inherit>table.py</font> | |
* <font 11.0pt/inherit;;#1f497d;;inherit>在网关的 web界面,打勾tcp_zigbee_dynamic_mapping.py,应用后重启设备,使主程序自动运行起来</font> | 你测试步骤: |
* <font 11.0pt/inherit;;#1f497d;;inherit>用一个tcpip调试工具,使调试工具作为TCP client连接到网关的TCP server上(默认端口号请查源代码),</font> | |
* <font 11.0pt/inherit;;#1f497d;;inherit>从</font> <font 11.0pt/inherit;;#1f497d;;inherit>XCTU</font> <font 11.0pt/inherit;;#1f497d;;inherit>打字,</font> <font 11.0pt/inherit;;#1f497d;;inherit>tcp</font> <font 11.0pt/inherit;;#1f497d;;inherit>调试工具上就会出现</font> <font 11.0pt/inherit;;#1f497d;;inherit>node1:X ,</font> <font 11.0pt/inherit;;#1f497d;;inherit>其中</font> <font 11.0pt/inherit;;#1f497d;;inherit>X</font> <font 11.0pt/inherit;;#1f497d;;inherit>就是你打的字</font> | |
* <font 11.0pt/inherit;;#1f497d;;inherit>Tcp</font> <font 11.0pt/inherit;;#1f497d;;inherit>调试工具上送</font> <font 11.0pt/inherit;;#1f497d;;inherit>nod1:test, XCTU</font> <font 11.0pt/inherit;;#1f497d;;inherit>就能收到</font> <font 11.0pt/inherit;;#1f497d;;inherit>test</font> | |
| |
| * 打开网关并上电,设法使一个测试套件的XBee router模块加入网关(通常退一下网就可以,即atnr命令或是按四下commission button)。这样使网关上能查到节点,或是检查节点的OP,CH和网关的协调器一致,以保证在同一个网络。设置XBee的节点名称NI为node1. |
| * 上传这两个源文件,网关上如有其它程序,可以删除,并取消自动启动程序(如果原来有的话) |
| * ssh到网关,运行python table_namer.py,它会生成节点列表,table.py |
| * 在网关的 web界面,打勾tcp_zigbee_dynamic_mapping.py,使主程序在重启后能自动运行起来,也可手动运行一次。 |
| * 用一个tcpip调试工具,使调试工具作为TCP client连接到网关的TCP server上(默认端口号请查源代码) |
| * 接模块的电脑XCTU输入任意字符,调试工具上就会出现node1:X ,X就是你输入的字符 |
| * 调试工具上键入node1:test, XCTU就能收到test |
| 由此,一个zigbee到TCP的双向通信链路就建好了. |
| |