ZWAVE Node Information Frame 实例

Node Information Frame

qq:380939960

在gateway上层应用程序中,可能我们会想知道某个节点支持哪些功能?例如是否支持user code?是否支持schedule?等等。通过Node Information Frame我们可以获得相关信息。

 

The Node InformationFrame (NIF) is used to inform other devices about node capabilities. The NIFcontains a structure with a protocol specific part that is handled by theZ-Wave protocol and an application specific part that is filled in by theapplication. The protocol specific part consists of a bit telling if the nodeis a continuously listening device, the Basic Device Class the device is basedon etc. The application specific part consists of the Generic and SpecificDevice Class and the Command Classes that are supported and/or controlled bythe device.

Zwave设备通过NIF来告知其他设备它自己所支持的功能。NIF中包含由Z-Wave协议栈来处理的protocol specific part,以及由上层应用处理的application specific part;protocol specific part中使用一个bit来说明zwave设备是否可以处于持续无线监听状态(通常都是AC供电的),这样的节点可以由于一直在线,所以可以实时控制,实时获取它的状态;同样它也给出这个设备属于哪个Basic Device Class;application specific part部分包含设备的Generic and Specific Device Class,以及这个设备自己可以支持或者控制的命令类。

A NIF will be sentto the controller when a node is to be included in the network, excluded fromthe network or upon request.

当设备被添加/删除/或者被主动请求NIF时,它会发送NIF给Z-Wave网络中的controller。

The figure belowshows the parameters hosted by NIF. 下图是NIF帧的具体描述

Byte descriptor \ bit number

7

6

5

4

3

2

1

0

Capability

Liste- ning

Z-Wave Protocol Specific Part

Security

Opt. Func.

Z-Wave Protocol Specific Part

Reserved

Z-Wave Protocol Specific Part

Basic *)

Basic Device Class (Z-Wave Protocol Specific Part)

Generic

Generic Device Class

Specific

Specific Device Class

NodeInfo[0]

Command Class 1

NodeInfo[n-1]

Command Class n

 

The Z-WaveProtocol in a controller saves all the Node Information except the supportedand controlled Command Classes when a node is included in the network. Thereserved field MUST be set to 0 by a sending node and MUST be ignored by areceiving node.

当一个节点被加入到Z-Wave网络中时,Controller中的Z-Wave协议栈部分会保存该节点的NIF,不过不包括它自己可以支持或者控制的命令类那部分信息。所以如果上层应用程序如果需要这些命令类信息的话,就需要自己保存。

 

Z-Wave ProtocolSpecific Part

The protocolspecific part of the NIF is handled by the Z-Wave protocol. This information isautomatically inserted in the packet by the protocol layer when transferringdata using the API.

NIF中的protocol specific part部分有Z-Wave协议栈来处理(sigma-design提供的sdk的code中会处理这部分功能),当使用SDK中的API发送数据时,Z-Wave协议栈会自动将这部分添加到数据包中,然后再发送出去,所以上层应用程序可以不用关心它。

 

Basic DeviceClass

The Basic DeviceClass field contains an identifier that identifies what Basic Device Class thisnode is based on and is set by the Z-Wave protocol. A detailed description ofall available Basic Device Classes is given in [1] for Z-Wave devices and [13]for Z-Wave Plus devices. The Z-Wave Plus devices have an additional parameterRole Type [10] defining device role in the network. The Role Type parameter isannounced via the Z-Wave Plus Info Command Class.

Note that the“Basic” field is only included when the NIF frame is sent by a controller.

Basic Device Class给出这个设备属于的基本类型,目前Z-Wave协议中定义的基本设备类如下

BASIC_TYPE_CONTROLLER         /*Node is a portable controller */

BASIC_TYPE_ROUTING_SLAVE      /*Node is a slave with routing capabilities*/

BASIC_TYPE_SLAVE               /*Nodeis a slave*/

BASIC_TYPE_STATIC_CONTROLLER   /*Node is a static controller*/

 

3.2.2 ApplicationSpecific Part

The applicationspecific part of the NIF is handled by the application. The information must bein accordance with the defined classes to obtain interoperability.

NIF中的application specific part部分由上层应用来处理,它必须遵循Z-Wave协议中定义的类,这样才能做到不同厂商的产品可以进行互通。

 

Listening Flag

The Listening flagis used to indicate that the node is always listening if set. An alwayslistening node must be powered continuously and reside on a fixed position inthe installation. An always listening node is included in the routing table toassist as repeater in the network. The routing table is static during normaloperation. In case the Listening flag is cleared the node is non-listening.This is typically used for battery operated nodes being asleep when theprotocol is idle to prolong battery lifetime. A battery operated node is notincluded in the routing table and is not used as a router in the network. Insome instances the node’s position in the network is still determined, andstored by the protocol.

