Skip to content

Commit 21fc395

Browse files
authored
Merge pull request #60 from c-jimenez/release/v0.7.0
Release/v0.7.0
2 parents 868a1d3 + c7eb62a commit 21fc395

File tree

78 files changed

+4862
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4862
-314
lines changed

.vscode/tasks.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"type": "shell",
99
"command": "make",
1010
"args": [
11-
"gcc-native"
11+
"gcc-native",
12+
"BUILD_TYPE=Debug"
1213
],
1314
"problemMatcher": "$gcc",
1415
"group": {
@@ -30,7 +31,8 @@
3031
"type": "shell",
3132
"command": "make",
3233
"args": [
33-
"clean-gcc-native"
34+
"clean-gcc-native",
35+
"BUILD_TYPE=Debug"
3436
],
3537
"group": "build"
3638
}

CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
cmake_minimum_required(VERSION 3.13)
66

77
project(OpenOCPP DESCRIPTION "Open Source C++ implementation of the OCPP 1.6 protocol"
8-
VERSION 0.6.0
8+
VERSION 0.7.0
99
)
1010

1111
# Definitions for Version.h file
@@ -94,8 +94,6 @@ target_link_libraries(open-ocpp-dynamic
9494
json
9595
ws
9696
websockets
97-
98-
stdc++fs
9997
)
10098
set_target_properties(open-ocpp-dynamic PROPERTIES OUTPUT_NAME "open-ocpp")
10199

CMakeLists_Options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ endif()
99
add_compile_definitions(LOG_LEVEL=${LOG_LEVEL})
1010

1111
# Static library
12-
option(BUILD_STATIC_LIBRARY "Build Open OCPP as a static library" OFF)
12+
option(BUILD_STATIC_LIBRARY "Build Open OCPP as a static library" ON)
1313

