CARMA C++
QuadratureModulator.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_DOWNCONVERTER_QUADRATUREMODULATOR_H
11 #define CARMA_DOWNCONVERTER_QUADRATUREMODULATOR_H
12 
14 #include "carma/util/PthreadMutex.h"
15 
16 #include <map>
17 #include <string>
18 #include <vector>
19 
20 namespace carma {
21 
22 namespace monitor {
23  class QuadMod;
24  class QuadModContainer;
25  class StateMonitorPointEnum;
26  class Xac;
27 } // End namespace monitor
28 
29 namespace downconverter {
30 
31  class WalshSequence;
32 
40  public:
41 
52  carma::monitor::QuadModContainer & quadModMon );
53 
57  virtual ~QuadratureModulator();
58 
67  std::map<carma::canbus::msgType, std::string>
68  getHalfSecMonitors() const;
69 
78  std::map<carma::canbus::msgType, std::string> getSlowMonitors() const;
79 
88  std::vector<carma::canbus::byteType> &data, bool sim);
89 
104 
112 
118  void updateFrameData();
119 
120  void walshTableColumnImminent( unsigned short length,
121  unsigned char crc );
122 
123  void loadWalshTableColumn( unsigned char segmentIndex,
124  std::vector<unsigned char> segment );
125 
126  void setPoutPreset();
127 
128  void setPout(double pout);
129 
130  void setPoutAtten(unsigned short atten);
131 
132  // Enable quadrature modulation and noise gain.
133  void enableQuadMod(bool enable);
134 
135  // Enable quadrature modulation sans noise gain.
136  void enableModulationOnly( bool enable );
137 
138  void loadWalshSequence( const WalshSequence & walshSequence );
139 
140  bool isEnabled();
141  bool checkIfOutPower(double power, double delta);
142  bool checkIfInPower(double power, double delta);
143 
144  private:
145 
146  // Prevent assignment and copy construction.
148  QuadratureModulator &operator=(const QuadratureModulator &);
149 
150  // Methods to process individual CAN messages. These routines are
151  // called by processMsg upon receipt of a CAN message.
152  void processBlankingFramePacket1( carma::canbus::DataVector & data );
153  void processBlankingFramePacket2( carma::canbus::DataVector & data );
154  void processBlankingFramePacket3( carma::canbus::DataVector & data );
155 
156  // Methods to produce simulated CAN messages. These routines are
157  // called by simulateMsg and then placed in the CAN message queue
158  // where they will eventually be processed by processMsg.
159  carma::canbus::Message simBlankingFramePacket1();
160  carma::canbus::Message simBlankingFramePacket2();
161  carma::canbus::Message simBlankingFramePacket3();
162 
163  const int inputNo_; // Corresponds to antenna no (1..8), not index!
164  carma::monitor::StateMonitorPointEnum * state_;
165  carma::monitor::QuadMod *mon_;
166  carma::monitor::Xac *xacMon_;
167 
168  double ifInPower_; // Current IF Input power
169  double ifOutPower_; // Current IF Output power
170  bool enabled_; // Is quadrature modulation enabled?
172 
173  }; // End class Quadrature Modulator
174 } // namespace downconverter
175 } // namespace carma
176 #endif
std::map< carma::canbus::msgType, std::string > getHalfSecMonitors() const
Retrieve a map of this devices half second monitor points.
virtual ~QuadratureModulator()
Destructor.
Class to encapsulate a CAN message.
Definition: Message.h:21
void updateFrameData()
Update data on a frame time scale This routine is called automatically by carma::canbus::Master every...
Quadrature modulator Device class implementation.
carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Produce a simulated CAN message for a given msgType.
std::map< carma::canbus::msgType, std::string > getSlowMonitors() const
Retrieve a map of this devices slow monitor points.
XacDevice canbus::device class implementation.
Definition: XacDevice.h:37
unsigned short apiType
Carma API id type.
Definition: Types.h:64
unsigned short nodeType
Carma Node Type id type.
Definition: Types.h:66
::std::vector< ::carma::canbus::byteType > DataVector
Alias for CAN data.
Definition: Types.h:72
static carma::canbus::apiType getApiId()
Staticly retrieve the API Id.
void processMsg(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool sim)
Process a CAN message addressed to this device.
QuadratureModulator(carma::canbus::nodeType node, carma::canbus::CanOutput &io, carma::monitor::QuadModContainer &quadModMon)
Constructor Creates a Quadrature Modulator device with the given node id.
carma::canbus::devices::XacDevice class declaration.
A simple wrapper class that makes use of ::pthread_mutex_t easier in a C++ world. ...
Definition: PthreadMutex.h:41
unsigned short msgType
Carma Message id type.
Definition: Types.h:69
CanOutput interface.
Definition: CanOutput.h:26