2015-12-01 21:30:52 -08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
2018-05-21 18:46:48 +01:00
|
|
|
* Copyright (C) 2018 Furrtek
|
2015-12-01 21:30:52 -08: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 15:28:33 -08:00
|
|
|
#ifndef __ANALOG_AUDIO_APP_H__
|
|
|
|
#define __ANALOG_AUDIO_APP_H__
|
2015-12-01 21:30:52 -08:00
|
|
|
|
|
|
|
#include "receiver_model.hpp"
|
2016-01-31 09:13:44 -08:00
|
|
|
|
|
|
|
#include "ui_receiver.hpp"
|
2015-12-01 21:30:52 -08:00
|
|
|
#include "ui_spectrum.hpp"
|
2016-04-30 13:56:54 -07:00
|
|
|
#include "ui_record_view.hpp"
|
2016-01-31 09:13:44 -08:00
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
2022-04-15 08:43:44 -04:00
|
|
|
#include "app_settings.hpp"
|
2017-11-28 08:52:04 +01:00
|
|
|
#include "tone_key.hpp"
|
|
|
|
|
2022-03-28 20:53:09 -07:00
|
|
|
|
2015-12-01 21:30:52 -08:00
|
|
|
namespace ui {
|
|
|
|
|
2016-01-31 09:13:44 -08:00
|
|
|
constexpr Style style_options_group {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::blue(),
|
|
|
|
.foreground = Color::white(),
|
|
|
|
};
|
|
|
|
|
2016-02-02 13:42:00 -08:00
|
|
|
class AMOptionsView : public View {
|
|
|
|
public:
|
|
|
|
AMOptionsView(const Rect parent_rect, const Style* const style);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config {
|
|
|
|
{ 0 * 8, 0 * 16, 2 * 8, 1 * 16 },
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_config {
|
|
|
|
{ 3 * 8, 0 * 16 },
|
2022-11-19 18:17:54 +01:00
|
|
|
5,
|
2023-05-11 22:45:32 +02:00
|
|
|
{ // using common messages from freqman.cpp
|
2016-02-02 13:42:00 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
class NBFMOptionsView : public View {
|
|
|
|
public:
|
|
|
|
NBFMOptionsView(const Rect parent_rect, const Style* const style);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config {
|
|
|
|
{ 0 * 8, 0 * 16, 2 * 8, 1 * 16 },
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
OptionsField options_config {
|
|
|
|
{ 3 * 8, 0 * 16 },
|
|
|
|
4,
|
2023-05-11 22:45:32 +02:00
|
|
|
{ // using common messages from freqman.cpp
|
2016-02-02 13:42:00 -08:00
|
|
|
}
|
|
|
|
};
|
2017-06-11 09:50:29 +01:00
|
|
|
|
|
|
|
Text text_squelch {
|
2017-11-28 08:52:04 +01:00
|
|
|
{ 9 * 8, 0 * 16, 8 * 8, 1 * 16 },
|
|
|
|
"SQ /99"
|
2017-06-11 09:50:29 +01:00
|
|
|
};
|
|
|
|
NumberField field_squelch {
|
|
|
|
{ 12 * 8, 0 * 16 },
|
2017-11-28 08:52:04 +01:00
|
|
|
2,
|
|
|
|
{ 0, 99 },
|
2017-06-11 09:50:29 +01:00
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2016-02-02 13:42:00 -08:00
|
|
|
};
|
|
|
|
|
2023-05-07 16:08:45 +02:00
|
|
|
|
|
|
|
class WFMOptionsView : public View {
|
|
|
|
public:
|
|
|
|
WFMOptionsView(const Rect parent_rect, const Style* const style);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Text label_config {
|
|
|
|
{ 0 * 8, 0 * 16, 2 * 8, 1 * 16 },
|
|
|
|
"BW",
|
|
|
|
};
|
|
|
|
OptionsField options_config {
|
|
|
|
{ 3 * 8, 0 * 16 },
|
2023-05-14 09:16:01 +02:00
|
|
|
4,
|
2023-05-11 22:45:32 +02:00
|
|
|
{ // using common messages from freqman.cpp
|
2023-05-07 16:08:45 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-07-31 13:47:40 +03:00
|
|
|
class AnalogAudioView;
|
|
|
|
|
|
|
|
class SPECOptionsView : public View {
|
|
|
|
public:
|
|
|
|
SPECOptionsView(AnalogAudioView* view, const Rect parent_rect, const Style* const style);
|
|
|
|
|
|
|
|
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 },
|
2023-04-07 13:44:48 +02:00
|
|
|
{ "100k", 100000 },
|
2020-07-31 13:47:40 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_speed {
|
|
|
|
{ 9 * 8, 0 * 16, 8 * 8, 1 * 16 },
|
|
|
|
"SP /63"
|
|
|
|
};
|
|
|
|
NumberField field_speed {
|
|
|
|
{ 12 * 8, 0 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 63 },
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-01-31 09:13:44 -08:00
|
|
|
class AnalogAudioView : public View {
|
2015-12-01 21:30:52 -08:00
|
|
|
public:
|
2018-06-12 07:55:12 +01:00
|
|
|
AnalogAudioView(NavigationView& nav);
|
2016-01-31 09:13:44 -08:00
|
|
|
~AnalogAudioView();
|
|
|
|
|
|
|
|
void on_hide() override;
|
|
|
|
|
|
|
|
void set_parent_rect(const Rect new_parent_rect) override;
|
|
|
|
|
|
|
|
void focus() override;
|
2015-12-01 21:30:52 -08:00
|
|
|
|
2022-04-26 23:09:24 +02:00
|
|
|
std::string title() const override { return "Audio RX"; };
|
2020-07-31 13:47:40 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2015-12-01 21:30:52 -08:00
|
|
|
private:
|
2016-04-22 12:30:02 -07:00
|
|
|
static constexpr ui::Dim header_height = 3 * 16;
|
2016-01-31 09:13:44 -08:00
|
|
|
|
2022-04-15 08:43:44 -04:00
|
|
|
// app save settings
|
|
|
|
std::app_settings settings { };
|
|
|
|
std::app_settings::AppSettings app_settings { };
|
|
|
|
|
2016-02-16 15:17:06 -08:00
|
|
|
const Rect options_view_rect { 0 * 8, 1 * 16, 30 * 8, 1 * 16 };
|
2017-11-28 08:52:04 +01:00
|
|
|
const Rect nbfm_view_rect { 0 * 8, 1 * 16, 18 * 8, 1 * 16 };
|
2016-02-16 15:17:06 -08:00
|
|
|
|
2020-07-31 13:47:40 +03:00
|
|
|
size_t spec_bw_index = 0;
|
|
|
|
uint32_t spec_bw = 20000000;
|
|
|
|
uint16_t spec_trigger = 63;
|
|
|
|
|
2017-05-18 11:06:11 +01:00
|
|
|
NavigationView& nav_;
|
2018-04-19 20:50:32 +01:00
|
|
|
//bool exit_on_squelch { false };
|
2017-05-18 11:06:11 +01:00
|
|
|
|
2016-01-31 09:13:44 -08:00
|
|
|
RSSI rssi {
|
|
|
|
{ 21 * 8, 0, 6 * 8, 4 },
|
|
|
|
};
|
|
|
|
|
|
|
|
Channel channel {
|
|
|
|
{ 21 * 8, 5, 6 * 8, 4 },
|
|
|
|
};
|
|
|
|
|
|
|
|
Audio audio {
|
|
|
|
{ 21 * 8, 10, 6 * 8, 4 },
|
|
|
|
};
|
|
|
|
|
|
|
|
FrequencyField field_frequency {
|
|
|
|
{ 5 * 8, 0 * 16 },
|
|
|
|
};
|
|
|
|
|
|
|
|
LNAGainField field_lna {
|
|
|
|
{ 15 * 8, 0 * 16 }
|
|
|
|
};
|
|
|
|
|
2016-04-12 10:48:24 -07:00
|
|
|
VGAGainField field_vga {
|
|
|
|
{ 18 * 8, 0 * 16 }
|
2016-01-31 09:13:44 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_modulation {
|
|
|
|
{ 0 * 8, 0 * 16 },
|
|
|
|
4,
|
|
|
|
{
|
2016-02-01 09:12:55 -08:00
|
|
|
{ " AM ", toUType(ReceiverModel::Mode::AMAudio) },
|
|
|
|
{ "NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio) },
|
|
|
|
{ "WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio) },
|
|
|
|
{ "SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis) },
|
2016-01-31 09:13:44 -08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_volume {
|
|
|
|
{ 28 * 8, 0 * 16 },
|
|
|
|
2,
|
|
|
|
{ 0, 99 },
|
|
|
|
1,
|
|
|
|
' ',
|
|
|
|
};
|
2017-11-28 08:52:04 +01:00
|
|
|
|
|
|
|
Text text_ctcss {
|
|
|
|
{ 19 * 8, 1 * 16, 11 * 8, 1 * 16 },
|
|
|
|
""
|
|
|
|
};
|
2016-01-31 09:13:44 -08:00
|
|
|
|
2016-11-26 16:50:44 -08:00
|
|
|
std::unique_ptr<Widget> options_widget { };
|
2016-02-02 13:42:00 -08:00
|
|
|
|
2016-04-30 13:56:54 -07:00
|
|
|
RecordView record_view {
|
|
|
|
{ 0 * 8, 2 * 16, 30 * 8, 1 * 16 },
|
2023-05-12 11:08:07 -07:00
|
|
|
u"AUD", u"AUDIO",
|
2022-03-28 20:53:09 -07:00
|
|
|
RecordView::FileType::WAV,
|
|
|
|
4096,
|
|
|
|
4
|
2016-04-22 12:30:02 -07:00
|
|
|
};
|
|
|
|
|
2018-04-18 22:44:41 +01:00
|
|
|
spectrum::WaterfallWidget waterfall { true };
|
2016-01-31 09:13:44 -08:00
|
|
|
|
|
|
|
void on_tuning_frequency_changed(rf::Frequency f);
|
|
|
|
void on_baseband_bandwidth_changed(uint32_t bandwidth_hz);
|
2016-02-02 13:39:02 -08:00
|
|
|
void on_modulation_changed(const ReceiverModel::Mode modulation);
|
2016-01-31 09:13:44 -08:00
|
|
|
void on_show_options_frequency();
|
|
|
|
void on_show_options_rf_gain();
|
2016-02-02 13:42:00 -08:00
|
|
|
void on_show_options_modulation();
|
2016-01-31 09:13:44 -08:00
|
|
|
void on_frequency_step_changed(rf::Frequency f);
|
|
|
|
void on_reference_ppm_correction_changed(int32_t v);
|
|
|
|
void on_headphone_volume_changed(int32_t v);
|
|
|
|
void on_edit_frequency();
|
2016-02-02 11:02:07 -08:00
|
|
|
|
2016-02-02 14:26:00 -08:00
|
|
|
void remove_options_widget();
|
|
|
|
void set_options_widget(std::unique_ptr<Widget> new_widget);
|
|
|
|
|
2016-02-02 13:39:02 -08:00
|
|
|
void update_modulation(const ReceiverModel::Mode modulation);
|
2017-05-18 11:06:11 +01:00
|
|
|
|
2018-04-19 20:50:32 +01:00
|
|
|
//void squelched();
|
2017-11-28 08:52:04 +01:00
|
|
|
void handle_coded_squelch(const uint32_t value);
|
2017-05-18 11:06:11 +01:00
|
|
|
|
2018-04-19 20:50:32 +01:00
|
|
|
/*MessageHandlerRegistration message_handler_squelch_signal {
|
2017-05-18 11:06:11 +01:00
|
|
|
Message::ID::RequestSignal,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
(void)p;
|
|
|
|
this->squelched();
|
|
|
|
}
|
2018-04-19 20:50:32 +01:00
|
|
|
};*/
|
2017-11-28 08:52:04 +01:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_coded_squelch {
|
|
|
|
Message::ID::CodedSquelch,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const CodedSquelchMessage*>(p);
|
|
|
|
this->handle_coded_squelch(message.value);
|
|
|
|
}
|
|
|
|
};
|
2015-12-01 21:30:52 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
2015-12-08 15:28:33 -08:00
|
|
|
#endif/*__ANALOG_AUDIO_APP_H__*/
|