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: "^1.0.0"

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