digi.xbee.packets.zigbee module¶
-
class
digi.xbee.packets.zigbee.RegisterJoiningDevicePacket(frame_id, registrant_address, options, key)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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
RegisterJoiningDevicePacketobject 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_idis less than 0 or greater than 255.
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 17. (start delim. + length (2 bytes) + frame type + frame id + 64-bit registrant addr. (8 bytes) + 16-bit registrant addr. (2 bytes) + options + checksum = 17 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.REGISTER_JOINING_DEVICE.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
registrant_address¶ XBee64BitAddress. Registrant 64-bit address.
-
property
options¶ RegisterKeyOptions. Register options.
-
property
key¶ Bytearray. Register key.
-
property
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.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
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
Trueif this packet is broadcast,Falseotherwise.- 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
dataunescaped.- Return type
Bytearray
-
class
digi.xbee.packets.zigbee.RegisterDeviceStatusPacket(frame_id, status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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.
See also
Class constructor. Instantiates a new
RegisterDeviceStatusPacketobject 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_idis less than 0 or greater than 255.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 17. (start delim. + length (2 bytes) + frame type + frame id + status + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 1 and 3)
InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte.InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
InvalidPacketException – if the frame type is not
ApiFrameType.REGISTER_JOINING_DEVICE_STATUS.InvalidOperatingModeException – if
operating_modeis not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
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.
See also
-
get_frame_type()¶ Returns the frame type of this packet.
- Returns
the frame type of this packet.
- Return type
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
Trueif this packet is broadcast,Falseotherwise.- 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
dataunescaped.- Return type
Bytearray
-
property
status¶ ZigbeeRegisterStatus. Register device status.