My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
AntennaDriveMsg.h
Go to the documentation of this file.
1 #ifndef ANTENNADRIVEMSG_H
2 #define ANTENNADRIVEMSG_H
3 
11 #include <string>
12 
13 #include "gcp/util/common/Exception.h"
14 #include "gcp/util/common/GenericTaskMsg.h"
15 
16 #include "gcp/antenna/control/specific/TrackerMsg.h"
17 
18 #include "gcp/control/code/unix/libunix_src/specific/specificregs.h"
19 
20 namespace gcp {
21  namespace antenna {
22  namespace control {
23 
29 
30  public:
31 
35  enum MsgType {
36  FLAG_BOARD, // A message to flag a board.
37  DRIVE_CONNECTED, // A message from the Tracker task that
38  // the drive is dis/connected.
39  POLL_GPS_STATUS,
40  TRACKER_MSG // A message for the tracker thread.
41  };
42 
47 
51  union {
52 
56  struct {
57  unsigned short board; // The register map index of the
58  // board to un/flag
59  bool flag; // True to flag, false to unflag
60  } flagBoard;
61 
65  struct {
66  bool connected;
68 
73 
74  } body;
75 
76  //------------------------------------------------------------
77  // Methods for accessing messages for tasks managed by this
78  // class.
79  //------------------------------------------------------------
80 
81  inline TrackerMsg* getTrackerMsg()
82  {
84  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
85 
86  type = TRACKER_MSG;
87  return &body.trackerMsg;
88  }
89 
90  inline AntennaDriveMsg* packShutdownDriveMsg()
91  {
92  TrackerMsg* trackerMsg = getTrackerMsg();
93 
94  trackerMsg->packShutdownDriveMsg();
95  }
96 
97  inline AntennaDriveMsg* packPollGpsStatusMsg()
98  {
100  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
101 
102  type = POLL_GPS_STATUS;
103  }
104  //------------------------------------------------------------
105  // Methods for packing messsages to the drive task.
106  //------------------------------------------------------------
107 
108  inline void packFlagBoardMsg(unsigned short board, bool flag) {
109  genericMsgType_ =
110  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
111 
112  type = FLAG_BOARD;
113  body.flagBoard.board = board;
114  body.flagBoard.flag = flag;
115  }
116 
117  inline void packDriveConnectedMsg(bool connected)
118  {
119  genericMsgType_ =
120  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
121 
122  type = DRIVE_CONNECTED;
123 
124  body.driveConnected.connected = connected;
125  }
126 
127  }; // End AntennaDriveMsg class
128 
129  }; // End namespace control
130  }; // End namespace antenna
131 } // End namespace gcp
132 
133 #endif // End #ifndef
Definition: GenericTaskMsg.h:31
TrackerMsg trackerMsg
Definition: AntennaDriveMsg.h:72
struct gcp::antenna::control::AntennaDriveMsg::@1::@3 driveConnected
union gcp::antenna::control::AntennaDriveMsg::@1 body
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
struct gcp::antenna::control::AntennaDriveMsg::@1::@2 flagBoard
MsgType
Definition: AntennaDriveMsg.h:35
MsgType type
Definition: AntennaDriveMsg.h:46
Definition: TrackerMsg.h:33
Definition: AntennaDriveMsg.h:27