|
ocpp 0.24.1
A C++ implementation of the Open Charge Point Protocol
|
This class manages access to the device model representation and to the device model interface and provides functionality to support the use cases defined in the functional block Provisioning. More...
#include <device_model.hpp>
Public Member Functions | |
| DeviceModel (std::unique_ptr< DeviceModelStorageInterface > device_model_storage_interface) | |
| Constructor for the device model. More... | |
| template<typename T > | |
| T | get_value (const RequiredComponentVariable &component_variable, const AttributeEnum &attribute_enum=AttributeEnum::Actual) const |
| Direct access to value of a VariableAttribute for the given component, variable and attribute_enum. This should only be called for variables that have a role standardized in the OCPP2.0.1 specification. More... | |
| template<typename T > | |
| std::optional< T > | get_optional_value (const ComponentVariable &component_variable, const AttributeEnum &attribute_enum=AttributeEnum::Actual) const |
| Access to std::optional of a VariableAttribute for the given component, variable and attribute_enum. More... | |
| template<typename T > | |
| RequestDeviceModelResponse< T > | request_value (const Component &component_id, const Variable &variable_id, const AttributeEnum &attribute_enum) |
Requests a value of a VariableAttribute specified by combination of component_id and variable_id from the device model. More... | |
| std::optional< MutabilityEnum > | get_mutability (const Component &component_id, const Variable &variable, const AttributeEnum &attribute_enum) |
| Get the mutability for the given component, variable and attribute_enum. More... | |
| SetVariableStatusEnum | set_value (const Component &component_id, const Variable &variable_id, const AttributeEnum &attribute_enum, const std::string &value, const std::string &source, const bool allow_read_only=false) |
Sets the variable_id attribute value specified by component_id , variable_id and attribute_enum. More... | |
| SetVariableStatusEnum | set_read_only_value (const Component &component_id, const Variable &variable_id, const AttributeEnum &attribute_enum, const std::string &value, const std::string &source) |
Sets the variable_id attribute value specified by component_id , variable_id and attribute_enum for read only variables only. Only works on certain allowed components. More... | |
| std::optional< VariableMetaData > | get_variable_meta_data (const Component &component_id, const Variable &variable_id) |
Gets the VariableMetaData for the given component_id and variable_id. More... | |
| std::vector< ReportData > | get_base_report_data (const ReportBaseEnum &report_base) |
Gets the ReportData for the specifed filter report_base component_variables and component_criteria. More... | |
| std::vector< ReportData > | get_custom_report_data (const std::optional< std::vector< ComponentVariable > > &component_variables=std::nullopt, const std::optional< std::vector< ComponentCriterionEnum > > &component_criteria=std::nullopt) |
Gets the ReportData for the specifed filter component_variables and component_criteria. More... | |
| void | register_variable_listener (on_variable_changed &&listener) |
| void | register_monitor_listener (on_monitor_updated &&listener) |
| std::vector< SetMonitoringResult > | set_monitors (const std::vector< SetMonitoringData > &requests, const VariableMonitorType type=VariableMonitorType::CustomMonitor) |
Sets the given monitor requests in the device model. More... | |
| bool | update_monitor_reference (int32_t monitor_id, const std::string &reference_value) |
| std::vector< VariableMonitoringPeriodic > | get_periodic_monitors () |
| std::vector< MonitoringData > | get_monitors (const std::vector< MonitoringCriterionEnum > &criteria, const std::vector< ComponentVariable > &component_variables) |
Gets the Monitoring data for the request criteria and component_variables. More... | |
| std::vector< ClearMonitoringResult > | clear_monitors (const std::vector< int > &request_ids, bool allow_protected=false) |
Clears the given request_ids from the registered monitors if request_id is present. More... | |
| int32_t | clear_custom_monitors () |
| Clears all the custom monitors (set by the CSMS) present in the database. More... | |
| void | check_integrity (const std::map< int32_t, int32_t > &evse_connector_structure) |
| Check data integrity of the device model provided by the device model data storage: For "required" variables, assert values exist. Checks might be extended in the future. | |
This class manages access to the device model representation and to the device model interface and provides functionality to support the use cases defined in the functional block Provisioning.
|
explicit |
Constructor for the device model.
| device_model_storage_interface | pointer to a device model interface class |
| int32_t ocpp::v2::DeviceModel::clear_custom_monitors | ( | ) |
Clears all the custom monitors (set by the CSMS) present in the database.
| std::vector< ClearMonitoringResult > ocpp::v2::DeviceModel::clear_monitors | ( | const std::vector< int > & | request_ids, |
| bool | allow_protected = false |
||
| ) |
Clears the given request_ids from the registered monitors if request_id is present.
| request_ids | |
| allow_protected | if we should delete the non-custom monitors, defaults to false when this operation is requested by the CSMS |
| std::vector< ReportData > ocpp::v2::DeviceModel::get_base_report_data | ( | const ReportBaseEnum & | report_base | ) |
Gets the ReportData for the specifed filter report_base component_variables and component_criteria.
| report_base | |
| component_variables | |
| component_criteria |
| std::vector< ReportData > ocpp::v2::DeviceModel::get_custom_report_data | ( | const std::optional< std::vector< ComponentVariable > > & | component_variables = std::nullopt, |
| const std::optional< std::vector< ComponentCriterionEnum > > & | component_criteria = std::nullopt |
||
| ) |
Gets the ReportData for the specifed filter component_variables and component_criteria.
| report_base | |
| component_variables | |
| component_criteria |
| std::vector< MonitoringData > ocpp::v2::DeviceModel::get_monitors | ( | const std::vector< MonitoringCriterionEnum > & | criteria, |
| const std::vector< ComponentVariable > & | component_variables | ||
| ) |
Gets the Monitoring data for the request criteria and component_variables.
| criteria | |
| component_variables |
| std::optional< MutabilityEnum > ocpp::v2::DeviceModel::get_mutability | ( | const Component & | component_id, |
| const Variable & | variable, | ||
| const AttributeEnum & | attribute_enum | ||
| ) |
Get the mutability for the given component, variable and attribute_enum.
| component_id | |
| variable_id | |
| attribute_enum |
|
inline |
Access to std::optional of a VariableAttribute for the given component, variable and attribute_enum.
| T | Type of the value that is requested |
| component_variable | Combination of Component and Variable that identifies the Variable |
| attribute_enum |
component_variable and attribute_enum could successfully requested from the storage and a value is present for this combination, else std::nullopt .
|
inline |
Direct access to value of a VariableAttribute for the given component, variable and attribute_enum. This should only be called for variables that have a role standardized in the OCPP2.0.1 specification.
| T | datatype of the value that is requested |
| component_variable | Combination of Component and Variable that identifies the Variable |
| attribute_enum | defaults to AttributeEnum::Actual |
| std::optional< VariableMetaData > ocpp::v2::DeviceModel::get_variable_meta_data | ( | const Component & | component_id, |
| const Variable & | variable_id | ||
| ) |
Gets the VariableMetaData for the given component_id and variable_id.
| component_id | |
| variable_id |
component_id or variable_id not present
|
inline |
Requests a value of a VariableAttribute specified by combination of component_id and variable_id from the device model.
| T | datatype of the value that is requested |
| component_id | |
| variable_id | |
| attribute_enum |
| std::vector< SetMonitoringResult > ocpp::v2::DeviceModel::set_monitors | ( | const std::vector< SetMonitoringData > & | requests, |
| const VariableMonitorType | type = VariableMonitorType::CustomMonitor |
||
| ) |
Sets the given monitor requests in the device model.
| request | |
| type | The type of the set monitors. HardWiredMonitor - used for OEM specific monitors, PreconfiguredMonitor - monitors that were manually defined in the component config, CustomMonitor - used for monitors that are set by the CSMS, |
| SetVariableStatusEnum ocpp::v2::DeviceModel::set_read_only_value | ( | const Component & | component_id, |
| const Variable & | variable_id, | ||
| const AttributeEnum & | attribute_enum, | ||
| const std::string & | value, | ||
| const std::string & | source | ||
| ) |
Sets the variable_id attribute value specified by component_id , variable_id and attribute_enum for read only variables only. Only works on certain allowed components.
| component_id | |
| variable_id | |
| attribute_enum | |
| value | |
| source | The source of the value (for example 'csms' or 'default'). |
| SetVariableStatusEnum ocpp::v2::DeviceModel::set_value | ( | const Component & | component_id, |
| const Variable & | variable_id, | ||
| const AttributeEnum & | attribute_enum, | ||
| const std::string & | value, | ||
| const std::string & | source, | ||
| const bool | allow_read_only = false |
||
| ) |
Sets the variable_id attribute value specified by component_id , variable_id and attribute_enum.
| component_id | |
| variable_id | |
| attribute_enum | |
| value | |
| source | The source of the value (for example 'csms' or 'default'). |
| allow_read_only | If this is true, read-only variables can be changed, otherwise only non read-only variables can be changed. Defaults to false |