DDS  ver. 1.6
StatChannel.h
Go to the documentation of this file.
1 // Copyright 2014 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 
6 #ifndef __DDS__StatChannel__
7 #define __DDS__StatChannel__
8 // DDS
9 #include "ClientChannelImpl.h"
10 #include "Options.h"
11 
12 namespace dds
13 {
14  namespace stat_cmd
15  {
16  class CStatChannel : public protocol_api::CClientChannelImpl<CStatChannel>
17  {
18  CStatChannel(boost::asio::io_service& _service)
19  : CClientChannelImpl<CStatChannel>(_service, protocol_api::EChannelType::UI)
20  {
22  if (m_options.m_bEnable)
23  {
24  pushMsg<protocol_api::cmdENABLE_STAT>();
25  }
26  else if (m_options.m_bDisable)
27  {
28  pushMsg<protocol_api::cmdDISABLE_STAT>();
29  }
30  else if (m_options.m_bGet)
31  {
32  pushMsg<protocol_api::cmdGET_STAT>();
33  }
34  });
35 
37  LOG(MiscCommon::info) << "Connected to the commander server";
38  });
39 
41  LOG(MiscCommon::log_stderr) << "Failed to connect to commander server.";
42  });
43  }
44 
46 
47  public:
49  MESSAGE_HANDLER(cmdSIMPLE_MSG, on_cmdSIMPLE_MSG)
51 
52  void setOptions(const SOptions& _options)
53  {
54  m_options = _options;
55  }
56 
57  private:
58  // Message Handlers
60 
61  private:
62  SOptions m_options;
63  };
64  }
65 }
66 #endif
Definition: def.h:156
Definition: ChannelEventsImpl.h:19
bool m_bGet
Definition: dds-stat/src/Options.h:36
#define MESSAGE_HANDLER(msg, func)
Definition: BaseChannelImpl.h:100
#define REGISTER_DEFAULT_REMOTE_ID_STRING
Definition: BaseChannelImpl.h:133
BEGIN_MSG_MAP(CStatChannel) MESSAGE_HANDLER(cmdSIMPLE_MSG
Definition: StatChannel.h:16
Definition: BaseChannelImpl.h:148
std::shared_ptr< SEmptyCmd > ptr_t
Definition: CommandAttachmentImpl.h:65
#define LOG(severity)
Definition: Logger.h:54
Definition: ProtocolCommands.h:32
dds-commander&#39;s container of options
Definition: dds-stat/src/Options.h:25
Definition: ChannelEventsImpl.h:21
Definition: dds-agent/src/AgentConnectionManager.h:16
connection_t subscribeOnEvent(EChannelEvents _type, typename signal_t::slot_function_type _subscriber)
Definition: ChannelEventsImpl.h:45
bool m_bDisable
Definition: dds-stat/src/Options.h:35
on_cmdSIMPLE_MSG END_MSG_MAP() void setOptions(const SOptions &_options)
Definition: StatChannel.h:50
Definition: BaseChannelImpl.h:40
Definition: def.h:150
bool m_bEnable
Definition: dds-stat/src/Options.h:34
Definition: ChannelEventsImpl.h:18