2017-01-30 08:10:30 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_TRANSMITTER_H__
|
|
|
|
#define __UI_TRANSMITTER_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_painter.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
|
|
|
|
|
|
|
#include "rf_path.hpp"
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class TXGainField : public NumberField {
|
|
|
|
public:
|
|
|
|
std::function<void(void)> on_show_options { };
|
|
|
|
|
|
|
|
TXGainField(Point parent_pos);
|
|
|
|
};
|
|
|
|
|
|
|
|
class TransmitterView : public View {
|
|
|
|
public:
|
|
|
|
std::function<void(void)> on_edit_frequency { };
|
|
|
|
std::function<void(void)> on_start { };
|
|
|
|
std::function<void(void)> on_stop { };
|
|
|
|
|
2017-02-11 23:05:21 -05:00
|
|
|
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock);
|
|
|
|
TransmitterView(
|
|
|
|
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth
|
|
|
|
) : TransmitterView { y, frequency_step, bandwidth, false }
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-30 08:10:30 -05:00
|
|
|
~TransmitterView();
|
|
|
|
|
|
|
|
void on_show() override;
|
2017-02-07 17:12:20 -05:00
|
|
|
void paint(Painter& painter) override;
|
2017-02-07 12:48:17 -05:00
|
|
|
void focus() override;
|
2017-01-30 08:10:30 -05:00
|
|
|
|
|
|
|
void set_transmitting(const bool transmitting);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Style style_start {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::green(),
|
|
|
|
};
|
|
|
|
const Style style_stop {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
|
|
|
};
|
2017-02-11 23:05:21 -05:00
|
|
|
const Style style_locked {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::dark_grey(),
|
|
|
|
};
|
2017-01-30 08:10:30 -05:00
|
|
|
|
2017-02-11 23:05:21 -05:00
|
|
|
bool lock_ { false };
|
2017-01-30 08:10:30 -05:00
|
|
|
bool transmitting_ { false };
|
|
|
|
|
|
|
|
FrequencyField field_frequency {
|
2017-02-07 17:12:20 -05:00
|
|
|
{ 0 * 8, 1 * 8 }
|
2017-01-30 08:10:30 -05:00
|
|
|
};
|
|
|
|
|
2017-02-11 23:05:21 -05:00
|
|
|
Text text_gain {
|
|
|
|
{ 0 * 8, 3 * 8, 5 * 8, 1 * 16 },
|
|
|
|
"Gain:"
|
|
|
|
};
|
2017-01-30 08:10:30 -05:00
|
|
|
TXGainField field_gain {
|
2017-02-11 23:05:21 -05:00
|
|
|
{ 5 * 8, 3 * 8 }
|
2017-01-30 08:10:30 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
NumberField field_bw {
|
2017-02-07 17:12:20 -05:00
|
|
|
{ 13 * 8, 1 * 8 },
|
2017-02-02 04:29:14 -05:00
|
|
|
3,
|
|
|
|
{ 1, 150 },
|
2017-01-30 08:10:30 -05:00
|
|
|
1,
|
|
|
|
' '
|
|
|
|
};
|
|
|
|
Text text_kHz {
|
2017-02-07 17:12:20 -05:00
|
|
|
{ 16 * 8, 1 * 8, 3 * 8, 1 * 16 },
|
2017-01-30 08:10:30 -05:00
|
|
|
"kHz"
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_start {
|
2017-02-07 17:12:20 -05:00
|
|
|
{ 20 * 8, 1 * 8, 9 * 8, 32 },
|
2017-01-30 08:10:30 -05:00
|
|
|
"START"
|
|
|
|
};
|
|
|
|
|
|
|
|
void on_tuning_frequency_changed(rf::Frequency f);
|
|
|
|
void on_bandwidth_changed(uint32_t bandwidth);
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_TRANSMITTER_H__*/
|