ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
Classes | Functions
init_device_model_db.hpp File Reference
#include <filesystem>
#include <ocpp/common/database/database_handler_common.hpp>
#include <ocpp/v2/device_model_storage_interface.hpp>

Go to the source code of this file.

Classes

struct  ocpp::v2::ComponentKey
 Class that holds a component. More...
 
struct  ocpp::v2::DbVariableAttribute
 Struct that holds a VariableAttribute struct and an database id. More...
 
struct  ocpp::v2::DeviceModelVariable
 Struct holding the Variable of a device model. More...
 
class  ocpp::v2::InitDeviceModelDbError
 Error class to be able to throw a custom error within the class. More...
 
class  ocpp::v2::InitDeviceModelDb
 Class to initialize the device model db using the component config files. More...
 

Functions

void ocpp::v2::from_json (const json &j, ComponentKey &c)
 Convert from json to a ComponentKey struct. The to_json is not implemented as we don't need to write the component config to a json file.
 
void ocpp::v2::from_json (const json &j, DeviceModelVariable &c)
 Convert from json to a DeviceModelVariable struct. The to_json is not implemented for this struct as we don't need to write the component config to a json file.
 
void ocpp::v2::from_json (const json &j, VariableMonitoringMeta &c)
 Convert from json to a VariableMonitoringMeta struct. The to_json is not implemented for this struct as we don't need to write the component config to a json file.
 

Detailed Description

This class will read the device model config files and put them in the device model database.

If the database already exists and there are some changes on components, this class will make the changes in the database accordingly.

It will also re-apply the component config. Config items will only be replaced if they are changed and the value in the database is not set by an external source, like the CSMS.

The data from the component config json files or database are read into some structs. Some structs could be reused from the DeviceModelStorage class, but some members are missing there and and to prevent too many database reads, some structs are 'redefined' in this class with the proper members.

Since the DeviceModel class creates a map based on the device model database in the constructor, this class should first be finished with the initialization before creating the DeviceModel class.

The config values are updated every startup as well, as long as the initial / default values are set in the database. If the value is set by the user or csms or some other process, the value will not be overwritten.

Almost every function throws exceptions, because this class should be used only when initializing the chargepoint and the database must be correct before starting the application.