ArmNN
 20.02
CommandHandler Class Reference

#include <CommandHandler.hpp>

Public Member Functions

 CommandHandler (uint32_t timeout, bool stopAfterTimeout, CommandHandlerRegistry &commandHandlerRegistry, PacketVersionResolver &packetVersionResolver)
 
 ~CommandHandler ()
 
void SetTimeout (uint32_t timeout)
 
void SetStopAfterTimeout (bool stopAfterTimeout)
 
void Start (IProfilingConnection &profilingConnection)
 
void Stop ()
 
bool IsRunning () const
 

Detailed Description

Definition at line 21 of file CommandHandler.hpp.

Constructor & Destructor Documentation

◆ CommandHandler()

CommandHandler ( uint32_t  timeout,
bool  stopAfterTimeout,
CommandHandlerRegistry commandHandlerRegistry,
PacketVersionResolver packetVersionResolver 
)
inline

Definition at line 24 of file CommandHandler.hpp.

28  : m_Timeout(timeout)
29  , m_StopAfterTimeout(stopAfterTimeout)
30  , m_IsRunning(false)
31  , m_KeepRunning(false)
32  , m_CommandThread()
33  , m_CommandHandlerRegistry(commandHandlerRegistry)
34  , m_PacketVersionResolver(packetVersionResolver)
35  {}

◆ ~CommandHandler()

~CommandHandler ( )
inline

Definition at line 36 of file CommandHandler.hpp.

References CommandHandler::Stop().

Member Function Documentation

◆ IsRunning()

bool IsRunning ( ) const
inline

Definition at line 43 of file CommandHandler.hpp.

Referenced by BOOST_AUTO_TEST_CASE(), and CommandHandler::Start().

43 { return m_IsRunning.load(); }

◆ SetStopAfterTimeout()

void SetStopAfterTimeout ( bool  stopAfterTimeout)
inline

Definition at line 39 of file CommandHandler.hpp.

References CommandHandler::Start(), and CommandHandler::Stop().

Referenced by BOOST_AUTO_TEST_CASE().

39 { m_StopAfterTimeout.store(stopAfterTimeout); }

◆ SetTimeout()

void SetTimeout ( uint32_t  timeout)
inline

Definition at line 38 of file CommandHandler.hpp.

38 { m_Timeout.store(timeout); }

◆ Start()

void Start ( IProfilingConnection profilingConnection)

Definition at line 17 of file CommandHandler.cpp.

References CommandHandler::IsRunning().

Referenced by BOOST_AUTO_TEST_CASE(), CommandHandler::SetStopAfterTimeout(), and ProfilingService::Update().

18 {
19  if (IsRunning())
20  {
21  return;
22  }
23 
24  if (m_CommandThread.joinable())
25  {
26  m_CommandThread.join();
27  }
28 
29  m_IsRunning.store(true);
30  m_KeepRunning.store(true);
31  m_CommandThread = std::thread(&CommandHandler::HandleCommands, this, std::ref(profilingConnection));
32 }

◆ Stop()


The documentation for this class was generated from the following files: