2015-12-02 00:30:52 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
2018-05-21 13:46:48 -04:00
|
|
|
* Copyright (C) 2018 Furrtek
|
2015-12-02 00:30:52 -05:00
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2015-12-08 18:28:33 -05:00
|
|
|
#ifndef __ANALOG_AUDIO_APP_H__
|
|
|
|
#define __ANALOG_AUDIO_APP_H__
|
2015-12-02 00:30:52 -05:00
|
|
|
|
|
|
|
#include "receiver_model.hpp"
|
2016-01-31 12:13:44 -05:00
|
|
|
|
|
|
|
#include "ui_receiver.hpp"
|
2023-06-18 15:11:04 -04:00
|
|
|
#include "ui_freq_field.hpp"
|
2015-12-02 00:30:52 -05:00
|
|
|
#include "ui_spectrum.hpp"
|
2016-04-30 16:56:54 -04:00
|
|
|
#include "ui_record_view.hpp"
|
2023-06-07 11:33:32 -04:00
|
|
|
#include "ui_styles.hpp"
|
2022-04-15 08:43:44 -04:00
|
|
|
#include "app_settings.hpp"
|
2023-06-14 03:57:20 -04:00
|
|
|
#include "radio_state.hpp"
|
2017-11-28 02:52:04 -05:00
|
|
|
#include "tone_key.hpp"
|
|
|
|
|
2015-12-02 00:30:52 -05:00
|
|
|
namespace ui {
|
|
|
|
|
2016-02-02 16:42:00 -05:00
|
|
|
class AMOptionsView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
2023-06-19 01:48:29 -04:00
|
|
|
AMOptionsView(Rect parent_rect, const Style* style);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config{
|
|
|
|
{0 * 8, 0 * 16, 2 * 8, 1 * 16},
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_config{
|
|
|
|
{3 * 8, 0 * 16},
|
2023-05-26 13:47:41 -04:00
|
|
|
6, // number of blanking characters
|
2023-05-18 16:16:05 -04:00
|
|
|
{
|
|
|
|
// using common messages from freqman.cpp
|
|
|
|
}};
|
2016-02-02 16:42:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class NBFMOptionsView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
2023-06-19 01:48:29 -04:00
|
|
|
NBFMOptionsView(Rect parent_rect, const Style* style);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config{
|
|
|
|
{0 * 8, 0 * 16, 2 * 8, 1 * 16},
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
OptionsField options_config{
|
|
|
|
{3 * 8, 0 * 16},
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
// using common messages from freqman.cpp
|
|
|
|
}};
|
|
|
|
|
|
|
|
Text text_squelch{
|
2023-07-02 19:53:51 -04:00
|
|
|
{7 * 8, 0 * 16, 8 * 8, 1 * 16},
|
2023-05-18 16:16:05 -04:00
|
|
|
"SQ /99"};
|
|
|
|
NumberField field_squelch{
|
2023-07-02 19:53:51 -04:00
|
|
|
{10 * 8, 0 * 16},
|
2023-05-18 16:16:05 -04:00
|
|
|
2,
|
|
|
|
{0, 99},
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2016-02-02 16:42:00 -05:00
|
|
|
};
|
|
|
|
|
2023-05-07 10:08:45 -04:00
|
|
|
class WFMOptionsView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
2023-06-19 01:48:29 -04:00
|
|
|
WFMOptionsView(Rect parent_rect, const Style* style);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config{
|
|
|
|
{0 * 8, 0 * 16, 2 * 8, 1 * 16},
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
OptionsField options_config{
|
|
|
|
{3 * 8, 0 * 16},
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
// using common messages from freqman.cpp
|
|
|
|
}};
|
2023-05-07 10:08:45 -04:00
|
|
|
};
|
|
|
|
|
2020-07-31 06:47:40 -04:00
|
|
|
class AnalogAudioView;
|
|
|
|
|
|
|
|
class SPECOptionsView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
2023-06-19 01:48:29 -04:00
|
|
|
SPECOptionsView(AnalogAudioView* view, Rect parent_rect, const Style* style);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config{
|
|
|
|
{0 * 8, 0 * 16, 2 * 8, 1 * 16},
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
OptionsField options_config{
|
|
|
|
{3 * 8, 0 * 16},
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
{"20m ", 20000000},
|
|
|
|
{"10m ", 10000000},
|
|
|
|
{" 5m ", 5000000},
|
|
|
|
{" 2m ", 2000000},
|
|
|
|
{" 1m ", 1000000},
|
|
|
|
{"500k", 500000},
|
|
|
|
{"100k", 100000},
|
|
|
|
}};
|
|
|
|
|
|
|
|
Text text_speed{
|
|
|
|
{9 * 8, 0 * 16, 8 * 8, 1 * 16},
|
|
|
|
"SP /63"};
|
|
|
|
NumberField field_speed{
|
|
|
|
{12 * 8, 0 * 16},
|
|
|
|
2,
|
|
|
|
{0, 63},
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2020-07-31 06:47:40 -04:00
|
|
|
};
|
|
|
|
|
2016-01-31 12:13:44 -05:00
|
|
|
class AnalogAudioView : public View {
|
2023-05-18 16:16:05 -04:00
|
|
|
public:
|
|
|
|
AnalogAudioView(NavigationView& nav);
|
2023-07-04 19:26:26 -04:00
|
|
|
AnalogAudioView(NavigationView& nav, ReceiverModel::settings_t override);
|
2023-05-18 16:16:05 -04:00
|
|
|
~AnalogAudioView();
|
|
|
|
|
2023-06-19 01:48:29 -04:00
|
|
|
void set_parent_rect(Rect new_parent_rect) override;
|
2023-05-18 16:16:05 -04:00
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Audio RX"; };
|
|
|
|
|
|
|
|
size_t get_spec_bw_index();
|
|
|
|
void set_spec_bw(size_t index, uint32_t bw);
|
|
|
|
|
|
|
|
uint16_t get_spec_trigger();
|
|
|
|
void set_spec_trigger(uint16_t trigger);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr ui::Dim header_height = 3 * 16;
|
|
|
|
|
2023-06-18 15:11:04 -04:00
|
|
|
NavigationView& nav_;
|
2023-06-14 03:57:20 -04:00
|
|
|
RxRadioState radio_state_{};
|
2023-06-11 14:47:13 -04:00
|
|
|
app_settings::SettingsManager settings_{
|
2023-06-12 13:40:32 -04:00
|
|
|
"rx_audio", app_settings::Mode::RX,
|
|
|
|
app_settings::Options::UseGlobalTargetFrequency};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
const Rect options_view_rect{0 * 8, 1 * 16, 30 * 8, 1 * 16};
|
|
|
|
const Rect nbfm_view_rect{0 * 8, 1 * 16, 18 * 8, 1 * 16};
|
|
|
|
|
|
|
|
size_t spec_bw_index = 0;
|
|
|
|
uint32_t spec_bw = 20000000;
|
|
|
|
uint16_t spec_trigger = 63;
|
|
|
|
|
|
|
|
RSSI rssi{
|
2023-06-18 15:11:04 -04:00
|
|
|
{21 * 8, 0, 6 * 8, 4}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Channel channel{
|
2023-06-18 15:11:04 -04:00
|
|
|
{21 * 8, 5, 6 * 8, 4}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Audio audio{
|
2023-06-18 15:11:04 -04:00
|
|
|
{21 * 8, 10, 6 * 8, 4}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-06-18 15:11:04 -04:00
|
|
|
RxFrequencyField field_frequency{
|
2023-05-18 16:16:05 -04:00
|
|
|
{5 * 8, 0 * 16},
|
2023-06-18 15:11:04 -04:00
|
|
|
nav_};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
LNAGainField field_lna{
|
|
|
|
{15 * 8, 0 * 16}};
|
|
|
|
|
|
|
|
VGAGainField field_vga{
|
|
|
|
{18 * 8, 0 * 16}};
|
|
|
|
|
|
|
|
OptionsField options_modulation{
|
|
|
|
{0 * 8, 0 * 16},
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
{" AM ", toUType(ReceiverModel::Mode::AMAudio)},
|
|
|
|
{"NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio)},
|
|
|
|
{"WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio)},
|
|
|
|
{"SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis)},
|
|
|
|
}};
|
|
|
|
|
2023-06-04 15:56:46 -04:00
|
|
|
AudioVolumeField field_volume{
|
|
|
|
{28 * 8, 0 * 16}};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
Text text_ctcss{
|
2023-07-02 19:53:51 -04:00
|
|
|
{16 * 8, 1 * 16, 14 * 8, 1 * 16},
|
2023-05-18 16:16:05 -04:00
|
|
|
""};
|
|
|
|
|
|
|
|
std::unique_ptr<Widget> options_widget{};
|
|
|
|
|
|
|
|
RecordView record_view{
|
|
|
|
{0 * 8, 2 * 16, 30 * 8, 1 * 16},
|
|
|
|
u"AUD",
|
|
|
|
u"AUDIO",
|
|
|
|
RecordView::FileType::WAV,
|
|
|
|
4096,
|
|
|
|
4};
|
|
|
|
|
2023-06-30 01:34:19 -04:00
|
|
|
spectrum::WaterfallView waterfall{true};
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);
|
2023-06-19 01:48:29 -04:00
|
|
|
void on_modulation_changed(ReceiverModel::Mode modulation);
|
2023-05-18 16:16:05 -04:00
|
|
|
void on_show_options_frequency();
|
|
|
|
void on_show_options_rf_gain();
|
|
|
|
void on_show_options_modulation();
|
|
|
|
void on_frequency_step_changed(rf::Frequency f);
|
|
|
|
void on_reference_ppm_correction_changed(int32_t v);
|
|
|
|
|
|
|
|
void remove_options_widget();
|
|
|
|
void set_options_widget(std::unique_ptr<Widget> new_widget);
|
|
|
|
|
2023-06-19 01:48:29 -04:00
|
|
|
void update_modulation(ReceiverModel::Mode modulation);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
2023-06-19 01:48:29 -04:00
|
|
|
void handle_coded_squelch(uint32_t value);
|
2023-05-18 16:16:05 -04:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_coded_squelch{
|
|
|
|
Message::ID::CodedSquelch,
|
2023-06-19 01:48:29 -04:00
|
|
|
[this](const Message* p) {
|
2023-05-18 16:16:05 -04:00
|
|
|
const auto message = *reinterpret_cast<const CodedSquelchMessage*>(p);
|
|
|
|
this->handle_coded_squelch(message.value);
|
|
|
|
}};
|
2015-12-02 00:30:52 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
2023-05-18 16:16:05 -04:00
|
|
|
#endif /*__ANALOG_AUDIO_APP_H__*/
|