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 notNone
and it’s not valid for create anIOSample
.See also
-
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 + source addr. (4 bytes) + rssi + receive options + rf data (5 bytes) + checksum = 16 bytes).
- InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
- InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte
. - InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
- InvalidPacketException – if the frame type is not
ApiFrameType.IO_DATA_SAMPLE_RX_INDICATOR_WIFI
. - InvalidOperatingModeException – if
operating_mode
is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
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.
-
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
-
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 (
-
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
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: - InvalidPacketException – if the Bytearray length is less than 17. (start delim. + length (2 bytes) + frame type + frame id + dest. addr. (8 bytes) + transmit options + command (2 bytes) + checksum = 17 bytes).
- InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
- InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte
. - InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
- InvalidPacketException – if the frame type is not
ApiFrameType.REMOTE_AT_COMMAND_REQUEST_WIFI
. - InvalidOperatingModeException – if
operating_mode
is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
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.
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
-
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: Raises: - InvalidPacketException – if the bytearray length is less than 17. (start delim. + length (2 bytes) + frame type + frame id + source addr. (8 bytes) + command (2 bytes) + receive options + checksum = 17 bytes).
- InvalidPacketException – if the length field of ‘raw’ is different than its real length. (length field: bytes 2 and 3)
- InvalidPacketException – if the first byte of ‘raw’ is not the header byte. See
SpecialByte
. - InvalidPacketException – if the calculated checksum is different than the checksum field value (last byte).
- InvalidPacketException – if the frame type is not
ApiFrameType.REMOTE_AT_COMMAND_RESPONSE_WIFI
. - 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
-
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.