My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
MasterMsg.h
1 #ifndef MASTERMSG_H
2 #define MASTERMSG_H
3 
11 #include "gcp/util/common/Exception.h"
12 #include "gcp/util/common/GenericMasterTaskMsg.h"
13 #include "gcp/util/common/SignalTask.h"
14 
15 #include "gcp/mediator/specific/ControlMsg.h"
16 #include "gcp/mediator/specific/ScannerMsg.h"
17 #include "gcp/mediator/specific/OptCamMsg.h"
18 
19 namespace gcp {
20 namespace mediator {
21 
22  class MasterMsg :
24 
25  public:
29  enum MsgType {
30  CONTROL_CONNECTED, // A message that we are dis/connected from
31  // the control port
32 
33  OPTCAM_CONNECTED, // A message that we are dis/connected from
34  // the scanner port
35  SCANNER_CONNECTED, // A message that we are dis/connected from
36  // the scanner port
37 
38  PTEL_CONNECTED, // A message that the pointing telescope is
39  // dis/connected from the ptel port
40 
41  DEICING_CONNECTED, // A message that the deicing control computer is
42  // dis/connected from the ptel port
43 
44  SEND_HEARTBEAT,
45 
46  CONTROL_MSG,
47  OPTCAM_MSG,
48  SCANNER_MSG
49  };
50 
55 
59  union {
60 
61  struct {
62  bool connected;
63  } controlConnected;
64 
65  struct {
66  bool connected;
67  } scannerConnected;
68 
69  struct {
70  bool connected;
71  } optcamConnected;
72 
73  struct {
74  bool connected;
75  } ptelConnected;
76 
77  struct {
78  bool connected;
79  } deicingConnected;
80 
85 
90 
95 
96  } body;
97 
98  //------------------------------------------------------------
99  // Methods for returning pointers to messages for threads
100  // managed by this task.
101  //------------------------------------------------------------
102 
103  inline OptCamMsg* getOptCamMsg()
104  {
105  genericMsgType_ =
106  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
107 
108  type = OPTCAM_MSG;
109  return &body.optcamMsg;
110  }
111 
112  inline ScannerMsg* getScannerMsg()
113  {
114  genericMsgType_ =
115  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
116 
117  type = SCANNER_MSG;
118  return &body.scannerMsg;
119  }
120 
121  inline ControlMsg* getControlMsg()
122  {
123  genericMsgType_ =
124  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
125 
126  type = CONTROL_MSG;
127  return &body.controlMsg;
128  }
129 
130 
131  //------------------------------------------------------------
132  // Methods for packing messages.
133 
137  inline void packSendHeartBeatMsg()
138  {
139  genericMsgType_ =
140  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
141 
142  type = SEND_HEARTBEAT;
143  }
144 
148  inline void packControlConnectedMsg(bool connected)
149  {
150  genericMsgType_ =
151  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
152 
153  type = CONTROL_CONNECTED;
154 
155  body.controlConnected.connected = connected;
156  }
157 
161  inline void packPtelControlConnectedMsg(bool connected)
162  {
163  genericMsgType_ =
164  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
165 
166  type = PTEL_CONNECTED;
167 
168  body.ptelConnected.connected = connected;
169  }
170 
174  inline void packDeicingControlConnectedMsg(bool connected)
175  {
176  genericMsgType_ =
177  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
178 
179  type = DEICING_CONNECTED;
180 
181  body.deicingConnected.connected = connected;
182  }
183 
187  inline void packScannerConnectedMsg(bool connected)
188  {
189  genericMsgType_ =
190  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
191 
192  type = SCANNER_CONNECTED;
193 
194  body.scannerConnected.connected = connected;
195  }
196 
200  inline void packOptCamConnectedMsg(bool connected)
201  {
202  genericMsgType_ =
203  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
204 
205  type = OPTCAM_CONNECTED;
206 
207  body.optcamConnected.connected = connected;
208  }
209 
210  }; // End class MasterMsg
211 
212 } // End namespace mediator
213 } // End namespace gcp
214 
215 #endif // End #ifndef
OptCamMsg optcamMsg
Definition: MasterMsg.h:89
ScannerMsg scannerMsg
Definition: MasterMsg.h:94
void packSendHeartBeatMsg()
Definition: MasterMsg.h:137
MsgType type
Definition: MasterMsg.h:54
void packDeicingControlConnectedMsg(bool connected)
Definition: MasterMsg.h:174
Definition: GenericMasterTaskMsg.h:36
Definition: ScannerMsg.h:18
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
Definition: MasterMsg.h:22
Definition: OptCamMsg.h:16
void packControlConnectedMsg(bool connected)
Definition: MasterMsg.h:148
ControlMsg controlMsg
Definition: MasterMsg.h:84
void packOptCamConnectedMsg(bool connected)
Definition: MasterMsg.h:200
Definition: ControlMsg.h:22
void packScannerConnectedMsg(bool connected)
Definition: MasterMsg.h:187
void packPtelControlConnectedMsg(bool connected)
Definition: MasterMsg.h:161
union gcp::mediator::MasterMsg::@192 body
MsgType
Definition: MasterMsg.h:29