12.07.2015 Views

Z-Stack Developer's Guide

Z-Stack Developer's Guide

Z-Stack Developer's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Z-<strong>Stack</strong>Developer’s <strong>Guide</strong>


Introduction1.1.1PurposeThis document explains some of the components of the Texas Instruments ZigBee stack and theirfunctioning. It explains the configurable parameters in the ZigBee stack and how they may bechanged by the application developer to suit the application requirements.이 문서는 TI 지그비와 그 기능을 하는 몇 가지 구성품에 대한 설명을 합니다. 그 설명들은 지그비스텍 내에 각종구성품의 구성과 응용프로그램에 맞는 필요조건을 프로그램 개발자에 의하여 어떻게 변경 시켜야 하는지를 설명합니다.1.2ScopeThis document describes concepts and settings for the Texas Instruments Z-<strong>Stack</strong> Release. Thisis a ZigBee-2007 compliant stack for the ZigBee and ZigBee PRO stack profiles.이 문서는 TI Z-<strong>Stack</strong> Release에 대한 개념과 설정 들을 설명합니다. 이것은 지그비와 지그비프로 스택 프로필에대한 ZigBee-2007 호환 됩니다.1.3


AcronymsAF Application FrameworkAIB APS Information BaseAES Advanced Encryption StandardAPI Application Programming InterfaceAPS Application Support Sub-LayerAPSDE APS Date EntityAPSME APS Management EntityASDU APS Service Datagram UnitCCM* Enhanced counter with CBC-MAC mode of operationEPID Extended PAN IDMSG MessageNHLE Next Higher Layer EntityNIB Network Information BaseNWK NetworkPAN Personal Area NetworkSE Smart EnergyZDO ZigBee Device Object1.4Reference Documents[1] ZigBee Specification, R17, ZigBee Alliance document number 053474r17ZB.[2] Z-<strong>Stack</strong> API (SWRA195)Copyright 12. ZigBeeA ZigBee network is a multi-hop network with battery-powered devices. This means that twodevices that wish to exchange data in a ZigBee network may have to depend on otherintermediate devices to be able to successfully do so. Because of this cooperative nature of thenetwork, proper functioning requires that each device (i) perform specific networking functionsand (ii) configure certain parameters to specific values. The set of networking functions that adevice performs determines the role of the device in the network and is called a device type.The set of parameters that need to be configured to specific values, along with those values, iscalled a stack profile.


지그비는 배터리로 구동하는 징검다리연결 네트워크입니다. 이것은 지그비 네트워크에서 데이터를 교환하기를원하는 2 장치가 다른 장치들의 중간에서 의존하여 성공적으로할 수 있음을 의미 합니다. 네트워크의 본질적인특징으로 인해, 각 장치가 명확하게 실행하는 네트워킹 기능과 특정한 값으로 매개변수를 구성하는 기능이 요구됩니다. 하나의 장치가 수행하는 네트워킹 기능을 네트워크 내의 역할을 결정하고 그것을 장치의 유형 이라고합니다. 매개변수의 설정은 명확한 값으로 구성되어지는 것이 요구되고, 따라서 그것들의 값을 스택 프로필이라고부릅니다.2.1Device TypesThere are three logical device types in a ZigBee network – (i) Coordinator (ii) Router and (iii)End-device. A ZigBee network consists of a Coordinator node and multiple Router andEnd-device nodes. Note that the device type does not in any way restrict the type of applicationthat may run on the particular device.지그비 네트워크에는 3가지 형의 논리 장치가 있습니다. - (1) Coordinator (2) Router and (3) End-device. 지그비네트워크는 하나의 코디네이터 노드와 다수의 라우터와 종단장치 노드로 구성 됩니다. 특별한 장치에서 운영 될수도 있는 응용프로그램의 형태는 장치의 유형을 어떤 방법으로든지 제한하지 않습니다.An example network is shown in the diagram above, with the ZigBee coordinator ( in black ),the routers ( in red ) and the end devices ( white ).한 예를 위에 그림에서 보입니다, 지그비 코디네이터는 흑색으로 라우터는 적색으로 그리고 종단장치는 백색으로보여주고 있습니다.2.1.1CoordinatorThis is the device that “starts” a ZigBee network. It is the first device on the network. Thecoordinator node scnas the RF environment for existing networks, chooses a channel and anetwork identifier ( also called PAN ID ) and then starts the network.


