digi.xbee.packets.common module¶
-
class
digi.xbee.packets.common.
ATCommPacket
(frame_id, command, parameter=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an AT command packet.
Used to query or set module parameters on the local device. This API command applies changes after executing the command. (Changes made to module parameters take effect once changes are applied.).
Command response is received as an
ATCommResponsePacket
.See also
Class constructor. Instantiates a new
ATCommPacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- command (String or bytearray) – AT command of the packet.
- parameter (Bytearray, optional) – the AT command parameter.
- 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.ValueError
– if length of command is different from 2.
See also
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + command (2 bytes) + checksum = 8 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.AT_COMMAND
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
command
¶ Returns the AT command of the packet.
Returns: the AT command of the packet. Return type: String
-
parameter
¶ Returns the parameter of the packet.
Returns: the parameter of the packet. Return type: Bytearray
-
effective_len
¶ Returns the effective length of the packet.
Returns: Effective length of the packet. Return type: Integer
-
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.common.
ATCommQueuePacket
(frame_id, command, parameter=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an AT command Queue packet.
Used to query or set module parameters on the local device.
In contrast to the
ATCommPacket
API packet, new parameter values are queued and not applied until either anATCommPacket
is sent or the applyChanges() method of theXBeeDevice
class is issued.Command response is received as an
ATCommResponsePacket
.See also
Class constructor. Instantiates a new
ATCommQueuePacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- command (String or bytearray) – the AT command of the packet.
- parameter (Bytearray, optional) – the AT command parameter. Optional.
- 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.ValueError
– if length of command is different from 2.
See also
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 8. (start delim. + length (2 bytes) + frame type + frame id + command + checksum = 8 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.AT_COMMAND_QUEUE
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
command
¶ Returns the AT command of the packet.
Returns: the AT command of the packet. Return type: String
-
parameter
¶ Returns the parameter of the packet.
Returns: the parameter of the packet. Return type: Bytearray
-
effective_len
¶ Returns the effective length of the packet.
Returns: Effective length of the packet. Return type: Integer
-
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.common.
ATCommResponsePacket
(frame_id, command, response_status=<ATCommandStatus.OK: (0, 'Status OK')>, comm_value=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an AT command response packet.
In response to an AT command message, the module will send an AT command response message. Some commands will send back multiple frames (for example, the ND - Node Discover command).
This packet is received in response of an
ATCommPacket
.Response also includes an
ATCommandStatus
object with the status of the AT command.See also
Class constructor. Instantiates a new
ATCommResponsePacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet. Must be between 0 and 255.
- command (String or bytearray) – the AT command of the packet.
- response_status (
ATCommandStatus
or Integer) – the status of the AT command. - comm_value (Bytearray, optional) – the AT command response value.
- 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.ValueError
– if length of command is different from 2.
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 + frame id + at command (2 bytes) + command status + 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.AT_COMMAND_RESPONSE
.InvalidPacketException
– if the command status field is not a valid value. SeeATCommandStatus
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
command
¶ Returns the AT command of the packet.
Returns: the AT command of the packet. Return type: String
-
command_value
¶ Returns the AT command response value.
Returns: the AT command response value. Return type: Bytearray
-
real_status
¶ Returns the AT command response status of the packet.
Returns: the AT command response status of the packet. Return type: Integer
-
status
¶ Returns the AT command response status of the packet.
Returns: the AT command response status of the packet. Return type: ATCommandStatus
See also
-
effective_len
¶ Returns the effective length of the packet.
Returns: Effective length of the packet. Return type: Integer
-
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.common.
ReceivePacket
(x64bit_addr, x16bit_addr, rx_options, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a receive packet. Packet is built using the parameters of the constructor or providing a valid byte array.
When the module receives an RF packet, it is sent out the UART using this message type.
This packet is received when external devices send transmit request packets to this module.
Among received data, some options can also be received indicating transmission parameters.
See also
Class constructor. Instantiates a new
ReceivePacket
object with the provided parameters.Parameters: - x64bit_addr (
XBee64BitAddress
) – the 64-bit source address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - rx_options (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.
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 16. (start delim. + length (2 bytes) + frame type + 64bit addr. + 16bit addr. + Receive options + checksum = 16 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 notApiFrameType.RECEIVE_PACKET
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
See also
-
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.common.
RemoteATCommandPacket
(frame_id, x64bit_addr, x16bit_addr, tx_options, command, parameter=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a Remote AT command Request packet. Packet is built using the parameters of the constructor or providing a valid byte array.
Used to query or set module parameters on a remote device. For parameter changes on the remote device to take effect, changes must be applied, either by setting the apply changes options bit, or by sending an AC command to the remote node.
Remote command options are set as a bitfield.
If configured, command response is received as a
RemoteATCommandResponsePacket
.Class constructor. Instantiates a new
RemoteATCommandPacket
object with the provided parameters.Parameters: - frame_id (integer) – the frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – the 64-bit destination address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit destination address. - tx_options (Integer) – bitfield of supported transmission options.
- command (String or bytearray) – AT command to send.
- parameter (Bytearray, optional) – AT command parameter.
- 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.ValueError
– if length of command is different from 2.
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the Bytearray length is less than 19. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + 16bit addr. + transmit options + command (2 bytes) + checksum = 19 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 notApiFrameType.REMOTE_AT_COMMAND_REQUEST
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
x64bit_dest_addr
¶ Returns the 64-bit destination address.
Returns: the 64-bit destination address. Return type: XBee64BitAddress
See also
-
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
-
parameter
¶ Returns the AT command parameter.
Returns: the AT command parameter. Return type: Bytearray
-
command
¶ Returns the AT command.
Returns: the AT command. Return type: String
-
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.common.
RemoteATCommandResponsePacket
(frame_id, x64bit_addr, x16bit_addr, command, resp_status, comm_value=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a remote AT command response packet. Packet is built using the parameters of the constructor or providing a valid byte array.
If a module receives a remote command response RF data frame in response to a remote AT command request, the module will send a remote AT command response message out the UART. Some commands may send back multiple frames, for example, Node Discover (ND) command.
This packet is received in response of a
RemoteATCommandPacket
.Response also includes an object with the status of the AT command.
Class constructor. Instantiates a new
RemoteATCommandResponsePacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – the 64-bit source address - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - command (String or bytearray) – the AT command of the packet.
- resp_status (
ATCommandStatus
or Integer) – the status of the AT command. - comm_value (Bytearray, optional) – the AT command response value. Optional.
- 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.ValueError
– if length of command is different from 2.
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 19. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + 16bit addr. + receive options + command (2 bytes) + checksum = 19 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 notApiFrameType.REMOTE_AT_COMMAND_RESPONSE
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
command
¶ Returns the AT command of the packet.
Returns: the AT command of the packet. Return type: String
-
command_value
¶ Returns the AT command response value.
Returns: the AT command response value. Return type: Bytearray
-
real_status
¶ Returns the AT command response status of the packet.
Returns: the AT command response status of the packet. Return type: Integer
-
status
¶ Returns the AT command response status of the packet.
Returns: the AT command response status of the packet. Return type: ATCommandStatus
See also
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
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.common.
TransmitPacket
(frame_id, x64bit_addr, x16bit_addr, broadcast_radius, tx_options, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a transmit request packet. Packet is built using the parameters of the constructor or providing a valid API byte array.
A transmit request API frame causes the module to send data as an RF packet to the specified destination.
The 64-bit destination address should be set to 0x000000000000FFFF for a broadcast transmission (to all devices).
The coordinator can be addressed by either setting the 64-bit address to 0x0000000000000000 and the 16-bit address to 0xFFFE, OR by setting the 64-bit address to the coordinator’s 64-bit address and the 16-bit address to 0x0000.
For all other transmissions, setting the 16-bit address to the correct 16-bit address can help improve performance when transmitting to multiple destinations.
If a 16-bit address is not known, this field should be set to 0xFFFE (unknown).
The transmit status frame (
ApiFrameType.TRANSMIT_STATUS
) will indicate the discovered 16-bit address, if successful (seeTransmitStatusPacket
).The broadcast radius can be set from 0 up to NH. If set to 0, the value of NH specifies the broadcast radius (recommended). This parameter is only used for broadcast transmissions.
The maximum number of payload bytes can be read with the NP command.
Several transmit options can be set using the transmit options bitfield.
See also
Class constructor. Instantiates a new
TransmitPacket
object with the provided parameters.Parameters: - frame_id (integer) – the frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – the 64-bit destination address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit destination address. - broadcast_radius (Integer) – maximum number of hops a broadcast transmission can occur.
- tx_options (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.
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 18. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + 16bit addr. + broadcast radius + Transmit options + checksum = 18 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 notApiFrameType.TRANSMIT_REQUEST
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
rf_data
¶ Returns the RF data to send.
Returns: the RF data to send. Return type: Bytearray
-
transmit_options
¶ Returns the transmit options bitfield.
Returns: the transmit options bitfield. Return type: Integer See also
-
broadcast_radius
¶ Returns the broadcast radius. Broadcast radius is the maximum number of hops a broadcast transmission.
Returns: the broadcast radius. Return type: Integer
-
x64bit_dest_addr
¶ Returns the 64-bit destination address.
Returns: the 64-bit destination address. Return type: XBee64BitAddress
See also
-
x16bit_dest_addr
¶ Returns the 16-bit destination address.
Returns: the 16-bit destination address. Return type: XBee16BitAddress
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.common.
TransmitStatusPacket
(frame_id, x16bit_addr, tx_retry_count, transmit_status=<TransmitStatus.SUCCESS: (0, 'Success')>, discovery_status=<DiscoveryStatus.NO_DISCOVERY_OVERHEAD: (0, 'No discovery overhead')>, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a transmit status packet. Packet is built using the parameters of the constructor or providing a valid raw byte array.
When a Transmit Request is completed, the module sends a transmit status message. This message will indicate if the packet was transmitted successfully or if there was a failure.
This packet is the response to standard and explicit transmit requests.
See also
Class constructor. Instantiates a new
TransmitStatusPacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- x16bit_addr (
XBee16BitAddress
) – 16-bit network address the packet was delivered to. - tx_retry_count (Integer) – the number of application transmission retries that took place.
- transmit_status (
TransmitStatus
, optional) – transmit status. Default: SUCCESS. - discovery_status (
DiscoveryStatus
, optional) – discovery status. Default: NO_DISCOVERY_OVERHEAD. - 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.-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 11. (start delim. + length (2 bytes) + frame type + frame id + 16bit addr. + transmit retry count + delivery status + discovery status + checksum = 11 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 notApiFrameType.TRANSMIT_STATUS
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
x16bit_dest_addr
¶ Returns the 16-bit destination address.
Returns: the 16-bit destination address. Return type: XBee16BitAddress
See also
-
transmit_status
¶ Returns the transmit status.
Returns: the transmit status. Return type: TransmitStatus
See also
-
transmit_retry_count
¶ Returns the transmit retry count.
Returns: the transmit retry count. Return type: Integer
-
discovery_status
¶ Returns the discovery status.
Returns: the discovery status. Return type: DiscoveryStatus
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.common.
ModemStatusPacket
(modem_status, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a modem status packet. Packet is built using the parameters of the constructor or providing a valid API raw byte array.
RF module status messages are sent from the module in response to specific conditions and indicates the state of the modem in that moment.
See also
Class constructor. Instantiates a new
ModemStatusPacket
object with the provided parameters.Parameters: - modem_status (
ModemStatus
) – the modem status event. - 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 6. (start delim. + length (2 bytes) + frame type + modem status + checksum = 6 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 notApiFrameType.MODEM_STATUS
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
modem_status
¶ Returns the modem status event.
Returns: The modem status event. Return type: ModemStatus
See also
-
effective_len
¶ Returns the effective length of the packet.
Returns: Effective length of the packet. Return type: Integer
-
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
- modem_status (
-
class
digi.xbee.packets.common.
IODataSampleRxIndicatorPacket
(x64bit_addr, x16bit_addr, rx_options, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an IO data sample RX indicator packet. Packet is built using the parameters of the constructor or providing a valid API byte array.
When the module receives an IO sample frame from a remote device, it sends the sample out the UART using this frame type (when AO=0). Only modules running API firmware will send IO samples out the UART.
Among received data, some options can also be received indicating transmission parameters.
See also
Class constructor. Instantiates a new
IODataSampleRxIndicatorPacket
object with the provided parameters.Parameters: - x64bit_addr (
XBee64BitAddress
) – the 64-bit source address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - rx_options (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.
Raises: ValueError
– if rf_data is not None and it’s not valid for create anIOSample
.-
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. + 16bit addr. + 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 notApiFrameType.IO_DATA_SAMPLE_RX_INDICATOR
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
See also
-
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
-
io_sample
¶ Returns the IO sample corresponding to the data contained in the packet.
Returns: - the IO sample of the packet, None if the
- packet has not any data or if the sample could not be generated correctly.
Return type: IOSample
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
- x64bit_addr (
-
class
digi.xbee.packets.common.
ExplicitAddressingPacket
(frame_id, x64bit_addr, x16bit_addr, src_endpoint, dest_endpoint, cluster_id, profile_id, broadcast_radius=0, transmit_options=0, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an explicit addressing command packet. Packet is built using the parameters of the constructor or providing a valid API payload.
Allows application layer fields (endpoint and cluster ID) to be specified for a data transmission. Similar to the transmit request, but also requires application layer addressing fields to be specified (endpoints, cluster ID, profile ID). An explicit addressing request API frame causes the module to send data as an RF packet to the specified destination, using the specified source and destination endpoints, cluster ID, and profile ID.
The 64-bit destination address should be set to 0x000000000000FFF for a broadcast transmission (to all devices).
The coordinator can be addressed by either setting the 64-bit address to 0x000000000000000 and the 16-bit address to 0xFFFE, OR by setting the 64-bit address to the coordinator’s 64-bit address and the 16-bit address to 0x0000.
For all other transmissions, setting the 16-bit address to the right 16-bit address can help improve performance when transmitting to multiple destinations.
If a 16-bit address is not known, this field should be set to 0xFFFE (unknown).
The transmit status frame (
ApiFrameType.TRANSMIT_STATUS
) will indicate the discovered 16-bit address, if successful (seeTransmitStatusPacket
)).The broadcast radius can be set from 0 up to NH. If set to 0, the value of NH specifies the broadcast radius (recommended). This parameter is only used for broadcast transmissions.
The maximum number of payload bytes can be read with the NP command. Note: if source routing is used, the RF payload will be reduced by two bytes per intermediate hop in the source route.
Several transmit options can be set using the transmit options bitfield.
See also
Class constructor. . Instantiates a new
ExplicitAddressingPacket
object with the provided parameters.Parameters: - frame_id (Integer) – the frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – the 64-bit address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit address. - src_endpoint (Integer) – source endpoint. 1 byte.
- dest_endpoint (Integer) – destination endpoint. 1 byte.
- cluster_id (Integer) – cluster id. Must be between 0 and 0xFFFF.
- profile_id (Integer) – profile id. Must be between 0 and 0xFFFF.
- broadcast_radius (Integer) – maximum number of hops a broadcast transmission can occur.
- transmit_options (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.
Raises: ValueError
– if frame_id, src_endpoint or dst_endpoint are less than 0 or greater than 255.ValueError
– if lengths of cluster_id or profile_id (respectively) are less than 0 or greater than 0xFFFF.
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– if the bytearray length is less than 24. (start delim. + length (2 bytes) + frame type + frame ID + 64bit addr. + 16bit addr. + source endpoint + dest. endpoint + cluster ID (2 bytes) + profile ID (2 bytes) + broadcast radius + transmit options + checksum = 24 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.EXPLICIT_ADDRESSING
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
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
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
source_endpoint
¶ Returns the source endpoint of the transmission.
Returns: the source endpoint of the transmission. Return type: Integer
-
dest_endpoint
¶ Returns the destination endpoint of the transmission.
Returns: the destination endpoint of the transmission. Return type: Integer
-
cluster_id
¶ Returns the cluster ID of the transmission.
Returns: the cluster ID of the transmission. Return type: Integer
-
profile_id
¶ Returns the profile ID of the transmission.
- Returns
- Integer: the profile ID of the transmission.
-
rf_data
¶ Returns the RF data to send.
Returns: the RF data to send. Return type: Bytearray
-
transmit_options
¶ Returns the transmit options bitfield.
Returns: the transmit options bitfield. Return type: Integer See also
-
broadcast_radius
¶ Returns the broadcast radius. Broadcast radius is the maximum number of hops a broadcast transmission.
Returns: the broadcast radius. Return type: Integer
-
x64bit_dest_addr
¶ Returns the 64-bit destination address.
Returns: the 64-bit destination address. Return type: XBee64BitAddress
See also
-
x16bit_dest_addr
¶ Returns the 16-bit destination address.
Returns: the 16-bit destination address. Return type: XBee16BitAddress
See also
-
class
digi.xbee.packets.common.
ExplicitRXIndicatorPacket
(x64bit_addr, x16bit_addr, src_endpoint, dest_endpoint, cluster_id, profile_id, rx_options, rf_data=None, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents an explicit RX indicator packet. Packet is built using the parameters of the constructor or providing a valid API payload.
When the modem receives an RF packet it is sent out the UART using this message type (when AO=1).
This packet is received when external devices send explicit addressing packets to this module.
Among received data, some options can also be received indicating transmission parameters.
Class constructor. Instantiates a new
ExplicitRXIndicatorPacket
object with the provided parameters.Parameters: - x64bit_addr (
XBee64BitAddress
) – the 64-bit source address. - x16bit_addr (
XBee16BitAddress
) – the 16-bit source address. - src_endpoint (Integer) – source endpoint. 1 byte.
- dest_endpoint (Integer) – destination endpoint. 1 byte.
- cluster_id (Integer) – cluster ID. Must be between 0 and 0xFFFF.
- profile_id (Integer) – profile ID. Must be between 0 and 0xFFFF.
- rx_options (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.
Raises: ValueError
– if src_endpoint or dst_endpoint are less than 0 or greater than 255.ValueError
– if lengths of cluster_id or profile_id (respectively) are different from 2.
-
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 22. (start delim. + length (2 bytes) + frame type + 64bit addr. + 16bit addr. + source endpoint + dest. endpoint + cluster ID (2 bytes) + profile ID (2 bytes) + receive options + checksum = 22 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.EXPLICIT_RX_INDICATOR
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
effective_len
¶ Override method.
See also
XBeeAPIPacket.effective_len()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: the 64-bit source address. Return type: XBee64BitAddress
See also
-
x16bit_source_addr
¶ Returns the 16-bit source address.
Returns: the 16-bit source address. Return type: XBee16BitAddress
See also
-
source_endpoint
¶ Returns the source endpoint of the transmission.
Returns: the source endpoint of the transmission. Return type: Integer
-
dest_endpoint
¶ Returns the destination endpoint of the transmission.
Returns: the destination endpoint of the transmission. Return type: Integer
-
cluster_id
¶ Returns the cluster ID of the transmission.
Returns: the cluster ID of the transmission. Return type: Integer
-
profile_id
¶ Returns the profile ID of the transmission.
- Returns
- Integer: the profile ID of the transmission.
-
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
- x64bit_addr (