1414
# Unit tests
1515
option(BUILD_UNIT_TESTS "Build unit tests" ON)

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Contributing
2+
3+
**Open OCPP** welcomes contributions. When contributing, please follow the code below.
4+
5+
## Coding rules
6+
7+
* The **.clang-format** file at the root of the source tree must not be modified (or **after** having a discussion between all the contributors)
8+
* The code must formatted using the above mentionned file with a clang-format compliant tools (ex: Visual Studio Code)
9+
* Every interface/class/method must be documented using the [Doxygen](https://www.doxygen.nl/) format
10+
* Use of smart pointers for memory allocation is greatly recommended
11+
* Use of C/C++ macros is discouraged
12+
* Keep code simple to understand and don't be afraid to add comments!
13+
14+
## Issues
15+
16+
Feel free to submit issues and enhancement requests.
17+
18+
Please help us by providing minimal reproducible examples, because source code is easier to let other people understand what happens. For crash problems on certain platforms, please bring stack dump content with the detail of the OS, compiler, etc.
19+
20+
Please try breakpoint debugging first, tell us what you found, see if we can start exploring based on more information been prepared.
21+
22+
## Workflow
23+
24+
Follow the "fork-and-pull" Git workflow :
25+
26+
* Fork the repo on GitHub
27+
* Clone the project to your own machine
28+
* Checkout a new branch on your fork, start developing on the branch
29+
* Test the change before commit, Make sure the changes pass all the tests, please add test case for each new feature or bug-fix if needed.
30+
* Commit changes to your own branch
31+
* Push your work back up to your fork
32+
* Submit a Pull request so that we can review your changes
33+
34+
**Be sure to merge the latest from "upstream" before making a pull request!**

examples/common/config/OcppConfig.h

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class OcppConfig : public ocpp::config::IOcppConfig
7373
beforehand like a local action to start a transaction. */
7474
bool authorizeRemoteTxRequests() const override { return getBool("AuthorizeRemoteTxRequests"); }
7575
/** @brief Number of times to blink Charge Point lighting when signalling */
76-
unsigned int blinkRepeat() const override { return getUInt("BlinkRepeat"); }
76+
unsigned int blinkRepeat() const override { return get<unsigned int>("BlinkRepeat"); }
7777
/** @brief Size (in seconds) of the clock-aligned data interval. This is the size (in seconds) of the set of evenly spaced aggregation intervals
7878
per day, starting at 00:00:00 (midnight). For example, a value of 900 (15 minutes) indicates that every day should be broken into
7979
96 15-minute intervals.
@@ -104,30 +104,30 @@ class OcppConfig : public ocpp::config::IOcppConfig
104104
Values are reported in CSL, formatted: 0.RST, 1.RST, 2.RTS */
105105
std::string connectorPhaseRotation() const override { return getString("ConnectorPhaseRotation"); }
106106
/** @brief Maximum number of items in a ConnectorPhaseRotation Configuration Key. */
107-
unsigned int connectorPhaseRotationMaxLength() const override { return getUInt("ConnectorPhaseRotationMaxLength"); }
107+
unsigned int connectorPhaseRotationMaxLength() const override { return get<unsigned int>("ConnectorPhaseRotationMaxLength"); }
108108
/** @brief Maximum number of requested configuration keys in a GetConfiguration.req PDU. */
109-
unsigned int getConfigurationMaxKeys() const override { return getUInt("GetConfigurationMaxKeys"); }
109+
unsigned int getConfigurationMaxKeys() const override { return get<unsigned int>("GetConfigurationMaxKeys"); }
110110
/** @brief Interval of inactivity (no OCPP exchanges) with central system after which the Charge Point should send a Heartbeat.req PDU */
111111
std::chrono::seconds heartbeatInterval() const override { return get<std::chrono::seconds>("HeartbeatInterval"); }
112112
/** @brief Percentage of maximum intensity at which to illuminate Charge Point lighting */
113-
unsigned int lightIntensity() const override { return getUInt("LightIntensity"); }
113+
unsigned int lightIntensity() const override { return get<unsigned int>("LightIntensity"); }
114114
/** @brief Whether the Charge Point, when offline, will start a transaction for locally-authorized identifiers. */
115115
bool localAuthorizeOffline() const override { return getBool("LocalAuthorizeOffline"); }
116116
/** @brief Whether the Charge Point, when online, will start a transaction for locally-authorized identifiers without waiting for or
117117
requesting an Authorize.conf from the Central System */
118118
bool localPreAuthorize() const override { return getBool("LocalPreAuthorize"); }
119119
/** @brief Maximum energy in Wh delivered when an identifier is invalidated by the Central System after start of a transaction. */
120-
unsigned int maxEnergyOnInvalidId() const override { return getUInt("MaxEnergyOnInvalidId"); }
120+
unsigned int maxEnergyOnInvalidId() const override { return get<unsigned int>("MaxEnergyOnInvalidId"); }
121121
/** @brief Clock-aligned measurand(s) to be included in a MeterValues.req PDU, every ClockAlignedDataInterval seconds */
122122
std::string meterValuesAlignedData() const override { return getString("MeterValuesAlignedData"); }
123123
/** @brief Maximum number of items in a MeterValuesAlignedData Configuration Key. */
124-
unsigned int meterValuesAlignedDataMaxLength() const override { return getUInt("MeterValuesAlignedDataMaxLength"); }
124+
unsigned int meterValuesAlignedDataMaxLength() const override { return get<unsigned int>("MeterValuesAlignedDataMaxLength"); }
125125
/** @brief Sampled measurands to be included in a MeterValues.req PDU, every MeterValueSampleInterval seconds. Where
126126
applicable, the Measurand is combined with the optional phase; for instance: Voltage.L1
127127
Default: "Energy.Active.Import.Register" */
128128
std::string meterValuesSampledData() const override { return getString("MeterValuesSampledData"); }
129129
/** @brief Maximum number of items in a MeterValuesSampledData Configuration Key. */
130-
unsigned int meterValuesSampledDataMaxLength() const override { return getUInt("MeterValuesSampledDataMaxLength"); }
130+
unsigned int meterValuesSampledDataMaxLength() const override { return get<unsigned int>("MeterValuesSampledDataMaxLength"); }
131131
/** @brief Interval between sampling of metering (or other) data, intended to be transmitted by "MeterValues" PDUs. For charging
132132
session data (ConnectorId>0), samples are acquired and transmitted periodically at this interval from the start of the charging
133133
transaction.
@@ -137,9 +137,9 @@ class OcppConfig : public ocpp::config::IOcppConfig
137137
Central System. */
138138
std::chrono::seconds minimumStatusDuration() const override { return get<std::chrono::seconds>("MinimumStatusDuration"); }
139139
/** @brief The number of physical charging connectors of this Charge Point. */
140-
unsigned int numberOfConnectors() const override { return getUInt("NumberOfConnectors"); }
140+
unsigned int numberOfConnectors() const override { return get<unsigned int>("NumberOfConnectors"); }
141141
/** @brief Number of times to retry an unsuccessful reset of the Charge Point. */
142-
unsigned int resetRetries() const override { return getUInt("ResetRetries"); }
142+
unsigned int resetRetries() const override { return get<unsigned int>("ResetRetries"); }
143143
/** @brief When set to true, the Charge Point SHALL administratively stop the transaction when the cable is unplugged from the EV. */
144144
bool stopTransactionOnEVSideDisconnect() const override { return getBool("StopTransactionOnEVSideDisconnect"); }
145145
/** @brief whether the Charge Point will stop an ongoing transaction when it receives a non- Accepted authorization status in a
@@ -149,19 +149,19 @@ class OcppConfig : public ocpp::config::IOcppConfig
149149
PDU for every ClockAlignedDataInterval of the Transaction */
150150
std::string stopTxnAlignedData() const override { return getString("StopTxnAlignedData"); }
151151
/** @brief Maximum number of items in a StopTxnAlignedData Configuration Key. */
152-
unsigned int stopTxnAlignedDataMaxLength() const override { return getUInt("StopTxnAlignedDataMaxLength"); }
152+
unsigned int stopTxnAlignedDataMaxLength() const override { return get<unsigned int>("StopTxnAlignedDataMaxLength"); }
153153
/** @brief Sampled measurands to be included in the TransactionData element of StopTransaction.req PDU, every
154154
MeterValueSampleInterval seconds from the start of the charging session */
155155
std::string stopTxnSampledData() const override { return getString("StopTxnSampledData"); }
156156
/** @brief Maximum number of items in a StopTxnSampledData Configuration Key.*/
157-
unsigned int stopTxnSampledDataMaxLength() const override { return getUInt("StopTxnSampledDataMaxLength"); }
157+
unsigned int stopTxnSampledDataMaxLength() const override { return get<unsigned int>("StopTxnSampledDataMaxLength"); }
158158
/** @brief A list of supported Feature Profiles. Possible profile identifiers: Core, FirmwareManagement, LocalAuthListManagement,
159159
Reservation, SmartCharging and RemoteTrigger. */
160160
std::string supportedFeatureProfiles() const override { return getString("SupportedFeatureProfiles"); }
161161
/** @brief Maximum number of items in a SupportedFeatureProfiles Configuration Key. */
162-
unsigned int supportedFeatureProfilesMaxLength() const override { return getUInt("SupportedFeatureProfilesMaxLength"); }
162+
unsigned int supportedFeatureProfilesMaxLength() const override { return get<unsigned int>("SupportedFeatureProfilesMaxLength"); }
163163
/** @brief How often the Charge Point should try to submit a transaction-related message when the Central System fails to process it. */
164-
unsigned int transactionMessageAttempts() const override { return getUInt("TransactionMessageAttempts"); }
164+
unsigned int transactionMessageAttempts() const override { return get<unsigned int>("TransactionMessageAttempts"); }
165165
/** @brief How long the Charge Point should wait before resubmitting a transaction-related message that the Central System failed to
166166
process. */
167167
std::chrono::seconds transactionMessageRetryInterval() const override
@@ -180,9 +180,9 @@ class OcppConfig : public ocpp::config::IOcppConfig
180180
/** @brief whether the Local Authorization List is enabled */
181181
bool localAuthListEnabled() const override { return getBool("LocalAuthListEnabled"); }
182182
/** @brief Maximum number of identifications that can be stored in the Local Authorization List */
183-
unsigned int localAuthListMaxLength() const override { return getUInt("LocalAuthListMaxLength"); }
183+
unsigned int localAuthListMaxLength() const override { return get<unsigned int>("LocalAuthListMaxLength"); }
184184
/** @brief Maximum number of identifications that can be send in a single SendLocalList.req */
185-
unsigned int sendLocalListMaxLength() const override { return getUInt("SendLocalListMaxLength"); }
185+
unsigned int sendLocalListMaxLength() const override { return get<unsigned int>("SendLocalListMaxLength"); }
186186

187187
// Reservation Profile
188188

@@ -193,15 +193,15 @@ class OcppConfig : public ocpp::config::IOcppConfig
193193

194194
/** @brief Max StackLevel of a ChargingProfile. The number defined also indicates the max allowed number of installed charging
195195
schedules per Charging Profile Purposes. */
196-
unsigned int chargeProfileMaxStackLevel() const override { return getUInt("ChargeProfileMaxStackLevel"); }
196+
unsigned int chargeProfileMaxStackLevel() const override { return get<unsigned int>("ChargeProfileMaxStackLevel"); }
197197
/** @brief A list of supported quantities for use in a ChargingSchedule. Allowed values: 'Current' and 'Power' */
198198
std::string chargingScheduleAllowedChargingRateUnit() const override { return getString("ChargingScheduleAllowedChargingRateUnit"); }
199199
/** @brief Maximum number of periods that may be defined per ChargingSchedule. */
200-
unsigned int chargingScheduleMaxPeriods() const override { return getUInt("ChargingScheduleMaxPeriods"); }
200+
unsigned int chargingScheduleMaxPeriods() const override { return get<unsigned int>("ChargingScheduleMaxPeriods"); }
201201
/** @brief If defined and true, this Charge Point support switching from 3 to 1 phase during a Transaction. */
202202
bool connectorSwitch3to1PhaseSupported() const override { return getBool("ConnectorSwitch3to1PhaseSupported"); }
203203
/** @brief Maximum number of Charging profiles installed at a time */
204-
unsigned int maxChargingProfilesInstalled() const override { return getUInt("MaxChargingProfilesInstalled"); }
204+
unsigned int maxChargingProfilesInstalled() const override { return get<unsigned int>("MaxChargingProfilesInstalled"); }
205205

206206
//
207207
// Specific setters
@@ -240,10 +240,10 @@ class OcppConfig : public ocpp::config::IOcppConfig
240240

241241
/** @brief This configuration key can be used to limit the size of the 'certificateChain' field from the CertificateSigned.req PDU. The value
242242
of this configuration key has a maximum limit of 10.000 characters. */
243-
unsigned int certificateSignedMaxChainSize() const override { return getUInt("CertificateSignedMaxChainSize"); }
243+
unsigned int certificateSignedMaxChainSize() const override { return get<unsigned int>("CertificateSignedMaxChainSize"); }
244244

245245
/** @brief Maximum number of Root/CA certificates that can be installed in the Charge Point. */
246-
unsigned int certificateStoreMaxLength() const override { return getUInt("CertificateStoreMaxLength"); }
246+
unsigned int certificateStoreMaxLength() const override { return get<unsigned int>("CertificateStoreMaxLength"); }
247247

248248
/** @brief This configuration key contains CPO name (or an organization trusted by the CPO) as used in the Charge Point Certificate. This
249249
is the CPO name that is to be used in a CSR send via: SignCertificate.req */
@@ -257,7 +257,7 @@ class OcppConfig : public ocpp::config::IOcppConfig
257257
After the security profile was successfully changed, the Charge Point disconnects from the Central System and SHALL
258258
reconnect using the new configured Security Profile.
259259
Default, when no security profile is yet configured: 0. */
260-
unsigned int securityProfile() const override { return getUInt("SecurityProfile"); }
260+
unsigned int securityProfile() const override { return get<unsigned int>("SecurityProfile"); }
261261

262262
/** @brief Comma separated list of supported file transfer protocols for upload AND download
263263
Allowed values : FTP, FTPS, HTTP, HTTPS, SFTP */
@@ -269,8 +269,6 @@ class OcppConfig : public ocpp::config::IOcppConfig
269269

270270
/** @brief Get a boolean parameter */
271271
bool getBool(const std::string& param) const { return m_config.get(OCPP_PARAMS, param).toBool(); }
272-
/** @brief Get an unsigned integer parameter */
273-
unsigned int getUInt(const std::string& param) const { return m_config.get(OCPP_PARAMS, param).toUInt(); }
274272
/** @brief Get a string parameter */
275273
std::string getString(const std::string& param) const { return m_config.get(OCPP_PARAMS, param); }
276274
/** @brief Get a value which can be created from an unsigned integer */

examples/common/simulators/MeterSimulator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ SOFTWARE.
2323
*/
2424

2525
#include "MeterSimulator.h"
26-
#include "TimerPool.h"
26+
#include "ITimerPool.h"
2727

2828
/** @brief Constructor */
29-
MeterSimulator::MeterSimulator(ocpp::helpers::TimerPool& timer_pool, unsigned int phases_count)
29+
MeterSimulator::MeterSimulator(ocpp::helpers::ITimerPool& timer_pool, unsigned int phases_count)
3030
: m_update_timer(timer_pool),
3131
m_phases_count(phases_count),
3232
m_voltages(m_phases_count),

examples/common/simulators/MeterSimulator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MeterSimulator : public IMeter
3535
{
3636
public:
3737
/** @brief Constructor */
38-
MeterSimulator(ocpp::helpers::TimerPool& timer_pool, unsigned int phases_count);
38+
MeterSimulator(ocpp::helpers::ITimerPool& timer_pool, unsigned int phases_count);
3939

4040
/** @brief Destructor */
4141
virtual ~MeterSimulator();

examples/security_centralsystem/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ int main(int argc, char* argv[])
158158
CentralSystemEventsHandler event_handler(chargepoint_db);
159159

160160
// Use the same timer and worker pool for all the instances
161-
std::shared_ptr<ocpp::helpers::TimerPool> timer_pool = std::make_shared<ocpp::helpers::TimerPool>();
161+
std::shared_ptr<ocpp::helpers::ITimerPool> timer_pool(new ocpp::helpers::TimerPool());
162162
std::shared_ptr<ocpp::helpers::WorkerThreadPool> worker_pool =
163163
std::make_shared<ocpp::helpers::WorkerThreadPool>(2u); // 1 asynchronous timer operations + 1 for asynchronous jobs/responses
164164

makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ tests-install-gcc-native: gcc-native install-gcc-native
6060
@mkdir -p $(GCC_NATIVE_BUILD_DIR)/tests/deploy
6161
@cd $(GCC_NATIVE_BUILD_DIR)/tests/deploy && export CC=gcc && export CXX=g++ && cmake -D CMAKE_BUILD_TYPE=$(BUILD_TYPE) -D TARGET=native $(CMAKE_INSTALL_PREFIX) $(ROOT_DIR)/tests/deploy
6262
@make --silent -C $(GCC_NATIVE_BUILD_DIR)/tests/deploy $(VERBOSE) $(PARALLEL_BUILD)
63+
@make --silent -C $(GCC_NATIVE_BUILD_DIR)/tests/deploy test ARGS=--output-on-failure
6364
@echo "gcc-native build installation checked!"
6465

6566
$(GCC_NATIVE_BUILD_DIR)/Makefile:
@@ -97,6 +98,7 @@ tests-install-clang-native: clang-native install-clang-native
9798
@mkdir -p $(CLANG_NATIVE_BUILD_DIR)/tests/deploy
9899
@cd $(CLANG_NATIVE_BUILD_DIR)/tests/deploy && export CC=clang && export CXX=clang++ && cmake -D CMAKE_BUILD_TYPE=$(BUILD_TYPE) -D TARGET=native -D _CMAKE_TOOLCHAIN_PREFIX=llvm- -D BIN_DIR=$(CLANG_NATIVE_BIN_DIR) $(CMAKE_INSTALL_PREFIX) $(ROOT_DIR)/tests/deploy
99100
@make --silent -C $(CLANG_NATIVE_BUILD_DIR)/tests/deploy $(VERBOSE) $(PARALLEL_BUILD)
101+
@make --silent -C $(CLANG_NATIVE_BUILD_DIR)/tests/deploy test ARGS=--output-on-failure
100102
@echo "clang-native build installation checked!"
101103

102104
$(CLANG_NATIVE_BUILD_DIR)/Makefile:

0 commit comments

Comments
 (0)