通过Listeningflag来表示一个zwave设备是否可以一直处于监听状态的。持续监听状态的设备一般必须通过AC提供持续的电源供电,同时在安装时位置也是固定的(需要承担路由功能)。持续监听节点在加入到网络中时,会被包含进路由表中,在网络中充当repeater,来拓展整个zwave网络的覆盖范围(zwave本身是短距离通讯,如果没有repeater的话,通讯距离会比较近)。由于这些节点位置是固定的,所以在通常操作过程中,路由表都是稳定不变的。如果某个设备的NIF中Listening flag为0,那么这个设备就不能持续处于监听状态。这种节点通常都是通过电池功能的,为了延长电池的供电寿命,节点大部分时间都处于休眠状态,不能进行任何Z-Wave的信令交互。所以这种节点在添加到网络中时,都不会被包含在路由表中。

 

 

OptionalFunctionality Flag

The OptionalFunctionality flag is used to indicate that this node supports other commandclasses than the mandatory for the selected generic/specific device class andthat a controlling node needs to look at the supported command classes to fullycontrol this device.

这个标识符用来说明设备支持的命令类是否比协议中要求的必须支持的要多。当该flag被设置时,控制节点需要查看这个设备支持的所有命令类,以便完整地控制这个设备。

 

Generic DeviceClass

The Generic DeviceClass field contains an identifier that identifies what Generic Device Classthis node is part of and must be set by the application. For a detaileddescription of all available Generic Device Classes, refer to [1] for Z-Wavedevices and [13] for Z-Wave Plus devices.

Specific DeviceClass

The SpecificDevice Class field specifies what Specific Device Class this application ispart of and must be set by the application. For a detailed description of allavailable Specific Device Classes, refer to [1] for Z-Wave devices and [13] forZ-Wave Plus devices.

 

Command Class

The Command Classfield is used to advertise Command Classes implemented by the node. The fieldMUST NOT be longer than 35 bytes.

通过命令类列表来说明这个设备支持的所有命令类,也就是这个设备支持的所有功能;要求这部分不能大于35bytes,由于目前一个命令类是1个byte,所以一个设备也只能最多支持35个命令类。

The field MUSTadvertise the list of Command Classes that the node supports.

命令类列表中必须给出这个设备支持的所有命令类。

The field MAYadvertise the list of Command Classes that the node can control in other nodes.If present, the list of controlling Command Classes MUST be prepended by theCOMMAND_CLASS_MARK Command Class identifier.

The Basic CommandClass MUST NOT be advertised in the Node Information Frame.

另外可以在命令列表中给出该设备在其他节点中可以控制的命令类的列表(就是该节点可以发送某些控制命令给其他节点);如果某个设备支持这种类型的命令类,则这些命令类必须由COMMAND_CLASS_MARK命令类标识符开始,也就是跟在COMMAND_CLASS_MARK后面。Basic Command Class不能在节点信息帧中通告。

举例说明:

Philio 的PST02-A是一个PIR,door/windows,temperature,illumination的4合一sensor;它的NIF信息如下:

generic=0x07      GENERIC_TYPE_SENSOR_NOTIFICATION

specific=0x01     SPECIFIC_TYPE_NOTIFICATION_SENSOR

basic=0x04,generic=0x07, specific=0x01

cmdClasses =

0x5E  COMMAND_CLASS_ZWAVEPLUS_INFO_V2

0x80  COMMAND_CLASS_BATTERY

0x71  COMMAND_CLASS_ALARM_V2

0x85  COMMAND_CLASS_ASSOCIATION_V2

0x70  COMMAND_CLASS_CONFIGURATION_V2

0x72  COMMAND_CLASS_MANUFACTURER_SPECIFIC_V2

0x86  COMMAND_CLASS_VERSION_V2

0x30  COMMAND_CLASS_SENSOR_BINARY_V2

0x31  COMMAND_CLASS_SENSOR_MULTILEVEL

0x84  COMMAND_CLASS_WAKE_UP_V2

0x59  COMMAND_CLASS_ASSOCIATION_GRP_INFO

0x73  COMMAND_CLASS_POWERLEVEL

0x5A  COMMAND_CLASS_DEVICE_RESET_LOCALLY

0x8F  COMMAND_CLASS_MULTI_CMD

0x98  COMMAND_CLASS_SECURITY

0x7A  COMMAND_CLASS_FIRMWARE_UPDATE_MD

0xEF COMMAND_CLASS_MARK

0x20 COMMAND_CLASS_BASIC

在它的说明书中提到:

The Device support2 groups. The group 1 is for receiving the report message, like trigged event,temperature, illumination etc. The group 2 is for light control, the devicewill send the “Basic Set” command to this group, And each group support 8 nodesmaximum.

