CARMA C++
NoiseSource.h
Go to the documentation of this file.
1 
10 #ifndef CARMA_DOWNCONVERTER_NOISESOURCE_H
11 #define CARMA_DOWNCONVERTER_NOISESOURCE_H
12 
14 #include "carma/util/PthreadMutex.h"
15 
16 #include <map>
17 #include <string>
18 #include <tao/Basic_Types.h>
19 #include <vector>
20 
21 namespace carma {
22 
23 namespace monitor {
24  class NoiseSource;
25  class NoiseSourceContainer;
26  class StateMonitorPointEnum;
27  class Xac;
28 }
29 
30 namespace downconverter {
31 
39  public:
40 
50  carma::monitor::NoiseSourceContainer & nsMon );
51 
52 
56  virtual ~NoiseSource();
57 
65  std::map<carma::canbus::msgType, std::string>
66  getHalfSecMonitors() const;
67 
75  std::map<carma::canbus::msgType, std::string> getSlowMonitors() const;
76 
85  std::vector<carma::canbus::byteType> &data, bool sim);
86 
101 
109 
115  void updateFrameData();
116 
117  private:
118 
119  // Prohibit copy and assignment.
120  NoiseSource(const NoiseSource &);
121  NoiseSource &operator=(const NoiseSource &);
122 
123  public:
124 
125  void setNoiseOutputToPreset();
126  void setNoiseOutput(CORBA::Double pout);
127  void setNoiseAttenuation(CORBA::UShort atten);
128  void enableNoiseSource(CORBA::Boolean enable);
129  void setToneOutputToPreset( );
130  void setToneOutput( CORBA::Double powerIndBm );
131  void setToneAttenuation( CORBA::UShort atten);
132  void enableToneSource(CORBA::Boolean enable);
133  bool isEnabled();
134 
135  private:
136 
137  // Methods to process individual CAN messages. These routines
138  // are called by processMsg.
139  void processBlankingFramePacket1( carma::canbus::DataVector & data );
140  void processBlankingFramePacket2( carma::canbus::DataVector & data );
141  void processBlankingFramePacket3( carma::canbus::DataVector & data );
142 
143  // Methods to produce simulated CAN messages. These routines are
144  // called by simulateMsg. The returned Message is then placed in
145  // the CAN message queue where they will eventually be processed
146  // by processMsg above. See carma::canbus::Master for more info.
147  carma::canbus::Message simBlankingFramePacket1();
148  carma::canbus::Message simBlankingFramePacket2();
149  carma::canbus::Message simBlankingFramePacket3();
150 
151  carma::monitor::StateMonitorPointEnum * state_;
152  carma::monitor::NoiseSource * mon_;
153  carma::monitor::Xac * xacMon_;
154 
155  // Shared status variables
156  struct Shared {
157 
158  Shared( );
159 
160  bool noiseEnabled;
161  bool simNoiseEnabled;
163 
164  } shared_;
165 
166  }; // End class NoiseSource
167 } // End namespace downconverter
168 } // End namespace carma
169 #endif
static carma::canbus::apiType getApiId()
Staticly retrieve the API Id.
carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Produce a simulated CAN message for a given msgType.
Noise Source Device Class.
Definition: NoiseSource.h:38
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...
NoiseSource(carma::canbus::nodeType node, carma::canbus::CanOutput &io, carma::monitor::NoiseSourceContainer &nsMon)
Constructor Creates a Noise Source device with the given node id.
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::map< carma::canbus::msgType, std::string > getHalfSecMonitors() const
Retrieve a map of this devices half second monitor points.
::std::vector< ::carma::canbus::byteType > DataVector
Alias for CAN data.
Definition: Types.h:72
virtual ~NoiseSource()
Destructor.
carma::canbus::devices::XacDevice class declaration.
void processMsg(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool sim)
Process a CAN message.
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
std::map< carma::canbus::msgType, std::string > getSlowMonitors() const
Return a map of this devices slow monitor points.