digi.xbee.packets.wifi module
- class digi.xbee.packets.wifi.IODataSampleRxIndicatorWifiPacket(src_address, rssi, rx_options, rf_data=None, op_mode=OperatingMode.API_MODE)[source]
Bases:
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:
src_address (
ipaddress.IPv4Address
) – the 64-bit source address.rssi (Integer) – received signal strength indicator.
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 an
IOSample
.
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 from 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 from 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()
- property effective_len
Override method.
See also
- property source_address
Returns the IPv4 address of the source device.
- Returns:
the IPv4 address of the source device.
- Return type:
ipaddress.IPv4Address
See also
ipaddress.IPv4Address
- 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:
See also
- 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.
See also
- get_frame_type()
Returns the frame type of this packet.
- Returns:
the frame type of this packet.
- Return type:
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:
- 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.wifi.RemoteATCommandWifiPacket(frame_id, dest_address, tx_options, command, parameter=None, op_mode=OperatingMode.API_MODE)[source]
Bases:
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.tx_options (Integer) – bitfield of supported transmission options.
command (String) – 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 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 from 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 from 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()
- property effective_len
Override method.
See also
- property dest_address
Returns the IPv4 address of the destination device.
- Returns:
the IPv4 address of the destination device.
- Return type:
ipaddress.IPv4Address
See also
ipaddress.IPv4Address
- property transmit_options
Returns the transmit options bitfield.
- Returns:
the transmit options bitfield.
- Return type:
Integer
See also
- property command
Returns the AT command.
- Returns:
the AT command.
- Return type:
String
- property parameter
Returns the AT command parameter.
- Returns:
the AT command parameter.
- 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.
See also
- get_frame_type()
Returns the frame type of this packet.
- Returns:
the frame type of this packet.
- Return type:
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:
- 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.wifi.RemoteATCommandResponseWifiPacket(frame_id, src_address, command, resp_status, comm_value=None, op_mode=OperatingMode.API_MODE)[source]
Bases:
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.
src_address (
ipaddress.IPv4Address
) – the IPv4 address of the source device.command (String) – the AT command of the packet. Must be a string.
resp_status (
ATCommandStatus
) – 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 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 from 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 from 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()
- 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.
See also
- get_frame_type()
Returns the frame type of this packet.
- Returns:
the frame type of this packet.
- Return type:
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:
- 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
- property effective_len
Override method.
See also
- property source_address
Returns the IPv4 address of the source device.
- Returns:
the IPv4 address of the source device.
- Return type:
ipaddress.IPv4Address
See also
ipaddress.IPv4Address
- property command
Returns the AT command of the packet.
- Returns:
the AT command of the packet.
- Return type:
String
- property status
Returns the AT command response status of the packet.
- Returns:
the AT command response status of the packet.
- Return type:
See also
- property command_value
Returns the AT command response value.
- Returns:
the AT command response value.
- Return type:
Bytearray