2015-08-28 18:50:42 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-05-27 07:26:43 +00:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-08-28 18:50:42 +00: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 10:06:47 +00:00
|
|
|
#include "ui_textentry.hpp"
|
2015-08-28 18:50:42 +00:00
|
|
|
#include "message.hpp"
|
|
|
|
#include "transmitter_model.hpp"
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class LCRView : public View {
|
|
|
|
public:
|
2016-02-04 09:27:53 +00:00
|
|
|
LCRView(NavigationView& nav);
|
2015-08-28 18:50:42 +00:00
|
|
|
~LCRView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
void paint(Painter& painter) override;
|
2016-07-27 19:26:03 +00:00
|
|
|
|
|
|
|
std::string title() const override { return "LCR transmit"; };
|
2017-04-24 17:15:57 +00:00
|
|
|
|
2015-08-28 18:50:42 +00:00
|
|
|
private:
|
2016-08-02 10:44:31 +00:00
|
|
|
struct scan_list_t {
|
|
|
|
uint8_t count;
|
2017-04-18 17:12:32 +00:00
|
|
|
const std::string * addresses;
|
2016-07-27 19:26:03 +00:00
|
|
|
};
|
2016-08-02 10:44:31 +00:00
|
|
|
|
2016-08-17 00:55:34 +00:00
|
|
|
const scan_list_t scan_list[2] = {
|
2017-04-18 17:12:32 +00:00
|
|
|
{ 36, &RGSB_list_Lille[0] },
|
|
|
|
{ 20, &RGSB_list_Reims[0] }
|
2016-08-02 10:44:31 +00:00
|
|
|
};
|
|
|
|
|
2017-04-18 17:12:32 +00:00
|
|
|
const std::string RGSB_list_Lille[36] = {
|
2016-07-27 19:26:03 +00:00
|
|
|
"AI10", "AI20", "AI30", "AI40",
|
|
|
|
"AI50", "AI60", "AI70", "AJ10",
|
|
|
|
"AJ20", "AJ30", "AJ40", "AJ50",
|
|
|
|
"AJ60", "AJ70", "AK10",
|
2015-09-03 04:34:00 +00:00
|
|
|
"EAA0", "EAB0", "EAC0", "EAD0",
|
|
|
|
"EbA0", "EbB0", "EbC0", "EbD0",
|
|
|
|
"EbE0", "EbF0", "EbG0", "EbH0",
|
|
|
|
"EbI0", "EbJ0", "EbK0", "EbL0",
|
|
|
|
"EbM0", "EbN0", "EbO0", "EbP0",
|
2016-07-27 19:26:03 +00:00
|
|
|
"EbS0"
|
2015-09-03 04:34:00 +00:00
|
|
|
};
|
2016-08-02 10:44:31 +00:00
|
|
|
|
2017-04-18 17:12:32 +00:00
|
|
|
const std::string RGSB_list_Reims[20] = {
|
2016-08-02 10:44:31 +00: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 22:12:20 +00:00
|
|
|
uint8_t scan_count { 0 }, scan_index { 0 };
|
2017-04-24 17:15:57 +00:00
|
|
|
uint32_t scan_progress { 0 };
|
2017-06-11 01:53:06 +00:00
|
|
|
std::string litteral[5] { { " " } };
|
2017-04-18 17:12:32 +00:00
|
|
|
std::string rgsb { " " };
|
2016-07-29 02:52:51 +00:00
|
|
|
char lcr_message[512];
|
2017-04-21 05:22:31 +00:00
|
|
|
uint16_t lcr_message_data[256];
|
2017-02-07 22:12:20 +00:00
|
|
|
rf::Frequency f { 0 };
|
|
|
|
uint8_t repeat_index { 0 };
|
2016-05-27 07:26:43 +00:00
|
|
|
|
2017-04-18 11:55:49 +00:00
|
|
|
std::vector<std::string> parse_litterals();
|
2016-07-27 22:08:05 +00:00
|
|
|
void update_progress();
|
2016-07-27 19:26:03 +00:00
|
|
|
void start_tx(const bool scan);
|
2016-07-27 01:03:40 +00:00
|
|
|
void on_txdone(int n);
|
2016-07-27 22:08:05 +00:00
|
|
|
void on_button_setam(NavigationView& nav, Button& button);
|
2016-07-27 01:03:40 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
const Style style_val {
|
|
|
|
.font = font::fixed_8x16,
|
2016-12-09 01:35:50 +00:00
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::green(),
|
2016-05-27 07:26:43 +00:00
|
|
|
};
|
|
|
|
const Style style_cancel {
|
|
|
|
.font = font::fixed_8x16,
|
2016-12-09 01:35:50 +00:00
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
2015-09-04 18:37:27 +00:00
|
|
|
};
|
2016-07-27 22:08:05 +00:00
|
|
|
|
2017-04-24 17:15:57 +00:00
|
|
|
Labels labels {
|
|
|
|
{ { 2 * 8, 4 }, "EC:", Color::light_grey() },
|
2017-06-11 01:53:06 +00:00
|
|
|
{ { 84, 268 }, "Scan list:", Color::light_grey() }
|
2017-04-24 17:15:57 +00:00
|
|
|
};
|
|
|
|
|
2017-02-07 22:12:20 +00:00
|
|
|
std::array<Button, 5> buttons { };
|
|
|
|
std::array<Checkbox, 5> checkboxes { };
|
|
|
|
std::array<Rectangle, 5> rectangles { };
|
2015-09-04 18:37:27 +00:00
|
|
|
|
|
|
|
Text text_recap {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 12 * 8, 4, 18 * 8, 16 },
|
2015-09-04 18:37:27 +00:00
|
|
|
"-"
|
|
|
|
};
|
2016-05-09 18:42:20 +00:00
|
|
|
|
2016-07-25 14:21:27 +00:00
|
|
|
OptionsField options_ec {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 40, 4 },
|
|
|
|
4,
|
2016-07-25 14:21:27 +00:00
|
|
|
{
|
2017-04-24 17:15:57 +00:00
|
|
|
{ "Auto", 0 },
|
|
|
|
{ "Jour", 1 },
|
|
|
|
{ "Nuit", 2 },
|
|
|
|
{ "S ? ", 3 }
|
2016-07-25 14:21:27 +00:00
|
|
|
}
|
2016-05-09 18:42:20 +00:00
|
|
|
};
|
2015-09-04 18:37:27 +00:00
|
|
|
|
2015-08-28 18:50:42 +00:00
|
|
|
Button button_setrgsb {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 8, 24, 80, 32 },
|
|
|
|
"RGSB"
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
2017-09-02 07:28:29 +00:00
|
|
|
Button button_modem_setup {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 13 * 8, 24, 128, 32 },
|
|
|
|
"Modem setup"
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
2016-08-02 10:44:31 +00:00
|
|
|
Button button_clear {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 174, 64, 58, 19 * 8 },
|
2016-08-02 10:44:31 +00:00
|
|
|
"CLEAR"
|
|
|
|
};
|
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
Text text_status {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 16, 222, 128, 16 },
|
2016-05-27 07:26:43 +00:00
|
|
|
"Ready"
|
|
|
|
};
|
|
|
|
ProgressBar progress {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 16, 242, 208, 16 }
|
2016-05-27 07:26:43 +00:00
|
|
|
};
|
|
|
|
|
2015-08-28 18:50:42 +00:00
|
|
|
Button button_transmit {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 8, 270, 64, 32 },
|
2015-09-03 04:34:00 +00:00
|
|
|
"TX"
|
|
|
|
};
|
2017-04-24 17:15:57 +00:00
|
|
|
|
2016-08-02 10:44:31 +00:00
|
|
|
OptionsField options_scanlist {
|
2017-06-11 01:53:06 +00:00
|
|
|
{ 84, 284 },
|
2016-08-02 10:44:31 +00:00
|
|
|
6,
|
|
|
|
{
|
|
|
|
{ "Reims ", 1 }
|
|
|
|
}
|
|
|
|
};
|
2017-04-24 17:15:57 +00:00
|
|
|
|
2016-05-27 07:26:43 +00:00
|
|
|
Button button_scan {
|
2017-04-24 17:15:57 +00:00
|
|
|
{ 166, 270, 64, 32 },
|
2016-05-27 07:26:43 +00:00
|
|
|
"SCAN"
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
2016-07-27 01:03:40 +00:00
|
|
|
|
|
|
|
MessageHandlerRegistration message_handler_tx_done {
|
|
|
|
Message::ID::TXDone,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = *reinterpret_cast<const TXDoneMessage*>(p);
|
2016-12-09 17:21:47 +00:00
|
|
|
this->on_txdone(message.progress);
|
2016-07-27 01:03:40 +00:00
|
|
|
}
|
|
|
|
};
|
2015-08-28 18:50:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|