DDS  ver. 1.6
GenericChannel.h
Go to the documentation of this file.
1 // Copyright 2014 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 #ifndef __DDS__GenericChannel__
6 #define __DDS__GenericChannel__
7 // DDS
8 #include "ClientChannelImpl.h"
9 #include "Options.h"
10 
11 namespace dds
12 {
13  namespace agent_cmd_cmd
14  {
15  class CGenericChannel : public protocol_api::CClientChannelImpl<CGenericChannel>
16  {
17  CGenericChannel(boost::asio::io_service& _service)
18  : CClientChannelImpl<CGenericChannel>(_service, protocol_api::EChannelType::UI)
19  {
23  << "The DDS commander [" << this->socket().remote_endpoint().address().to_string()
24  << "] has closed the connection.";
25  });
26 
28  switch (m_options.m_agentCmd)
29  {
30  case EAgentCmdType::GETLOG:
31  LOG(MiscCommon::log_stdout) << "Requesting log files from agents...";
32  pushMsg<protocol_api::cmdGET_LOG>();
33  break;
34  case EAgentCmdType::UPDATE_KEY:
35  {
36  LOG(MiscCommon::log_stdout) << "Sending key update command...";
37  protocol_api::SUpdateKeyCmd cmd;
38  cmd.m_sKey = m_options.m_sUpdKey_key;
39  cmd.m_sValue = m_options.m_sUpdKey_value;
40  pushMsg<protocol_api::cmdUPDATE_KEY>(cmd);
41  }
42  break;
43  default:
44  LOG(MiscCommon::log_stderr) << "Uknown command.";
45  stop();
46  }
47  });
48  }
49 
51 
52  public:
57  END_MSG_MAP()
58 
59  void setOptions(const SOptions& _options)
60  {
61  m_options = _options;
62  }
63 
64  private:
65  // Message Handlers
67  bool on_cmdSHUTDOWN(
69  bool on_cmdPROGRESS(
71 
72  private:
73  SOptions m_options;
74  };
75  }
76 }
77 #endif /* defined(__DDS__GenericChannel__) */
Definition: def.h:156
BEGIN_MSG_MAP(CGenericChannel) MESSAGE_HANDLER(dds MESSAGE_HANDLER(dds::protocol_api::cmdSHUTDOWN, on_cmdSHUTDOWN) MESSAGE_HANDLER(dds
Definition: GenericChannel.h:55
#define REGISTER_DEFAULT_REMOTE_ID_STRING
Definition: BaseChannelImpl.h:133
dds-agent-cmd&#39;s container of options
Definition: dds-agent-cmd/src/Options.h:57
Definition: BaseChannelImpl.h:148
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:65
Definition: ProtocolCommands.h:29
#define LOG(severity)
Definition: Logger.h:54
Definition: ProtocolCommands.h:58
Definition: ProtocolCommands.h:32
Definition: ChannelEventsImpl.h:21
#define END_MSG_MAP()
Definition: BaseChannelImpl.h:122
Definition: dds-agent/src/AgentConnectionManager.h:16
connection_t subscribeOnEvent(EChannelEvents _type, typename signal_t::slot_function_type _subscriber)
Definition: ChannelEventsImpl.h:45
Definition: GenericChannel.h:15
Definition: BaseChannelImpl.h:40
EAgentCmdType m_agentCmd
Definition: dds-agent-cmd/src/Options.h:67
boost::asio::ip::tcp::socket & socket()
Definition: BaseChannelImpl.h:265
Definition: ChannelEventsImpl.h:20
Definition: def.h:150
#define BEGIN_MSG_MAP(theClass)
Definition: BaseChannelImpl.h:46
void stop()
Definition: BaseChannelImpl.h:257