BlackBox Component
Installation
The component requires ESP-IDF 5.3 and higher and is installed using IDF Component Manager.
Add this to the idf_component.yml
in the project main
directory or in the component directory:
dependencies:
plasmapper/pl_blackbox: "^2.0.2"
Add this to the source code:
#include "pl_blackbox.h"
Add extern "C"
to the app_main
function:
extern "C" void app_main(void) {...}
Add this to the sdkconfig.defaults
in the project directory or configure the values using Project Configuration:
CONFIG_COMPILER_CXX_RTTI=y
CONFIG_LWIP_SO_RCVBUF=y
Features
This is an implementation of this specification for ESP-IDF.
PL::BlackBox
is a base class for a BlackBox device.
The descendant class should override PL::BlackBox::GetFirmwareInfo()
.
Configuration
PL::BlackBoxConfiguration
is a base class for configurations that can be saved, loaded and erased from NVS.
PL::BlackBoxConfigurationParameter
objects can be used to provide configuration parameter validation.
PL::BlackBox::AddConfiguration()
adds a device configuration. A number of Add methods add hardware interface and server configurations.
By default all added hardware interfaces and servers are enabled and their parameters are fixed.
To make parameters configurable PL::BlackBoxConfigurationParameter::SetValueValidator()
, PL::BlackBoxConfigurationParameter::SetValidValues()
or PL::BlackBoxConfigurationParameter::DisableValueValidation()
should be used.
PL::BlackBox::LoadAllConfigurations()
loads all configurations from NVS.
PL::BlackBox::SaveAllConfigurations()
saves all configurations to NVS.
PL::BlackBox::EraseAllConfigurations()
erases all configurations from NVS.
PL::BlackBox::ApplyHardwareInterfaceConfigurations()
and PL::BlackBox::ApplyServerConfigurations()
apply the correspondent configurations to the hardware interfaces and servers.
Modbus Server
PL::BlackBoxModbusServer
is a PL::ModbusServer
class extension that contains memory areas specified
in BlackBox Modbus description.
Thread safety
Class method thread safety is implemented by having the PL::Lockable
as a base class and creating the class object lock guard at the beginning of the methods.
Examples
API reference
- Types
- PL::BlackBox class
BlackBox
BlackBox::BlackBox()
BlackBox::GetHardwareInfoNvsNamespaceName()
BlackBox::SetHardwareInfoNvsNamespaceName()
BlackBox::GetGeneralConfigurationNvsNamespaceName()
BlackBox::SetGeneralConfigurationNvsNamespaceName()
BlackBox::GetHardwareInfo()
BlackBox::GetFirmwareInfo()
BlackBox::GetDeviceName()
BlackBox::SetDeviceName()
BlackBox::Restart()
BlackBox::GetRestartedFlag()
BlackBox::ClearRestartedFlag()
BlackBox::AddConfiguration()
BlackBox::AddHardwareInterfaceConfiguration()
BlackBox::AddServerConfiguration()
BlackBox::GetAllConfigurations()
BlackBox::GetHardwareInterfaceConfigurations()
BlackBox::GetServerConfigurations()
BlackBox::LoadAllConfigurations()
BlackBox::SaveAllConfigurations()
BlackBox::EraseAllConfigurations()
BlackBox::ApplyHardwareInterfaceConfigurations()
BlackBox::ApplyServerConfigurations()
BlackBox::defaultHardwareInfoNvsNamespaceName
BlackBox::defaultGeneralConfigurationNvsNamespaceName
BlackBox::hardwareInfoNameNvsKey
BlackBox::hardwareInfoMajorVersionNvsKey
BlackBox::hardwareInfoMinorVersionNvsKey
BlackBox::hardwareInfoPatchVersionNvsKey
BlackBox::hardwareInfoUidNvsKey
BlackBox::generalConfigurationDeviceNameNvsKey
- PL::BlackBoxConfiguration class
- PL::BlackBoxConfigurationParameter class
BlackBoxConfigurationParameter
BlackBoxConfigurationParameter::BlackBoxConfigurationParameter()
BlackBoxConfigurationParameter::GetValue()
BlackBoxConfigurationParameter::SetValue()
BlackBoxConfigurationParameter::SetValueValidator()
BlackBoxConfigurationParameter::SetValidValues()
BlackBoxConfigurationParameter::DisableValueValidation()
- PL::BlackBoxHardwareInterfaceConfiguration class
BlackBoxHardwareInterfaceConfiguration
BlackBoxHardwareInterfaceConfiguration::BlackBoxHardwareInterfaceConfiguration()
BlackBoxHardwareInterfaceConfiguration::GetHardwareInterface()
BlackBoxHardwareInterfaceConfiguration::Lock()
BlackBoxHardwareInterfaceConfiguration::Unlock()
BlackBoxHardwareInterfaceConfiguration::Load()
BlackBoxHardwareInterfaceConfiguration::Save()
BlackBoxHardwareInterfaceConfiguration::Erase()
BlackBoxHardwareInterfaceConfiguration::Apply()
BlackBoxHardwareInterfaceConfiguration::enabled
BlackBoxHardwareInterfaceConfiguration::enabledNvsKey
- PL::BlackBoxUartConfiguration class
BlackBoxUartConfiguration
BlackBoxUartConfiguration::BlackBoxUartConfiguration()
BlackBoxUartConfiguration::Load()
BlackBoxUartConfiguration::Save()
BlackBoxUartConfiguration::Apply()
BlackBoxUartConfiguration::GetHardwareInterface()
BlackBoxUartConfiguration::Lock()
BlackBoxUartConfiguration::Unlock()
BlackBoxUartConfiguration::Erase()
BlackBoxUartConfiguration::baudRate
BlackBoxUartConfiguration::dataBits
BlackBoxUartConfiguration::parity
BlackBoxUartConfiguration::stopBits
BlackBoxUartConfiguration::flowControl
BlackBoxUartConfiguration::enabled
BlackBoxUartConfiguration::baudRateNvsKey
BlackBoxUartConfiguration::dataBitsNvsKey
BlackBoxUartConfiguration::parityNvsKey
BlackBoxUartConfiguration::stopBitsNvsKey
BlackBoxUartConfiguration::flowControlNvsKey
BlackBoxUartConfiguration::enabledNvsKey
- PL::BlackBoxNetworkInterfaceConfiguration class
BlackBoxNetworkInterfaceConfiguration
BlackBoxNetworkInterfaceConfiguration::BlackBoxNetworkInterfaceConfiguration()
BlackBoxNetworkInterfaceConfiguration::Load()
BlackBoxNetworkInterfaceConfiguration::Save()
BlackBoxNetworkInterfaceConfiguration::Apply()
BlackBoxNetworkInterfaceConfiguration::GetHardwareInterface()
BlackBoxNetworkInterfaceConfiguration::Lock()
BlackBoxNetworkInterfaceConfiguration::Unlock()
BlackBoxNetworkInterfaceConfiguration::Erase()
BlackBoxNetworkInterfaceConfiguration::ipV4Address
BlackBoxNetworkInterfaceConfiguration::ipV4Netmask
BlackBoxNetworkInterfaceConfiguration::ipV4Gateway
BlackBoxNetworkInterfaceConfiguration::ipV6GlobalAddress
BlackBoxNetworkInterfaceConfiguration::ipV4DhcpClientEnabled
BlackBoxNetworkInterfaceConfiguration::ipV6DhcpClientEnabled
BlackBoxNetworkInterfaceConfiguration::enabled
BlackBoxNetworkInterfaceConfiguration::ipV4AddressNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4NetmaskNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4GatewayNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV6GlobalAddressNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4DhcpClientEnabledNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV6DhcpClientEnabledNvsKey
BlackBoxNetworkInterfaceConfiguration::enabledNvsKey
- PL::BlackBoxEthernetConfiguration class
BlackBoxEthernetConfiguration
BlackBoxEthernetConfiguration::BlackBoxEthernetConfiguration()
BlackBoxEthernetConfiguration::Load()
BlackBoxEthernetConfiguration::Save()
BlackBoxEthernetConfiguration::Apply()
BlackBoxEthernetConfiguration::GetHardwareInterface()
BlackBoxEthernetConfiguration::Lock()
BlackBoxEthernetConfiguration::Unlock()
BlackBoxEthernetConfiguration::Erase()
BlackBoxEthernetConfiguration::ipV4Address
BlackBoxEthernetConfiguration::ipV4Netmask
BlackBoxEthernetConfiguration::ipV4Gateway
BlackBoxEthernetConfiguration::ipV6GlobalAddress
BlackBoxEthernetConfiguration::ipV4DhcpClientEnabled
BlackBoxEthernetConfiguration::ipV6DhcpClientEnabled
BlackBoxEthernetConfiguration::enabled
BlackBoxEthernetConfiguration::ipV4AddressNvsKey
BlackBoxEthernetConfiguration::ipV4NetmaskNvsKey
BlackBoxEthernetConfiguration::ipV4GatewayNvsKey
BlackBoxEthernetConfiguration::ipV6GlobalAddressNvsKey
BlackBoxEthernetConfiguration::ipV4DhcpClientEnabledNvsKey
BlackBoxEthernetConfiguration::ipV6DhcpClientEnabledNvsKey
BlackBoxEthernetConfiguration::enabledNvsKey
- PL::BlackBoxWiFiStationConfiguration class
BlackBoxWiFiStationConfiguration
BlackBoxWiFiStationConfiguration::BlackBoxWiFiStationConfiguration()
BlackBoxWiFiStationConfiguration::Load()
BlackBoxWiFiStationConfiguration::Save()
BlackBoxWiFiStationConfiguration::Apply()
BlackBoxWiFiStationConfiguration::GetHardwareInterface()
BlackBoxWiFiStationConfiguration::Lock()
BlackBoxWiFiStationConfiguration::Unlock()
BlackBoxWiFiStationConfiguration::Erase()
BlackBoxWiFiStationConfiguration::ssid
BlackBoxWiFiStationConfiguration::password
BlackBoxWiFiStationConfiguration::ipV4Address
BlackBoxWiFiStationConfiguration::ipV4Netmask
BlackBoxWiFiStationConfiguration::ipV4Gateway
BlackBoxWiFiStationConfiguration::ipV6GlobalAddress
BlackBoxWiFiStationConfiguration::ipV4DhcpClientEnabled
BlackBoxWiFiStationConfiguration::ipV6DhcpClientEnabled
BlackBoxWiFiStationConfiguration::enabled
BlackBoxWiFiStationConfiguration::ssidNvsKey
BlackBoxWiFiStationConfiguration::passwordNvsKey
BlackBoxWiFiStationConfiguration::ipV4AddressNvsKey
BlackBoxWiFiStationConfiguration::ipV4NetmaskNvsKey
BlackBoxWiFiStationConfiguration::ipV4GatewayNvsKey
BlackBoxWiFiStationConfiguration::ipV6GlobalAddressNvsKey
BlackBoxWiFiStationConfiguration::ipV4DhcpClientEnabledNvsKey
BlackBoxWiFiStationConfiguration::ipV6DhcpClientEnabledNvsKey
BlackBoxWiFiStationConfiguration::enabledNvsKey
- PL::BlackBoxUsbDeviceCdcConfiguration class
- PL::BlackBoxServerConfiguration class
BlackBoxServerConfiguration
BlackBoxServerConfiguration::BlackBoxServerConfiguration()
BlackBoxServerConfiguration::GetServer()
BlackBoxServerConfiguration::Load()
BlackBoxServerConfiguration::Save()
BlackBoxServerConfiguration::Erase()
BlackBoxServerConfiguration::Apply()
BlackBoxServerConfiguration::enabled
BlackBoxServerConfiguration::enabledNvsKey
- PL::BlackBoxStreamServerConfiguration class
BlackBoxStreamServerConfiguration
BlackBoxStreamServerConfiguration::BlackBoxStreamServerConfiguration()
BlackBoxStreamServerConfiguration::GetServer()
BlackBoxStreamServerConfiguration::Load()
BlackBoxStreamServerConfiguration::Save()
BlackBoxStreamServerConfiguration::Erase()
BlackBoxStreamServerConfiguration::Apply()
BlackBoxStreamServerConfiguration::enabled
BlackBoxStreamServerConfiguration::enabledNvsKey
- PL::BlackBoxNetworkInterfaceConfiguration class
BlackBoxNetworkInterfaceConfiguration
BlackBoxNetworkInterfaceConfiguration::BlackBoxNetworkInterfaceConfiguration()
BlackBoxNetworkInterfaceConfiguration::Load()
BlackBoxNetworkInterfaceConfiguration::Save()
BlackBoxNetworkInterfaceConfiguration::Apply()
BlackBoxNetworkInterfaceConfiguration::GetHardwareInterface()
BlackBoxNetworkInterfaceConfiguration::Lock()
BlackBoxNetworkInterfaceConfiguration::Unlock()
BlackBoxNetworkInterfaceConfiguration::Erase()
BlackBoxNetworkInterfaceConfiguration::ipV4Address
BlackBoxNetworkInterfaceConfiguration::ipV4Netmask
BlackBoxNetworkInterfaceConfiguration::ipV4Gateway
BlackBoxNetworkInterfaceConfiguration::ipV6GlobalAddress
BlackBoxNetworkInterfaceConfiguration::ipV4DhcpClientEnabled
BlackBoxNetworkInterfaceConfiguration::ipV6DhcpClientEnabled
BlackBoxNetworkInterfaceConfiguration::enabled
BlackBoxNetworkInterfaceConfiguration::ipV4AddressNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4NetmaskNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4GatewayNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV6GlobalAddressNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV4DhcpClientEnabledNvsKey
BlackBoxNetworkInterfaceConfiguration::ipV6DhcpClientEnabledNvsKey
BlackBoxNetworkInterfaceConfiguration::enabledNvsKey
- PL::BlackBoxModbusServerConfiguration class
BlackBoxModbusServerConfiguration
BlackBoxModbusServerConfiguration::BlackBoxModbusServerConfiguration()
BlackBoxModbusServerConfiguration::Load()
BlackBoxModbusServerConfiguration::Save()
BlackBoxModbusServerConfiguration::Apply()
BlackBoxModbusServerConfiguration::GetServer()
BlackBoxModbusServerConfiguration::Erase()
BlackBoxModbusServerConfiguration::protocol
BlackBoxModbusServerConfiguration::stationAddress
BlackBoxModbusServerConfiguration::port
BlackBoxModbusServerConfiguration::maxNumberOfClients
BlackBoxModbusServerConfiguration::enabled
BlackBoxModbusServerConfiguration::protocolNvsKey
BlackBoxModbusServerConfiguration::stationAddressNvsKey
BlackBoxModbusServerConfiguration::portNvsKey
BlackBoxModbusServerConfiguration::maxNumberOfClientsNvsKey
BlackBoxModbusServerConfiguration::enabledNvsKey
- PL::BlackBoxHttpServerConfiguration class
BlackBoxHttpServerConfiguration
BlackBoxHttpServerConfiguration::BlackBoxHttpServerConfiguration()
BlackBoxHttpServerConfiguration::Load()
BlackBoxHttpServerConfiguration::Save()
BlackBoxHttpServerConfiguration::Apply()
BlackBoxHttpServerConfiguration::GetServer()
BlackBoxHttpServerConfiguration::Erase()
BlackBoxHttpServerConfiguration::port
BlackBoxHttpServerConfiguration::maxNumberOfClients
BlackBoxHttpServerConfiguration::enabled
BlackBoxHttpServerConfiguration::portNvsKey
BlackBoxHttpServerConfiguration::maxNumberOfClientsNvsKey
BlackBoxHttpServerConfiguration::enabledNvsKey
- PL::BlackBoxMdnsServerConfiguration class
BlackBoxMdnsServerConfiguration
BlackBoxMdnsServerConfiguration::BlackBoxMdnsServerConfiguration()
BlackBoxMdnsServerConfiguration::Load()
BlackBoxMdnsServerConfiguration::Save()
BlackBoxMdnsServerConfiguration::Apply()
BlackBoxMdnsServerConfiguration::GetServer()
BlackBoxMdnsServerConfiguration::Erase()
BlackBoxMdnsServerConfiguration::port
BlackBoxMdnsServerConfiguration::maxNumberOfClients
BlackBoxMdnsServerConfiguration::enabled
BlackBoxMdnsServerConfiguration::portNvsKey
BlackBoxMdnsServerConfiguration::maxNumberOfClientsNvsKey
BlackBoxMdnsServerConfiguration::enabledNvsKey
- PL::BlackBoxModbusServer class
BlackBoxModbusServer
BlackBoxModbusServer::BlackBoxModbusServer()
BlackBoxModbusServer::BlackBoxModbusServer()
BlackBoxModbusServer::BlackBoxModbusServer()
BlackBoxModbusServer::BlackBoxModbusServer()
BlackBoxModbusServer::Lock()
BlackBoxModbusServer::Unlock()
BlackBoxModbusServer::Enable()
BlackBoxModbusServer::Disable()
BlackBoxModbusServer::AddMemoryArea()
BlackBoxModbusServer::AddMemoryArea()
BlackBoxModbusServer::IsEnabled()
BlackBoxModbusServer::GetStationAddress()
BlackBoxModbusServer::SetStationAddress()
BlackBoxModbusServer::SetTaskParameters()
BlackBoxModbusServer::GetBaseServer()
BlackBoxModbusServer::GetProtocol()
BlackBoxModbusServer::SetProtocol()
BlackBoxModbusServer::GetReadTimeout()
BlackBoxModbusServer::SetReadTimeout()
BlackBoxModbusServer::GetDelayAfterRead()
BlackBoxModbusServer::SetDelayAfterRead()
BlackBoxModbusServer::GetName()
BlackBoxModbusServer::SetName()
BlackBoxModbusServer::enabledEvent
BlackBoxModbusServer::disabledEvent
BlackBoxModbusServer::registerMemoryAreaSize
BlackBoxModbusServer::coilMemoryAreaSize
BlackBoxModbusServer::generalConfigurationMemoryAddress
BlackBoxModbusServer::hardwareInterfaceConfigurationMemoryAddress
BlackBoxModbusServer::serverConfigurationMemoryAddress
BlackBoxModbusServer::plbbSignature
BlackBoxModbusServer::memoryMapVersion
BlackBoxModbusServer::maxNameSize
BlackBoxModbusServer::maxWiFiSsidSize
BlackBoxModbusServer::maxWiFiPasswordSize
BlackBoxModbusServer::defaultName
BlackBoxModbusServer::defaultReadTimeout
BlackBoxModbusServer::defaultBufferSize
BlackBoxModbusServer::defaultNetworkProtocol
BlackBoxModbusServer::defaultNetworkStationAddress
BlackBoxModbusServer::maxNumberOfModbusBitsToRead
BlackBoxModbusServer::maxNumberOfModbusBitsToWrite
BlackBoxModbusServer::maxNumberOfModbusRegistersToRead
BlackBoxModbusServer::maxNumberOfModbusRegistersToWrite
BlackBoxModbusServer::ReadRtuData()
BlackBoxModbusServer::HandleRequest()
BlackBoxModbusServer::WriteExceptionFrame()
BlackBoxModbusServer::ReadFrame()
BlackBoxModbusServer::WriteFrame()
BlackBoxModbusServer::GetDataBuffer()