My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
AntennaLnaMsg.h
Go to the documentation of this file.
1 #ifndef GCP_ANTENNA_CONTROL_ANTENNALNAMSG_H
2 #define GCP_ANTENNA_CONTROL_ANTENNALNAMSG_H
3 
11 #include "gcp/util/common/GenericTaskMsg.h"
12 
13 #include "gcp/control/code/unix/libunix_src/common/netobj.h"
14 #include "gcp/util/common/Debug.h"
15 #include "gcp/util/specific/Directives.h"
16 
17 //#include "gcp/util/specific/Rx.h"
18 
19 namespace gcp {
20  namespace antenna {
21  namespace control {
22 
26  class AntennaLnaMsg :
28 
29  public:
30 
34  enum MsgType {
35  READ_DATA,
36  CONNECT,
37  DISCONNECT,
38  LNA_CMD
39  };
40 
41  enum lnaCmdId {
42  LNA_SET_DRAIN_VOLTAGE,
43  LNA_SET_DRAIN_CURRENT,
44  LNA_SET_GATE_VOLTAGE,
45  LNA_SET_BIAS,
46  LNA_SET_MODULE,
47  LNA_CHANGE_VOLTAGE,
48  LNA_GET_VOLTAGE,
49  LNA_ENABLE_BIAS_QUERY
50  };
51 
56 
60  double currTime_; // in mjd
61 
65  union {
66  struct {
67  unsigned lnaCmdId;
68  float drainCurrent;
69  float drainVoltage;
70  int lnaNumber;
71  int stageNumber;
72  } lna;
73  } body;
74 
75  //------------------------------------------------------------
76  // Methods for packing messages
77  //------------------------------------------------------------
78 
79  //------------------------------------------------------------
80  // Pack a command to read data from the lna power supply
81  //------------------------------------------------------------
82  inline void packReadDataMsg()
83  {
85  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
86 
87  type = READ_DATA;
88  }
89 
90  //------------------------------------------------------------
91  // Pack a command to connected to receiver backend
92  //------------------------------------------------------------
93  inline void packConnectMsg()
94  {
96  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
97 
98  type = CONNECT;
99  }
100 
101  //------------------------------------------------------------
102  // Pack a command to disconnect the receiver
103  //------------------------------------------------------------
104  inline void packDisconnectMsg()
105  {
106  genericMsgType_ =
107  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
108 
109  type = DISCONNECT;
110  }
111 
112  //------------------------------------------------------------
113  // Pack a general command
114  //------------------------------------------------------------
115  inline void packLnaCmdMsg(unsigned cmdId, float drainVoltage, float drainCurrent, int lnaNumber, int stageNumber)
116  {
117  genericMsgType_ =
118  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
119 
120  COUT("got to pack lna cmd msg");
121  type = LNA_CMD;
122 
123  body.lna.lnaCmdId = cmdId;
124  body.lna.drainVoltage = drainVoltage;
125  body.lna.drainCurrent = drainCurrent;
126  body.lna.lnaNumber = lnaNumber;
127  body.lna.stageNumber = stageNumber;
128  // we'll convert the message into what issueCommand wants
129  // in execute command
130 
131  };
132 
133  }; // End class AntennaRxMsg
134 
135  }; // End namespace control
136  }; // End namespace antenna
137 } // End namespace gcp
138 
139 #endif // End #ifndef
Definition: GenericTaskMsg.h:31
Definition: AntennaLnaMsg.h:26
MsgType type
Definition: AntennaLnaMsg.h:55
MsgType
Definition: AntennaLnaMsg.h:34
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
union gcp::antenna::control::AntennaLnaMsg::@6 body
double currTime_
Definition: AntennaLnaMsg.h:60