发表于:2009/8/4 11:47:02
#0楼
在无线龙zigbee开发系统c51rf-3系列中提供的zigbee2006协议栈在未修改前支持5级路由深度,每个路由器最多可连接20个节点(最多包括6个路由器节点)。
那用户如何修改协议栈来提高路由深度及连接节点呢?
打开zigbee2006协议栈源代码,找到“nwk”中的nwk_globals.h及nwk_globals.c二个文件。
1)打开nwk_globals.h文件,可看到:
#if ( stack_profile_id == home_controls )
#define max_node_depth 5
#define nwk_mode nwk_mode_mesh
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#elif ( stack_profile_id == generic_star )
#define max_node_depth 5
#define nwk_mode nwk_mode_star
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#elif ( stack_profile_id == network_specific )
// define your own stack profile settings
#define max_node_depth 5
#define nwk_mode nwk_mode_mesh
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#endif
由
max_node_depth
来定义路由深度。
2)再打开
nwk_globals.c文件,可以看到:
#if defined ( rtr_nwk )
// change this if using a different stack profile...
// cskip array
uint16 *cskip;
#if ( stack_profile_id == home_controls )
byte cskiprtrs[max_node_depth+1] = {6,6,6,6,6,0};
byte cskipchldrn[max_node_depth+1] = {20,20,20,20,20,0};
#elif ( stack_profile_id == generic_star )
byte cskiprtrs[max_node_depth+1] = {5,5,5,5,5,0};
byte cskipchldrn[max_node_depth+1] = {5,5,5,5,5,0};
#elif ( stack_profile_id == network_specific )
byte cskiprtrs[max_node_depth+1] = {5,5,5,5,5,0};
byte cskipchldrn[max_node_depth+1] = {5,5,5,5,5,0};
#endif // stack_profile_id
#endif // rtr_nwk
修改
cskiprtrs及
cskipchldrn二个数组的数值即可。
如
max_node_depth=6,路由器最多可连接10个路由器,路由器最多可连接30个节点时。
修改为:
#if ( stack_profile_id == home_controls )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {30,30,30,30,30,
30,
0};
#elif ( stack_profile_id == generic_star )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {10,10,10,10,10,
10,
0};
#elif ( stack_profile_id == network_specific )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {10,10,10,10,10,
10,
0};
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=96148&Name=honeycomb
那用户如何修改协议栈来提高路由深度及连接节点呢?
打开zigbee2006协议栈源代码,找到“nwk”中的nwk_globals.h及nwk_globals.c二个文件。
1)打开nwk_globals.h文件,可看到:
#if ( stack_profile_id == home_controls )
#define max_node_depth 5
#define nwk_mode nwk_mode_mesh
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#elif ( stack_profile_id == generic_star )
#define max_node_depth 5
#define nwk_mode nwk_mode_star
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#elif ( stack_profile_id == network_specific )
// define your own stack profile settings
#define max_node_depth 5
#define nwk_mode nwk_mode_mesh
#define security_mode security_residential
#if ( secure != 0 )
#define use_nwk_security 1 // true or false
#define security_level 5
#else
#define use_nwk_security 0 // true or false
#define security_level 0
#endif
#endif
由
max_node_depth
来定义路由深度。
2)再打开
nwk_globals.c文件,可以看到:
#if defined ( rtr_nwk )
// change this if using a different stack profile...
// cskip array
uint16 *cskip;
#if ( stack_profile_id == home_controls )
byte cskiprtrs[max_node_depth+1] = {6,6,6,6,6,0};
byte cskipchldrn[max_node_depth+1] = {20,20,20,20,20,0};
#elif ( stack_profile_id == generic_star )
byte cskiprtrs[max_node_depth+1] = {5,5,5,5,5,0};
byte cskipchldrn[max_node_depth+1] = {5,5,5,5,5,0};
#elif ( stack_profile_id == network_specific )
byte cskiprtrs[max_node_depth+1] = {5,5,5,5,5,0};
byte cskipchldrn[max_node_depth+1] = {5,5,5,5,5,0};
#endif // stack_profile_id
#endif // rtr_nwk
修改
cskiprtrs及
cskipchldrn二个数组的数值即可。
如
max_node_depth=6,路由器最多可连接10个路由器,路由器最多可连接30个节点时。
修改为:
#if ( stack_profile_id == home_controls )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {30,30,30,30,30,
30,
0};
#elif ( stack_profile_id == generic_star )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {10,10,10,10,10,
10,
0};
#elif ( stack_profile_id == network_specific )
byte cskiprtrs[max_node_depth+1] = {10,10,10,10,10,10,
0};
byte cskipchldrn[max_node_depth+1] = {10,10,10,10,10,
10,
0};
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=96148&Name=honeycomb