My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
AntennaRxMsg.h
Go to the documentation of this file.
1 #ifndef GCP_ANTENNA_CONTROL_ANTENNARXMSG_H
2 #define GCP_ANTENNA_CONTROL_ANTENNARXMSG_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 AntennaRxMsg :
28 
29  public:
30 
34  enum MsgType {
35  INVALID ,
36  CONNECT ,
37  DISCONNECT ,
38  READ_DATA ,
39  WRITE_DATA ,
40  RX_CMD
41  };
42 
43  // these are bogus. we never refer to these.
44  enum rxCmdId {
45  RX_SETUP_ADC,
46  RX_RESET_FPGA,
47  RX_RESET_FIFO,
48  RX_SET_SWITCH_PERIOD,
49  RX_SET_BURST_LENGTH,
50  RX_SET_INTEGRATION_PERIOD,
51  RX_SET_TRIM_LENGTH,
52  RX_ENABLE_SIMULATOR,
53  RX_ENABLE_NOISE,
54  RX_ENABLE_WALSHING,
55  RX_ENABLE_ALT_WALSHING,
56  RX_ENABLE_FULL_WALSHING,
57  RX_ENABLE_NONLINEARITY,
58  RX_GET_BURST_DATA,
59  RX_ENABLE_ALPHA,
60  RX_SET_ALPHA,
61  RX_SET_NONLIN
62  };
63 
68 
72  double currTime_; // in mjd
73 
77  union {
78  struct {
79  unsigned cmdId;
80  // unsigned char address;
81  // unsigned char* period;
82  float fltVal;
83  int chanVal;
84  int stageVal;
85  } rx;
86  } body;
87 
88  //------------------------------------------------------------
89  // Methods for packing messages
90  //------------------------------------------------------------
91 
92  //------------------------------------------------------------
93  // Pack a command to read data from the receiver
94  //------------------------------------------------------------
95  inline void packReadDataMsg()
96  {
98  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
99 
100  type = READ_DATA;
101  }
102 
103  //------------------------------------------------------------
104  // Pack a command to write data from the receiver to disk
105  //------------------------------------------------------------
106  inline void packWriteDataMsg(gcp::util::TimeVal& currTime)
107  {
108  genericMsgType_ =
109  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
110 
111  type = WRITE_DATA;
112 
113  currTime_ = currTime.getTimeInSeconds();
114 
115  }
116 
117  //------------------------------------------------------------
118  // Pack a command to connected to receiver backend
119  //------------------------------------------------------------
120  inline void packConnectMsg()
121  {
122  genericMsgType_ =
123  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
124 
125  type = CONNECT;
126  }
127 
128  //------------------------------------------------------------
129  // Pack a command to disconnect the receiver
130  //------------------------------------------------------------
131  inline void packDisconnectMsg()
132  {
133  genericMsgType_ =
134  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
135 
136  type = DISCONNECT;
137  }
138 
139  //------------------------------------------------------------
140  // Pack a general command
141  //------------------------------------------------------------
142  inline void packRxCmdMsg(unsigned cmdId, float fltVal, int stageVal, int channelVal)
143  {
144  genericMsgType_ =
145  gcp::util::GenericTaskMsg::TASK_SPECIFIC;
146 
147  COUT("got to pack rx md msg");
148  type = RX_CMD;
149 
150  body.rx.cmdId = cmdId;
151  body.rx.fltVal = fltVal;
152  body.rx.stageVal = stageVal;
153  body.rx.chanVal = channelVal;
154  // we'll convert the message into what issueCommand wants
155  // in execute command
156 
157  };
158 
159  }; // End class AntennaRxMsg
160 
161  }; // End namespace control
162  }; // End namespace antenna
163 } // End namespace gcp
164 
165 #endif // End #ifndef
Definition: GenericTaskMsg.h:31
MsgType type
Definition: AntennaRxMsg.h:67
MsgType
Definition: AntennaRxMsg.h:34
union gcp::antenna::control::AntennaRxMsg::@20 body
GenericMsgType genericMsgType_
Definition: GenericTaskMsg.h:50
double currTime_
Definition: AntennaRxMsg.h:72
Definition: TimeVal.h:55
double getTimeInSeconds() const
Definition: TimeVal.cc:589
Definition: AntennaRxMsg.h:26