Veethree D7 SDK
Loading...
Searching...
No Matches
vsdk::sys::bootloader_manager Class Reference

Detailed Description

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()
{
using namespace vsdk::sys;
uint32_t n_level{};
std::string s_level{};
// set as integer
bootloader_manager::set_value("brightness_level", 75);
// get as integer
bootloader_manager::get_value("brightness_level", n_level);
// set as a string
bootloader_manager::set_value("brightness_level", "80");
// get as a string
bootloader_manager::get_value("brightness_level", s_level);
// get all environment variables and their values
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 Public Member Functions

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.

Detailed Description

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()
{
using namespace vsdk::sys;
uint32_t n_level{};
std::string s_level{};
// set as integer
bootloader_manager::set_value("brightness_level", 75);
// get as integer
bootloader_manager::get_value("brightness_level", n_level);
// set as a string
bootloader_manager::set_value("brightness_level", "80");
// get as a string
bootloader_manager::get_value("brightness_level", s_level);
// get all environment variables and their values
std::unordered_map<std::string, std::string> env;
}

Member Function Documentation

◆ 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
varThe bootloader environment variable name.
valueThe var value, as an integer.
Exceptions
std::runtime_errorcan 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
varThe bootloader environment variable name.
valueThe var value, as an integer.
Exceptions
std::runtime_errorcan be thrown if the bootloader underlying library is unable to get the variable value.
std::invalid_argumentwill 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
environmentThe 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
varThe bootloader environment variable name.
valueThe new var value (as string).
Exceptions
std::runtime_errorcan 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
varThe bootloader environment variable name.
valueThe new var value (as integer).
hexIndicate if the numerical data should be converted to hex string, defaults to false (decimal).
Exceptions
std::runtime_errorcan 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: