digi.xbee.packets.raw module¶
-
class
digi.xbee.packets.raw.TX64Packet(frame_id, x64bit_addr, transmit_options, rf_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a TX (Transmit) 64 Request packet. Packet is built using the parameters of the constructor or providing a valid byte array.
A TX Request message will cause the module to transmit data as an RF Packet.
See also
Class constructor. Instantiates a new
TX64Packetobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
x64bit_addr (
XBee64BitAddress) – the 64-bit destination address.transmit_options (Integer) – bitfield of supported transmission options.
rf_data (Bytearray, optional) – RF data that is sent to the destination device. Optional.
See also
- Raises
ValueError – if frame_id is 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 15. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + transmit options + checksum = 15 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.TX_64.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x64bit_dest_addr¶ Returns the 64-bit destination address.
- Returns
the 64-bit destination address.
- Return type
See also
-
property
transmit_options¶ Returns the transmit options bitfield.
- Returns
the transmit options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the RF data to send.
- Returns
the RF data to send.
- Return type
Bytearray
-
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
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 must be escaped.
- 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 info 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.raw.TX16Packet(frame_id, x16bit_addr, transmit_options, rf_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a TX (Transmit) 16 Request packet. Packet is built using the parameters of the constructor or providing a valid byte array.
A TX request message will cause the module to transmit data as an RF packet.
See also
Class constructor. Instantiates a new
TX16Packetobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
x16bit_addr (
XBee16BitAddress) – the 16-bit destination address.transmit_options (Integer) – bitfield of supported transmission options.
rf_data (Bytearray, optional) – RF data that is sent to the destination device. Optional.
See also
- Raises
ValueError – if frame_id is 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 9. (start delim. + length (2 bytes) + frame type + frame id + 16bit addr. + transmit options + checksum = 9 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.TX_16.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x16bit_dest_addr¶ Returns the 16-bit destination address.
- Returns
the 16-bit destination address.
- Return type
See also
-
property
transmit_options¶ Returns the transmit options bitfield.
- Returns
the transmit options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the RF data to send.
- Returns
the RF data to send.
- Return type
Bytearray
-
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
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 must be escaped.
- 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 info 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.raw.TXStatusPacket(frame_id, transmit_status)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents a TX (Transmit) status packet. Packet is built using the parameters of the constructor or providing a valid API payload.
When a TX request is completed, the module sends a TX status message. This message will indicate if the packet was transmitted successfully or if there was a failure.
See also
Class constructor. Instantiates a new
TXStatusPacketobject with the provided parameters.- Parameters
frame_id (Integer) – the frame ID of the packet.
transmit_status (
TransmitStatus) – transmit status. Default: SUCCESS.
- Raises
ValueError – if frame_id is 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 7. (start delim. + length (2 bytes) + frame type + frame id + transmit status + checksum = 7 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.TX_16.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
transmit_status¶ Returns the transmit status.
- Returns
the transmit status.
- Return type
See also
-
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
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 must be escaped.
- 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 info 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.raw.RX64Packet(x64bit_addr, rssi, receive_options, rf_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents an RX (Receive) 64 request packet. Packet is built using the parameters of the constructor or providing a valid API byte array.
When the module receives an RF packet, it is sent out the UART using this message type.
This packet is the response to TX (transmit) 64 request packets.
See also
Class constructor. Instantiates a
RX64Packetobject with the provided parameters.- Parameters
x64bit_addr (
XBee64BitAddress) – the 64-bit source address.rssi (Integer) – received signal strength indicator.
receive_options (Integer) – bitfield indicating the receive options.
rf_data (Bytearray, optional) – received RF data. Optional.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 15. (start delim. + length (2 bytes) + frame type + 64bit addr. + rssi + receive options + checksum = 15 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.RX_64.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x64bit_source_addr¶ Returns the 64-bit source address.
- Returns
the 64-bit source address.
- Return type
See also
-
property
rssi¶ Returns the received Signal Strength Indicator (RSSI).
- Returns
the received Signal Strength Indicator (RSSI).
- Return type
Integer
-
property
receive_options¶ Returns the receive options bitfield.
- Returns
the receive options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the received RF data.
- Returns
the received RF data.
- Return type
Bytearray
-
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
-
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 must be escaped.
- 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 info 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.raw.RX16Packet(x16bit_addr, rssi, receive_options, rf_data=None)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents an RX (Receive) 16 Request packet. Packet is built using the parameters of the constructor or providing a valid API byte array.
When the module receives an RF packet, it is sent out the UART using this message type
This packet is the response to TX (Transmit) 16 Request packets.
See also
Class constructor. Instantiates a
RX16Packetobject with the provided parameters.- Parameters
x16bit_addr (
XBee16BitAddress) – the 16-bit source address.rssi (Integer) – received signal strength indicator.
receive_options (Integer) – bitfield indicating the receive options.
rf_data (Bytearray, optional) – received RF data. Optional.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 9.
(start delim. + length (2 bytes) + frame type + 16bit addr. + rssi –
receive options + checksum = 9 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.RX_16.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x16bit_source_addr¶ Returns the 16-bit source address.
- Returns
the 16-bit source address.
- Return type
See also
-
property
rssi¶ Returns the received Signal Strength Indicator (RSSI).
- Returns
the received Signal Strength Indicator (RSSI).
- Return type
Integer
-
property
receive_options¶ Returns the receive options bitfield.
- Returns
the receive options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the received RF data.
- Returns
the received RF data.
- Return type
Bytearray
-
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
-
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 must be escaped.
- 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 info 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.raw.RX64IOPacket(x64bit_addr, rssi, receive_options, rf_data)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents an RX64 address IO packet. Packet is built using the parameters of the constructor or providing a valid API payload.
I/O data is sent out the UART using an API frame.
See also
Class constructor. Instantiates an
RX64IOPacketobject with the provided parameters.- Parameters
x64bit_addr (
XBee64BitAddress) – the 64-bit source address.rssi (Integer) – received signal strength indicator.
receive_options (Integer) – bitfield indicating the receive options.
rf_data (Bytearray) – received RF data.
See also
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 20. (start delim. + length (2 bytes) + frame type + 64bit addr. + rssi + receive options + rf data (5 bytes) + checksum = 20 bytes)
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.RX_IO_64.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x64bit_source_addr¶ Returns the 64-bit source address.
- Returns
the 64-bit source address.
- Return type
XBee64BitAddress
See also
-
property
rssi¶ Returns the received Signal Strength Indicator (RSSI).
- Returns
the received Signal Strength Indicator (RSSI).
- Return type
Integer
-
property
receive_options¶ Returns the receive options bitfield.
- Returns
the receive options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the received RF data.
- Returns
the received RF data.
- Return type
Bytearray
-
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
-
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 must be escaped.
- 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 info 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.raw.RX16IOPacket(x16bit_addr, rssi, receive_options, rf_data)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis class represents an RX16 address IO packet. Packet is built using the parameters of the constructor or providing a valid byte array.
I/O data is sent out the UART using an API frame.
See also
Class constructor. Instantiates an
RX16IOPacketobject with the provided parameters.- Parameters
x16bit_addr (
XBee16BitAddress) – the 16-bit source address.rssi (Integer) – received signal strength indicator.
receive_options (Integer) – bitfield indicating the receive options.
rf_data (Bytearray) – received RF data.
See also
-
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
-
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 must be escaped.
- 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 info 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
-
static
create_packet(raw, operating_mode)[source]¶ Override method.
- Returns
- Raises
InvalidPacketException – if the bytearray length is less than 14. (start delim. + length (2 bytes) + frame type + 16bit addr. + rssi + receive options + rf data (5 bytes) + checksum = 14 bytes).
InvalidPacketException – if the length field of ‘raw’ is different from 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 from the checksum field value (last byte).
InvalidPacketException – if the frame type is different from
ApiFrameType.RX_IO_16.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x16bit_source_addr¶ Returns the 16-bit source address.
- Returns
the 16-bit source address.
- Return type
See also
-
property
rssi¶ Returns the received Signal Strength Indicator (RSSI).
- Returns
the received Signal Strength Indicator (RSSI).
- Return type
Integer
-
property
receive_options¶ Returns the receive options bitfield.
- Returns
the receive options bitfield.
- Return type
Integer
See also
-
property
rf_data¶ Returns the received RF data.
- Returns
the received RF data.
- Return type
Bytearray