digi.xbee.packets.raw module¶
-
class
digi.xbee.packets.raw.
TX64Packet
(frame_id, x64bit_addr, tx_opts, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
TX64Packet
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – the 64-bit destination address. - tx_opts (Integer) – bitfield of supported transmission options.
- rf_data (Bytearray, optional) – RF data that is sent to the destination device.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.TX_64
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x64bit_dest_addr
¶ Returns the 64-bit destination address.
Returns: the 64-bit destination address. Return type: XBee64BitAddress
See also
-
transmit_options
¶ Returns the transmit options bitfield.
Returns: the transmit options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the RF data to send.
Returns: the RF data to send. Return type: Bytearray
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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, tx_opts, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
TX16Packet
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- x16bit_addr (
XBee16BitAddress
) – the 16-bit destination address. - tx_opts (Integer) – bitfield of supported transmission options.
- rf_data (Bytearray, optional) – RF data that is sent to the destination device.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.TX_16
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x16bit_dest_addr
¶ Returns the 16-bit destination address.
Returns: the 16-bit destination address. Return type: XBee16BitAddress
See also
-
transmit_options
¶ Returns the transmit options bitfield.
Returns: the transmit options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the RF data to send.
Returns: the RF data to send. Return type: Bytearray
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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, tx_status, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
TXStatusPacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- tx_status (
TransmitStatus
) – transmit status. - op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.TX_16
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
transmit_status
¶ Returns the transmit status.
Returns: the transmit status. Return type: TransmitStatus
See also
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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, rx_opts, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
RX64Packet
object with the provided parameters.Parameters: - x64bit_addr (
XBee64BitAddress
) – the 64-bit source address. - rssi (Integer) – received signal strength indicator.
- rx_opts (Integer) – bitfield indicating the receive options.
- rf_data (Bytearray, optional) – received RF data.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.RX_64
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
rssi
¶ Returns the received Signal Strength Indicator (RSSI).
Returns: the received Signal Strength Indicator (RSSI). Return type: Integer
-
receive_options
¶ Returns the receive options bitfield.
Returns: the receive options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the received RF data.
Returns: the received RF data. Return type: Bytearray
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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
- x64bit_addr (
-
class
digi.xbee.packets.raw.
RX16Packet
(x16bit_addr, rssi, rx_opts, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
RX16Packet
object with the provided parameters.Parameters: - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - rssi (Integer) – received signal strength indicator.
- rx_opts (Integer) – bitfield indicating the receive options.
- rf_data (Bytearray, optional) – received RF data.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.RX_16
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
See also
-
rssi
¶ Returns the received Signal Strength Indicator (RSSI).
Returns: the received Signal Strength Indicator (RSSI). Return type: Integer
-
receive_options
¶ Returns the receive options bitfield.
Returns: the receive options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the received RF data.
Returns: the received RF data. Return type: Bytearray
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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
- x16bit_addr (
-
class
digi.xbee.packets.raw.
RX64IOPacket
(x64bit_addr, rssi, rx_opts, data, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
RX64IOPacket
object with the provided parameters.Parameters: - x64bit_addr (
XBee64BitAddress
) – the 64-bit source address. - rssi (Integer) – received signal strength indicator.
- rx_opts (Integer) – bitfield indicating the receive options.
- data (Bytearray) – received RF data.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.RX_IO_64
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
rssi
¶ Returns the received Signal Strength Indicator (RSSI).
Returns: the received Signal Strength Indicator (RSSI). Return type: Integer
-
receive_options
¶ Returns the receive options bitfield.
Returns: the receive options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the received RF data.
Returns: the received RF data. Return type: Bytearray
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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
- x64bit_addr (
-
class
digi.xbee.packets.raw.
RX16IOPacket
(x16bit_addr, rssi, rx_opts, data, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This 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
RX16IOPacket
object with the provided parameters.Parameters: - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - rssi (Integer) – received signal strength indicator.
- rx_opts (Integer) – bitfield indicating the receive options.
- data (Bytearray) – received RF data.
- op_mode (
OperatingMode
, optional, default=`OperatingMode.API_MODE`) – The mode in which the frame was captured.
See also
-
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: 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
-
op_mode
¶ Retrieves the operating mode in which this packet was read.
Returns: The operating mode. Return type: OperatingMode
-
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. SeeSpecialByte
.InvalidPacketException
– if the calculated checksum is different from the checksum field value (last byte).InvalidPacketException
– if the frame type is different fromApiFrameType.RX_IO_16
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
See also
-
rssi
¶ Returns the received Signal Strength Indicator (RSSI).
Returns: the received Signal Strength Indicator (RSSI). Return type: Integer
-
receive_options
¶ Returns the receive options bitfield.
Returns: the receive options bitfield. Return type: Integer See also
-
rf_data
¶ Returns the received RF data.
Returns: the received RF data. Return type: Bytearray
- x16bit_addr (