Device: Allow skipping of device state refreshing on call to open

This commit is contained in:
Max Brombach
2026-11-03 11:20:04 -05:00
committed by Kyle Schwarz
parent dffb0bcefb
commit 645549193d
21 changed files with 124 additions and 166 deletions
@@ -15,20 +15,33 @@ namespace icsneo {
namespace Bootloader {
using Logger = icsneo::Device::OpenStatusHandler;
enum class StatusType {
Progress,
Failed
};
/**
* @brief Alias of callback function for progress of a bootloader pipeline task
*
* The progress value passed into the callback function indicates the following:
* 1) If the value is std::nullopt, this implies the status message is for an asynchronous task or a task in which the current progress is unknown.
* 2) If the value is between 0 and 1 (i.e., 0 <= progress <= 1), this implies the actual progress of the current task as a percentage.
* 3) Values not between 0 and 1 (i.e., progress < 0 or progress > 1) are undefined.
*/
using StatusHandler = std::function<void(StatusType type, const std::string& status, std::optional<double> progress)>;
bool requiresUpdate(icsneo::Device& device, const FWRepo& fw);
bool update(
icsneo::Device& device,
const FWRepo& fw,
Logger logger = [](icsneo::Device::OpenStatusType, const std::string&, std::optional<double>) { return icsneo::Device::OpenDirective::Continue; },
StatusHandler statusHandler = [](StatusType, const std::string&, std::optional<double>) {},
bool alreadyInBootloader = false,
bool forceFlash = false
);
bool enterBootloader(icsneo::Device& device);
bool exitBootloader(icsneo::Device& device, Logger logger, bool updatedChips);
bool verifyConnection(icsneo::Device& device, Logger logger);
bool exitBootloader(icsneo::Device& device, StatusHandler statusHandler, bool updatedChips);
bool verifyConnection(icsneo::Device& device, StatusHandler statusHandler);
bool isSFPChip(const icsneo::Bootloader::Chip& chip);
bool isSFPIEF(const icsneo::Bootloader::IEF& ief);