@@ -25,31 +25,109 @@ SOFTWARE.
2525#ifndef CHARGEPOINTCONFIG_H
2626#define CHARGEPOINTCONFIG_H
2727
28+ #include " IChargePointConfig.h"
2829#include " IniFile.h"
29- #include " OcppConfig.h"
30- #include " StackConfig.h"
3130
32- /* * @brief Configuration of the Charge Point demo */
33- class ChargePointConfig
31+ /* * @brief Section name for the parameters */
32+ static const std::string STACK_PARAMS = " ChargePoint" ;
33+
34+ /* * @brief Charge Point stack internal configuration */
35+ class ChargePointConfig : public ocpp ::config::IChargePointConfig
3436{
3537 public:
3638 /* * @brief Constructor */
37- ChargePointConfig (const std::string& config_file) : m_config(config_file), m_stack_config(m_config), m_ocpp_config(m_config) { }
39+ ChargePointConfig (ocpp::helpers::IniFile& config) : m_config(config) { }
40+
41+ // Paths
42+
43+ /* * @brief Path to the database to store persistent data */
44+ std::string databasePath () const override { return getString (" DatabasePath" ); }
45+ /* * @brief Path to the JSON schemas to validate the messages */
46+ std::string jsonSchemasPath () const override { return getString (" JsonSchemasPath" ); }
47+
48+ // Communication parameters
49+
50+ /* * @brief Connection URL */
51+ std::string connexionUrl () const override { return getString (" ConnexionUrl" ); };
52+ /* * @brief Charge point identifier */
53+ std::string chargePointIdentifier () const override { return getString (" ChargePointIdentifier" ); }
54+ /* * @brief Connection timeout */
55+ std::chrono::milliseconds connectionTimeout () const override { return get<std::chrono::milliseconds>(" ConnectionTimeout" ); }
56+ /* * @brief Retry interval */
57+ std::chrono::milliseconds retryInterval () const override { return get<std::chrono::milliseconds>(" RetryInterval" ); }
58+ /* * @brief Call request timeout */
59+ std::chrono::milliseconds callRequestTimeout () const override { return get<std::chrono::milliseconds>(" CallRequestTimeout" ); }
60+ /* * @brief Cipher list to use for TLSv1.2 connections */
61+ std::string tlsv12CipherList () const override { return getString (" Tlsv12CipherList" ); }
62+ /* * @brief Cipher list to use for TLSv1.3 connections */
63+ std::string tlsv13CipherList () const override { return getString (" Tlsv13CipherList" ); }
64+ /* * @brief ECDH curve to use for TLS connections */
65+ std::string tlsvEcdhCurve () const override { return getString (" TlsEcdhCurve" ); }
66+ /* * @brief Allow TLS connections using self-signed certificates
67+ * (Warning : enabling this feature is not recommended in production) */
68+ bool tlsAllowSelfSignedCertificates () const override { return getBool (" TlsAllowSelfSignedCertificates" ); }
69+ /* * @brief Allow TLS connections using expired certificates
70+ * (Warning : enabling this feature is not recommended in production) */
71+ bool tlsAllowExpiredCertificates () const override { return getBool (" TlsAllowExpiredCertificates" ); }
72+ /* * @brief Accept non trusted certificates for TLS connections
73+ * (Warning : enabling this feature is not recommended in production) */
74+ bool tlsAcceptNonTrustedCertificates () const override { return getBool (" TlsAcceptNonTrustedCertificates" ); }
75+ /* * @brief Skip server name check in certificates for TLS connections
76+ * (Warning : enabling this feature is not recommended in production) */
77+ bool tlsSkipServerNameCheck () const override { return getBool (" TlsSkipServerNameCheck" ); }
78+
79+ // Charge point identification
80+
81+ /* * @brief Charge box serial number */
82+ std::string chargeBoxSerialNumber () const override { return getString (" ChargeBoxSerialNumber" ); }
83+ /* * @brief Charge point model */
84+ std::string chargePointModel () const override { return getString (" ChargePointModel" ); }
85+ /* * @brief Charge point serial number */
86+ std::string chargePointSerialNumber () const override { return getString (" ChargePointSerialNumber" ); }
87+ /* * @brief Charge point vendor */
88+ std::string chargePointVendor () const override { return getString (" ChargePointVendor" ); }
89+ /* * @brief Firmware version */
90+ std::string firmwareVersion () const override { return getString (" FirmwareVersion" ); }
91+ /* * @brief ICCID of the moden's SIM card */
92+ std::string iccid () const override { return getString (" Iccid" ); }
93+ /* * @brief IMSI of the moden's SIM card */
94+ std::string imsi () const override { return getString (" Imsi" ); }
95+ /* * @brief Main electrical meter serial number */
96+ std::string meterSerialNumber () const override { return getString (" MeterSerialNumber" ); }
97+ /* * @brief Main electrical meter type */
98+ std::string meterType () const override { return getString (" MeterType" ); }
99+
100+ // Charging
101+
102+ /* * @brief Nominal operating voltage (needed for Watt to Amp conversions in smart charging profiles) */
103+ float operatingVoltage () const override { return static_cast <float >(getFloat (" OperatingVoltage" )); }
104+
105+ // Authent
106+
107+ /* * @brief Maximum number of entries in the authentication cache */
108+ unsigned int authentCacheMaxEntriesCount () const override { return get<unsigned int >(" AuthentCacheMaxEntriesCount" ); }
38109
39- /* * @brief Stack internal configuration */
40- ocpp::config::IChargePointConfig& stackConfig () { return m_stack_config; }
110+ // Logs
41111
42- /* * @brief Standard OCPP configuration */
43- ocpp::config::IOcppConfig& ocppConfig () { return m_ocpp_config ; }
112+ /* * @brief Maximum number of entries in the log (0 = no logs in database) */
113+ unsigned int logMaxEntriesCount () const override { return get< unsigned int >( " LogMaxEntriesCount " ) ; }
44114
45115 private:
46116 /* * @brief Configuration file */
47- ocpp::helpers::IniFile m_config;
117+ ocpp::helpers::IniFile& m_config;
48118
49- /* * @brief Stack internal configuration */
50- StackConfig m_stack_config;
51- /* * @brief Standard OCPP configuration */
52- OcppConfig m_ocpp_config;
119+ /* * @brief Get a boolean parameter */
120+ bool getBool (const std::string& param) const { return m_config.get (STACK_PARAMS, param).toBool (); }
121+ /* * @brief Get a floating point parameter */
122+ double getFloat (const std::string& param) const { return m_config.get (STACK_PARAMS, param).toFloat (); }
123+ /* * @brief Get a string parameter */
124+ std::string getString (const std::string& param) const { return m_config.get (STACK_PARAMS, param); }
125+ /* * @brief Get a value which can be created from an unsigned integer */
126+ template <typename T>
127+ T get (const std::string& param) const
128+ {
129+ return T (m_config.get (STACK_PARAMS, param).toUInt ());
130+ }
53131};
54132
55133#endif // CHARGEPOINTCONFIG_H
0 commit comments