3660|4

3238

帖子

5

TA的资源

五彩晶圆(中级)

楼主
 

zigbee协议栈(二) [复制链接]

三、Jennic ZigBee Stack Software
This chapter introduces the ZigBee stack software that is provided as part of the Jennic Software Developer’s Kit (SDK).

1. Software Package Contents
The Jennic ZigBee Stack software contains the following components:
ZigBee stack level software (the use of this software is transparent), including the Basic Operating System (BOS) on which the Jennic ZigBee software runs.
• Application Programming Interfaces (APIs) described in Section 3.2.
Demonstration programs示例程序 described in Section 3.3.

2. Application Programming Interfaces (APIs)

The following APIs are provided to aid easy application development for ZigBee network nodes:
Application Development API
• Application Framework (AF) APIs
• ZigBee Device Profile (ZDP) APIs
• Basic Operating System (BOS) API
The locations of these APIs, in relation to the software layers with which they interact, are shown in the figure below.


􀁌Note: 除了以上的 ZigBee APIs,在基于zigbee stack的程序中还可能用到Jennic Integrated Peripherals API and Board API,这些会在Integrated Peripherals API和 Board API手册中详细介绍。
1)Application Development API
The Application Development API 与 Application Framework(AFDE)和ZDO进行交互.
这些API的作用有:
•初始化设备类型(C,R,E)
•翻译应用程序收到的数据帧。
详见zigbee application development API手册
2)Application Framework (AF) APIs
这些API与AF进行交互,有两中AF APIS,分别处理数据帧和设备描述(data frames and device descriptors)
•AF sub-layer Data Entity (AFDE) API: AFDE API与程序要发送的数据的创建有关,这种API由函数和数据结构组成,并使用它们完成上述功能,支持两种帧格式:KVP和MSG。
•AF sub-layer Management Entity (AFME) API:这种API实现添加删除修改设备上的descriptor,由函数和数据结构组成,并使用它们完成上述功能。它处理以下descriptor:Node, Power, Simple, Complex and User.
详见AF APIS手册
3)ZigBee Device Profile (ZDP) APIs
ZDP APIS 与romote nodeZDO进行交互。包括3个API,它们的作用是获得网络中其它节点的信息。
ZDP Device Discovery API: This API is used to obtain device addresses; it can get the (local) network address of the device with a given MAC (IEEE) address, and vice-versa.
ZDP Service Discovery API: This API is used to obtain information about network devices; for example, the information contained in the device descriptors.
ZDP Binding API: This API is used for binding and unbinding network devices.
These APIs operate on the principle of requests and responses. One node sends a request across the network, then the node that can fulfil this request sends a response. For example, to obtain the network address of the device with a given MAC address, a Network Address Request containing the MAC address is sent out; the device with this MAC address then responds with its network address.
For further details of the ZDP APIs, refer to the ZigBee Device Profile APIs Reference Manual.
4)Basic Operating System (BOS) API
The BOS API interacts with the Basic Operating System (BOS) on which the Jennic ZigBee Stack runs. This API provides functions for:
• Registering user tasks with the BOS.
• Handling events and messages between the application and the BOS.
• Enabling and disabling interrupts.
Managing memory.
For further details of the BOS API, refer to the BOS API Reference Manual.前面已在BOS API文中介绍。
3.实例软件
实例程序为 JN-AN-1024-ZigBee-Wireless-LightSwitch-1v7,这个程序的功能是进行灯开关控制
This demonstration software includes three source files, in the Source folder:
• Light.c: Contains application code for a light (Router)
• Switch.c: Contains application code for a switch (End Device)
• NullNode.c: Contains application code for a null controller (Co-ordinator), required for starting a system.
这个实例程序使用的profile是ZigBee Home Controls-Lighting (HCL) public profile.
The three example programs are described further below.

Null Controller (Co-ordinator)
This example code is contained in the file NullNode.c. It starts the device as a ZigBee Co-ordinator, which starts the network, allows other devices to join and provides a service to bind endpoints together. For example, the Co-ordinator is responsible for binding the light and the switch to each other.
Light (Router)
This example code is contained in the file Light.c. It runs as a ZigBee Router. The code joins the Router to the network, and then requests that it is bound to a switch by the Co-ordinator.
Switch (End Device)
This example code is contained in the file Switch.c. It runs as a ZigBee End Device. The code joins the End Device to the network, and then requests that it is bound to a light by the Co-ordinator.
4.Developing ZigBee Applications
The contents of the chapter are as follows:
• Describes a generic application and the functions used.
• Steps through an example application provided with the Jennic ZigBee Stack software.
• Describes essential function calls.
• Describes essential parameters.
• Explains how to add a new application to your system.
! Caution: Your application must return control to the ZigBee stack whenever possible. Therefore, you should avoid code that blocks such as while(1) loops.
1)A Generic ZigBee Application
应用程序必须与zigbee stack分享进程控制权,BOS的作用就是对两者进行协调。由application负责启动BOS和stack。
应用程序运行流程图
此处省略一些列JZA_ 函数.
2)Essential Functions Calls重要函数调用
初始化stack
(void)JZS_u32InitSystem(TRUE);
An ideal place to make this call is at the beginning of AppColdStart. For a warm start, the parameter in the above function must be set to FALSE.
初始化BOS
bBosRun(TRUE);
An ideal place to make this call is at the end of AppColdStart. For a warm start, the parameter in the above function must be set to FALSE.

启动stack
JZS_vStartStack();
This call should be made at the end of JZA_boAppStart.
3)重要参数和变量
  • 配置stack结构体JZS_sConfig的参数


An ideal place to set these parameters is in AppColdStart.
  • Stack Variables
The stack variable JZS_eStackState can be read to determine the network status of the node. This variable is described in the Jennic Application Development API Reference Manual (JN-RM-2014).后面增加内容之后在添加链接
[ 本帖最后由 wateras1 于 2013-6-19 13:38 编辑 ]
此帖出自RF/无线论坛

最新回复

召集讨论,谢谢,trek830@qq.com  详情 回复 发表于 2016-3-16 15:12
点赞 关注
个人签名淘宝:https://viiot.taobao.com/Q群243090717
多年专业物联网行业经验,个人承接各类物联网外包项目
 

回复
举报

5

帖子

1

TA的资源

一粒金砂(初级)

沙发
 
此帖出自RF/无线论坛
 
 

回复

6

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
zigbee 的phy层协议能不能支持测距?
此帖出自RF/无线论坛
 
 
 

回复

6

帖子

0

TA的资源

一粒金砂(初级)

4
 
请问phy层协议有吗?
此帖出自RF/无线论坛
 
 
 

回复

6

帖子

0

TA的资源

一粒金砂(初级)

5
 
召集讨论,谢谢,trek830@qq.com
此帖出自RF/无线论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
快速回复 返回顶部 返回列表