@@ -27,7 +27,6 @@ along with OpenOCPP. If not, see <http://www.gnu.org/licenses/>.
2727#include " MessageDispatcher.h"
2828#include " MeterValuesManager.h"
2929#include " ReservationManager.h"
30- #include " RpcClient.h"
3130#include " SmartChargingManager.h"
3231#include " StatusManager.h"
3332#include " TransactionManager.h"
@@ -106,6 +105,9 @@ ChargePoint::ChargePoint(const ocpp::config::IChargePointConfig& stack_config,
106105
107106 // Uptime timer
108107 m_uptime_timer.setCallback (std::bind (&ChargePoint::processUptime, this ));
108+
109+ // Random numbers
110+ std::srand (time (nullptr ));
109111}
110112
111113/* * @brief Destructor */
@@ -200,11 +202,13 @@ bool ChargePoint::start()
200202
201203 // Allocate resources
202204 m_ws_client = std::unique_ptr<ocpp::websockets::IWebsocketClient>(ocpp::websockets::WebsocketFactory::newClient ());
203- m_rpc_client = std::make_unique<ocpp::rpc::RpcClient>(*m_ws_client, " ocpp1.6" , std::rand () );
205+ m_rpc_client = std::make_unique<ocpp::rpc::RpcClient>(*m_ws_client, " ocpp1.6" );
204206 m_rpc_client->registerListener (*this );
207+ m_rpc_client->registerClientListener (*this );
205208 m_rpc_client->registerSpy (*this );
206209 m_msg_dispatcher = std::make_unique<ocpp::messages::MessageDispatcher>(m_stack_config.jsonSchemasPath ());
207- m_msg_sender = std::make_unique<ocpp::messages::GenericMessageSender>(m_stack_config, *m_rpc_client, m_messages_converter);
210+ m_msg_sender = std::make_unique<ocpp::messages::GenericMessageSender>(
211+ *m_rpc_client, m_messages_converter, m_stack_config.callRequestTimeout ());
208212
209213 m_config_manager = std::make_unique<ConfigManager>(m_ocpp_config, m_messages_converter, *m_msg_dispatcher);
210214 m_trigger_manager = std::make_unique<TriggerMessageManager>(m_connectors, m_messages_converter, *m_msg_dispatcher);
@@ -571,7 +575,7 @@ bool ChargePoint::notifyFirmwareUpdateStatus(bool success)
571575 return ret;
572576}
573577
574- /* * @copydoc void IRpcClientListener ::rpcClientConnected() */
578+ /* * @copydoc void RpcClient::IListener ::rpcClientConnected() */
575579void ChargePoint::rpcClientConnected ()
576580{
577581 LOG_INFO << " Connected to Central System" ;
@@ -580,7 +584,7 @@ void ChargePoint::rpcClientConnected()
580584 m_events_handler.connectionStateChanged (true );
581585}
582586
583- /* * @copydoc void IRpcClientListener ::rpcClientFailed() */
587+ /* * @copydoc void RpcClient::IListener ::rpcClientFailed() */
584588void ChargePoint::rpcClientFailed ()
585589{
586590 LOG_ERROR << " Connection failed with Central System" ;
@@ -600,44 +604,44 @@ void ChargePoint::rpcClientFailed()
600604 m_events_handler.connectionFailed (last_status);
601605}
602606
603- /* * @copydoc void IRpcClientListener::rpcClientDisconnected () */
604- void ChargePoint::rpcClientDisconnected ()
607+ /* * @copydoc void IRpc::IListener::rpcDisconnected () */
608+ void ChargePoint::rpcDisconnected ()
605609{
606610 LOG_ERROR << " Connection lost with Central System" ;
607611 m_status_manager->updateConnectionStatus (false );
608612 m_transaction_manager->updateConnectionStatus (false );
609613 m_events_handler.connectionStateChanged (false );
610614}
611615
612- /* * @copydoc void IRpcClientListener::rpcClientError () */
613- void ChargePoint::rpcClientError ()
616+ /* * @copydoc void IRpc::IListener::rpcError () */
617+ void ChargePoint::rpcError ()
614618{
615619 LOG_ERROR << " Connection error with Central System" ;
616620 m_events_handler.connectionStateChanged (false );
617621}
618622
619- /* * @copydoc void IRpcClientListener::rpcClientCallReceived (const std::string&,
620- const rapidjson::Value&,
621- rapidjson::Document&,
622- const char*&,
623- std::string&) */
624- bool ChargePoint::rpcClientCallReceived (const std::string& action,
625- const rapidjson::Value& payload,
626- rapidjson::Document& response,
627- const char *& error_code,
628- std::string& error_message)
623+ /* * @copydoc void IRpc::IListener::rpcCallReceived (const std::string&,
624+ const rapidjson::Value&,
625+ rapidjson::Document&,
626+ const char*&,
627+ std::string&) */
628+ bool ChargePoint::rpcCallReceived (const std::string& action,
629+ const rapidjson::Value& payload,
630+ rapidjson::Document& response,
631+ const char *& error_code,
632+ std::string& error_message)
629633{
630634 return m_msg_dispatcher->dispatchMessage (action, payload, response, error_code, error_message);
631635}
632636
633- /* * @copydoc void IRpcClientSpy::rcpClientMessageReceived (const std::string&) */
634- void ChargePoint::rcpClientMessageReceived (const std::string& msg)
637+ /* * @copydoc void IRpc::ISpy::rcpMessageReceived (const std::string&) */
638+ void ChargePoint::rcpMessageReceived (const std::string& msg)
635639{
636640 LOG_COM << " RX : " << msg;
637641}
638642
639- /* * @copydoc void IRpcClientSpy::rcpClientMessageSent (const std::string&) */
640- void ChargePoint::rcpClientMessageSent (const std::string& msg)
643+ /* * @copydoc void IRpc::ISpy::rcpMessageSent (const std::string&) */
644+ void ChargePoint::rcpMessageSent (const std::string& msg)
641645{
642646 m_status_manager->resetHeartBeatTimer ();
643647 LOG_COM << " TX : " << msg;
0 commit comments