Zigbee.EZSP (zigbee v0.1.0)

Copy Markdown View Source

EZSP application layer over Zigbee.EZSP.ASH.Connection.

This is the low-level EmberZNet protocol client, a thin, synchronous command/response transport over the NCP. Most code should use the Zigbee facade with Zigbee.EZSP.Adapter instead, which adds the coordinator sequence (form, endpoints, unicast) and normalizes NCP callbacks into backend-neutral events. Reach for this module directly only for raw EZSP commands the adapter doesn't expose.

On startup this server opens the serial port, performs the ASH reset handshake, then negotiates the EZSP protocol version (the mandatory first command). After that, command/3 issues EZSP commands and blocks for the matching response; unsolicited NCP callbacks are forwarded to a subscriber.

Example

{:ok, ezsp} = Zigbee.EZSP.start_link(device: "/dev/cu.usbmodem1CDBD45F0F5C1")
Zigbee.EZSP.info(ezsp)
#=> %{protocol_version: 13, stack_type: 2, stack_version: "7.4.4.0"}

{:ok, frame} = Zigbee.EZSP.command(ezsp, 0x0026, <<>>)  # getEui64

Summary

Functions

Map a callback frame ID to a friendly name, or nil if unknown.

Returns a specification to start this module under a supervisor.

Send an EZSP command and wait for its response.

Version/stack info discovered during startup negotiation.

Register pid to receive {:ezsp_callback, frame} for unsolicited frames.

Functions

callback_name(frame_id)

Map a callback frame ID to a friendly name, or nil if unknown.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

command(server, frame_id, params \\ <<>>)

Send an EZSP command and wait for its response.

frame_id may be an atom from the known table (e.g. :get_eui64) or a raw 16-bit integer. Returns {:ok, frame} where frame.params holds the response bytes, or {:error, reason}.

info(server)

Version/stack info discovered during startup negotiation.

start_link(opts)

subscribe(server, pid \\ self())

Register pid to receive {:ezsp_callback, frame} for unsolicited frames.