이것은 시작 네트워크입니다. 그것은 네트워크에서 첫 번째 장치입니다. 코디네이터 노드는 존재하는 네트워크에대한 RF 환경을 흝어 보고, 하나의 채널과 하나의 네트워크 식별자 (또는 PAN ID)를선택하고 그런다음네트워크를 시작 합니다.The coordinator node can also be used, optionally, to assist in setting up security andapplication-level bindings in the network.또한 코디네이터 노드는 선택적으로 보안 설정을 어시스트 하고 네트워크 내에서 응용프로그램 수준의 바인딩사용 되어 질 수 있습니다.Note that the role of the Coordinator is mainly related to starting up and configuring thenetwork. Once that is accomplished, the Coordinator behaves like a Router node (or may evengo away). The continued operation of the network does not depend on the presence of theCoordinator due to the distributed nature of the ZigBee network.그 코디네이터의 역할은 주로 시작하는데 관련 되고 네트워크 구성을 합니다. 일단 성취가 되고나면 코디네이터의하나의 라우터와 같은 행동 (또는 멀리 사라 질 수도 있습니다) 을 합니다. 네트워크의 계속되는 동작은코디네이터의 존재에 의존 하지 않고 지그비의 분산 본질에 의해서 합니다.2.1.2RouterA Router performs functions for (i) allowing other devices to join the network (ii) multi-hoprouting (iii) assisting in communication for its child battery-powered end devices.In general, Routers are expected to be active all the time and thus have to be mains-powered.라우터는 다른 장치들이 (1)네트워크에 연결하도록 허용하는 (2)징검다리연결 결로, (3)배터리 구동 자식종단장치에 대한 통신 보조 기능들을 수행 합니다. 일반적으로 라우터는 활성화가 예상된 모든 시간 따라서전원을 구동해야만 합니다.2.1.3End-deviceAn end-device has no specific responsibility for maintaining the network infrastructure, so it cansleep and wake up as it chooses. Thus it can be a battery-powered node.Generally, the memory requirements (especially RAM requirements) are lower for an end-device.종단장치는 네트워크 기반을 유지하는데 대한 특별한 책임을 가지지 않는다, 그래서 선택에 따라 수면과 깨어 날수 있다. 그래서 배터리 구동 노드로 되어 질 수 있습니다. 일반적으로 메모리 요구는 (특별히 RAM 요구) 하나의종단장치 대하여 낮게 됩니다.Notes:In Z-<strong>Stack</strong>, the device type is usually determined at compile-time via compile options


(ZDO_COORDINATOR and RTR_NWK). All sample applications are provided with separate projectfiles to build each device type.Z-<strong>Stack</strong> 애서 장치 종류는 통상적으로 컴파일 할 때 컴파일 옵션을 통해서 결정되어집니다.2.2<strong>Stack</strong> ProfileThe set of stack parameters that need to be configured to specific values, along with the abovedevice type values, is called a stack profile. The parameters that comprise the stack profile aredefined by the ZigBee Alliance.스택의 설정 매개변수들은 특정 값으로 구성하기위해 필요 하고, 따라서 위의 장치 종류의 값을 <strong>Stack</strong> profile라고부른다. 스택을 구성하는 매개변수는 지그비 연합에서 정의 되어 집니다.All devices in a network must conform to the same stack profile (i.e., all devices must have thestack profile parameters configured to the same values).하나의 네트워크 안에있는 모든 장치들이 같은 스택 프로파일 (즉, 모든 장치들은 스택 프로파일의 매개변수가동일한 값으로 구성 되어야 합니다) 인지 확인해야 합니다.The ZigBee Alliance has defined two different stack profiles for the ZigBee-2007 specification,Zigbee and Zigbee PRO, with the goal of promoting interoperability. All devices that conform tothis stack profile will be able to work in a network with devices from other vendors that alsoconform to it.지그비 연합은 ZigBee-2007 특성에 대하여 2가지 다른 스택 프로파일 정의를 가지고 있습니다, ZigBee 와 ZigBeePRO를 상호운용 촉진의 목표를 가지고 있습니다. 모든 장치들은 다른 업체의 장치들과 네트워크 내에서 동작이되어 질 수 있는 스택 프로파일 요구 합니다.If application developers choose to change the settings for any of these parameters, they can doso with the caveat that those devices will no longer be able to interoperate with devices fromother vendors that choose to follow the ZigBee specified stack profile. Thus, developers of“closed networks” may choose to change the settings of the stack profile variables. These stackprofiles are called “network-specific” stack profile.응용프로그램 개발자는 이러한 매개변수에 대하여 설정 변경을 선택하면, 그들은 지그비가 지정한 스택의프로파일에 선택에 따라 타사 장치와 상호 운영을 곧 중지 될 것이라는 경고를 합니다. 따라서 “폐쇄 네트워크”개발자는 스택 프로파일 변수를 변경하도록 선택 할 수도 있습니다. 이들 프로파일들은 “네트워크-특성” 스택프로파일 이라고 부릅니다.The stack profile identifier that a device conforms to is present in the beacon transmitted by thatdevice. This enables a device to determine the stack profile of a network before joining to it.The “network-specific” stack profile has an ID of 0 while the ZigBee stack profile has ID of 1,


