f660550f86
- Added `AppHub` app - Added `AppHubDetails` app - Added `cJSON` dependency - Renamed `AppSim` module to `FirmwareSim` - Added extra `tt::app::alertdialg::start()` - Renamed `addApp()`, `removeApp()`, `findAppById()` and `getApps()` to `addAppManifest()`, `removeAppManifest()`, `findAppManifestById()` and `getAppManifests()` - Added `tt::lvgl::toolbar_clear_actions()` - Added `tt::network::EspHttpClient` as a thread-safe wrapper around `esp_http_client` - Added `tt::network::http::download()` to download files - Added `tt::network::ntp::isSynced()` - When time is synced, the timestamp is stored in NVS flash. On boot, it is restored. This helps SSL connections when doing a quick reset: when WiFi reconnects, the user doesn't have to wait for NTP sync before SSL works. - Added `tt::json::Reader` as a `cJSON` wrapper - Added `int64_t` support for `Preferences` - Added `int64_t` support for `Bundle` - Added dependencies: `cJSON`, `esp-tls` - When time is synced via NTP, disable time sync. - Added docs to 'tt::file::` functions - Added `tt::string::join()` that works with `std::vector<const char*>` - Fixed `tt::file::getLastPathSegment()` for the scenario when a path was passed with only a single segment - Set `CONFIG_ESP_MAIN_TASK_STACK_SIZE=5120` (from about 3k) for all boards - Set `CONFIG_MBEDTLS_SSL_PROTO_TLS1_3=y` for all boards
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace tt {
|
|
|
|
/**
|
|
* Settings that persist on NVS flash for ESP32.
|
|
* On simulator, the settings are only in-memory.
|
|
*
|
|
* Note that on ESP32, there are limitations:
|
|
* - namespace name is limited by NVS_NS_NAME_MAX_SIZE (generally 16 characters)
|
|
* - key is limited by NVS_KEY_NAME_MAX_SIZE (generally 16 characters)
|
|
*/
|
|
class Preferences {
|
|
|
|
const char* namespace_;
|
|
|
|
public:
|
|
explicit Preferences(const char* namespace_) {
|
|
this->namespace_ = namespace_;
|
|
}
|
|
|
|
bool hasBool(const std::string& key) const;
|
|
bool hasInt32(const std::string& key) const;
|
|
bool hasInt64(const std::string& key) const;
|
|
bool hasString(const std::string& key) const;
|
|
|
|
bool optBool(const std::string& key, bool& out) const;
|
|
bool optInt32(const std::string& key, int32_t& out) const;
|
|
bool optInt64(const std::string& key, int64_t& out) const;
|
|
bool optString(const std::string& key, std::string& out) const;
|
|
|
|
void putBool(const std::string& key, bool value);
|
|
void putInt32(const std::string& key, int32_t value);
|
|
void putInt64(const std::string& key, int64_t value);
|
|
void putString(const std::string& key, const std::string& value);
|
|
};
|
|
|
|
} // namespace
|