digi.xbee.packets.wifi module

class digi.xbee.packets.wifi.IODataSampleRxIndicatorWifiPacket(source_address, rssi, receive_options, rf_data=None)[source]

Bases: digi.xbee.packets.base.XBeeAPIPacket

This class represents a IO data sample RX indicator (Wi-Fi) packet. Packet is built using the parameters of the constructor or providing a valid API payload.

When the module receives an IO sample frame from a remote device, it sends the sample out the UART or SPI using this frame type. Only modules running API mode will be able to receive IO samples.

Among received data, some options can also be received indicating transmission parameters.

See also

Class constructor. Instantiates a new IODataSampleRxIndicatorWifiPacket object with the provided parameters.

Parameters:
  • source_address (ipaddress.IPv4Address) – the 64-bit source address.
  • rssi (Integer) – received signal strength indicator.
  • receive_options (Integer) – bitfield indicating the receive options.
  • rf_data (Bytearray, optional) – received RF data. Optional.
Raises:

ValueError – if rf_data is not None and it’s not valid for create an IOSample.

See also

ipaddress.IPv4Address
static create_packet(raw, operating_mode)[source]

Override method.

Returns:

IODataSampleRxIndicatorWifiPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

source_address

ipaddress.IPv4Address. IPv4 source address.

rssi

Integer. Received Signal Strength Indicator (RSSI) value.

receive_options

Integer. Receive options bitfield.

rf_data

Bytearray. Received RF data.

io_sample

IO sample corresponding to the data contained in the packet.

Type:IOSample
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
output(escaped=False)

Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.

Parameters:escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
Returns:raw bytearray of the XBeePacket.
Return type:Bytearray
to_dict()

Returns a dictionary with all information of the XBeePacket fields.

Returns:dictionary with all information of the XBeePacket fields.
Return type:Dictionary
static unescape_data(data)

Un-escapes the provided bytearray data.

Parameters:data (Bytearray) – the bytearray to unescape.
Returns:data unescaped.
Return type:Bytearray
class digi.xbee.packets.wifi.RemoteATCommandWifiPacket(frame_id, dest_address, transmit_options, command, parameter=None)[source]

Bases: digi.xbee.packets.base.XBeeAPIPacket

This class represents a remote AT command request (Wi-Fi) packet. Packet is built using the parameters of the constructor or providing a valid API payload.

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

Class constructor. Instantiates a new RemoteATCommandWifiPacket object with the provided parameters.

Parameters:
  • frame_id (integer) – the frame ID of the packet.
  • dest_address (ipaddress.IPv4Address) – the IPv4 address of the destination device.
  • transmit_options (Integer) – bitfield of supported transmission options.
  • command (String) – AT command to send.
  • parameter (Bytearray, optional) – AT command parameter. Optional.
Raises:
  • ValueError – if frame_id is less than 0 or greater than 255.
  • ValueError – if length of command is different than 2.

See also

ipaddress.IPv4Address
static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RemoteATCommandWifiPacket

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

dest_address

ipaddress.IPv4Address. IPv4 destination address.

transmit_options

Integer. Transmit options bitfield.

command

String. AT command.

parameter

Bytearray. AT command parameter.

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
output(escaped=False)

Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.

Parameters:escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
Returns:raw bytearray of the XBeePacket.
Return type:Bytearray
to_dict()

Returns a dictionary with all information of the XBeePacket fields.

Returns:dictionary with all information of the XBeePacket fields.
Return type:Dictionary
static unescape_data(data)

Un-escapes the provided bytearray data.

Parameters:data (Bytearray) – the bytearray to unescape.
Returns:data unescaped.
Return type:Bytearray
class digi.xbee.packets.wifi.RemoteATCommandResponseWifiPacket(frame_id, source_address, command, response_status, comm_value=None)[source]

Bases: digi.xbee.packets.base.XBeeAPIPacket

This class represents a remote AT command response (Wi-Fi) packet. Packet is built using the parameters of the constructor or providing a valid API payload.

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 ATCommandStatus object with the status of the AT command.

Class constructor. Instantiates a new RemoteATCommandResponseWifiPacket object with the provided parameters.

Parameters:
  • frame_id (Integer) – the frame ID of the packet.
  • source_address (ipaddress.IPv4Address) – the IPv4 address of the source device.
  • command (String) – the AT command of the packet. Must be a string.
  • response_status (ATCommandStatus) – the status of the AT command.
  • comm_value (Bytearray, optional) – the AT command response value.
Raises:
  • ValueError – if frame_id is less than 0 or greater than 255.
  • ValueError – if length of command is different than 2.

See also

ipaddress.IPv4Address
static create_packet(raw, operating_mode)[source]

Override method.

Returns:

RemoteATCommandResponseWifiPacket.

Raises:

See also

XBeeAPIPacket._check_api_packet()
needs_id()[source]

Override method.

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
output(escaped=False)

Returns the raw bytearray of this XBeePacket, ready to be send by the serial port.

Parameters:escaped (Boolean) – indicates if the raw bytearray will be escaped or not.
Returns:raw bytearray of the XBeePacket.
Return type:Bytearray
to_dict()

Returns a dictionary with all information of the XBeePacket fields.

Returns:dictionary with all information of the XBeePacket fields.
Return type:Dictionary
static unescape_data(data)

Un-escapes the provided bytearray data.

Parameters:data (Bytearray) – the bytearray to unescape.
Returns:data unescaped.
Return type:Bytearray
source_address

ipaddress.IPv4Address. IPv4 source address.

command

String. AT command.

status

ATCommandStatus. AT command response status.

command_value

Bytearray. AT command value.