PL::BlackBox class

class BlackBox

Base class for the BlackBox device.

Public Functions

BlackBox()

Creates a BlackBox device.

std::string GetHardwareInfoNvsNamespaceName()

Gets the hardware info NVS namespace name.

Returns:

hardware info NVS namespace name

void SetHardwareInfoNvsNamespaceName(const std::string &nvsNamespaceName)

Sets the hardware info NVS namespace name.

Parameters:

nvsNamespaceName – hardware info NVS namespace name

std::string GetGeneralConfigurationNvsNamespaceName()

Gets the general configuration NVS namespace name.

Returns:

general configuration NVS namespace name

void SetGeneralConfigurationNvsNamespaceName(const std::string &nvsNamespaceName)

Sets the general configuration NVS namespace name.

Parameters:

nvsNamespaceName – general configuration NVS namespace name

virtual BlackBoxHardwareInfo GetHardwareInfo()

Gets the hardware information.

Returns:

hardware information

virtual BlackBoxFirmwareInfo GetFirmwareInfo() = 0

Gets the firmware information.

Returns:

firmware information

std::string GetDeviceName()

Gets the device name.

Returns:

device name

void SetDeviceName(const std::string &name)

Sets the device name.

Parameters:

name – device name

virtual esp_err_t Restart()

Restarts the device.

Returns:

error code

bool GetRestartedFlag()

Checks if the device has been restarted.

Returns:

true if the device has been restarted

void ClearRestartedFlag()

Clears the reset flag.

void AddConfiguration(std::shared_ptr<BlackBoxConfiguration> configuration)

Adds a configuration.

std::shared_ptr<BlackBoxHardwareInterfaceConfiguration> AddHardwareInterfaceConfiguration(std::shared_ptr<HardwareInterface> hardwareInterface, std::string nvsNamespaceName)

Adds a hardware interface configuration.

Parameters:

hardwareInterface – hardware interface

Returns:

hardware interface configuration

std::shared_ptr<BlackBoxServerConfiguration> AddServerConfiguration(std::shared_ptr<Server> server, std::string nvsNamespaceName)

Adds a server configuration.

Parameters:

server – server

Returns:

server configuration

std::vector<std::shared_ptr<BlackBoxConfiguration>> GetAllConfigurations()

Gets all configurations.

Returns:

configurations

std::vector<std::shared_ptr<BlackBoxHardwareInterfaceConfiguration>> GetHardwareInterfaceConfigurations()

Gets the hardware interface configurations.

Returns:

hardware interface configurations

std::vector<std::shared_ptr<BlackBoxServerConfiguration>> GetServerConfigurations()

Gets the server configurations.

Returns:

server configurations

void LoadAllConfigurations()

Loads all configurations.

void SaveAllConfigurations()

Saves all configurations.

void EraseAllConfigurations()

Erases all configurations.

void ApplyHardwareInterfaceConfigurations()

Applies hardware interface configurations.

void ApplyServerConfigurations()

Applies server configurations.

Public Static Attributes

static const std::string defaultHardwareInfoNvsNamespaceName

Default hardware info NVS namespace.

static const std::string defaultGeneralConfigurationNvsNamespaceName

Default general configuration NVS namespace.

static const std::string hardwareInfoNameNvsKey

Hardware name NVS key.

static const std::string hardwareInfoMajorVersionNvsKey

Hardware major version NVS key.

static const std::string hardwareInfoMinorVersionNvsKey

Hardware minor version NVS key.

static const std::string hardwareInfoPatchVersionNvsKey

Hardware patch version NVS key.

static const std::string hardwareInfoUidNvsKey

Hardware UID NVS key.

static const std::string generalConfigurationDeviceNameNvsKey

General configuration device name NVS key.