mayhem-firmware/firmware/application/ui_lcr.hpp

183 lines
3.9 KiB
C++
Raw Normal View History

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