and a ZigBee PRO stack profile has ID of 2. The stack profile is configured by theSTACK_PROFILE_ID parameter in nwk_globals.h file.하나의 장치에서 스택프로파일 식별자는 그 장치에 의해서 현재 비콘 전송에 따릅니다. 이것은 하나의 장치가네트워크에 합류하기 전에 스택프로파일을 확인 할 수 있게 합니다. “네트워크 특성” 스택 프로파일은 지그비 스택프로파일이 ‘1’의 ID를 가지고 있는 동안 ‘0’의 ID를 가지고 있으며, 지그비프로 스택프로파일은 2의 ID를 가집니다.스택프로파일은 nwk_globals.h 파일 안에 있는 STACK_PROFILE_ID의 매개변수에 의해서 구성 됩니다.Normally, a device of 1 profile (ex. ZigBee PRO) joins a network with the same profile. If arouter of 1 profile (ex. ZigBee PRO) joins a network with a different profile (ex. ZigBee-2007),it will join as a non-sleeping end device. An end device of 1 profile (ex. ZigBee PRO) willalways be an end device in a network with a different profile.일반적으로 하나의 장치에 하나의 프로파일 (예: 지그비프로) 동일한 프로파일로 네트워크에 연결 합니다, 만약하나의 라우터에 하나의 프로파일 (예: 지그비프로)가 다른 프로파일 (예: 지그비2007)과 네트워크에 합류 한다면,non-sleeping 종단장치 로 합류가 될 것입니다. 하나의 종단장치의 1 프로파일 (예: 지그비프로)은 하나의네트워킹 안에 다른 프로파일로 항상 종단장치로 있게 됩니다.3. Addressing3.1Address typesZigBee devices have two types of addresses. A 64-bit IEEE address (also called MAC addressor Extended address) and a 16-bit network address (also called logical address or short address).지그비 장치는 2가지 유형의 주소를 가지고 있습니다. 하나는 64비트 EIEE address (MAC address 또는 Extendedaddres 라고 부르는) 그리고 16 비트 네트워크 주소 (logical address 또는 short address 라고 부르는).The 64-bit address is a globally unique address and is assigned to the device for its lifetime. Itis usually set by the manufacturer or during installation. These addresses are maintained andallocated by the IEEE. More information on how to acquire a block of these addresses isavailable at http://standards.ieee.org/regauth/oui/index.shtml. The 16-bit address is assigned to adevice when it joins a network and is intended for use while it is on the network. It is onlyunique within that network. It is used for identifying devices and sending data within thenetwork.64비트 주소는 전 세계적인 고유번호이고 장치의 수명 가지 사용합니다. 그것은 통상적으로 생산 시 또는 장치의설치 중에 설정되어 집니다. 이들 주소들은 IEEE에 의해서 부여 받고 유지 되어 집니다. 더 많은 주소의 불록을취득하는 방법에 대한 정보는 http://standards.ieee.org/regauth/oui/index.shtml 에 있습니다.16비트 주소는 장치가 네트워크에 연결 할 때 장치에 할당되고 그것은 네트워크상에 있을 동안 사용하기 위한것입니다. 그것은 단지 네트워크 내에서만 고유 합니다. 이것은 네트워크 내에서 장치를 식별 하고 데이터를보내기 위하여 사용 됩니다.


