Skip to content

Commit 8f77f58

Browse files
committed
[localcontroller] Remove dual notification from IRtc::ISpy interface when LocalController::ChargePointProxy has been instanciated from CentralSystem::ChargePointProxy
1 parent f8fcb33 commit 8f77f58

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/centralsystem/chargepoint/ChargePointProxy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ ChargePointProxy::ChargePointProxy(ICentralSystem&
7878

7979
/** @brief Destructor */
8080
ChargePointProxy::~ChargePointProxy()
81+
{
82+
unregisterFromRpcSpy();
83+
}
84+
85+
/** @brief Unregister to the IRpc::ISpy interface messages */
86+
void ChargePointProxy::unregisterFromRpcSpy()
8187
{
8288
m_rpc->unregisterSpy(*this);
8389
}

src/centralsystem/chargepoint/ChargePointProxy.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ChargePointProxy : public ICentralSystem::IChargePoint, public ocpp::rpc::
5858
/** @brief Destructor */
5959
virtual ~ChargePointProxy();
6060

61+
/** @brief Unregister to the IRpc::ISpy interface messages */
62+
void unregisterFromRpcSpy();
63+
6164
// ICentralSystem::IChargePoint interface
6265

6366
/** @copydoc ICentralSystem&& ICentralSystem::IChargePoint::centralSystem() */

src/localcontroller/chargepoint/ChargePointProxy.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ std::shared_ptr<IChargePointProxy> IChargePointProxy::createFrom(
5656

5757
// Associate both
5858
centralsystem->setChargePointProxy(proxy);
59+
60+
// Unregister old proxy from RPC spy events
61+
cs_proxy->unregisterFromRpcSpy();
5962
}
6063

6164
return proxy;

0 commit comments

Comments
 (0)