My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
AntennaControlMsg.h
1 #ifndef SZA_ANTENNA_ANTENNACONTROLMSG_H
2 #define SZA_ANTENNA_ANTENNACONTROLMSG_H
3 
11 #include "gcp/util/common/Exception.h"
12 #include "gcp/util/common/GenericTaskMsg.h"
13 #include "gcp/util/common/NetMsg.h"
14 
15 #include "gcp/antenna/control/specific/AntennaGpibMsg.h"
16 #include "gcp/antenna/control/specific/AntennaLnaMsg.h"
17 
18 namespace gcp {
19  namespace antenna {
20  namespace control {
21 
24 
25  public:
26 
30  enum MsgType {
31  CONNECT, // Attempt to connect to the control host.
32  NETMSG, // A network message intended for the controller.
33  GPIB_MSG, // A message intended for the gpib network
34  DLP_TEMPS, // A message intended for the temperature controller
35  LNA_MSG, // A message to the LNA power supply
36  ADC_VOLTS, // A message to the Labjack ADC
37  };
38 
43 
44  union {
45  gcp::util::NetMsg networkMsg;
48  } body;
49 
54  {
56  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
57 
58  type = NETMSG;
59  return &body.networkMsg;
60  }
61 
62  //------------------------------------------------------------
63  // Methods for accessing task messages managed by this class.
64  //------------------------------------------------------------
65 
66  inline AntennaGpibMsg* getGpibMsg()
67  {
69  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
70 
71  type = GPIB_MSG;
72  return &body.gpibMsg;
73  }
74 
75  inline AntennaLnaMsg* getLnaMsg()
76  {
78  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
79 
80  type = LNA_MSG;
81  return &body.lnaMsg;
82  }
83 
84  //------------------------------------------------------------
85  // Methods for packing message to the communications task.
86  //
87  // We explicitly initialize genericMsgType_ in each method,
88  // since we cannot do this in a constructor, since objects
89  // with explicit constructors apparently can't be union
90  // members.
91  //------------------------------------------------------------
92 
96  inline void packConnectMsg() {
98  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
99 
100  type = CONNECT;
101  }
102 
103  inline void packDlpMsg() {
104  genericMsgType_ =
105  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
106 
107  type = DLP_TEMPS;
108  }
109 
110  inline void packAdcMsg() {
111  genericMsgType_ =
112  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
113 
114  type = ADC_VOLTS;
115  }
116 
117  private:
118  }; // End class AntennaControlMsg
119 
120  }; // End namespace control
121  }; // End namespace antenna
122 } // End namespace gcp
123 
124 #endif // End #ifndef
125 
126 
Definition: GenericTaskMsg.h:31
void packConnectMsg()
Definition: AntennaControlMsg.h:96
Definition: AntennaGpibMsg.h:21
Definition: AntennaLnaMsg.h:26
MsgType type
Definition: AntennaControlMsg.h:42
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
Definition: NetMsg.h:26
Definition: AntennaControlMsg.h:22
gcp::util::NetMsg * getNetMsg()
Definition: AntennaControlMsg.h:53
MsgType
Definition: AntennaControlMsg.h:30