3.2 Network address assignment3.2.1Tree AddressingZigBee 2007 uses a distributed addressing scheme for assigning the network addresses. Thisscheme ensures that all assigned network addresses are unique throughout the whole network.This is necessary so that there is no ambiguity about which device a particular packet should berouted to. Also, the distributed nature of the addressing algorithm ensures that a device only hasto communicate with its parent device to receive a unique network-wide address. There is noneed for network-wide communication for address assignment and this helps in scalability of thenetwork.지그비 2007은 네트워크 주소 할당을 위해서 분산 주소지정 제도를 사용합니다. 이 계획은 모든 할당된 네트워크주소가 전체 네트워크에 걸처서 고유한 것을 보장 합니다. 이것은 어떤 장치에 특별한 패킷을 보내는 경로에 대한애매모호함이 없도록 하는데 필요합니다. 또한 분산 본성의 주소할당 알고리즘은 하나의 장치만이 부모 장치와통신을 하기 위하여 네트워크-전체에서 특정한 주소에서 수신을 보장 합니다. 거기에는 네트워크 전체에 대한통신을 필요가 없고 주소 할당에 대한 것과 네트워크 확장성에 도움을 줍니다.The addressing scheme requires that some parameters are known ahead of time and areconfigured in each router that joins the network. These are the MAX_DEPTH, MAX_ROUTERSand MAX_CHILDREN parameters. These are part of the stack profile and the ZigBee-2007 stackprofile has defined values for these parameters (MAX_DEPTH = 5, MAX_CHILDREN = 20,MAX_ROUTERS = 6).주소지정 계획은 미리 알고 있는 약간의 매개변수가 필요 하고 각 경로 내에 합류할 네트워크가 구성되어있습니다. 이들은 MAX_DEPTH, MAX_ROUTERS 그리고 MAX_CHILDREN 매개변수가 있습니다. 이것들은 스택프로파일의 부분과 그리고 이들 매개변수들 (MAX_DEPTH = 5, MAX_CHILDREN = 20, MAX_ROUTERS = 6) 에대한 정의된 값을 가진 지그비-2007 스택 프로파일입니다.The MAX_DEPTH determines the maximum depth of the network. The coordinator is at depth 0and its child nodes are at depth 1 and their child nodes are at depth 2 and so on. Thus theMAX_DEPTH parameter limits how “long” the network can be physically.The MAX_CHILDREN parameter determines the maximum number of child nodes that a router(or coordinator) node can possess.MAX_DEPTH는 네트워크의 최대깊이를 결정합니다. 코디네이터는 깊이를 0으로 그의 자식 노드는 깊이를 1로그리고 그들의 자식노드는 깊이를 2 등등. 따라서 MAX_DEPTH 매개변수는 물리적으로 네트워크를 얼마나 길게할 것인지를 제한합니다.MAX_CHILDREN 매개변수는 최대 자식노드 하나의 라우터가 (또는 코디네이터)노드가처리 할 수를 결정 합니다.


The MAX_ROUTERS parameter determines the maximum number of router-capable child nodesthat a router (or coordinator) node can possess. This parameter is a subset of theMAX_CHILDREN parameter and the remaining (MAX_CHILDREN – MAX_ROUTERS) entries arefor end devices.MAX_ROUTERS 매개변수는 하나의 라우터 (또는 코디네이터)노드가 처리 할 수 있는 라우터가 수용할 자식노드수를 결정 합니다. 이 매개변수는 MAX_CHILDREN 매개변수의 하위 집단이고 종단 참가 장치의 남아 있는수입니다 (MAX_CHILDREN - MAX_ROUTERS).If developers wish to change these values, they need to follow the following steps:개발자가 이 수를 변경 하려면, 아래와 같은 수순을 따를 필요가 있습니다.· First it must be ensured that the new values for these parameters are legal. Since the totaladdress space is limited to about 216, there are limits on how large these parameters can be setto.먼저 새로운 값들이 이들 매개변수에 합법적임이 보장 되어야 합니다. 그래서 총 주소공간은 약 2의 16승으로제한됩니다, 제한은 얼마나 큰 매개변수를 설정 할 것인가에 따라 제한을 합니다.· After choosing legal values, the developer needs to ensure not to use the standard stackprofile and instead set it to network-specific (i.e. change the STACK_PROFILE_ID in“nwk_globals.h” to NETWORK_SPECIFIC) because the values are different from the valuesdefined for the ZigBee profile. Then the MAX_DEPTH parameter in “nwk_globals.h” may be setto the appropriate value.합법적인 값을 선택한 후, 개발자는 표준 스택 프로파일을 사용하지 않도록 하고 그대신 설정을 네트워크-특성(예: "nwk_globals,h" 내의 STACK_PROFILE_ID을 NETWORK_SPECIFIC로 변경)을 설정합니다, 이유는 값들이지그비 프로파일에 정의된 값들과 다르기 때문입니다. 그런다음 “n자_globals.h" 안에 있는 MAX_DEPTH매개변수를 적당한 값으로 설정 될 수 있습니다.· In addition, the array’s CskipChldrn and CskipRtrs must be set in the nwk_globals.c file.These arrays are populated with the values for MAX_CHILDREN and MAX_ROUTERS value forthe first MAX_DEPTH indices followed by a zero value.추가적으로 "nwk_globals,c" 파일 안에있는 어레이의 CskipChldrn 과 CskipRtrs를 필히 설정해야 합니다.이 배열은 처음 MAX_DEPTH 지수가 영의 값 다음에 MAX_CHILDREN 과 MAX_ROUTERS 값으로 채워집니다.3.2.2 Stochastic Addressing 확률적인 주소지정ZigBee PRO uses a stochastic (random) addressing scheme for assigning the network addresses.


