SoDaRadio-5.0.3-master:8901fb5
USRPTX.hxx
Go to the documentation of this file.
1 /*
2 Copyright (c) 2012,2013,2014 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 USRPTX_HDR
30 #define USRPTX_HDR
31 #include "SoDaBase.hxx"
32 #include "MultiMBox.hxx"
33 #include "Command.hxx"
34 #include "Params.hxx"
35 #include "QuadratureOscillator.hxx"
36 #include <uhd/usrp/multi_usrp.hpp>
37 #include <uhd/stream.hpp>
38 
39 namespace SoDa {
51  class USRPTX : public SoDaThread {
52  public:
63  USRPTX(Params * params, uhd::usrp::multi_usrp::sptr _usrp,
64  DatMBox * _tx_stream, DatMBox * _cw_env_stream,
65  CmdMBox * _cmd_stream);
69  void run();
70 
71  private:
72 
73  uhd::usrp::multi_usrp::sptr usrp;
74 
79  void transmitSwitch(bool tx_on);
80 
84  void getTXStreamer();
85 
90  void execGetCommand(Command * cmd);
95  void execSetCommand(Command * cmd);
100  void execRepCommand(Command * cmd);
101 
109  void setCWFreq(bool usb, double freq);
110 
120  void doCW(std::complex<float> * out, float * envelope, unsigned int env_len);
121 
122  unsigned int tx_subs;
123  unsigned int cmd_subs;
124  unsigned int cw_subs;
125 
129 
130  bool tx_enabled;
132 
133  double CW_tone_freq;
135 
136  float * beacon_env;
137  bool beacon_mode;
138 
139  float * zero_env;
140 
141  std::complex<float> * cw_buf;
142  std::complex<float> * zero_buf;
143 
144  double tx_sample_rate;
145  unsigned int tx_buffer_size;
147 
149 
150  uhd::stream_args_t * stream_args;
151  uhd::tx_streamer::sptr tx_bits;
152  uhd::tx_metadata_t md;
153 
154  // transverter local oscillator support
155  bool LO_enabled;
157  bool LO_capable;
158 
159  std::complex<float> * const_buf;
160  };
161 
162 }
163 
164 
165 #endif
uhd::stream_args_t * stream_args
Definition: USRPTX.hxx:150
The Baseclass for all SoDa objects, and useful commonly used classes.
float * zero_env
envelope for dead silence
Definition: USRPTX.hxx:139
The Thread baseclass for all SoDa thread objects.
Definition: SoDaBase.hxx:284
USRPTX(Params *params, uhd::usrp::multi_usrp::sptr _usrp, DatMBox *_tx_stream, DatMBox *_cw_env_stream, CmdMBox *_cmd_stream)
Constructor for RF Transmit/modulator process.
Definition: USRPTX.cxx:39
void setCWFreq(bool usb, double freq)
set the CW tone frequency to generate an IQ stream
Definition: USRPTX.cxx:222
bool LO_capable
if true, this hardware model supports LO config
Definition: USRPTX.hxx:157
SoDa::Command::ModulationType tx_modulation
type of transmit modulation (CW_U,CW_L,USB,LSB...)
Definition: USRPTX.hxx:131
This class handles command line parameters and built-ins.
Definition: Params.hxx:42
DatMBox * tx_stream
transmit audio stream
Definition: USRPTX.hxx:126
void doCW(std::complex< float > *out, float *envelope, unsigned int env_len)
given a keying envelope, impose it on the CW tone
Definition: USRPTX.cxx:211
bool beacon_mode
if true, we&#39;re transmitting a steady carrier
Definition: USRPTX.hxx:137
void execGetCommand(Command *cmd)
execute GET commands from the command channel
Definition: USRPTX.cxx:298
DatMBox * cw_env_stream
envelope stream from text-to-CW converter (CW unit)
Definition: USRPTX.hxx:127
std::complex< float > * zero_buf
zero signal envelope to fill in end of transmit stream
Definition: USRPTX.hxx:142
unsigned int tx_buffer_size
size of buffer going to USRP
Definition: USRPTX.hxx:145
void execSetCommand(Command *cmd)
handle SET commands from the command channel
Definition: USRPTX.cxx:258
unsigned int cw_subs
subscription handle for cw envelope stream (from CW unit)
Definition: USRPTX.hxx:124
unsigned int tx_subs
subscription handle for transmit audio stream (from BaseBandTX)
Definition: USRPTX.hxx:122
QuadratureOscillator CW_osc
CW tone IQ oscillator.
Definition: USRPTX.hxx:134
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
void transmitSwitch(bool tx_on)
start/stop transmit stream
Definition: USRPTX.cxx:229
float * beacon_env
steady constant amplitude envelope
Definition: USRPTX.hxx:136
void execRepCommand(Command *cmd)
handle Report commands from the command channel
Definition: USRPTX.cxx:309
uhd::usrp::multi_usrp::sptr usrp
the radio.
Definition: USRPTX.hxx:73
ModulationType
modulation selector targets take one of these values
Definition: Command.hxx:478
std::complex< float > * cw_buf
CW modulated envelope to send to USRP.
Definition: USRPTX.hxx:141
void run()
USRPTX run loop: handle commands, and modulate the tx carrier.
Definition: USRPTX.cxx:113
unsigned int cmd_subs
subscription handle for command stream
Definition: USRPTX.hxx:123
std::complex< float > * const_buf
envelope for dead silence
Definition: USRPTX.hxx:159
float cw_env_amplitude
used to set CW output envelope, constant at 0.7
Definition: USRPTX.hxx:146
double tx_sample_rate
sample rate for buffer going to USRP (UHD)
Definition: USRPTX.hxx:144
The Transmit RF Path.
Definition: USRPTX.hxx:51
bool tx_enabled
if true, we&#39;re transmitting.
Definition: USRPTX.hxx:130
bool LO_configured
if true, the LO has had its gain/freq set.
Definition: USRPTX.hxx:156
void getTXStreamer()
setup transmit streamer.
Definition: USRPTX.cxx:252
sin/cos oscillator to drive TX signal chain
bool waiting_to_run_dry
When set, we should send out a report when we run out of CW buffer.
Definition: USRPTX.hxx:148
double CW_tone_freq
Definition: USRPTX.hxx:133
bool LO_enabled
if true, we&#39;re in local transverter mode
Definition: USRPTX.hxx:155
uhd::tx_metadata_t md
metadata describing USRP transmit buffer
Definition: USRPTX.hxx:152
CmdMBox * cmd_stream
command stream
Definition: USRPTX.hxx:128
uhd::tx_streamer::sptr tx_bits
USRP (UHD) transmit stream handle.
Definition: USRPTX.hxx:151