SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
UI.hxx
Go to the documentation of this file.
1/*
2Copyright (c) 2012, 2025 Matthew H. Reilly (kb1vc)
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
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
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28#pragma once
29
30#include "SoDaBase.hxx"
31#include "SoDaThread.hxx"
32
33#include "Command.hxx"
34#include "Params.hxx"
35#include "UI.hxx"
36#include "UDSockets.hxx"
37#include "Spectrogram.hxx"
38
39#include <SoDa/MailBox.hxx>
40#include <memory>
41
42
43namespace SoDa {
44 class UI;
45 typedef std::shared_ptr<UI> UIPtr;
46
47
48 class UI : public SoDa::Thread {
49 private:
50 UI(ParamsPtr params);
51
52 public:
53 static UIPtr make(ParamsPtr params) {
54 auto ret = std::shared_ptr<UI>(new UI(params));
55 ret->registerThread(ret);
56 return ret;
57 }
58
59
60 ~UI();
61
67 void subscribeToMailBoxes(const std::vector<MailBoxBasePtr> & mailboxes);
68
69 void run();
70
71 private:
73
74 // Do an FFT on an rx buffer and send the positive
75 // frequencies to any network listeners.
77
78 // the internal communications paths -- between the SoDa threads.
81 CmdMBox::Subscription cmd_subs;
82 CDatMBox::Subscription if_subs;
83
84
85 // these are the pieces of the posix message queue interface to the GUI or whatever.
87
88 // we ship a spectrogram of the RX IF stream to the GUI
90 unsigned int spectrogram_buckets;
91
95 std::vector<float> lo_spectrum;
96
97 // the spectrum runs from -100kHz below to 100kHz above the center freq.
98 static const double spectrum_span; // = 200e3;
99
104
105 std::vector<float> spectrum, log_spectrum;
107
110
111 unsigned int fft_send_counter;
112
113 // flag to signal that we're in microwave LO search mode.
115
120
122 };
123}
124
125
The Baseclass for all SoDa objects, and useful commonly used classes.
The Baseclass for all SoDa thread objects.
The Thread baseclass for all SoDa thread objects.
std::vector< float > lo_spectrum
Definition UI.hxx:95
unsigned int fft_send_counter
Definition UI.hxx:111
static UIPtr make(ParamsPtr params)
Definition UI.hxx:53
void subscribeToMailBoxes(const std::vector< MailBoxBasePtr > &mailboxes)
connect to useful mailboxes.
void run()
Each thread object must define its "run" loop.
CmdMBoxPtr cwtxt_stream
Definition UI.hxx:79
float fft_acc_gain
Definition UI.hxx:108
void updateSpectrumState()
SpectrogramPtr spectrogram
Definition UI.hxx:89
int required_spect_buckets
Definition UI.hxx:103
void sendCommandSocket(CommandPtr ptr)
UI(ParamsPtr params)
void execSetCommand(CommandPtr cmd)
optional method to handle "SET" commands – commands that set internal state in the object.
std::vector< float > log_spectrum
Definition UI.hxx:105
CDatMBox::Subscription if_subs
Definition UI.hxx:82
SpectrogramPtr lo_spectrogram
Definition UI.hxx:92
void execGetCommand(CommandPtr cmd)
optional method to handle "GET" commands – commands that request a response
SoDa::UD::ServerSocket * wfall_socket
Definition UI.hxx:86
bool lo_check_mode
Definition UI.hxx:114
double hz_per_bucket
Definition UI.hxx:102
double spectrum_center_freq
Definition UI.hxx:101
CDatMBoxPtr if_stream
Definition UI.hxx:80
bool new_spectrum_setting
Definition UI.hxx:106
double baseband_rx_freq
Definition UI.hxx:100
unsigned int spectrogram_buckets
Definition UI.hxx:90
void execRepCommand(CommandPtr cmd)
optional method that reports status or the result of some action.
std::vector< float > spectrum
Definition UI.hxx:105
void reportSpectrumCenterFreq()
static const double spectrum_span
Definition UI.hxx:98
double lo_hz_per_bucket
Definition UI.hxx:94
unsigned int lo_spectrogram_buckets
Definition UI.hxx:93
void sendFFT(SoDa::CBufPtr buf)
SoDa::UD::ServerSocket * server_socket
Definition UI.hxx:86
CmdMBoxPtr cmd_stream
Definition UI.hxx:79
unsigned int fft_update_interval
Definition UI.hxx:109
CmdMBox::Subscription cmd_subs
Definition UI.hxx:81
std::shared_ptr< UI > UIPtr
Definition UI.hxx:45
std::shared_ptr< Spectrogram > SpectrogramPtr
std::shared_ptr< Params > ParamsPtr
Definition Params.hxx:42
std::shared_ptr< Command > CommandPtr
Definition Command.hxx:41
std::shared_ptr< CmdMBox > CmdMBoxPtr
Definition SoDaBase.hxx:79
std::shared_ptr< CDatMBox > CDatMBoxPtr
Definition SoDaBase.hxx:91
std::shared_ptr< CBuf > CBufPtr
Definition SoDaBase.hxx:64