Z-Stack Home Developer's Guide—8. Additional Information for HA Applications中文翻译

下面是Z-Stack Home 1.2.0开发资料中的Z-Stack Home Developer’s Guide—8. Additional Information for HA Applications的中文翻译。

8.HA应用程序的其他信息

样例应用程序实现了一组最小的功能。可选的特性,在ZigBee Home Automation Specification文档中做了详细的描述,在一个更加功能全面的应用程序中能够被添加进来。

除了支持适当的族和属性,应用程序一定要选择一个zigbee设备类型并且支持非易失性内存(NVM)。

8.1 ZigBee 设备类型

zigbee遵循以下3种设备类型:zigbee协调器,zigbee路由,zigbee终端设备。每个应用程序必须决定这个应用程序将支持哪种设备类型。以下是最基本的原则。查看更详细的介绍,请看Texas Instruments document SWRA176, Z-Stack Developer’s Guide文档。

  • 使用zigbee协调器开始组建一个网络,通常作为一个基站。
  • 使用zigbee路由作为一个促进作用,比如作为一个网络的出口,在一个给定的设施(12个或者更少的设备) 只有在这种设备不是很多的时候才使用。除此之外,将用作zigbee终端设备。
  • 使用一个zigbee终端设备来保持正常的休眠以节约能源(通常是电池供电设备),或者 这里有靠的很近的很多这样的设备 用于一个主电源来控制这些设备。

8.2在NVM中存储变量

通常,一个设备必须要有非易失性内存来保证,因为设备必须记住它的网络配置。

为了保存一个变量到NVM中,必须为这个变量创建一个item ID。这些ID在应用程序中预留的范围是0x0401~0x0FFF。这些ID的完整列表,请参阅ZComDef.h文件。

一旦item ID被定义了,一定要使用osal_nv_item_init()进行初始化。这个函数将使用item ID,存储变量的长度,和一个变量(如果用户想使用这个初始值的话)。

往NVM写一个item,使用osal_nv_write()。这个函数将使用itemID,item的偏移索引,写数据的长度,写数据的变量。

往NVM读一个item,使用osal_nv_read()。这个函数使用itemID,item的偏移索引,读数据的长度,将数据读到哪个变量。这些函数可以在OSAL_Nv.c文件中找到。

8.3用户接口

以下的用户接口应该在每个应用程序:
- 在每个端点上调用EZ-Mode的方法
- 将整个设备重置为出厂设置的方法(不在一个网络,等等)
- 在引起应用程序的操作(比如 一个开关打开一个灯)
- 将供电设备设置为休眠状态

英文原文

8. Additional Information for HA Applications

The sample applications implement a minimal set of features to operate. Optional features, as described in the
ZigBee Home Automation Specification [1], can be added for a more full-featured application.
In addition to enabling the appropriate clusters and attributes, application must also select a ZigBee device type and
enable non-volatile memory (NVM).

8.1 ZigBee Device Type

ZigBee allows for 3 device types: a ZigBee Coordinator, ZigBee Router, and ZigBee End Device. It must be decided
for each application which ZigBee device type the application will be. The following are basic guidelines. For
complete details, please see [4].
Use a ZC for device that will start the network, typically a base-station
Use a ZR for devices that will be mains powered, such as an outlet. Only use this type if there won’t be very many
of these devices at a given facility (12 or less in radio range of each other). Otherwise, use ZED.
Use a ZED for devices that will normally sleep in order to conserve power (usually battery operated devices), or for
mains-power operated devices, if there are many such devices in close proximity (see above).

8.2 Storing Variables to Non-Volatile Memory

In general, a device must have non-volatile memory enabled to be certified, because it must remember its network
configuration.
To save a variable to NVM, an item ID must be created for that variable. IDs reserved for applications range from
0x0401 to 0x0FFF. For a complete list of these IDs, refer to the ZComDef.h file.
Once the item ID is defined, it must be initialized using osal_nv_item_init(). This function passes the item
ID, length of the variable to be stored, and the variable (if the user wants to use the initial value).
To write an item to NVM, use osal_nv_write(). This function passes the item ID, the index offset into an item,
the length of data to write, and the variable to write.
To read the item from NVM, use osal_nv_read(). This function passes the item ID, the index offset into an
item, length of data to read, and the variable to read the data to. These functions can be found in the OSAL_Nv.c file.

8.3 User Interface

The following user interface elements should be in each application:
 Some way to invoke EZ-Mode on each endpoint
 Some way to reset the entire device to factory new settings (not on a network, etc…)
 Some way to cause the application action (e.g. a switch turning on a light)
 Set up battery powered devices as sleepy devices

猜你喜欢

转载自blog.csdn.net/qq_29542611/article/details/81408093
今日推荐