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)[source]

Bases: 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.

Raises:

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

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

TX64Packet.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

property effective_len

Override method.

property x64bit_dest_addr

Returns the 64-bit destination address.

Returns:

the 64-bit destination address.

Return type:

XBee64BitAddress

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.

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

property 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)[source]

Bases: 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.

Raises:

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

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

TX16Packet.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

property effective_len

Override method.

property x16bit_dest_addr

Returns the 16-bit destination address.

Returns:

the 16-bit destination address.

Return type:

XBee16BitAddress

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.

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

property 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)[source]

Bases: 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.

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.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

TXStatusPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

property transmit_status

Returns the transmit status.

Returns:

the transmit status.

Return type:

TransmitStatus

See also

property effective_len

Returns the effective length of the packet.

Returns:

Effective length of the packet.

Return type:

Integer

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.

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

property 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)[source]

Bases: 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.

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.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RX64Packet

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

is_broadcast()[source]

Override method.

See also

XBeeAPIPacket.is_broadcast()
property effective_len

Override method.

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.

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

property 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.RX16Packet(x16bit_addr, rssi, rx_opts, rf_data=None, op_mode=OperatingMode.API_MODE)[source]

Bases: 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.

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.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RX16Packet.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

is_broadcast()[source]

Override method.

See also

XBeeAPIPacket.is_broadcast()
property effective_len

Override method.

property x16bit_source_addr

Returns the 16-bit source address.

Returns:

the 16-bit source address.

Return type:

XBee16BitAddress

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.

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

property 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.RX64IOPacket(x64bit_addr, rssi, rx_opts, data, op_mode=OperatingMode.API_MODE)[source]

Bases: 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.

static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RX64IOPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

is_broadcast()[source]

Override method.

See also

XBeeAPIPacket.is_broadcast()
property effective_len

Override method.

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.

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

property 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

property 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.RX16IOPacket(x16bit_addr, rssi, rx_opts, data, op_mode=OperatingMode.API_MODE)[source]

Bases: 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.

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.

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

property 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:

RX16IOPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

is_broadcast()[source]

Override method.

See also

XBeeAPIPacket.is_broadcast()
property effective_len

Override method.

property x16bit_source_addr

Returns the 16-bit source address.

Returns:

the 16-bit source address.

Return type:

XBee16BitAddress

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 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