CARMA C++
AntennaMasterMsg.h
Go to the documentation of this file.
1 #ifndef ANTENNAMASTERMSG_H
2 #define ANTENNAMASTERMSG_H
3 
11 #include <string>
12 
15 
22 
23 namespace sza {
24  namespace antenna {
25  namespace control {
26 
33 
34  public:
35 
39  enum MsgType {
40  ADOPT_BOARD, // Record a board adoption request from
41  // another task
42  CONTROL_MSG, // A message for the communications task
43  CONTROL_CONNECTED, // We are dis/connected from/to the control host
44  DRIVE_MSG, // A message for the drive task
45  FLAG_BOARD,
46  SCANNER_CONNECTED, // We are dis/connected from/to the archiver
47  MONITOR_MSG, // A message for the monitor task
48  PMAC_CONNECTED, // The pmac is dis/connected
49  RX_MSG, // A message for the rx task
50  STRIP_CONTROL_MSG,// A message for the strip control task
51  SEND_HEARTBEAT, // Initiate a heartbeat.
52  };
53 
58 
62  union {
63 
67  struct {
68  unsigned short board;
69  AntennaTask::Id taskId;
70  } adoptBoard;
71 
75  struct {
76  unsigned short board;
77  bool flag;
78  } flagBoard;
79 
84  struct {
85  bool connected;
87 
92  struct {
93  bool connected;
95 
99  struct {
100  bool connected;
101  } pmacConnected;
102 
103  //------------------------------------------------------------
104  // Message bodies for threads managed by the AntennaMaster
105  //------------------------------------------------------------
106 
110  AntennaControlMsg controlMsg;
111 
116 
121 
126 
130  UmacControlMsg umacControlMsg;
131 
132  } body;
133 
134  //------------------------------------------------------------
135  // Methods for accessing task messages managed by this class.
136  //------------------------------------------------------------
137 
138  inline AntennaControlMsg* getControlMsg()
139  {
140  genericMsgType_ =
141  sza::util::GenericTaskMsg::TASK_SPECIFIC;
142 
143  type = CONTROL_MSG;
144  return &body.controlMsg;
145  }
146 
147  inline AntennaDriveMsg* getDriveMsg()
148  {
149  genericMsgType_ =
150  sza::util::GenericTaskMsg::TASK_SPECIFIC;
151 
152  type = DRIVE_MSG;
153  return &body.driveMsg;
154  }
155 
156  inline AntennaMonitorMsg* getMonitorMsg()
157  {
158  genericMsgType_ =
159  sza::util::GenericTaskMsg::TASK_SPECIFIC;
160 
161  type = MONITOR_MSG;
162  return &body.monitorMsg;
163  }
164 
165  inline AntennaRxMsg* getRxMsg()
166  {
167  genericMsgType_ =
168  sza::util::GenericTaskMsg::TASK_SPECIFIC;
169 
170  type = RX_MSG;
171  return &body.rxMsg;
172  }
173 
174  inline UmacControlMsg* getUmacControlMsg()
175  {
176  genericMsgType_ =
177  sza::util::GenericTaskMsg::TASK_SPECIFIC;
178 
179  type = STRIP_CONTROL_MSG;
180  return &body.umacControlMsg;
181  }
182 
183  //------------------------------------------------------------
184  // Methods for packaging messages intended for this task.
185  //------------------------------------------------------------
186 
190  inline void packSendHeartBeatMsg()
191  {
192  genericMsgType_ =
193  sza::util::GenericTaskMsg::TASK_SPECIFIC;
194 
195  type = SEND_HEARTBEAT;
196  }
197 
201  inline void packAdoptBoardMsg(unsigned short board,
202  AntennaTask::Id taskId)
203  {
204  genericMsgType_ =
205  sza::util::GenericTaskMsg::TASK_SPECIFIC;
206 
207  type = ADOPT_BOARD;
208  body.adoptBoard.board = board;
209  body.adoptBoard.taskId = taskId;
210  }
211 
212  inline void packFlagBoardMsg(unsigned short board, bool flag)
213  {
214  genericMsgType_ =
215  sza::util::GenericTaskMsg::TASK_SPECIFIC;
216 
217  type = FLAG_BOARD;
218  body.flagBoard.board = board;
219  body.flagBoard.flag = flag;
220  }
221 
222  inline void packControlConnectedMsg(bool connected)
223  {
224  genericMsgType_ =
225  sza::util::GenericTaskMsg::TASK_SPECIFIC;
226 
227  type = CONTROL_CONNECTED;
228 
229  body.controlConnected.connected = connected;
230  }
231 
232  inline void packScannerConnectedMsg(bool connected)
233  {
234  genericMsgType_ =
235  sza::util::GenericTaskMsg::TASK_SPECIFIC;
236 
237  type = SCANNER_CONNECTED;
238 
239  body.scannerConnected.connected = connected;
240  }
241 
242  inline void packPmacConnectedMsg(bool connected)
243  {
244  genericMsgType_ =
245  sza::util::GenericTaskMsg::TASK_SPECIFIC;
246 
247  type = PMAC_CONNECTED;
248 
249  body.pmacConnected.connected = connected;
250  }
251 
252  }; // End class AntennaMasterMsg
253 
254  }; // End namespace control
255  }; // End namespace antenna
256 }; // End namespace sza
257 
258 #endif // End #ifndef
void packAdoptBoardMsg(unsigned short board, AntennaTask::Id taskId)
............................................................
A class to manage messages used to communicate with an AntennaMaster thread.
A container for messages sent to the Drive Task.
Tagged: Mon Jul 19 11:41:59 PDT 2004.
UmacControlMsg umacControlMsg
A message for the UmacControl task.
Tagged: Fri Nov 14 12:39:34 UTC 2003.
Started: Thu Feb 26 14:19:05 UTC 2004.
MsgType type
The type of this message.
Tagged: Thu Nov 13 16:53:31 UTC 2003.
Class to encapsulate messages send to the Rx task.
Definition: AntennaRxMsg.h:40
AntennaControlMsg controlMsg
A message for the AntennaControl task.
struct sza::antenna::control::AntennaMasterMsg::@10::@14 scannerConnected
A message that the scanner is dis/connected from the archiver host.
Tagged: Thu Nov 13 16:53:31 UTC 2003.
union sza::antenna::control::AntennaMasterMsg::@10 body
A union of supported messages.
Tagged: Thu Nov 13 16:53:29 UTC 2003.
void packSendHeartBeatMsg()
............................................................
AntennaRxMsg rxMsg
A message for the AntennaRx task.
AntennaMonitorMsg monitorMsg
A message for the AntennaMonitor task.
A class to encapsulate messages sent to the Monitor Task.
Tagged: Fri Nov 14 12:39:36 UTC 2003.
Id
An enumerator to identify a valid antenna task.
Definition: AntennaTask.h:25
GenericMsgType genericMsgType_
A type for this message.
struct sza::antenna::control::AntennaMasterMsg::@10::@13 controlConnected
A message that the control task is dis/connected from the control host.
A class to encapsulate message types for a generic task.
struct sza::antenna::control::AntennaMasterMsg::@10::@12 flagBoard
Message to flag a board.
Tagged: Thu Nov 13 16:53:28 UTC 2003.
struct sza::antenna::control::AntennaMasterMsg::@10::@11 adoptBoard
Specify which task is responsible for flagging a board.
AntennaDriveMsg driveMsg
A message for the AntennaDrive task.
struct sza::antenna::control::AntennaMasterMsg::@10::@15 pmacConnected
A message that the pmac is dis/connected.
MsgType
Enumerate supported AntennaMaster messages.