This addressing scheme randomly assigns short addresses to new devices, and then uses the restof the devices in the network to ensure that there are no duplicate addresses. When a devicejoins, it receives its randomly generated address from its parent. The new network node thengenerates a “Device Announce” (which contains its new short address and its extended address)to the rest of the network. If there is another device with the same short address, a node(router) in the network will send out a broadcast “Network Status – Address Conflict” to theentire network and all devices with the conflicting short address will change its short address.When the conflicted devices change their address they issue their own “Device Announce” tocheck their new address for conflicts within the network.지그비프로는 네트워크 주소지정에 대한 계획을 확률적 (무작위) 주소지정 방법을 사용합니다. 이 주소는 새장치에 무작위로 할당한 짧은 주소를 부여합니다. 그리고 네트워크 내에 장치들에는 주소가 중복이 되지 않도록남은 것을 사용합니다. 장치가 연합을 할 때 무작위로 발생한 주소를 부모로부터 받습니다.새 네트워크 노드를 생성 한 다음 네트워크의 나머지 에게 “장치 발표”를 합니다.만약 다른 장치가 동일한주소를 가지고 있다면, 네트워크에 노드 (라우터)는 “네트워크 상태 - 주소 충돌” 전체 네트워크에 방송을 하고짧은 주소가 충돌하는 장치들은 그것의 짧은 주소를 변경 하게 됩니다. 충돌 된 장치들은 네트워크 내에 충돌에대한 그들의 새 주소를 확인 하고 그들 자신이 발행한 주소로 변경하고 “장치 발표”를 합니다.End devices do not participate in the “Address Conflict”. Their parents do that for them. If an“Address Conflict” occurs for an end device, its parent will issue the end device a “RejoinResponse” message to change the end device’s short address and the end device issues a“Device Announce” to check their new address for conflicts within the network.종단 장치는 “Address Conflict"에 참여하지 않습니다. 그들의 부모가 그들을 대신 합니다. 만약 “Address Conflict"가 하나의 종단장치에 발생하면, 부모는 종단장치에 ”Rejoin Response" 메시지를 발생하여 종단장치의 짧은주소를 변경 하도록 하고 종단장치는 “Device Announce" 발행하여 그들의 새 주소가 네트워크 내애서 충돌에대한 확인을 합니다.When a “Device Announce” is received, the association and binding tables are updated with thenew short address, routing table information is not updated (new routes must be established). If aparent determines that the “Device Announce” pertains to one of its end device children, but itdidn’t come directly from the child, the parent will assume that the child moved to anotherparent.“Device Announce" 가 접수 됐을 때, 협회와 바인딩 테이블은 새로운짧은 주소로 개정된다, 경로 정보테이블에는 개정을 하지 않고 (새 경로는 반드시 설립 되어야 합니다). 부모가 ”Device Announce" 결정하면자식들 중 하나의 종단장치에 적용 합니다, 그렇지만 자식으로부터 직접 오지는 않습니다, 부모는 자식이 다른부모에게로 옮겨 간 것으로 가정합니다.


