Skip to content

Commit

Permalink
[localcontroller] Remove dual notification from IRtc::ISpy interface …
Browse files Browse the repository at this point in the history
…when LocalController::ChargePointProxy has been instanciated from CentralSystem::ChargePointProxy
  • Loading branch information
c-jimenez committed May 20, 2024
1 parent f8fcb33 commit 8f77f58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/centralsystem/chargepoint/ChargePointProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ ChargePointProxy::ChargePointProxy(ICentralSystem&

/** @brief Destructor */
ChargePointProxy::~ChargePointProxy()
{
unregisterFromRpcSpy();
}

/** @brief Unregister to the IRpc::ISpy interface messages */
void ChargePointProxy::unregisterFromRpcSpy()
{
m_rpc->unregisterSpy(*this);
}
Expand Down
3 changes: 3 additions & 0 deletions src/centralsystem/chargepoint/ChargePointProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ class ChargePointProxy : public ICentralSystem::IChargePoint, public ocpp::rpc::
/** @brief Destructor */
virtual ~ChargePointProxy();

/** @brief Unregister to the IRpc::ISpy interface messages */
void unregisterFromRpcSpy();

// ICentralSystem::IChargePoint interface

/** @copydoc ICentralSystem&& ICentralSystem::IChargePoint::centralSystem() */
Expand Down
3 changes: 3 additions & 0 deletions src/localcontroller/chargepoint/ChargePointProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ std::shared_ptr<IChargePointProxy> IChargePointProxy::createFrom(

// Associate both
centralsystem->setChargePointProxy(proxy);

// Unregister old proxy from RPC spy events
cs_proxy->unregisterFromRpcSpy();
}

return proxy;
Expand Down

0 comments on commit 8f77f58

Please sign in to comment.