SoDaRadio-5.0.3-master:8901fb5
USRPRX.hxx
Go to the documentation of this file.
1 /*
2 Copyright (c) 2012, Matthew H. Reilly (kb1vc)
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef USRPRX_HDR
30 #define USRPRX_HDR
31 #include "SoDaBase.hxx"
32 #include "MultiMBox.hxx"
33 #include "Command.hxx"
34 #include "Params.hxx"
35 #include "UI.hxx"
36 #include "QuadratureOscillator.hxx"
37 #include <uhd/usrp/multi_usrp.hpp>
38 #include <uhd/stream.hpp>
39 
40 namespace SoDa {
46  class USRPRX : public SoDaThread {
47  public:
59  USRPRX(Params * params, uhd::usrp::multi_usrp::sptr usrp,
60  DatMBox * _rx_stream, DatMBox * _if_stream,
61  CmdMBox * _cmd_stream);
62 
66  void run();
67 
68  private:
69  void execCommand(Command * cmd);
70  void execGetCommand(Command * cmd);
71  void execSetCommand(Command * cmd);
72  void execRepCommand(Command * cmd);
73 
74  void startStream();
75  void stopStream();
76 
84  void doMixer(SoDaBuf * inout);
85  void set3rdLOFreq(double IF_tuning);
86 
90  unsigned int cmd_subs;
91 
92  // state for the USRP widget
93  uhd::rx_streamer::sptr rx_bits;
94  uhd::usrp::multi_usrp::sptr usrp;
95 
96  unsigned int rx_buffer_size;
97 
98  // are we collecting?
100 
102 
103  // pointer to user interface box -- we send it FFT snapshots
104  UI * ui;
105 
106  // IF tuner
110 
111  // spectrum reporting
113 
114  //debug hooks
115  int outf[2];
116  int scount;
117 
118  std::ofstream rf_dumpfile;
119  std::ofstream if_dumpfile;
120 
121  };
122 }
123 
124 
125 #endif
The Baseclass for all SoDa objects, and useful commonly used classes.
void execCommand(Command *cmd)
Definition: USRPRX.cxx:206
The Thread baseclass for all SoDa thread objects.
Definition: SoDaBase.hxx:284
void doMixer(SoDaBuf *inout)
implement a complex down converter with complex multiplication
Definition: USRPRX.cxx:187
USRPRX(Params *params, uhd::usrp::multi_usrp::sptr usrp, DatMBox *_rx_stream, DatMBox *_if_stream, CmdMBox *_cmd_stream)
The constructor.
Definition: USRPRX.cxx:42
QuadratureOscillator IF_osc
Definition: USRPRX.hxx:107
Definition: UI.hxx:40
unsigned int cmd_subs
Definition: USRPRX.hxx:90
std::ofstream if_dumpfile
Definition: USRPRX.hxx:119
This class handles command line parameters and built-ins.
Definition: Params.hxx:42
void execGetCommand(Command *cmd)
optional method to handle "GET" commands – commands that request a response
Definition: USRPRX.cxx:280
uhd::rx_streamer::sptr rx_bits
Definition: USRPRX.hxx:93
unsigned int rx_buffer_size
Definition: USRPRX.hxx:96
SoDa::Command::ModulationType rx_modulation
Definition: USRPRX.hxx:101
CmdMBox * cmd_stream
Definition: USRPRX.hxx:89
bool audio_rx_stream_enabled
Definition: USRPRX.hxx:99
The Buffer Class.
Definition: SoDaBase.hxx:72
void run()
USRPRX is a thread – this is its run loop.
Definition: USRPRX.cxx:104
uhd::usrp::multi_usrp::sptr usrp
Definition: USRPRX.hxx:94
The Receive RF Path.
Definition: USRPRX.hxx:46
This is a list of all the commands that can "do something" to one or more components in the SoDa radi...
Definition: Command.hxx:47
bool enable_spectrum_report
Definition: USRPRX.hxx:112
DatMBox * if_stream
Definition: USRPRX.hxx:88
ModulationType
modulation selector targets take one of these values
Definition: Command.hxx:478
void startStream()
Definition: USRPRX.cxx:224
void execRepCommand(Command *cmd)
optional method that reports status or the result of some action.
Definition: USRPRX.cxx:285
std::ofstream rf_dumpfile
Definition: USRPRX.hxx:118
double rx_sample_rate
Definition: USRPRX.hxx:109
double current_IF_tuning
Definition: USRPRX.hxx:108
void stopStream()
Definition: USRPRX.cxx:233
DatMBox * rx_stream
Definition: USRPRX.hxx:87
int outf[2]
Definition: USRPRX.hxx:115
sin/cos oscillator to drive TX signal chain
void set3rdLOFreq(double IF_tuning)
Definition: USRPRX.cxx:198
void execSetCommand(Command *cmd)
optional method to handle "SET" commands – commands that set internal state in the object...
Definition: USRPRX.cxx:240