Class is wrapper for FlashInterface. It allows to read/write environment variables stored in flash memory.
More...
#include <environment_interface.h>
Class is wrapper for FlashInterface. It allows to read/write environment variables stored in flash memory.
◆ Variable
The Variable enum specifies supported environment variables.
Enumerator |
---|
ENVVAR_CURRENT_BOOT_REGION | |
ENVVAR_NEXT_BOOT_REGION | |
ENVVAR_TIMESTAMP | |
◆ EnvironmentInterface()
Constructor initializes the interface.
Intialization includes verification whether the provided flash memory size is enough, reading of environment variables from flash memory and writing default values when variables are not set.
There is not guarantee that the object is in valid state. User should call isValid() method to determine if the object was initialized successfully. When the object is in invalid state, the behaviour is undefined.
- Parameters
-
flash | Pointer to FlashInterface object. |
flashSpace | Specifies flash memory space for storing environment variables |
◆ ~EnvironmentInterface()
vitroio::sdk::impl::EnvironmentInterface::~EnvironmentInterface |
( |
| ) |
|
◆ getVariable()
uint32_t vitroio::sdk::impl::EnvironmentInterface::getVariable |
( |
Variable |
variable | ) |
const |
Function allows to get value of environment variable
.
- Parameters
-
variable | Variable for which the value is to be get. |
- Returns
- Function returns value of
variable
.
- Note
- If the
variable
is unknown the function will return 0. Therefore it is important to use variables defined in Variable enum.
◆ getVariableIOKeys()
void vitroio::sdk::impl::EnvironmentInterface::getVariableIOKeys |
( |
uint8_t * |
retValue, |
|
|
uint32_t |
offset, |
|
|
uint32_t |
bytes |
|
) |
| const |
◆ isValid()
bool vitroio::sdk::impl::EnvironmentInterface::isValid |
( |
| ) |
const |
Function allows to check whether the interface is in valid state.
- Note
- This method should be called always after creation of the object.
- Returns
- Function returns true if the object is valid or false otherwise.
◆ save()
int vitroio::sdk::impl::EnvironmentInterface::save |
( |
| ) |
|
Function saves environment variables to the flash memory.
- Returns
- Function returns VITROIO_ERR_SUCCESS on success or appropriate error code otherwise.
◆ setVariable()
void vitroio::sdk::impl::EnvironmentInterface::setVariable |
( |
Variable |
variable, |
|
|
uint32_t |
value |
|
) |
| |
Function allows to set value of environment variable
.
- Parameters
-
variable | Variable for which the value is to be set. |
value | Value of variable to set. |
- Note
- If the
variable
is unknown the function will just return. Therefore it is important to use variables defined in Variable enum.
◆ setVariableIOKeys()
void vitroio::sdk::impl::EnvironmentInterface::setVariableIOKeys |
( |
uint8_t * |
value, |
|
|
uint32_t |
offset, |
|
|
uint32_t |
bytes |
|
) |
| |