Skip to content

Commit

Permalink
Added system config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Mahoudeau committed Sep 10, 2024
1 parent 08caf7c commit 79417d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/system/FileConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace libsystem {
* Available types for values.
* Logic needs to be implemented before adding any new value.
*/
typedef std::variant<nullptr_t, uint8_t, uint16_t, uint32_t, uint64_t, std::string> file_config_types_t;
typedef std::variant<std::nullptr_t, uint8_t, uint16_t, uint32_t, uint64_t, std::string> file_config_types_t;

public:
/**
Expand Down
5 changes: 5 additions & 0 deletions lib/system/libsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace libsystem {
std::vector<std::string> bootErrors;
DeviceMode deviceMode = NORMAL;
auto systemConfig = FileConfig(storage::Path("system/config.bfc"));
}

class Restart final : public std::exception {
Expand Down Expand Up @@ -239,6 +240,10 @@ libsystem::DeviceMode libsystem::getDeviceMode() {
return deviceMode;
}

libsystem::FileConfig libsystem::getSystemConfig() {
return systemConfig;
}

libsystem::exceptions::RuntimeError::RuntimeError(const std::string &message): runtime_error(message) {
panic(message, false);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/system/libsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <cstdint>
#include <stdexcept>

#include <FileConfig.hpp>

// Replace this in "platformio.ini" ?
#define OS_NAME "PaxOS"

Expand Down Expand Up @@ -40,6 +42,8 @@ namespace libsystem {
void setDeviceMode(DeviceMode mode);
[[nodiscard]] DeviceMode getDeviceMode();

FileConfig getSystemConfig();

namespace exceptions {
class RuntimeError final : public std::runtime_error {
public:
Expand Down

0 comments on commit 79417d4

Please sign in to comment.