Settings stored in NVS. More...
#include <settings.hpp>
Public Member Functions | |
Settings () | |
std::string | getStationmDNS () const |
Get station mDNS. | |
esp_err_t | setStationmDNS (std::string_view str) |
Set station mDNS. | |
std::string | getStationSSID () const |
Get station SSID. | |
esp_err_t | setStationSSID (std::string_view str) |
Set station SSID. | |
std::string | getStationPassword () const |
Get station password. | |
esp_err_t | setStationPassword (std::string_view str) |
Set station password. | |
uint8_t | getHttpReceiveTimeout () const |
Get HTTP receive timeout. | |
esp_err_t | setHttpReceiveTimeout (uint8_t value) |
Set HTTP receive timeout. | |
uint8_t | getHttpTransmitTimeout () const |
Get HTTP transmit timeout. | |
esp_err_t | setHttpTransmitTimeout (uint8_t value) |
Set HTTP transmit timeout. | |
out::track::CurrentLimit | getCurrentLimit () const |
Get current limit. | |
esp_err_t | setCurrentLimit (out::track::CurrentLimit value) |
Set current limit. | |
out::track::CurrentLimit | getCurrentLimitService () const |
Get current limit in service mode. | |
esp_err_t | setCurrentLimitService (out::track::CurrentLimit value) |
Set current limit in service mode. | |
uint8_t | getCurrentShortCircuitTime () const |
Get current short circuit time. | |
esp_err_t | setCurrentShortCircuitTime (uint8_t value) |
Set current short circuit time. | |
uint8_t | getDccPreamble () const |
Get DCC preamble count. | |
esp_err_t | setDccPreamble (uint8_t value) |
Set DCC preamble count. | |
uint8_t | getDccBit1Duration () const |
Get DCC bit 1 duration. | |
esp_err_t | setDccBit1Duration (uint8_t value) |
Set DCC bit 1 duration. | |
uint8_t | getDccBit0Duration () const |
Get DCC bit 0 duration. | |
esp_err_t | setDccBit0Duration (uint8_t value) |
Set DCC bit 0 duration. | |
uint8_t | getDccBiDiBitDuration () const |
Get DCC BiDi bit duration. | |
esp_err_t | setDccBiDiBitDuration (uint8_t value) |
Set DCC BiDi bit duration. | |
uint8_t | getDccProgrammingType () const |
Get DCC programming type. | |
esp_err_t | setDccProgrammingType (uint8_t value) |
Set DCC programming type. | |
uint8_t | getDccStartupResetPacketCount () const |
Get DCC startup reset packet count. | |
esp_err_t | setDccStartupResetPacketCount (uint8_t value) |
Set DCC startup reset packet count. | |
uint8_t | getDccContinueResetPacketCount () const |
Get DCC continue reset packet count. | |
esp_err_t | setDccContinueResetPacketCount (uint8_t value) |
Set DCC continue reset packet count. | |
uint8_t | getDccProgramPacketCount () const |
Get DCC program packet count. | |
esp_err_t | setDccProgramPacketCount (uint8_t value) |
Set DCC program packet count. | |
bool | getDccBitVerifyTo1 () const |
Get DCC bit verify. | |
esp_err_t | setDccBitVerifyTo1 (bool value) |
Set DCC bit verify. | |
uint8_t | getDccProgrammingAckCurrent () const |
Get DCC programming ack current. | |
esp_err_t | setDccProgrammingAckCurrent (uint8_t value) |
Set DCC programming ack current. | |
uint8_t | getDccLocoFlags () const |
Get DCC loco flags. | |
esp_err_t | setDccLocoFlags (uint8_t value) |
Set DCC loco flags. | |
uint8_t | getDccAccessoryFlags () const |
Get DCC accessory flags. | |
esp_err_t | setDccAccessoryFlags (uint8_t value) |
Set DCC accessory flags. | |
uint8_t | getMduPreamble () const |
Get MDU preamble count. | |
esp_err_t | setMduPreamble (uint8_t value) |
Set MDU preamble count. | |
uint8_t | getMduAckreq () const |
Get MDU ackreq count. | |
esp_err_t | setMduAckreq (uint8_t value) |
Set MDU ackreq count. | |
Public Member Functions inherited from mem::nvs::Base | |
auto | begin () const |
auto | cbegin () const |
auto | end () const |
auto | cend () const |
esp_err_t | erase (std::string const &key) |
Erase key-value pair with given key name. | |
esp_err_t | eraseAll () |
Erase all key-value pairs in a namespace. | |
Additional Inherited Members | |
Protected Member Functions inherited from mem::nvs::Base | |
Base (char const *namespace_name, nvs_open_mode_t open_mode) | |
Ctor. | |
~Base () | |
Dtor. | |
std::string | getBlob (std::string const &key) const |
Get blob value for given key. | |
esp_err_t | setBlob (std::string const &key, std::string_view str) |
Set blob value for given key. | |
uint8_t | getU8 (std::string const &key) const |
Get uint8_t value for given key. | |
esp_err_t | setU8 (std::string const &key, uint8_t value) |
Set uint8_t value for given key. | |
uint8_t | getU16 (std::string const &key) const |
Get uint16_t value for given key. | |
esp_err_t | setU16 (std::string const &key, uint16_t value) |
Set uint16_t value for given key. | |
nvs::Settings stores various firmware preferences in the NVS namespace "settings". Most settings are either directly strings or integer types, all others (e.g. out::track::CurrentLimit) are converted accordingly within the class. Each setting has a getter and a setter, the latter of which may perform various checks (e.g. value range).
|
inlineexplicit |
out::track::CurrentLimit mem::nvs::Settings::getCurrentLimit | ( | ) | const |
out::track::CurrentLimit mem::nvs::Settings::getCurrentLimitService | ( | ) | const |
uint8_t mem::nvs::Settings::getCurrentShortCircuitTime | ( | ) | const |
uint8_t mem::nvs::Settings::getDccAccessoryFlags | ( | ) | const |
uint8_t mem::nvs::Settings::getDccBiDiBitDuration | ( | ) | const |
uint8_t mem::nvs::Settings::getDccBit0Duration | ( | ) | const |
uint8_t mem::nvs::Settings::getDccBit1Duration | ( | ) | const |
bool mem::nvs::Settings::getDccBitVerifyTo1 | ( | ) | const |
uint8_t mem::nvs::Settings::getDccContinueResetPacketCount | ( | ) | const |
uint8_t mem::nvs::Settings::getDccLocoFlags | ( | ) | const |
uint8_t mem::nvs::Settings::getDccPreamble | ( | ) | const |
uint8_t mem::nvs::Settings::getDccProgrammingAckCurrent | ( | ) | const |
uint8_t mem::nvs::Settings::getDccProgrammingType | ( | ) | const |
uint8_t mem::nvs::Settings::getDccProgramPacketCount | ( | ) | const |
uint8_t mem::nvs::Settings::getDccStartupResetPacketCount | ( | ) | const |
uint8_t mem::nvs::Settings::getHttpReceiveTimeout | ( | ) | const |
uint8_t mem::nvs::Settings::getHttpTransmitTimeout | ( | ) | const |
uint8_t mem::nvs::Settings::getMduAckreq | ( | ) | const |
uint8_t mem::nvs::Settings::getMduPreamble | ( | ) | const |
std::string mem::nvs::Settings::getStationmDNS | ( | ) | const |
std::string mem::nvs::Settings::getStationPassword | ( | ) | const |
std::string mem::nvs::Settings::getStationSSID | ( | ) | const |
esp_err_t mem::nvs::Settings::setCurrentLimit | ( | out::track::CurrentLimit | value | ) |
value | Current limit |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | Current limit out of range |
esp_err_t mem::nvs::Settings::setCurrentLimitService | ( | out::track::CurrentLimit | value | ) |
value | Current limit in service mode |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | Current limit in service mode out of range |
esp_err_t mem::nvs::Settings::setCurrentShortCircuitTime | ( | uint8_t | value | ) |
value | Current short circuit time [ms] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | Current short circuit time out of range |
esp_err_t mem::nvs::Settings::setDccAccessoryFlags | ( | uint8_t | value | ) |
value | DCC accessory flags |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
esp_err_t mem::nvs::Settings::setDccBiDiBitDuration | ( | uint8_t | value | ) |
value | DCC BiDi bit duration [µs] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC BiDi bit duration out of range |
esp_err_t mem::nvs::Settings::setDccBit0Duration | ( | uint8_t | value | ) |
value | DCC bit 0 duration [µs] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC bit 0 duration out of range |
esp_err_t mem::nvs::Settings::setDccBit1Duration | ( | uint8_t | value | ) |
value | DCC bit 1 duration [µs] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC bit 1 duration out of range |
esp_err_t mem::nvs::Settings::setDccBitVerifyTo1 | ( | bool | value | ) |
value | DCC bit verify |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
esp_err_t mem::nvs::Settings::setDccContinueResetPacketCount | ( | uint8_t | value | ) |
value | DCC continue reset packet count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC continue reset packet count out of range |
esp_err_t mem::nvs::Settings::setDccLocoFlags | ( | uint8_t | value | ) |
value | DCC loco flags |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
esp_err_t mem::nvs::Settings::setDccPreamble | ( | uint8_t | value | ) |
value | DCC preamble count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC preamble count out of range |
esp_err_t mem::nvs::Settings::setDccProgrammingAckCurrent | ( | uint8_t | value | ) |
value | DCC programming ack current [mA] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC programming ack current out of range |
esp_err_t mem::nvs::Settings::setDccProgrammingType | ( | uint8_t | value | ) |
value | DCC programming type |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC programming type out of range |
esp_err_t mem::nvs::Settings::setDccProgramPacketCount | ( | uint8_t | value | ) |
value | DCC program packet count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC program packet count out of range |
esp_err_t mem::nvs::Settings::setDccStartupResetPacketCount | ( | uint8_t | value | ) |
value | DCC startup reset packet count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | DCC startup reset packet count out of range |
esp_err_t mem::nvs::Settings::setHttpReceiveTimeout | ( | uint8_t | value | ) |
value | HTTP receive timeout [s] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | HTTP receive timeout out of range |
esp_err_t mem::nvs::Settings::setHttpTransmitTimeout | ( | uint8_t | value | ) |
value | HTTP transmit timeout [s] |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | HTTP transmit timeout out of range |
esp_err_t mem::nvs::Settings::setMduAckreq | ( | uint8_t | value | ) |
value | MDU ackreq count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | MDU ackreq count out of range |
esp_err_t mem::nvs::Settings::setMduPreamble | ( | uint8_t | value | ) |
value | MDU preamble count |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_INVALID_ARG | MDU preamble count out of range |
esp_err_t mem::nvs::Settings::setStationmDNS | ( | std::string_view | str | ) |
str | Station mDNS |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_NVS_VALUE_TOO_LONG | String value is too long |
ESP_ERR_INVALID_ARG | Invalid mDNS |
esp_err_t mem::nvs::Settings::setStationPassword | ( | std::string_view | str | ) |
str | Station password |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_NVS_VALUE_TOO_LONG | String value is too long |
esp_err_t mem::nvs::Settings::setStationSSID | ( | std::string_view | str | ) |
str | Station SSID |
ESP_OK | Value was set successfully |
ESP_FAIL | Internal error |
ESP_ERR_NVS_INVALID_NAME | Key name doesn't satisfy constraints |
ESP_ERR_NVS_NOT_ENOUGH_SPACE | Not enough space |
ESP_ERR_NVS_REMOVE_FAILED | Value wasn't updated because flash write operation has failed |
ESP_ERR_NVS_VALUE_TOO_LONG | String value is too long |