3.3 Addressing in Z-<strong>Stack</strong>In order to send data to a device on the ZigBee network, the application generally uses theAF_DataRequest() function. The destination device to which the packet is to be sent is oftype afAddrType_t (defined in “ZComDef.h”).지그비 네트워크에 있는 하나의 장치로 데이터를 보내기 위해서, 응용프로그램은 일반적으로 AF_DataRequest()함수를 사용합니다. 목적지 장치에 대한 패킷은 afAddrType_t 의 형식 (“ZComDef.h"에 정의 되어 있다)으로보내집니다.Note that in addition to the network address, the address mode parameter also needs to bespecified. The destination address mode can take one of the following values (AF address modesare defined in “AF.h”)네트워크 주소에 대한 추가적인 지적은, 주소 모드 매개변수 또한 지정 되어야 합니다. 목적지 주소 모드는 아래의값들 중에서 취할 수 있습니다 (AF address modes are defined in "AF.h").The address mode parameter is necessary because, in ZigBee, packets can be unicast, multicastor broadcast. A unicast packet is sent to a single device, a multicast packet is destined to agroup of devices and a broadcast packet is generally sent to all devices in the network. This isexplained in more detail below.지그비에서 주소 모드 매개변수가 필요한 이유가 패킷을 단일수신, 다수수신 또는 전체수신 선택해야 하기때문입니다. 하나의 유니캐스트 패킷은 하나의 장치로만 보내집니다, 하나의 멀티개스트 패킷은 장치들의 그룹으로그리고 브로드캐스트 패킷은 일반적으로 네트워크 내의 전체 장치들에게 보냅니다. 더욱 자세한 설명은 다음에있습니다.3.3.1 UnicastThis is the normal addressing mode and is used to send a packet to a single device whosenetwork address is known. The addrMode is set to Addr16Bit and the destination network


address is carried in the packet이것은 정상적인 주소지정 이고 하나의 패킷을 네트워크에서 주소가 알려진 하나의 장치로 보내는 것에 사용되고있습니다. addrMode 는 Addr16Bit로 설정하고 목적지 네트워크 주소는 패킷 내에 있습니다.3.3.2 IndirectThis is when the application is not aware of the final destination of the packet. The mode is setto AddrNotPresent and the destination address is not specified. Instead, the destination islooked up from a “binding table” that resides in the stack of the sending device. This feature iscalled Source binding (see later section for details on binding).이것은 응용프로그램이 패킷의 최종 목적지를 인식하지 못하고 있을 때입니다. 이 모드는 AddrNotPresent로 설정되고 목적지 주소가 자정 되어 있지 않았습니다. 그 대신 목적지가 보내는 장치의 스택 안에 존재하는 “bindingtable"에서 찾아보기에 있습니다. 이 기능은 소스 바인딩 (다음 섹션 un binding 자세하게 설명)이라고 합니다.When the packet is sent down to the stack, the destination address and end point is looked upfrom the binding table and used. The packet is then treated as a regular unicast packet. If morethan one destination device is found in the binding table, a copy of the packet is sent to eachof them. If no binding entry is found, the packet will not be sent.패킷이 스택으로 내려갔을 때, 목적지 주소와 종단 주소는 바인딩 테이블에서 찾아내고 사용 됩니다. 그 패킷은일반 유니 캐스트 패킷처럼 처리 됩니다. 하나 이상의 목적지 장치가 바인딩 테이블에 발견 되면 패킷의 복사본이각각 보내집니다. 바인딩에 참가된 장치가 없으면 패킷은 보내지지 않습니다.3.3.3BroadcastThis address mode is used when the application wants to send a packet to all devices in thenetwork. The address mode is set to AddrBroadcast and the destination address can be set toone of the following broadcast addresses:이 주소 모드는 응용프로그램이 하나의 패킷을 네트워크 내에 있는 모든 장치에게 보내기를 원 할 때 사용되고있습니다. 그 주소모드는 AddrBroadcast를 설정하고 목적지 주소는 다음 중에서 하나를 설정 할 수 있습니다.NWK_BROADCAST_SHORTADDR_DEVALL (0xFFFF) – the message will be sent to all devices inthe network (includes sleeping devices). For sleeping devices, the message is held at its parentuntil the sleeping device polls for it or the message is timed out(NWK_INDIRECT_MSG_TIMEOUT in f8wConfig.cfg).NWK_BROADCAST_SHORTADDR_DEVALL (0xFFFF) – 메시지는 네트워크 내의 모든 장치로 보내 집니다(수면상태 장치들도 포함 합니다.). 수면 중인 장치를 뤼해서 메시지는 수면 중인 장치가 폴링 하거나 유효시간이끝나기 전까지 보관 합니다(NWK_INDIRECT_MSG_TIMEOUT in f8wConfig.cfg).


NWK_BROADCAST_SHORTADDR_DEVRXON (0xFFFD) – the message will be sent to all devicesthat have the receiver on when idle (RXONWHENIDLE). That is, all devices except sleepingdevices.NWK_BROADCAST_SHORTADDR_DEVZCZR (0xFFFC) – the message is sent to all routers(including the coordinator ).3.3.4Group AddressingThis address mode is used when the application wants to send a packet to a group of devices.The address mode is set to afAddrGroup and the addr.shortAddr is set to the groupidentifier.이 주소 모드는 응용프로그램이 하나의 패킷을 장차들의 그룸으로 보내기를 원 할 때 사용됩니다. 그 주소 모드는afAddrGroup을 설정하고 addr.shortAddr이 그룸 식별자로 설정 합니다.Before using this feature, groups must be defined in the network [see aps_AddGroup() in theZ-<strong>Stack</strong> API doc].이 기능을 사용 하기전에 그룹들은 네트워크 내에 정의 되어 있어야만 합니다.Note that groups can also be used in conjunction with indirect addressing. The destinationaddress found in the binding table can be either a unicast or a group address. Also note thatbroadcast addressing is simply a special case of group addressing where the groups are setupahead of time.그룹들도 가접 주소자정 방식과 함께 사용 될 수 있습니다. 바인딩 테이블에서 발견된 목적지 주소는 유니 캐스트또는 그룹 주소가 될 수 있습니다. 또한 브로드캐스팅 주소는 단지 특별한 경우에 주소이고 거기에 그룹을 미리설정한 경우이다.Sample code for a device to add itself to a group with identifier 1:하나의 장치에 그룹 1로 식별자를 가지게 하는 샘플 코드.


3.4 Important Device AddressesAn application may want to know the address of its device and that of its parent. Use thefollowing functions to get this device’s address (defined in Z-<strong>Stack</strong> API Doc):응용프로그램은 장치 자신과 부모의 주소를 알기를 원 할 수도 있다. 아래와 같은 함수를 사용하여 장치의 주소를얻을 수 있다.· NLME_GetShortAddr() – returns this device’s 16 bit network address.· NLME_GetExtAddr() – returns this device’s 64 bit extended address.· Use the following functions to get this device’s parent’s addresses (defined in Z-<strong>Stack</strong> APIDoc). Note that the term “Coord” in these functions does not refer to the ZigBee Coordinator,but instead to the device’s parent (MAC Coordinator):이 장치의 부모주소를 얻기 위해서 다음 함수을 사용 한다. 이 함수에서 용어 “Coord"는 지그비의 코디네이터를참조 하지 않는 대신 장치의 부모 주소를 참조 합니다.· NLME_GetCoordShortAddr() – returns this device’s parent’s 16 bit short address.· NLME_GetCoordExtAddr() – returns this device’s parent’s 64 bit extended address.4. BindingBinding is a mechanism to control the flow of messages from one application to anotherapplication (or multiple applications). The binding mechanism is implemented in all devices andis called source binding.바인딩은 한 프로그램으로부터 다른 응용프로그램(또는 다중 응용 프로그램)으로 메시지의 흐름을 제어하기 위한메커니즘입니다. 바인딩 메커니즘은 모든 장치에 이용 되고 소스 바인딩 이라고 부릅니다.Binding allows an application to send a packet without knowing the destination address, the APSlayer determines the destination address from its binding table, and then forwards the message onto the destination application (or multiple applications) or group.바인딩은 한 응용프로그램이 하나의 패킷을 목적지 주소를 알지 못하고 보낼 수 있게 허용 하고, APS 레이어는자신의 바인딩 테이블 에서 목적지 주소를 알아내고, 목적지 응용프로그램(또는 다중 응용프로그램) 또는 그룹으로메시지를 전달합니다.4.1 Building a Binding Table


There are 3 ways to build a binding table:· ZigBee Device Object Bind Request – a commissioning tool can tell the device to make abinding record.지그비 장치 개체 바인딩 요청 -- 위임하는 도구는 바인딩 기록을 만들기 위한 장치를 알 수 있습니다.· ZigBee Device Object End Device Bind Request – 2 devices can tell the coordinator thatthey would like to setup a binding table record. The coordinator will make the match up andcreate the binding table entries in the 2 devices.지그비 장치 개체 종단 바인드 요청 -- 2 장치들은 설치 바이딩 테이블에 기록 하고자 하는 코디네이터를 알 수있습니다. 코디네이터는 일치하고 2 장치들 안에 참가 장치를 생성 하고 바인딩 테이블을 만듭니다..· Device Application – An application on the device can build or manage a binding table.장치 응용프로그램 -- 장치상에 응용프로그램을 만들거나 바인딩 케이블을 관리 할 수 있습니다.4.1.1ZigBee Device Object Bind RequestAny device or application can send a ZDO message to another device (over the air) to build abinding record for that other device in the network. This is called Assisted Binding and it willcreate a binding entry for the sending device.모든 장치 또는 응용프로그램은 ZDO 메시지를 네트워크 안에 있는 다른 장치에 대한 바인딩 레코드를 만들기위해 또 다른 장치로 보낼(공간을 넘어) 수 있다. 이것을 “Assisted Binding" (비인딩 도움이라)부르고 그것은 보낼장치에 관한 바이딩 엔트리를 만듭니다.4.1.1.1The Commissioning ApplicationAn application can do this by calling ZDP_BindReq() [defined in ZDProfile.h] with 2applications (addresses and endpoints) and the cluster ID wanted in the binding record. The firstparameter (target dstAddr) is the short address of the binding’s source address (where thebinding record will be stored). Calling ZDP_UnbindReq()can be used, with the sameparameters, to remove the binding record.Make sure you have the feature enabled in ZDConfig.h [ZDO_BIND_UNBIND_REQUEST].The target device will send back a ZigBee Device Object Bind or Unbind Response messagewhich the ZDO code on the coordinator will parse and notify ZDApp.c by calling


ZDApp_ProcessMsgCBs()with the status of the action.For the Bind Response, the status returned from the coordinator will be ZDP_SUCCESS,ZDP_TABLE_FULL, ZDP_INVALID_EP, or ZDP_NOT_SUPPORTED.For the Unbind Response, the status returned from the coordinator will be ZDP_SUCCESS,ZDP_NO_ENTRY, ZDP_INVALID_EP, or ZDP_NOT_SUPPORTED.4.1.1.2ZigBee Device Object End Device Bind RequestThis mechanism uses a button press or other similar action at the selected devices to bind withina specific timeout period. The End Device Bind Request messages are collected at thecoordinator within the timeout period and a resulting Binding Table entry is created based on theagreement of profile ID and cluster ID. The default end device binding timeout(APS_DEFAULT_MAXBINDING_TIME) is 16 seconds (defined in nwk_globals.h), but can bechanged if added to f8wConfig.cfg or as a compile flag.All sample applications have a function that handles key events [for example,TransmitApp_HandleKeys() in TransmitApp.c]. This function callsZDApp_SendEndDeviceBindReq() [in ZDApp.c], which gathers all the information for theapplication’s endpoint and calls ZDP_EndDeviceBindReq() [ZDProfile.c] to send the messageto the coordinator. Or, as in SampleLight and SampleSwitch, ZDP_EndDeviceBindReq() iscalled directly with only the cluster IDs relevant to the lamp On/Off functions.The coordinator will receive [ZDP_IncomingData() in ZDProfile.c] and parse[ZDO_ProcessEndDeviceBindReq() in ZDObject.c] the message and callZDApp_EndDeviceBindReqCB() [in ZDApp.c], which calls ZDO_MatchEndDeviceBind()[ZDObject.c] to process the request.Coordinator end device binding is a toggle process. Meaning that the first time your go throughthe process, it will create a binding entry in the requesting devices. Then, when you go throughthe process again, it will remove the bindings in the requesting devices. That’s why, in thefollowing process, it will send an unbind, and wait to see if the unbind was successful. If theunbind was successful, the binding entry must have existed and been removed, otherwise it sends


a binding request to make the entry.When the coordinator receives 2 matching End Device Bind Requests, it will start the process ofcreating source binding entries in the requesting devices. The coordinator follows the followingprocess, assuming matches were found in the ZDO End Device Bind Requests:1. Send a ZDO Unbind Request to the first device. The End Device Bind is toggle process, sothe unbind is sent first to remove an existing bind entry.2. Wait for the ZDO Unbind Response, if the response status is ZDP_NO_ENTRY, send a ZDOBind Request to make the binding entry in the source device. If the response status isZDP_SUCCESS, move on to the cluster ID for the first device (the unbind removed the entry –toggle).3. Wait for the ZDO Bind Response. When received, move on to the next cluster ID for thefirst device.4. When the first device is done, do the same process with the second device.5. When the second device is done, send the ZDO End Device Bind Response messages to boththe first and second device.4.1.2 Device Application Binding ManagerAnother way to enter binding entries on the device is for the application to manage the bindingtable for itself. Meaning that the application will enter and remove binding table entries locallyby calling the following binding table management functions (ref. Z-<strong>Stack</strong> API Document –Binding Table Management section):· bindAddEntry() – Add entry to binding table· bindRemoveEntry() – Remove entry from binding table· bindRemoveClusterIdFromList() – Remove a cluster ID from an existing bindingtable entry· bindAddClusterIdToList() – Add a cluster ID to an existing binding table entry


· bindRemoveDev() – Remove all entries with an address reference· bindRemoveSrcDev() – Remove all entries with a referenced source address· bindUpdateAddr () – Update entries to another address· bindFindExisting () – Find a binding table entry· bindIsClusterIDinList() – Check for an existing cluster ID in a table entry· bindNumBoundTo() – Number of entries with the same address (source or destination)· bindNumOfEntries() – Number of table entries· bindCapacity() – Maximum entries allowed· BindWriteNV() – Update table in NV.4.2Configuring Source BindingTo enable source binding in your device include the REFLECTOR compile flag in f8wConfig.cfg.Also in f8wConfig.cfg, look at the 2 binding configuration items(NWK_MAX_BINDING_ENTRIES & MAX_BINDING_CLUSTER_IDS).NWK_MAX_BINDING_ENTRIES is the maximum number of entries in the binding table andMAX_BINDING_CLUSTER_IDS is the maximum number of cluster IDs in each binding entry.The binding table is maintained in static RAM (not allocated), so the number of entries and thenumber of cluster IDs for each entry really affect the amount of RAM used. Each binding tableentry is 6 bytes plus (MAX_BINDING_CLUSTER_IDS * 2 bytes). Besides the amount of staticRAM used by the binding table, the binding configuration items also affect the number ofentries in the address manager.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!