digi.xbee.firmware module¶
-
class
digi.xbee.firmware.
UpdateConfigurer
(node, timeout=None, callback=None)[source]¶ Bases:
object
For internal use only. Helper class used to prepare nodes and/or network for an update.
Class constructor. Instantiates a new
UpdateConfigurer
with the given parameters.Parameters: - node (
AbstractXBeeDevice
) – Target being updated. - timeout (Float, optional, default=`None`) – Operations timeout.
- callback (Function) – Function to notify about the progress.
-
sync_sleep
¶ Returns whether node is part of a DigiMesh synchronous sleeping network.
Returns: True if it synchronous sleeps, False otherwise. Return type: Boolean
-
prepare_total
¶ Returns the total work for update preparation step.
Returns: Total prepare work. Return type: Integer
-
restore_total
¶ Returns the total work for update restoration step.
Returns: Total restore work. Return type: Integer
-
prepare_for_update
(prepare_node=True, prepare_net=True, restore_later=True)[source]¶ Prepares the node for an update process.
Parameters: - prepare_node (Boolean, optional, default=`True`) – True to prepare the node.
- prepare_net (Boolean, optional, default=`True`) – True to prepare the network.
- restore_later (Boolean, optional, default=`True`) – True to restore node original values when finish the update process.
-
restore_after_update
(restore_settings=True, port_settings=None)[source]¶ Restores the node after an update process.
Parameters: - restore_settings (Boolean, optional, default=`True`) – True to restore stored settings, False otherwise.
- port_settings (Dictionary, optional, default=`None`) – Dictionary with the new serial port configuration, None for remote node or if the serial config has not changed.
-
static
exec_at_cmd
(func, node, cmd, value=None, retries=5, apply=False)[source]¶ Reads the given parameter from the XBee with the given number of retries.
Parameters: - func (Function) – Function to execute.
- node (
AbstractXBeeDevice
) – XBee to get/set parameter. - (String or (cmd) – class: ATStringCommand): Parameter to get/set.
- value (Bytearray, optional, default=`None`) – Value to set.
- retries (Integer, optional, default=5) – Number of retries to perform.
- apply (Boolean, optional, default=`False`) – True to apply.
Returns: Read parameter value.
Return type: Bytearray
Raises: XBeeException
– If the value could be get/set after the retries.
-
progress_cb
(task, done=0)[source]¶ If a callback was provided in the constructor, notifies it with the provided task and the corresponding percentage.
Parameters: - task (String) – The task to inform about, it must be TASK_PREPARE or TASK_RESTORE.
- done (Integer, optional, default=0) – Total amount of done job. If 0, it is increased by one.
Returns: Total work done for the task.
Return type: Integer
- node (
-
digi.xbee.firmware.
update_local_firmware
(target, xml_fw_file, xbee_firmware_file=None, bootloader_firmware_file=None, timeout=None, progress_callback=None)[source]¶ Performs a local firmware update operation in the given target.
Parameters: - target (String or
XBeeDevice
) – Target of the firmware upload operation. String: serial port identifier.XBeeDevice
: XBee to upload its firmware. - xml_fw_file (String) – Path of the XML file that describes the firmware.
- xbee_firmware_file (String, optional) – Location of the XBee binary firmware file.
- bootloader_firmware_file (String, optional) – Location of the bootloader binary firmware file.
- timeout (Integer, optional) – Serial port read data timeout.
- progress_callback (Function, optional) –
Function to receive progress information. Receives two arguments:
- The current update task as a String
- The current update task percentage as an Integer
Raises: FirmwareUpdateException
– If there is any error performing the firmware update.- target (String or
-
digi.xbee.firmware.
update_remote_firmware
(remote, xml_fw_file, firmware_file=None, bootloader_file=None, max_block_size=0, timeout=None, progress_callback=None, _prepare=True)[source]¶ Performs a remote firmware update operation in the given target.
Parameters: - remote (
RemoteXBeeDevice
) – Remote XBee to upload. - xml_fw_file (String) – Path of the XML file that describes the firmware.
- firmware_file (String, optional) – Path of the binary firmware file.
- bootloader_file (String, optional) – Path of the bootloader firmware file.
- max_block_size (Integer, optional) – Maximum size of the ota block to send.
- timeout (Integer, optional) – Timeout to wait for remote frame requests.
- progress_callback (Function, optional) –
Function to receive progress information. Receives two arguments:
- The current update task as a String
- The current update task percentage as an Integer
Raises: FirmwareUpdateException
– if there is any error performing the remote firmware update.- remote (
-
digi.xbee.firmware.
update_remote_filesystem
(remote, ota_fs_file, max_block_size=0, timeout=None, progress_callback=None, _prepare=True)[source]¶ Performs a remote filesystem update operation in the given target.
Parameters: - remote (
RemoteXBeeDevice
) – Remote XBee to update its filesystem. - ota_fs_file (String) – Path of the OTA filesystem image file.
- max_block_size (Integer, optional) – Maximum size of the ota block to send.
- timeout (Integer, optional) – Timeout to wait for remote frame requests.
- progress_callback (Function, optional) –
Function to receive progress information. Receives two arguments:
- The current update task as a String
- The current update task percentage as an Integer
Raises: FirmwareUpdateException
– If there is any error updating the remote filesystem image.- remote (