[Release] wrt-commons_0.2.147
[platform/framework/web/wrt-commons.git] / examples / metronome / metronome_client.cpp
index 2411d09..1fca0df 100644 (file)
@@ -19,6 +19,7 @@
  * @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>
@@ -33,21 +34,21 @@ class MetronomeClientApplication
 {
 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();
@@ -57,7 +58,7 @@ private:
     {
         (void)event;
 
-        LogInfo("Connection broken");
+        LogDebug("Connection broken");
 
         // Must quit
         Quit();
@@ -66,8 +67,8 @@ private:
     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);
@@ -86,18 +87,18 @@ public:
         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