SoDaRadio-5.0.3-master:8901fb5
UI.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 UI_HDR
30 #define UI_HDR
31 #include "SoDaBase.hxx"
32 #include "MultiMBox.hxx"
33 #include "Command.hxx"
34 #include "Params.hxx"
35 #include "UI.hxx"
36 #include "UDSockets.hxx"
37 #include "Spectrogram.hxx"
38 
39 namespace SoDa {
40  class UI : public SoDaThread {
41  public:
42  UI(Params * params, CmdMBox * cwtxt_stream,
45  ~UI();
46 
47  void run();
48 
49  private:
50  // Do an FFT on an rx buffer and send the positive
51  // frequencies to any network listeners.
52  void sendFFT(SoDaBuf * buf);
53 
54  // the internal communications paths -- between the SoDa threads.
58  unsigned int if_subs, cmd_subs, gps_subs;
59 
60 
61  // these are the pieces of the posix message queue interface to the GUI or whatever.
63 
64  // we ship a spectrogram of the RX IF stream to the GUI
66  unsigned int spectrogram_buckets;
67 
69  unsigned int lo_spectrogram_buckets;
71  float * lo_spectrum;
72 
73  // the spectrum runs from -100kHz below to 100kHz above the center freq.
74  static const double spectrum_span; // = 200e3;
75 
78  double hz_per_bucket;
80 
81  float * spectrum, * log_spectrum;
83 
84  float fft_acc_gain;
85  unsigned int fft_update_interval;
86 
87  unsigned int fft_send_counter;
88 
89  // flag to signal that we're in microwave LO search mode.
91 
92  void updateSpectrumState();
93  void execSetCommand(Command * cmd);
94  void execGetCommand(Command * cmd);
95  void execRepCommand(Command * cmd);
96 
98  };
99 }
100 
101 
102 #endif
unsigned int gps_subs
Definition: UI.hxx:58
The Baseclass for all SoDa objects, and useful commonly used classes.
unsigned int spectrogram_buckets
Definition: UI.hxx:66
The Thread baseclass for all SoDa thread objects.
Definition: SoDaBase.hxx:284
unsigned int cmd_subs
Definition: UI.hxx:58
Definition: UI.hxx:40
void reportSpectrumCenterFreq()
Definition: UI.cxx:237
double spectrum_center_freq
Definition: UI.hxx:77
This class handles command line parameters and built-ins.
Definition: Params.hxx:42
SoDa::UD::ServerSocket * wfall_socket
Definition: UI.hxx:62
Spectrogram * lo_spectrogram
Definition: UI.hxx:68
CmdMBox * cwtxt_stream
Definition: UI.hxx:55
The Buffer Class.
Definition: SoDaBase.hxx:72
int required_spect_buckets
Definition: UI.hxx:79
CmdMBox * gps_stream
Definition: UI.hxx:55
float * log_spectrum
Definition: UI.hxx:81
float * spectrum
Definition: UI.hxx:81
double lo_hz_per_bucket
Definition: UI.hxx:70
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
double hz_per_bucket
Definition: UI.hxx:78
void run()
Each thread object must define its "run" loop.
Definition: UI.cxx:118
double baseband_rx_freq
Definition: UI.hxx:76
bool new_spectrum_setting
Definition: UI.hxx:82
SoDa::UD::ServerSocket * server_socket
Definition: UI.hxx:62
float fft_acc_gain
Definition: UI.hxx:84
CmdMBox * cmd_stream
Definition: UI.hxx:55
unsigned int fft_send_counter
Definition: UI.hxx:87
DatMBox * rx_stream
Definition: UI.hxx:56
void updateSpectrumState()
Definition: UI.cxx:96
~UI()
Definition: UI.cxx:112
UI(Params *params, CmdMBox *cwtxt_stream, DatMBox *rx_stream, DatMBox *if_stream, CmdMBox *cmd_stream, CmdMBox *gps_stream)
Definition: UI.cxx:34
void sendFFT(SoDaBuf *buf)
Definition: UI.cxx:316
static const double spectrum_span
Definition: UI.hxx:74
unsigned int fft_update_interval
Definition: UI.hxx:85
Spectrogram * spectrogram
Definition: UI.hxx:65
float * lo_spectrum
Definition: UI.hxx:71
unsigned int if_subs
Definition: UI.hxx:58
void execRepCommand(Command *cmd)
optional method that reports status or the result of some action.
Definition: UI.cxx:299
DatMBox * if_stream
Definition: UI.hxx:57
Spectrogram generates magnitude buffers from input sample stream.
Definition: Spectrogram.hxx:39
unsigned int lo_spectrogram_buckets
Definition: UI.hxx:69
void execGetCommand(Command *cmd)
optional method to handle "GET" commands – commands that request a response
Definition: UI.cxx:286
bool lo_check_mode
Definition: UI.hxx:90
void execSetCommand(Command *cmd)
optional method to handle "SET" commands – commands that set internal state in the object...
Definition: UI.cxx:260