@@ -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,8 +202,9 @@ 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 ());
207210 m_msg_sender = std::make_unique<ocpp::messages::GenericMessageSender>(m_stack_config, *m_rpc_client, m_messages_converter);
@@ -571,7 +574,7 @@ bool ChargePoint::notifyFirmwareUpdateStatus(bool success)
571574 return ret;
572575}
573576
574- /* * @copydoc void IRpcClientListener ::rpcClientConnected() */
577+ /* * @copydoc void RpcClient::IListener ::rpcClientConnected() */
575578void ChargePoint::rpcClientConnected ()
576579{
577580 LOG_INFO << " Connected to Central System" ;
@@ -580,7 +583,7 @@ void ChargePoint::rpcClientConnected()
580583 m_events_handler.connectionStateChanged (true );
581584}
582585
583- /* * @copydoc void IRpcClientListener ::rpcClientFailed() */
586+ /* * @copydoc void RpcClient::IListener ::rpcClientFailed() */
584587void ChargePoint::rpcClientFailed ()
585588{
586589 LOG_ERROR << " Connection failed with Central System" ;
@@ -600,44 +603,44 @@ void ChargePoint::rpcClientFailed()
600603 m_events_handler.connectionFailed (last_status);
601604}
602605
603- /* * @copydoc void IRpcClientListener::rpcClientDisconnected () */
604- void ChargePoint::rpcClientDisconnected ()
606+ /* * @copydoc void IRpc::IListener::rpcDisconnected () */
607+ void ChargePoint::rpcDisconnected ()
605608{
606609 LOG_ERROR << " Connection lost with Central System" ;
607610 m_status_manager->updateConnectionStatus (false );
608611 m_transaction_manager->updateConnectionStatus (false );
609612 m_events_handler.connectionStateChanged (false );
610613}
611614
612- /* * @copydoc void IRpcClientListener::rpcClientError () */
613- void ChargePoint::rpcClientError ()
615+ /* * @copydoc void IRpc::IListener::rpcError () */
616+ void ChargePoint::rpcError ()
614617{
615618 LOG_ERROR << " Connection error with Central System" ;
616619 m_events_handler.connectionStateChanged (false );
617620}
618621
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)
622+ /* * @copydoc void IRpc::IListener::rpcCallReceived (const std::string&,
623+ const rapidjson::Value&,
624+ rapidjson::Document&,
625+ const char*&,
626+ std::string&) */
627+ bool ChargePoint::rpcCallReceived (const std::string& action,
628+ const rapidjson::Value& payload,
629+ rapidjson::Document& response,
630+ const char *& error_code,
631+ std::string& error_message)
629632{
630633 return m_msg_dispatcher->dispatchMessage (action, payload, response, error_code, error_message);
631634}
632635
633- /* * @copydoc void IRpcClientSpy::rcpClientMessageReceived (const std::string&) */
634- void ChargePoint::rcpClientMessageReceived (const std::string& msg)
636+ /* * @copydoc void IRpc::ISpy::rcpMessageReceived (const std::string&) */
637+ void ChargePoint::rcpMessageReceived (const std::string& msg)
635638{
636639 LOG_COM << " RX : " << msg;
637640}
638641
639- /* * @copydoc void IRpcClientSpy::rcpClientMessageSent (const std::string&) */
640- void ChargePoint::rcpClientMessageSent (const std::string& msg)
642+ /* * @copydoc void IRpc::ISpy::rcpMessageSent (const std::string&) */
643+ void ChargePoint::rcpMessageSent (const std::string& msg)
641644{
642645 m_status_manager->resetHeartBeatTimer ();
643646 LOG_COM << " TX : " << msg;
0 commit comments