Zigbee.ZDO (zigbee v0.1.0)

Copy Markdown View Source

Zigbee Device Objects (ZDO) codec, the device-management protocol that runs on endpoint 0, profile 0x0000. Used to interview a freshly-joined device (enumerate its endpoints and their clusters) and to bind a cluster so the device reports to us.

Every ZDO payload begins with a 1-byte transaction sequence number. The APS cluster id is the ZDO command; responses use request_cluster ||| 0x8000. EUI64 addresses are little-endian on the wire (same order EZSP hands them to us), so we pass the raw 8-byte binaries straight through.

Summary

Functions

Cluster id for the Active Endpoints request (0x0005).

Active Endpoints request: which endpoints does node_id expose?

Cluster id for the Bind request (0x0021).

Bind request: make the device's cluster on src_endpoint deliver to us.

Decode an Active Endpoints response (cluster 0x8005) into %{seq, status, node_id, endpoints}.

Decode a Bind response (cluster 0x8021) into %{seq, status}.

Decode a Simple Descriptor response (cluster 0x8004) into %{seq, status, node_id, endpoint, profile, device, version, in_clusters, out_clusters}.

The response cluster id for a given request cluster (sets bit 15).

Cluster id for the Simple Descriptor request (0x0004).

Simple Descriptor request: what profile/device/clusters live on endpoint?

Functions

active_endpoints_cluster()

Cluster id for the Active Endpoints request (0x0005).

active_endpoints_request(seq, node_id)

@spec active_endpoints_request(byte(), 0..65535) :: binary()

Active Endpoints request: which endpoints does node_id expose?

bind_cluster()

Cluster id for the Bind request (0x0021).

bind_request(seq, src_eui64, src_endpoint, cluster, dst_eui64, dst_endpoint)

@spec bind_request(byte(), binary(), byte(), 0..65535, binary(), byte()) :: binary()

Bind request: make the device's cluster on src_endpoint deliver to us.

src_eui64 is the device's address, dst_eui64 the coordinator's, both raw 8-byte little-endian binaries. Destination addressing mode is fixed to 64-bit unicast (0x03).

decode_active_endpoints_response(other)

@spec decode_active_endpoints_response(binary()) :: {:ok, map()} | {:error, term()}

Decode an Active Endpoints response (cluster 0x8005) into %{seq, status, node_id, endpoints}.

decode_bind_response(other)

@spec decode_bind_response(binary()) :: {:ok, map()} | {:error, term()}

Decode a Bind response (cluster 0x8021) into %{seq, status}.

decode_simple_descriptor_response(other)

@spec decode_simple_descriptor_response(binary()) :: {:ok, map()} | {:error, term()}

Decode a Simple Descriptor response (cluster 0x8004) into %{seq, status, node_id, endpoint, profile, device, version, in_clusters, out_clusters}.

response_cluster(request_cluster)

The response cluster id for a given request cluster (sets bit 15).

simple_descriptor_cluster()

Cluster id for the Simple Descriptor request (0x0004).

simple_descriptor_request(seq, node_id, endpoint)

@spec simple_descriptor_request(byte(), 0..65535, byte()) :: binary()

Simple Descriptor request: what profile/device/clusters live on endpoint?