digi.xbee.packets.filesystem module¶
-
class
digi.xbee.packets.filesystem.
FSRequestPacket
(frame_id, command, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a File System Request. Packet is built using the parameters of the constructor or providing a valid API payload.
A File System Request allows to access the filesystem and perform different operations.
Command response is received as an
FSResponsePacket
.See also
Class constructor. Instantiates a new
FSRequestPacket
object with the provided parameters.Parameters: - frame_id (Integer) – Frame ID of the packet.
- command (
FSCmd
or bytearray) – File system command to execute. - 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.TypeError
– If command is not aFSCmd
or a bytearray.
See also
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– If the bytearray length is less than 7 + the minimum length of the command. (start delim. + length (2 bytes) + frame type + frame id + fs cmd id + checksum + cmd data = 7 bytes + cmd data).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.FILE_SYSTEM_REQUEST
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
command
¶ Returns the file system command of the packet.
Returns: File system command of the packet. Return type: String
-
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.filesystem.
FSResponsePacket
(frame_id, command, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a File System Response. Packet is built using the parameters of the constructor or providing a valid API payload.
This packet is received in response of an
FSRequestPacket
.See also
Class constructor. Instantiates a new
FSResponsePacket
object with the provided parameters.Parameters: - frame_id (Integer) – The frame ID of the packet.
- command (
FSCmd
or bytearray) – File system command to execute. - 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.TypeError
– If command is not aFSCmd
or a bytearray.
See also
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– If the bytearray length is less than 8 + the minimum length of the command. (start delim. + length (2 bytes) + frame type + frame id + fs cmd id + status + checksum + cmd data = 8 bytes + cmd data).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.FILE_SYSTEM_RESPONSE
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
command
¶ Returns the file system command of the packet.
Returns: File system command of the packet. Return type: String
-
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.filesystem.
RemoteFSRequestPacket
(frame_id, x64bit_addr, command, transmit_options=0, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a remote File System Request. Packet is built using the parameters of the constructor or providing a valid API payload.
Used to access the filesystem on a remote device and perform different operations.
Remote command options are set as a bitfield.
If configured, command response is received as a
RemoteFSResponsePacket
.See also
Class constructor. Instantiates a new
RemoteFSRequestPacket
object with the provided parameters.Parameters: - frame_id (Integer) – Frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – 64-bit destination address. - command (
FSCmd
or bytearray) – File system command to execute. - transmit_options (Integer, optional, default=`TransmitOptions.NONE.value`) – Bitfield of supported transmission options.
- 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.TypeError
– If command is not aFSCmd
or a bytearray.
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– If the bytearray length is less than 7 + the minimum length of the command. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + transmit options + fs cmd id + checksum + cmd data = 16 bytes + cmd data).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.REMOTE_FILE_SYSTEM_REQUEST
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x64bit_dest_addr
¶ Returns the 64-bit destination address.
Returns: 64-bit destination address. Return type: XBee64BitAddress
See also
-
command
¶ Returns the file system command of the packet.
Returns: File system command of the packet. Return type: String
-
transmit_options
¶ Returns the transmit options bitfield.
Returns: Transmit options bitfield. Return type: Integer 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.filesystem.
RemoteFSResponsePacket
(frame_id, x64bit_addr, command, rx_options, op_mode=<OperatingMode.API_MODE: (1, 'API mode')>)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacket
This class represents a Remote File System Response. Packet is built using the parameters of the constructor or providing a valid API payload.
This packet is received in response of an
RemoteFSRequestPacket
.See also
Class constructor. Instantiates a new
RemoteFSResponsePacket
object with the provided parameters.Parameters: - frame_id (Integer) – The frame ID of the packet.
- x64bit_addr (
XBee64BitAddress
) – 64-bit source address. - command (
FSCmd
or bytearray) – File system command to execute. - rx_options (Integer) – Bitfield indicating the receive options.
- 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.TypeError
– If command is not aFSCmd
or a bytearray.
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
-
static
create_packet
(raw, operating_mode)[source]¶ Override method.
Returns: Raises: InvalidPacketException
– If the bytearray length is less than 8 + the minimum length of the command. (start delim. + length (2 bytes) + frame type + frame id + 64bit addr. + receive options + fs cmd id + status + checksum + cmd data = 17 bytes + cmd data).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.REMOTE_FILE_SYSTEM_RESPONSE
.InvalidOperatingModeException
– if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
x64bit_source_addr
¶ Returns the 64-bit source address.
Returns: 64-bit source address. Return type: XBee64BitAddress
See also
-
command
¶ Returns the file system command of the packet.
Returns: File system command of the packet. Return type: String
-
receive_options
¶ Returns the receive options bitfield.
Returns: Receive options bitfield. Return type: Integer See also
-
digi.xbee.packets.filesystem.
build_fs_command
(cmd_bytearray, direction=0)[source]¶ Creates a file system command from raw data.
Parameters: - cmd_bytearray (Bytearray) – Raw data of the packet to build.
- direction (Integer, optional, default=0) – If this command is a request (0) or a response (1).
Raises: InvalidPacketException
– If cmd_bytearray is not a bytearray or its length is less than 1 for requests 2 for responses.See also