digi.xbee.packets.filesystem module¶
-
class
digi.xbee.packets.filesystem.FSRequestPacket(frame_id, command)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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
FSRequestPacketobject with the provided parameters.- Parameters
frame_id (Integer) – Frame ID of the packet.
command (
FSCmdor bytearray) – File system command to execute.
- Raises
ValueError – If frame_id is less than 0 or greater than 255.
TypeError – If command is not a
FSCmdor 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. See
SpecialByte.InvalidPacketException – If the calculated checksum is different from the checksum field value (last byte).
InvalidPacketException – If the frame type is different from
ApiFrameType.FILE_SYSTEM_REQUEST.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
command¶ Returns the file system command of the packet.
- Returns
File system command of the packet.
- Return type
String
-
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
-
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)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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
FSResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – The frame ID of the packet.
command (
FSCmdor bytearray) – File system command to execute.
- Raises
ValueError – If frame_id is less than 0 or greater than 255.
TypeError – If command is not a
FSCmdor 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. See
SpecialByte.InvalidPacketException – If the calculated checksum is different from the checksum field value (last byte).
InvalidPacketException – If the frame type is different from
ApiFrameType.FILE_SYSTEM_RESPONSE.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
command¶ Returns the file system command of the packet.
- Returns
File system command of the packet.
- Return type
String
-
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
-
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)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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
RemoteFSRequestPacketobject with the provided parameters.- Parameters
frame_id (Integer) – Frame ID of the packet.
x64bit_addr (
XBee64BitAddress) – 64-bit destination address.command (
FSCmdor bytearray) – File system command to execute.transmit_options (Integer, optional, default=`TransmitOptions.NONE.value`) – Bitfield of supported transmission options.
- Raises
ValueError – If frame_id is less than 0 or greater than 255.
TypeError – If command is not a
FSCmdor 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. See
SpecialByte.InvalidPacketException – If the calculated checksum is different from the checksum field value (last byte).
InvalidPacketException – If the frame type is different from
ApiFrameType.REMOTE_FILE_SYSTEM_REQUEST.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x64bit_dest_addr¶ Returns the 64-bit destination address.
- Returns
64-bit destination address.
- Return type
See also
-
property
command¶ Returns the file system command of the packet.
- Returns
File system command of the packet.
- Return type
String
-
property
transmit_options¶ Returns the transmit options bitfield.
- Returns
Transmit options bitfield.
- Return type
Integer
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
-
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, receive_options)[source]¶ Bases:
digi.xbee.packets.base.XBeeAPIPacketThis 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
RemoteFSResponsePacketobject with the provided parameters.- Parameters
frame_id (Integer) – The frame ID of the packet.
x64bit_addr (
XBee64BitAddress) – 64-bit source address.command (
FSCmdor bytearray) – File system command to execute.receive_options (Integer) – Bitfield indicating the receive options.
- Raises
ValueError – If frame_id is less than 0 or greater than 255.
TypeError – If command is not a
FSCmdor a bytearray.
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
-
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. See
SpecialByte.InvalidPacketException – If the calculated checksum is different from the checksum field value (last byte).
InvalidPacketException – If the frame type is different from
ApiFrameType.REMOTE_FILE_SYSTEM_RESPONSE.InvalidOperatingModeException – if operating_mode is not supported.
See also
XBeeAPIPacket._check_api_packet()
-
property
x64bit_source_addr¶ Returns the 64-bit source address.
- Returns
64-bit source address.
- Return type
See also
-
property
command¶ Returns the file system command of the packet.
- Returns
File system command of the packet.
- Return type
String
-
property
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