也就是说philio的PST02-A支持两个groups。Groups是lifeline,用于事件通报。例如PST02-A会通过group 1通报给controller门磁触发,PIR触发,温度数据,明度数据等;group 2主要用于灯光控制,PST02-A会通过group 2发送“Basic Set”到这个group,以便控制这个group中的其他设备。在PST02-2A的NIF中,我们可以看到COMMAND_CLASS_MARK后面跟着COMMAND_CLASS_BASIC命令,这个COMMAND_CLASS_BASIC是用来通过group 2发送“Basic Set”的。

 

If supported, theZ-Wave Plus Info Command Class MUST be the first Command Class in the list.

设备如果支持Z-Wave Plus的话,Z-Wave Plus Info Command Class必须位于命令类列表的第一个。

It has been foundthat legacy controllers MAY read as little as 6 lines from this list. Forbackwards compatibility, the list SHOULD advertise supported command classes inthe order indicated in Table 1 :

在Z-Wave产品实施中,我们发现有些老的controller只会从列表中读出6个命令类;因此为了向后兼容,命令类应该按照下表中的优先级进行排序。

 

Priority

Command Class

1 (First line)

COMMAND_CLASS_ZWAVEPLUS_INFO Applies only to Z-Wave Plus products

2 (if supported)

COMMAND_CLASS_SWITCH_MULTILEVEL or COMMAND_CLASS_SWITCH_BINARY

3 (if supported)

COMMAND_CLASS_SWITCH_ALL

4 (if supported)

COMMAND_CLASS_ASSOCIATION

5

All other command classes

 

Figure 3 shows thestructure of the Node Information frame:

下表给出NIF中命令类列表的具体构成信息。

Byte descriptor \ bit number

7

6

5

4

3

2

1

0

NodeInfo[0]

Command Class 1 (Support)

NodeInfo[x-1]

Command Class x (Support)

NodeInfo[x]

Command Class x+1 (COMMAND_CLASS_MARK)

NodeInfo[x+1]

Command Class x+2 (Control)

NodeInfo[n-1]

Command Class n (Control)


In case the devicehave no supported command classes and only can control other devices, the liststart with the identifier COMMAND_CLASS_MARK.

如果设备没有支持的命令类,只能够控制其他设备的话,则命令类的列表由COMMAND_CLASS_MARK开始。



 

通常controller会将它下面node的信息保存在某个文件中。因此在sigma design的SDK中我们可以使用int SupportsCmdClassFlags(BYTE nodeid, WORD class);这个函数来判断某个端点是否支持某个命令。

当然也可以自己主动发送ZW_RequestNodeInfo来获取某个节点支持的命令序列,然后判断是否支持某个命令。

 

 

例子:下面是Aeotec的doorbell支持的command class

rd_nif_request_notify, cmdLen(15)

 0x04 0x10 0x05 0x5E 0x86 0x25 0x70 0x72 0x59 0x85 0x73 0x7A 0x5A 0xEF 0x82

其中前三个是device type

 

0x04

0x10

0x05

Basis=0x04; general=0x10; specific=0x05

Basic Device Class:    BASIC_TYPE_ROUTING_SLAVE

General Device class:  GENERIC_TYPE_SWITCH_BINARY

Specific Device class: SPECIFIC_TYPE_SIREN

从这里可以看出来,Aeotec将doorbell作为SIREN来实现的。

该产品的链接是http://aeotec.com/z-wave-doorbell

 

 

0x5E  COMMAND_CLASS_ZWAVEPLUS_INFO

0x86  COMMAND_CLASS_VERSION

0x25  COMMAND_CLASS_SWITCH_BINARY

0x70  COMMAND_CLASS_CONFIGURATION

0x72  COMMAND_CLASS_MANUFACTURER_SPECIFIC

0x59  COMMAND_CLASS_ASSOCIATION_GRP_INFO

0x85  COMMAND_CLASS_ASSOCIATION

0x73  COMMAND_CLASS_POWERLEVEL

0x7A  COMMAND_CLASS_FIRMWARE_UPDATE_MD

0x5A  COMMAND_CLASS_DEVICE_RESET_LOCALLY

0xEF  COMMAND_CLASS_MARK

0x82  COMMAND_CLASS_HAIL  say hello

 

该产品默认按门外的button时,不会发送notification给ZWAVE dongle的。需要使用COMMAND_CLASS_CONFIGURATION先配置一个参数,具体信息如下:

“Works with HomeSeer ISY994Zw VeraEdge Z-Wave Gateway Controller - Set up parameter 80 = 1 (1 bit dec) to receive notifications and create scenes including the doorbell”

在代码中是调用 ZWAVE_ConfigurationSet(nodeid,80,1,1);

 

配置完后,不管是在本地按门铃,还是通过APP控制门铃,它都会上报一个COMMAND_CLASS_HAIL给ZWAVE controller。

 

按照上面标准中的说明,COMMAND_CLASS_MARK后的命令都应该是用来控制其他设备的,这样的话这里的COMMAND_CLASS_HAIL是什么意思那? Doorbell广播COMMAND_CLASS_HAIL后,关联的设备都触发动作? 摄像头拍照录像 ?

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值