Skip to content

Commit 113bdc7

Browse files
Merge branch 'develop_dadashi' of https://github.com/mahdidadashi65/open-ocpp into develop_dadashi
2 parents accd195 + 0573edf commit 113bdc7

40 files changed

+258
-57
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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 1.3.0
8+
VERSION 1.4.0
99
)
1010

1111
# Definitions for Version.h file

examples/common/DefaultCentralSystemEventsHandler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ bool DefaultCentralSystemEventsHandler::acceptConnection(const char* ip_address)
6666
return true;
6767
}
6868

69+
/** @copydoc void ICentralSystemEventsHandler::clientFailedToConnect(const char*) */
70+
void DefaultCentralSystemEventsHandler::clientFailedToConnect(const char* ip_address)
71+
{
72+
cout << "Client [" << ip_address << "] failed to connect" << endl;
73+
}
74+
6975
/** @copydoc bool ICentralSystemEventsHandler::checkCredentials(const std::string&, const std::string&) */
7076
bool DefaultCentralSystemEventsHandler::checkCredentials(const std::string& chargepoint_id, const std::string& password)
7177
{

examples/common/DefaultCentralSystemEventsHandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class DefaultCentralSystemEventsHandler : public ocpp::centralsystem::ICentralSy
4848
/** @copydoc bool ICentralSystemEventsHandler::acceptConnection(const char*) */
4949
bool acceptConnection(const char* ip_address) override;
5050

51+
/** @copydoc void ICentralSystemEventsHandler::clientFailedToConnect(const char*) */
52+
void clientFailedToConnect(const char* ip_address) override;
53+
5154
/** @copydoc bool ICentralSystemEventsHandler::checkCredentials(const std::string&, const std::string&) */
5255
bool checkCredentials(const std::string& chargepoint_id, const std::string& password) override;
5356

examples/common/DefaultChargePointEventsHandler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,13 @@ ocpp::types::UpdateFirmwareStatusEnumType DefaultChargePointEventsHandler::check
683683
if (!ca_certificates.empty())
684684
{
685685
// Check signing certificate
686-
if (signing_certificate.verify(ca_certificates))
686+
for (const auto& cer : ca_certificates)
687687
{
688-
ret = UpdateFirmwareStatusEnumType::Accepted;
688+
if (signing_certificate.verify(cer.certificateChain()))
689+
{
690+
ret = UpdateFirmwareStatusEnumType::Accepted;
691+
break;
692+
}
689693
}
690694
}
691695
else

examples/common/DefaultLocalControllerEventsHandler.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ bool DefaultLocalControllerEventsHandler::acceptConnection(const char* ip_addres
4848
return true;
4949
}
5050

51+
/** @copydoc void ILocalControllerEventsHandler::clientFailedToConnect(const char*) */
52+
void DefaultLocalControllerEventsHandler::clientFailedToConnect(const char* ip_address)
53+
{
54+
cout << "Client [" << ip_address << "] failed to connect" << endl;
55+
}
56+
5157
/** @copydoc bool ILocalControllerEventsHandler::checkCredentials(const std::string&, const std::string&) */
5258
bool DefaultLocalControllerEventsHandler::checkCredentials(const std::string& chargepoint_id, const std::string& password)
5359
{

examples/common/DefaultLocalControllerEventsHandler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class DefaultLocalControllerEventsHandler : public ocpp::localcontroller::ILocal
4646
/** @copydoc bool ILocalControllerEventsHandler::acceptConnection(const char*) */
4747
bool acceptConnection(const char* ip_address) override;
4848

49+
/** @copydoc void ILocalControllerEventsHandler::clientFailedToConnect(const char*) */
50+
void clientFailedToConnect(const char* ip_address) override;
51+
4952
/** @copydoc bool ILocalControllerEventsHandler::checkCredentials(const std::string&, const std::string&) */
5053
bool checkCredentials(const std::string& chargepoint_id, const std::string& password) override;
5154

examples/common/config/OcppConfig.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,15 @@ ocpp::types::ConfigurationStatus OcppConfig::setConfiguration(const std::string&
197197
{
198198
if ((it->second & PARAM_WRITE) != 0)
199199
{
200-
if (key.find("Interval") != std::string::npos)
201-
{
202-
if (value.find("-") != std::string::npos)
203-
{
204-
ret = ConfigurationStatus::Rejected;
205-
}
206-
}
200+
std::size_t key_is_interval = key.find("Interval");
201+
if (key_is_interval != std::string::npos)
202+
{
203+
std::size_t value_is_negative = value.find("-");
204+
if (value_is_negative != std::string::npos)
205+
{
206+
ret = ConfigurationStatus::Rejected;
207+
}
208+
}
207209

208210
if (ret != ConfigurationStatus::Rejected)
209211
{

src/centralsystem/CentralSystem.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ void CentralSystem::rpcClientConnected(const std::string& chargepoint_id, std::s
300300
m_events_handler.chargePointConnected(chargepoint);
301301
}
302302

303+
/** @copydoc void RpcServer::IListener::rpcClientFailedToConnect(const char*) */
304+
void CentralSystem::rpcClientFailedToConnect(const char* ip_address)
305+
{
306+
// Notify failure => no additional processing is done here
307+
// to keep this callback has fast as possible
308+
return m_events_handler.clientFailedToConnect(ip_address);
309+
}
310+
303311
/** @copydoc void RpcServer::IListener::rpcServerError() */
304312
void CentralSystem::rpcServerError()
305313
{

src/centralsystem/CentralSystem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class CentralSystem : public ICentralSystem, public ocpp::rpc::RpcServer::IListe
7878
/** @copydoc void RpcServer::IListener::rpcClientConnected(const std::string&, std::shared_ptr<Client>) */
7979
void rpcClientConnected(const std::string& chargepoint_id, std::shared_ptr<ocpp::rpc::RpcServer::Client> client) override;
8080

81+
/** @copydoc void RpcServer::IListener::rpcClientFailedToConnect(const char*) */
82+
void rpcClientFailedToConnect(const char* ip_address) override;
83+
8184
/** @copydoc void RpcServer::IListener::rpcServerError() */
8285
void rpcServerError() override;
8386

src/centralsystem/interface/ICentralSystemEventsHandler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class ICentralSystemEventsHandler
4040
*/
4141
virtual bool acceptConnection(const char* ip_address) = 0;
4242

43+
/**
44+
* @brief Called when connection fails to established
45+
* @param ip_address IP address of the client
46+
*/
47+
virtual void clientFailedToConnect(const char* ip_address) = 0;
48+
4349
/**
4450
* @brief Called to check the charge point credentials for HTTP basic authentication
4551
* @param chargepoint_id Charge Point identifier

0 commit comments

Comments
 (0)