The bootloader_manager class.
The bootloader_manager class is responsible for interacting with the board bootloader, primarily via bootloader environment variables.
#include <cstdint>
#include <string>
#include <unordered_map>
void fn()
{
uint32_t n_level{};
std::string s_level{};
std::unordered_map<std::string, std::string> env;
}
bootloader_manager interface
static void get_value(std::string_view var, uint64_t &value)
Get a bootloader variable value.
static void list_vars(std::unordered_map< std::string, std::string > &environment)
Get all the bootloader variable names and their values.
static void set_value(std::string_view var, uint64_t value, bool hex=false)
Set a bootloader variable value.
Any entities that belong to the system library.
#include <bootloader_manager.h>
|
| static void | set_value (std::string_view var, uint64_t value, bool hex=false) |
| | Set a bootloader variable value.
|
| static void | set_value (std::string_view var, std::string_view value) |
| | Set a bootloader variable value.
|
| static void | get_value (std::string_view var, uint64_t &value) |
| | Get a bootloader variable value.
|
| static void | get_value (std::string_view var, std::string &value) |
| | Get a bootloader variable value.
|
| static void | list_vars (std::unordered_map< std::string, std::string > &environment) |
| | Get all the bootloader variable names and their values.
|
The bootloader_manager class.
The bootloader_manager class is responsible for interacting with the board bootloader, primarily via bootloader environment variables.
#include <cstdint>
#include <string>
#include <unordered_map>
void fn()
{
uint32_t n_level{};
std::string s_level{};
std::unordered_map<std::string, std::string> env;
}
◆ get_value() [1/2]
| void vsdk::sys::bootloader_manager::get_value |
( |
std::string_view | var, |
|
|
std::string & | value ) |
|
static |
Get a bootloader variable value.
- Parameters
-
| var | The bootloader environment variable name. |
| value | The var value, as an integer. |
- Exceptions
-
| std::runtime_error | can be thrown if the bootloader underlying library is unable to get the variable value. |
◆ get_value() [2/2]
| void vsdk::sys::bootloader_manager::get_value |
( |
std::string_view | var, |
|
|
uint64_t & | value ) |
|
static |
Get a bootloader variable value.
- Parameters
-
| var | The bootloader environment variable name. |
| value | The var value, as an integer. |
- Exceptions
-
| std::runtime_error | can be thrown if the bootloader underlying library is unable to get the variable value. |
| std::invalid_argument | will be thrown if attempting to read a value that isn't a number. |
- Note
- If the value is stored in hex, octal or decimal, it will be parsed automatically.
-
Negative values wrap around.
◆ list_vars()
| void vsdk::sys::bootloader_manager::list_vars |
( |
std::unordered_map< std::string, std::string > & | environment | ) |
|
|
static |
Get all the bootloader variable names and their values.
- Parameters
-
| environment | The hash map to hold the key->value mappings. |
◆ set_value() [1/2]
| void vsdk::sys::bootloader_manager::set_value |
( |
std::string_view | var, |
|
|
std::string_view | value ) |
|
static |
Set a bootloader variable value.
- Parameters
-
| var | The bootloader environment variable name. |
| value | The new var value (as string). |
- Exceptions
-
| std::runtime_error | can be thrown if the bootloader underlying library is unable to set the new variable value. |
◆ set_value() [2/2]
| void vsdk::sys::bootloader_manager::set_value |
( |
std::string_view | var, |
|
|
uint64_t | value, |
|
|
bool | hex = false ) |
|
static |
Set a bootloader variable value.
- Parameters
-
| var | The bootloader environment variable name. |
| value | The new var value (as integer). |
| hex | Indicate if the numerical data should be converted to hex string, defaults to false (decimal). |
- Exceptions
-
| std::runtime_error | can be thrown if the bootloader underlying library is unable to set the new variable value. |
The documentation for this class was generated from the following file: