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
總結
以上是生活随笔為你收集整理的Z-Stack Home Developer's Guide—8. Additional Information for HA Applications中文翻译的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Redis 与 string 相关的常用
- 下一篇: 18. OD-反调试研究,破解反调试,编