IVGCVSW-3937 Rename CommandThread to CommandHandler

 * Renamed files, class name and methods accordingly
 * Updated unit tests accordingly

Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: Ifb88aa61edb93b852a07b1bd59bd259213677b44
diff --git a/src/profiling/CommandHandler.hpp b/src/profiling/CommandHandler.hpp
new file mode 100644
index 0000000..598eabd
--- /dev/null
+++ b/src/profiling/CommandHandler.hpp
@@ -0,0 +1,61 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include "CommandHandlerRegistry.hpp"
+#include "IProfilingConnection.hpp"
+#include "PacketVersionResolver.hpp"
+
+#include <atomic>
+#include <thread>
+
+namespace armnn
+{
+
+namespace profiling
+{
+
+class CommandHandler
+{
+public:
+    CommandHandler(uint32_t timeout,
+                  bool stopAfterTimeout,
+                  CommandHandlerRegistry& commandHandlerRegistry,
+                  PacketVersionResolver& packetVersionResolver)
+        : m_Timeout(timeout)
+        , m_StopAfterTimeout(stopAfterTimeout)
+        , m_IsRunning(false)
+        , m_KeepRunning(false)
+        , m_CommandThread()
+        , m_CommandHandlerRegistry(commandHandlerRegistry)
+        , m_PacketVersionResolver(packetVersionResolver)
+    {}
+    ~CommandHandler() { Stop(); }
+
+    void Start(IProfilingConnection& profilingConnection);
+    void Stop();
+
+    bool IsRunning() const;
+
+    void SetTimeout(uint32_t timeout);
+    void SetStopAfterTimeout(bool stopAfterTimeout);
+
+private:
+    void HandleCommands(IProfilingConnection& profilingConnection);
+
+    std::atomic<uint32_t> m_Timeout;
+    std::atomic<bool> m_StopAfterTimeout;
+    std::atomic<bool> m_IsRunning;
+    std::atomic<bool> m_KeepRunning;
+    std::thread m_CommandThread;
+
+    CommandHandlerRegistry& m_CommandHandlerRegistry;
+    PacketVersionResolver& m_PacketVersionResolver;
+};
+
+} // namespace profiling
+
+} // namespace armnn