2015-08-28 14:50:42 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-05-27 19:59:13 -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_menu.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
2016-05-27 19:59:13 -04:00
|
|
|
#include "ui_receiver.hpp"
|
2016-05-29 06:06:47 -04:00
|
|
|
#include "ui_textentry.hpp"
|
2015-08-28 14:50:42 -04:00
|
|
|
#include "message.hpp"
|
2016-12-08 15:08:53 -05:00
|
|
|
#include "rds.hpp"
|
|
|
|
|
|
|
|
using namespace rds;
|
2015-08-28 14:50:42 -04:00
|
|
|
|
2016-05-27 19:59:13 -04:00
|
|
|
namespace ui {
|
2015-08-28 14:50:42 -04:00
|
|
|
|
|
|
|
class RDSView : public View {
|
|
|
|
public:
|
2016-02-04 04:27:53 -05:00
|
|
|
RDSView(NavigationView& nav);
|
2015-08-28 14:50:42 -04:00
|
|
|
~RDSView();
|
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
|
2016-12-08 10:13:27 -05:00
|
|
|
std::string title() const override { return "RDS transmit"; };
|
|
|
|
|
2015-08-28 14:50:42 -04:00
|
|
|
private:
|
2016-05-29 06:06:47 -04:00
|
|
|
char PSN[9];
|
|
|
|
char RadioText[25];
|
|
|
|
bool txing = false;
|
2016-12-08 15:08:53 -05:00
|
|
|
RDS_flags rds_flags;
|
2016-05-29 06:06:47 -04:00
|
|
|
|
2016-12-05 06:56:41 -05:00
|
|
|
uint16_t message_length;
|
2016-05-29 06:06:47 -04:00
|
|
|
|
2016-12-05 06:56:41 -05:00
|
|
|
void start_tx();
|
|
|
|
void on_tuning_frequency_changed(rf::Frequency f);
|
2016-05-27 19:59:13 -04:00
|
|
|
|
|
|
|
FrequencyField field_frequency {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 1 * 8, 4 },
|
2016-05-27 19:59:13 -04:00
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Text text_pty {
|
|
|
|
{ 1 * 8, 16 + 8, 4 * 8, 16 },
|
|
|
|
"PTY:"
|
|
|
|
};
|
2016-05-27 19:59:13 -04:00
|
|
|
OptionsField options_pty {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 5 * 8, 16 + 8 },
|
2016-05-29 06:06:47 -04:00
|
|
|
8,
|
2016-05-27 19:59:13 -04:00
|
|
|
{
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "None", 0 },
|
|
|
|
{ "News", 1 },
|
|
|
|
{ "Affairs", 2 },
|
|
|
|
{ "Info", 3 },
|
|
|
|
{ "Sport", 4 },
|
|
|
|
{ "Educate", 5 },
|
|
|
|
{ "Drama", 6 },
|
|
|
|
{ "Culture", 7 },
|
|
|
|
{ "Science", 8 },
|
|
|
|
{ "Varied", 9 },
|
|
|
|
{ "Pop", 10 },
|
|
|
|
{ "Rock", 11 },
|
|
|
|
{ "Easy", 12 },
|
|
|
|
{ "Light", 13 },
|
2016-05-27 19:59:13 -04:00
|
|
|
{ "Classics", 14 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "Other", 15 },
|
|
|
|
{ "Weather", 16 },
|
|
|
|
{ "Finance", 17 },
|
2016-05-27 19:59:13 -04:00
|
|
|
{ "Children", 18 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "Social", 19 },
|
2016-05-27 19:59:13 -04:00
|
|
|
{ "Religion", 20 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "PhoneIn", 21 },
|
|
|
|
{ "Travel", 22 },
|
|
|
|
{ "Leisure", 23 },
|
|
|
|
{ "Jazz", 24 },
|
|
|
|
{ "Country", 25 },
|
2016-05-27 19:59:13 -04:00
|
|
|
{ "National", 26 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "Oldies", 27 },
|
|
|
|
{ "Folk", 28 },
|
|
|
|
{ "Docs", 29 },
|
2016-05-27 19:59:13 -04:00
|
|
|
{ "AlarmTst", 30 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "Alarm", 31 }
|
2016-05-27 19:59:13 -04:00
|
|
|
}
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
2016-05-29 06:06:47 -04:00
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Text text_countrycode {
|
|
|
|
{ 14 * 8, 16 + 8, 4 * 8, 16 },
|
|
|
|
"CC:"
|
|
|
|
};
|
2016-05-29 06:06:47 -04:00
|
|
|
OptionsField options_countrycode {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 17 * 8, 16 + 8 },
|
2016-05-29 06:06:47 -04:00
|
|
|
11,
|
|
|
|
{
|
|
|
|
{ "Albania", 9 },
|
|
|
|
{ "Algeria", 2 },
|
|
|
|
{ "Andorra", 3 },
|
|
|
|
{ "Austria", 10 },
|
|
|
|
{ "Azores", 8 },
|
|
|
|
{ "Belgium", 6 },
|
|
|
|
{ "Belarus", 15 },
|
|
|
|
{ "Bosnia", 15 },
|
|
|
|
{ "Bulgaria", 8 },
|
|
|
|
{ "Canaries", 14 },
|
|
|
|
{ "Croatia", 12 },
|
|
|
|
{ "Cyprus", 2 },
|
|
|
|
{ "Czech-Rep", 2 },
|
|
|
|
{ "Denmark", 9 },
|
|
|
|
{ "Egypt", 15 },
|
|
|
|
{ "Estonia", 2 },
|
|
|
|
{ "Faroe", 9 },
|
|
|
|
{ "Finland", 6 },
|
|
|
|
{ "France", 15 },
|
|
|
|
{ "Germany 1", 13 },
|
|
|
|
{ "Germany 2", 1 },
|
|
|
|
{ "Gibraltar", 10 },
|
|
|
|
{ "Greece", 1 },
|
|
|
|
{ "Hungary", 11 },
|
|
|
|
{ "Iceland", 10 },
|
|
|
|
{ "Iraq", 11 },
|
|
|
|
{ "Ireland", 2 },
|
|
|
|
{ "Israel", 4 },
|
|
|
|
{ "Italy", 5 },
|
|
|
|
{ "Jordan", 5 },
|
|
|
|
{ "Latvia", 9 },
|
|
|
|
{ "Lebanon", 10 },
|
|
|
|
{ "Libya", 13 },
|
|
|
|
{ "Liechtenst.", 9 },
|
|
|
|
{ "Lithuania", 12 },
|
|
|
|
{ "Luxembourg", 7 },
|
|
|
|
{ "Macedonia", 4 },
|
|
|
|
{ "Madeira", 8 },
|
|
|
|
{ "Malta", 12 },
|
|
|
|
{ "Moldova", 1 },
|
|
|
|
{ "Monaco", 11 },
|
|
|
|
{ "Morocco", 1 },
|
|
|
|
{ "Netherlands", 8 },
|
|
|
|
{ "Norway", 15 },
|
|
|
|
{ "Palestine", 8 },
|
|
|
|
{ "Poland", 3 },
|
|
|
|
{ "Portugal", 8 },
|
|
|
|
{ "Romania", 14 },
|
|
|
|
{ "Russia", 7 },
|
|
|
|
{ "San Marino", 3 },
|
|
|
|
{ "Slovakia", 5 },
|
|
|
|
{ "Slovenia", 9 },
|
|
|
|
{ "Spain", 14 },
|
|
|
|
{ "Sweden", 14 },
|
|
|
|
{ "Switzerland", 4 },
|
|
|
|
{ "Syria", 6 },
|
|
|
|
{ "Tunisia", 7 },
|
|
|
|
{ "Turkey", 3 },
|
|
|
|
{ "Ukraine", 6 },
|
|
|
|
{ "U.K.", 12 },
|
|
|
|
{ "Vatican", 4 },
|
|
|
|
{ "Yugoslavia", 13 }
|
|
|
|
}
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Text text_pi_code {
|
|
|
|
{ 1 * 8, 32 + 8, 3 * 8, 16 },
|
|
|
|
"PI:"
|
|
|
|
};
|
|
|
|
SymField sym_pi_code {
|
|
|
|
{ 4 * 8, 32 + 8 },
|
|
|
|
4,
|
2017-01-31 19:21:13 -05:00
|
|
|
SymField::SYMFIELD_HEX
|
2016-12-09 12:21:47 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
Text text_coverage {
|
|
|
|
{ 13 * 8, 32 + 8, 9 * 8, 16 },
|
|
|
|
"Cov:"
|
|
|
|
};
|
2016-05-29 06:06:47 -04:00
|
|
|
OptionsField options_coverage {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 17 * 8, 32 + 8 },
|
|
|
|
12,
|
2016-05-29 06:06:47 -04:00
|
|
|
{
|
|
|
|
{ "Local", 0 },
|
2016-12-09 12:21:47 -05:00
|
|
|
{ "Internat.", 1 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "National", 2 },
|
2016-12-08 10:13:27 -05:00
|
|
|
{ "Sup-regional", 3 },
|
2016-05-29 06:06:47 -04:00
|
|
|
{ "R11", 4 },
|
|
|
|
{ "R12", 5 },
|
|
|
|
{ "R13", 6 },
|
|
|
|
{ "R14", 7 },
|
|
|
|
{ "R15", 8 },
|
|
|
|
{ "R16", 9 },
|
|
|
|
{ "R17", 10 },
|
|
|
|
{ "R18", 11 },
|
|
|
|
{ "R19", 12 },
|
|
|
|
{ "R110", 13 },
|
|
|
|
{ "R111", 14 },
|
|
|
|
{ "R112", 15 }
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox check_mono_stereo {
|
|
|
|
{ 1 * 8, 4 * 16 },
|
|
|
|
6,
|
|
|
|
"Stereo"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox check_TA {
|
|
|
|
{ 12 * 8, 4 * 16 },
|
|
|
|
2,
|
|
|
|
"TA"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox check_TP {
|
|
|
|
{ 18 * 8, 4 * 16 },
|
|
|
|
2,
|
|
|
|
"TP"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
Checkbox check_MS {
|
|
|
|
{ 24 * 8, 4 * 16 },
|
|
|
|
2,
|
|
|
|
"MS"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Text text_psn {
|
|
|
|
{ 2 * 8, 6 * 16, 12 * 8, 16 },
|
|
|
|
"PSN:"
|
|
|
|
};
|
|
|
|
Button button_editpsn {
|
|
|
|
{ 22 * 8, 5 * 16 + 12, 48, 24 },
|
2016-05-29 06:06:47 -04:00
|
|
|
"Set"
|
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
|
|
|
|
Text text_radiotext {
|
|
|
|
{ 2 * 8, 8 * 16, 10 * 8, 16 },
|
|
|
|
"RadioText:"
|
|
|
|
};
|
2016-05-29 06:06:47 -04:00
|
|
|
Text text_radiotexta {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 2 * 8, 9 * 16, 19 * 8, 16 },
|
|
|
|
"-"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
|
|
|
Text text_radiotextb {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 2 * 8, 10 * 16, 19 * 8, 16 },
|
|
|
|
"-"
|
|
|
|
};
|
|
|
|
Button button_editradiotext {
|
|
|
|
{ 22 * 8, 8 * 16 + 12, 48, 24 },
|
|
|
|
"Set"
|
2016-05-29 06:06:47 -04:00
|
|
|
};
|
2016-12-09 12:21:47 -05:00
|
|
|
|
|
|
|
Text text_tx {
|
|
|
|
{ 2 * 8, 14 * 16, 3 * 8, 16 },
|
|
|
|
"TX:"
|
|
|
|
};
|
|
|
|
OptionsField options_tx {
|
|
|
|
{ 5 * 8, 14 * 16 },
|
|
|
|
11,
|
|
|
|
{
|
|
|
|
{ "PSN", 0 },
|
|
|
|
{ "RadioText", 1 },
|
|
|
|
{ "Date & time", 2 }
|
|
|
|
}
|
2015-08-28 14:50:42 -04:00
|
|
|
};
|
|
|
|
|
2016-12-09 12:21:47 -05:00
|
|
|
Button button_tx {
|
|
|
|
{ 3 * 8, 16 * 16, 80, 32 },
|
|
|
|
"START"
|
|
|
|
};
|
2015-08-28 14:50:42 -04:00
|
|
|
Button button_exit {
|
2016-12-09 12:21:47 -05:00
|
|
|
{ 19 * 8, 16 * 16, 64, 32 },
|
2015-08-28 14:50:42 -04:00
|
|
|
"Exit"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|