2015-08-28 14:50:42 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-05-27 03:26:43 -04:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-08-28 14:50:42 -04: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
2016-05-29 06:06:47 -04:00
|
|
|
#include "ui_textentry.hpp"
|
2017-09-24 15:05:42 -04:00
|
|
|
#include "ui_transmitter.hpp"
|
|
|
|
|
2015-08-28 14:50:42 -04:00
|
|
|
#include "message.hpp"
|
|
|
|
#include "transmitter_model.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
2017-09-24 15:05:42 -04:00
|
|
|
|
|
|
|
#define LCR_MAX_AM 5
|
2015-08-28 14:50:42 -04:00
|
|
|
|
|
|
|
class LCRView : public View {
|
|
|
|
public:
|
2016-02-04 04:27:53 -05:00
|
|
|
LCRView(NavigationView& nav);
|
2015-08-28 14:50:42 -04:00
|
|
|
~LCRView();
|
|
|
|
|
|
|
|
void focus() override;
|
2016-07-27 15:26:03 -04:00
|
|
|
|
|
|
|
std::string title() const override { return "LCR transmit"; };
|
2017-04-24 13:15:57 -04:00
|
|
|
|
2015-08-28 14:50:42 -04:00
|
|
|
private:
|
2016-08-02 06:44:31 -04:00
|
|
|
struct scan_list_t {
|
|
|
|
uint8_t count;
|
2017-04-18 13:12:32 -04:00
|
|
|
const std::string * addresses;
|
2016-07-27 15:26:03 -04:00
|
|
|
};
|
2016-08-02 06:44:31 -04:00
|
|
|
|
2016-08-16 20:55:34 -04:00
|
|
|
const scan_list_t scan_list[2] = {
|
2017-04-18 13:12:32 -04:00
|
|
|
{ 36, &RGSB_list_Lille[0] },
|
|
|
|
{ 20, &RGSB_list_Reims[0] }
|
2016-08-02 06:44:31 -04:00
|
|
|
};
|
2017-09-24 15:05:42 -04:00
|
|
|
|
2017-04-18 13:12:32 -04:00
|
|
|
const std::string RGSB_list_Lille[36] = {
|
2016-07-27 15:26:03 -04:00
|
|
|
"AI10", "AI20", "AI30", "AI40",
|
|
|
|
"AI50", "AI60", "AI70", "AJ10",
|
|
|
|
"AJ20", "AJ30", "AJ40", "AJ50",
|
|
|
|
"AJ60", "AJ70", "AK10",
|
2015-09-03 00:34:00 -04:00
|
|
|
"EAA0", "EAB0", "EAC0", "EAD0",
|
|
|
|
"EbA0", "EbB0", "EbC0", "EbD0",
|
|
|
|
"EbE0", "EbF0", "EbG0", "EbH0",
|
|
|
|
"EbI0", "EbJ0", "EbK0", "EbL0",
|
|
|
|
"EbM0", "EbN0", "EbO0", "EbP0",
|
2016-07-27 15:26:03 -04:00
|
|
|
"EbS0"
|
2015-09-03 00:34:00 -04:00
|
|
|
};
|
2016-08-02 06:44:31 -04:00
|
|
|
|
2017-04-18 13:12:32 -04:00
|
|
|
const std::string RGSB_list_Reims[20] = {
|
2016-08-02 06:44:31 -04:00
|
|
|
"AI10", "AI20", "AI30", "AI40",
|
|
|
|
"AI50", "AI60", "AI70",
|
|
|
|
"AJ10", "AJ20", "AJ30", "AJ40",
|
|
|
|
"AJ50", "AJ60", "AJ70",
|
|
|
|
"AK10", "AK20", "AK50", "AK60",
|
|
|
|
"AK70",
|
|
|
|
"AP10"
|
|
|
|
};
|
|
|
|
|
|
|
|
enum tx_modes {
|
|
|
|
IDLE = 0,
|
|
|
|
SINGLE,
|
|
|
|
SCAN
|
|
|
|
};
|
|
|
|
|
|
|
|
tx_modes tx_mode = IDLE;
|
2017-02-07 17:12:20 -05:00
|
|
|
uint8_t scan_count { 0 }, scan_index { 0 };
|
2017-04-24 13:15:57 -04:00
|
|
|
uint32_t scan_progress { 0 };
|
2017-09-24 15:05:42 -04:00
|
|
|
std::array<std::string, LCR_MAX_AM> litteral { { " " } };
|
|
|
|
std::string rgsb { "AI10" };
|
2017-04-21 01:22:31 -04:00
|
|
|
uint16_t lcr_message_data[256];
|
2017-02-07 17:12:20 -05:00
|
|
|
uint8_t repeat_index { 0 };
|
2016-05-27 03:26:43 -04:00
|
|
|
|
2016-07-27 18:08:05 -04:00
|
|
|
void update_progress();
|
2016-07-27 15:26:03 -04:00
|
|
|
void start_tx(const bool scan);
|
2017-09-24 15:05:42 -04:00
|
|
|
void on_tx_progress(const uint32_t progress, const bool done);
|
|
|
|
void on_button_set_am(NavigationView& nav, int16_t button_id);
|
2016-07-27 18:08:05 -04:00
|
|
|
|
2017-04-24 13:15:57 -04:00
|
|
|
Labels labels {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ { 0, 8 }, "EC: RGSB:", Color::light_grey() },
|
|
|
|
{ { 17 * 8, 4 * 8 }, "List:", Color::light_grey() }
|
2017-04-24 13:15:57 -04:00
|
|
|
};
|
|
|
|
|
2017-09-24 15:05:42 -04:00
|
|
|
std::array<Button, LCR_MAX_AM> buttons { };
|
|
|
|
std::array<Checkbox, LCR_MAX_AM> checkboxes { };
|
|
|
|
std::array<Rectangle, LCR_MAX_AM> rectangles { };
|
|
|
|
std::array<Text, LCR_MAX_AM> texts { };
|
2016-05-09 14:42:20 -04:00
|
|
|
|
2016-07-25 10:21:27 -04:00
|
|
|
OptionsField options_ec {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ 3 * 8, 8 },
|
2017-04-24 13:15:57 -04:00
|
|
|
4,
|
2016-07-25 10:21:27 -04:00
|
|
|
{
|
2017-04-24 13:15:57 -04:00
|
|
|
{ "Auto", 0 },
|
|
|
|
{ "Jour", 1 },
|
|
|
|
{ "Nuit", 2 },
|
|
|
|
{ "S ? ", 3 }
|
2016-07-25 10:21:27 -04:00
|
|
|
}
|
2016-05-09 14:42:20 -04:00
|
|
|
};
|
2015-09-04 14:37:27 -04:00
|
|
|
|
2017-09-24 15:05:42 -04:00
|
|
|
Button button_set_rgsb {
|
|
|
|
{ 13 * 8, 4, 8 * 8, 24 },
|
2017-04-24 13:15:57 -04:00
|
|
|
"RGSB"
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
2017-09-24 15:05:42 -04:00
|
|
|
Checkbox check_scan {
|
|
|
|
{ 22 * 8, 4 },
|
|
|
|
4,
|
|
|
|
"Scan"
|
|
|
|
};
|
|
|
|
|
2017-09-02 03:28:29 -04:00
|
|
|
Button button_modem_setup {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ 1 * 8, 4 * 8 + 2, 14 * 8, 24 },
|
2017-04-24 13:15:57 -04:00
|
|
|
"Modem setup"
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
2017-09-24 15:05:42 -04:00
|
|
|
OptionsField options_scanlist {
|
|
|
|
{ 22 * 8, 4 * 8 },
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
{ "Reims ", 1 }
|
|
|
|
}
|
|
|
|
};
|
2015-08-28 14:50:42 -04:00
|
|
|
|
2016-08-02 06:44:31 -04:00
|
|
|
Button button_clear {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ 22 * 8, 8 * 8, 7 * 8, 19 * 8 },
|
2016-08-02 06:44:31 -04:00
|
|
|
"CLEAR"
|
|
|
|
};
|
|
|
|
|
2016-05-27 03:26:43 -04:00
|
|
|
Text text_status {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ 2 * 8, 27 * 8 + 4, 26 * 8, 16 },
|
2016-05-27 03:26:43 -04:00
|
|
|
"Ready"
|
|
|
|
};
|
|
|
|
ProgressBar progress {
|
2017-09-24 15:05:42 -04:00
|
|
|
{ 2 * 8, 29 * 8 + 4, 26 * 8, 16 }
|
2016-08-02 06:44:31 -04:00
|
|
|
};
|
2017-04-24 13:15:57 -04:00
|
|
|
|
2017-09-24 15:05:42 -04:00
|
|
|
TransmitterView tx_view {
|
|
|
|
16 * 16,
|
|
|
|
10000,
|
|
|
|
12
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
2016-07-26 21:03:40 -04:00
|
|
|
|
2017-09-24 15:05:42 -04:00
|
|
|
MessageHandlerRegistration message_handler_tx_progress {
|
|
|
|
Message::ID::TXProgress,
|
2016-07-26 21:03:40 -04:00
|
|
|
[this](const Message* const p) {
|
2017-09-24 15:05:42 -04:00
|
|
|
const auto message = *reinterpret_cast<const TXProgressMessage*>(p);
|
|
|
|
this->on_tx_progress(message.progress, message.done);
|
2016-07-26 21:03:40 -04:00
|
|
|
}
|
|
|
|
};
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|