EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
eduart::sensorring::firmware_update::FirmwareUpdater Class Reference

Flashes sensor-board firmware images over a CAN interface. More...

#include <FirmwareUpdater.hpp>

Public Member Functions

 FirmwareUpdater (UpdateConfig config={})
 Constructs a FirmwareUpdater with the given timing/retry configuration.
bool flashSingleBoard (const com::ComInterfaceID &interface, std::uint8_t node_id, const std::string &hex_file_path, LogCallback log_callback={}) const
 Flashes a single board identified by its CAN node ID.
bool enterSingleBoardBootloader (const com::ComInterfaceID &interface, std::size_t board_index, LogCallback log_callback={}) const
 Requests a single board to enter bootloader mode.
bool flashAllBoardsSequential (const com::ComInterfaceID &interface, const std::string &hex_file_path, LogCallback log_callback={}) const
 Flashes every board on the ring sequentially with the same firmware image.
std::optional< std::uint8_t > detectBootloaderNode (const com::ComInterfaceID &interface) const
 Detects whether any board on the ring is currently in bootloader mode.
std::optional< std::uint8_t > detectBootloaderNodeWithRetries (const com::ComInterfaceID &interface)
 Detects whether any board on the ring is currently in bootloader mode, with retries. Number of retries and delay between retries are configurable via UpdateConfig.

Detailed Description

Flashes sensor-board firmware images over a CAN interface.

FirmwareUpdater uses the frankly bootloader protocol to transfer Intel HEX firmware images to one or more sensor boards connected on a CAN bus. All operations are synchronous and blocking; call them from a dedicated thread if you need to keep the rest of the application responsive.

Constructor & Destructor Documentation

◆ FirmwareUpdater()

eduart::sensorring::firmware_update::FirmwareUpdater::FirmwareUpdater ( UpdateConfig config = {})
explicit

Constructs a FirmwareUpdater with the given timing/retry configuration.

Parameters
configTiming and retry parameters. Defaults to UpdateConfig{}.

Member Function Documentation

◆ detectBootloaderNode()

std::optional< std::uint8_t > eduart::sensorring::firmware_update::FirmwareUpdater::detectBootloaderNode ( const com::ComInterfaceID & interface) const

Detects whether any board on the ring is currently in bootloader mode.

Parameters
interfaceCommunication interface to scan.
Returns
The CAN node ID of the board in bootloader mode, or std::nullopt if none was found.

◆ detectBootloaderNodeWithRetries()

std::optional< std::uint8_t > eduart::sensorring::firmware_update::FirmwareUpdater::detectBootloaderNodeWithRetries ( const com::ComInterfaceID & interface)

Detects whether any board on the ring is currently in bootloader mode, with retries. Number of retries and delay between retries are configurable via UpdateConfig.

Parameters
interfaceCommunication interface to scan.
Returns
The CAN node ID of the board in bootloader mode, or std::nullopt if none was found.

◆ enterSingleBoardBootloader()

bool eduart::sensorring::firmware_update::FirmwareUpdater::enterSingleBoardBootloader ( const com::ComInterfaceID & interface,
std::size_t board_index,
LogCallback log_callback = {} ) const

Requests a single board to enter bootloader mode.

Parameters
interfaceCommunication interface to use.
board_indexZero-based index of the board on the ring that should enter bootloader mode.
log_callbackOptional callback that receives status messages.
Returns
true if the board acknowledged the bootloader-enter request, false otherwise.

◆ flashAllBoardsSequential()

bool eduart::sensorring::firmware_update::FirmwareUpdater::flashAllBoardsSequential ( const com::ComInterfaceID & interface,
const std::string & hex_file_path,
LogCallback log_callback = {} ) const

Flashes every board on the ring sequentially with the same firmware image.

Parameters
interfaceCommunication interface to use.
hex_file_pathPath to the Intel HEX file that contains the firmware image.
log_callbackOptional callback that receives per-board progress messages.
Returns
true if every board was flashed successfully, false if any board failed.

◆ flashSingleBoard()

bool eduart::sensorring::firmware_update::FirmwareUpdater::flashSingleBoard ( const com::ComInterfaceID & interface,
std::uint8_t node_id,
const std::string & hex_file_path,
LogCallback log_callback = {} ) const

Flashes a single board identified by its CAN node ID.

Parameters
interfaceCommunication interface to use for the update.
node_idCAN node ID of the target board.
hex_file_pathPath to the Intel HEX file that contains the firmware image.
log_callbackOptional callback that receives progress and status messages.
Returns
true if the board was flashed successfully, false otherwise.

The documentation for this class was generated from the following file: