Move ReceiverMode enum to receiver_model.hpp

This commit is contained in:
Jared Boone 2015-12-01 21:00:31 -08:00
parent 74d6518ea1
commit e9bf500bfc
3 changed files with 29 additions and 29 deletions

View File

@ -33,6 +33,16 @@
class ReceiverModel {
public:
enum class Mode : int32_t {
AMAudio = 0,
NarrowbandFMAudio = 1,
WidebandFMAudio = 2,
AIS = 3,
SpectrumAnalysis = 4,
TPMS = 5,
ERT = 6,
};
constexpr ReceiverModel(
ClockManager& clock_manager
) : clock_manager(clock_manager)

View File

@ -456,7 +456,7 @@ ReceiverView::ReceiverView(
options_modulation.set_by_value(receiver_model.modulation());
options_modulation.on_change = [this](size_t n, OptionsField::value_t v) {
(void)n;
this->on_modulation_changed(static_cast<ReceiverMode>(v));
this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v));
};
/*
options_baseband_oversampling.set_by_value(receiver_model.baseband_oversampling());
@ -585,7 +585,7 @@ static ManchesterFormatted format_manchester(
class AnalogAudioModel {
public:
AnalogAudioModel(ReceiverMode mode) {
AnalogAudioModel(ReceiverModel::Mode mode) {
receiver_model.set_baseband_configuration({
.mode = toUType(mode),
.sampling_rate = 3072000,
@ -598,7 +598,7 @@ public:
class AnalogAudioView : public spectrum::WaterfallWidget {
public:
AnalogAudioView(
ReceiverMode mode
ReceiverModel::Mode mode
) : model { mode }
{
}
@ -864,30 +864,30 @@ void ReceiverView::on_vga_changed(int32_t v_db) {
receiver_model.set_vga(v_db);
}
void ReceiverView::on_modulation_changed(ReceiverMode mode) {
void ReceiverView::on_modulation_changed(ReceiverModel::Mode mode) {
remove_child(widget_content.get());
widget_content.reset();
switch(mode) {
case ReceiverMode::AMAudio:
case ReceiverMode::NarrowbandFMAudio:
case ReceiverMode::WidebandFMAudio:
case ReceiverModel::Mode::AMAudio:
case ReceiverModel::Mode::NarrowbandFMAudio:
case ReceiverModel::Mode::WidebandFMAudio:
widget_content = std::make_unique<AnalogAudioView>(mode);
break;
case ReceiverMode::AIS:
case ReceiverModel::Mode::AIS:
widget_content = std::make_unique<AISView>();
break;
case ReceiverMode::SpectrumAnalysis:
case ReceiverModel::Mode::SpectrumAnalysis:
widget_content = std::make_unique<SpectrumAnalysisView>();
break;
case ReceiverMode::TPMS:
case ReceiverModel::Mode::TPMS:
widget_content = std::make_unique<TPMSView>();
break;
case ReceiverMode::ERT:
case ReceiverModel::Mode::ERT:
widget_content = std::make_unique<ERTView>();
break;

View File

@ -357,16 +357,6 @@ constexpr Style style_options_group {
.foreground = Color::white(),
};
enum class ReceiverMode : int32_t {
AMAudio = 0,
NarrowbandFMAudio = 1,
WidebandFMAudio = 2,
AIS = 3,
SpectrumAnalysis = 4,
TPMS = 5,
ERT = 6,
};
class ReceiverView : public View {
public:
ReceiverView(NavigationView& nav, ReceiverModel& receiver_model);
@ -421,13 +411,13 @@ private:
{ 19 * 8, 1 * 16 },
4,
{
{ " AM ", toUType(ReceiverMode::AMAudio) },
{ "NFM ", toUType(ReceiverMode::NarrowbandFMAudio) },
{ "WFM ", toUType(ReceiverMode::WidebandFMAudio) },
{ "AIS ", toUType(ReceiverMode::AIS) },
{ "TPMS", toUType(ReceiverMode::TPMS) },
{ "ERT", toUType(ReceiverMode::ERT) },
{ "SPEC", toUType(ReceiverMode::SpectrumAnalysis) },
{ " AM ", toUType(ReceiverModel::Mode::AMAudio) },
{ "NFM ", toUType(ReceiverModel::Mode::NarrowbandFMAudio) },
{ "WFM ", toUType(ReceiverModel::Mode::WidebandFMAudio) },
{ "AIS ", toUType(ReceiverModel::Mode::AIS) },
{ "TPMS", toUType(ReceiverModel::Mode::TPMS) },
{ "ERT", toUType(ReceiverModel::Mode::ERT) },
{ "SPEC", toUType(ReceiverModel::Mode::SpectrumAnalysis) },
}
};
/*
@ -474,7 +464,7 @@ private:
void on_rf_amp_changed(bool v);
void on_lna_changed(int32_t v_db);
void on_vga_changed(int32_t v_db);
void on_modulation_changed(ReceiverMode mode);
void on_modulation_changed(ReceiverModel::Mode mode);
void on_show_options_frequency();
void on_show_options_rf_gain();
void on_frequency_step_changed(rf::Frequency f);