* @version 1.0
* @brief This file is the implementation file of metronome client example
*/
+#include <stddef.h>
#include <dpl/tcp_socket_rpc_client.h>
#include <dpl/tcp_socket_rpc_connection.h>
#include <dpl/application.h>
{
private:
DPL::TcpSocketRPCClient m_rpcClient;
- DPL::ScopedPtr<DPL::AbstractRPCConnection> m_rpcConnection;
+ std::unique_ptr<DPL::AbstractRPCConnection> m_rpcConnection;
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::AsyncCallEvent &event)
{
(void)event;
// Heart beat
- LogInfo("* Got metronome signal *");
+ LogDebug("* Got metronome signal *");
}
virtual void OnEventReceived(const DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent &event)
{
(void)event;
- LogInfo("Connection closed");
+ LogDebug("Connection closed");
// Must quit
Quit();
{
(void)event;
- LogInfo("Connection broken");
+ LogDebug("Connection broken");
// Must quit
Quit();
virtual void OnEventReceived(const DPL::AbstractRPCConnectorEvents::ConnectionEstablishedEvent &event)
{
// Save connection pointer
- LogInfo("Connected to metronome server");
- m_rpcConnection.Reset(event.GetArg1());
+ LogDebug("Connected to metronome server");
+ m_rpcConnection.reset(event.GetArg1());
// Attach event listeners
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::AddListener(this);
m_rpcClient.Open("127.0.0.1", 12345);
// Started
- LogInfo("Metronome client started");
+ LogDebug("Metronome client started");
}
virtual ~MetronomeClientApplication()
{
// Delete all RPC connections
- if (m_rpcConnection.Get())
+ if (m_rpcConnection.get())
{
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::AsyncCallEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionClosedEvent>::RemoveListener(this);
m_rpcConnection->DPL::EventSupport<DPL::AbstractRPCConnectionEvents::ConnectionBrokenEvent>::RemoveListener(this);
- m_rpcConnection.Reset();
+ m_rpcConnection.reset();
}
// Close RPC server