digi.xbee.packets.zigbee module

class digi.xbee.packets.zigbee.RegisterJoiningDevicePacket(frame_id, registrant_address, options, key)[source]

Bases: digi.xbee.packets.base.XBeeAPIPacket

This class represents a Register Joining Device packet. Packet is built using the parameters of the constructor or providing a valid API payload.

Use this frame to securely register a joining device to a trust center. Registration is the process by which a node is authorized to join the network using a preconfigured link key or installation code that is conveyed to the trust center out-of-band (using a physical interface and not over-the-air).

If registering a device with a centralized trust center (EO = 2), then the key entry will only persist for KT seconds before expiring.

Registering devices in a distributed trust center (EO = 0) is persistent and the key entry will never expire unless explicitly removed.

To remove a key entry on a distributed trust center, this frame should be issued with a null (None) key. In a centralized trust center you cannot use this method to explicitly remove the key entries.

See also

Class constructor. Instantiates a new RegisterJoiningDevicePacket object with the provided parameters.

Parameters:
  • frame_id (integer) – the frame ID of the packet.
  • registrant_address (XBee64BitAddress) – the 64-bit address of the destination device.
  • options (RegisterKeyOptions) – the register options indicating the key source.
  • key (Bytearray) – key of the device to register. Up to 16 bytes if entering a Link Key or up to 18 bytes (16-byte code + 2 byte CRC) if entering an Install Code.
Raises:

ValueError – if frame_id is less than 0 or greater than 255.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RegisterJoiningDevicePacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

registrant_address

XBee64BitAddress. Registrant 64-bit address.

options

RegisterKeyOptions. Register options.

key

Bytearray. Register key.

frame_id

Returns the frame ID of the packet.

Returns:the frame ID of the packet.
Return type:Integer
get_checksum()

Returns the checksum value of this XBeePacket.

The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.

Returns:checksum value of this XBeePacket.
Return type:Integer

See also

get_frame_spec_data()

Override method.

get_frame_type()

Returns the frame type of this packet.

Returns:the frame type of this packet.
Return type:ApiFrameType

See also

get_frame_type_value()

Returns the frame type integer value of this packet.

Returns:the frame type integer value of this packet.
Return type:Integer

See also

is_broadcast()

Returns whether this packet is broadcast or not.

Returns:True if this packet is broadcast, False otherwise.
Return type:Boolean
output(escaped=False)

Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.

Parameters:escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
Returns:raw bytearray of the XBeePacket.
Return type:Bytearray
to_dict()

Returns a dictionary with all information of the XBeePacket fields.

Returns:dictionary with all information of the XBeePacket fields.
Return type:Dictionary
static unescape_data(data)

Un-escapes the provided bytearray data.

Parameters:data (Bytearray) – the bytearray to unescape.
Returns:data unescaped.
Return type:Bytearray
class digi.xbee.packets.zigbee.RegisterDeviceStatusPacket(frame_id, status)[source]

Bases: digi.xbee.packets.base.XBeeAPIPacket

This class represents a Register Device Status packet. Packet is built using the parameters of the constructor or providing a valid API payload.

This frame is sent out of the UART of the trust center as a response to a 0x24 Register Device frame, indicating whether the registration was successful or not.

Class constructor. Instantiates a new RegisterDeviceStatusPacket object with the provided parameters.

Parameters:
  • frame_id (integer) – the frame ID of the packet.
  • status (ZigbeeRegisterStatus) – status of the register device operation.
Raises:

ValueError – if frame_id is less than 0 or greater than 255.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RegisterDeviceStatusPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

frame_id

Returns the frame ID of the packet.

Returns:the frame ID of the packet.
Return type:Integer
get_checksum()

Returns the checksum value of this XBeePacket.

The checksum is the last 8 bits of the sum of the bytes between the length field and the checksum field.

Returns:checksum value of this XBeePacket.
Return type:Integer

See also

get_frame_spec_data()

Override method.

get_frame_type()

Returns the frame type of this packet.

Returns:the frame type of this packet.
Return type:ApiFrameType

See also

get_frame_type_value()

Returns the frame type integer value of this packet.

Returns:the frame type integer value of this packet.
Return type:Integer

See also

is_broadcast()

Returns whether this packet is broadcast or not.

Returns:True if this packet is broadcast, False otherwise.
Return type:Boolean
output(escaped=False)

Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.

Parameters:escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
Returns:raw bytearray of the XBeePacket.
Return type:Bytearray
to_dict()

Returns a dictionary with all information of the XBeePacket fields.

Returns:dictionary with all information of the XBeePacket fields.
Return type:Dictionary
static unescape_data(data)

Un-escapes the provided bytearray data.

Parameters:data (Bytearray) – the bytearray to unescape.
Returns:data unescaped.
Return type:Bytearray
status

ZigbeeRegisterStatus. Register device status.