2015-11-12 19:19:05 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
2016-12-01 00:58:47 -05:00
|
|
|
* Copyright (C) 2016 Furrtek
|
2015-11-12 19:19:05 -05: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_font_fixed_8x16.hpp"
|
2016-12-01 00:58:47 -05:00
|
|
|
#include "ui_navigation.hpp"
|
2017-08-11 19:27:05 -04:00
|
|
|
#include "ui_tabview.hpp"
|
2016-12-01 00:58:47 -05:00
|
|
|
#include "transmitter_model.hpp"
|
2017-02-13 00:35:13 -05:00
|
|
|
#include "message.hpp"
|
|
|
|
#include "jammer.hpp"
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
using namespace jammer;
|
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
namespace ui {
|
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
class RangeView : public View {
|
2015-11-12 19:19:05 -05:00
|
|
|
public:
|
2017-08-11 19:27:05 -04:00
|
|
|
RangeView(NavigationView& nav);
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
void focus() override;
|
2017-08-12 02:07:21 -04:00
|
|
|
void paint(Painter&) override;
|
2016-07-26 21:03:40 -04:00
|
|
|
|
2017-08-12 02:07:21 -04:00
|
|
|
jammer_range_t frequency_range { false, 0, 0 };
|
2017-08-11 19:27:05 -04:00
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
private:
|
2017-08-12 02:07:21 -04:00
|
|
|
void update_min(rf::Frequency f);
|
|
|
|
void update_max(rf::Frequency f);
|
|
|
|
void update_center(rf::Frequency f);
|
|
|
|
void update_width(uint32_t w);
|
|
|
|
|
|
|
|
uint32_t width { };
|
|
|
|
rf::Frequency center { };
|
2016-12-05 06:56:41 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
static constexpr Style style_info {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::grey(),
|
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
static constexpr jammer_range_t range_presets[] = {
|
|
|
|
// GSM900 Orange
|
|
|
|
{ true, 935000000, 945000000 }, // BW:10M
|
|
|
|
// GSM1800 Orange
|
2017-08-12 02:07:21 -04:00
|
|
|
{ true, 1808000000, 1832000000 }, // BW:24M
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
// GSM900 SFR
|
|
|
|
{ true, 950000000, 960000000 }, // BW:10M
|
|
|
|
// GSM1800 SFR
|
2017-08-12 02:07:21 -04:00
|
|
|
{ true, 1832000000, 1853000000 }, // BW:21M
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
// GSM900 Bouygues
|
|
|
|
{ true, 925000000, 935000000 }, // BW:10M
|
|
|
|
// GSM1800 Bouygues
|
2017-08-12 02:07:21 -04:00
|
|
|
{ true, 1858000000, 1880000000 }, // BW:22M
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
// GSM900 Free
|
|
|
|
{ true, 945000000, 950000000 }, // BW:5M
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// GSM-R
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 921000000, 925000000 }, // BW:4M
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// DECT
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 1880000000, 1900000000 }, // BW: 20MHz
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2016-12-01 00:58:47 -05:00
|
|
|
// PMV AFSK
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 162930000, 162970000 }, // BW: 40kHz
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// ISM 433
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 433050000, 434790000 }, // Center: 433.92MHz BW: 0.2%
|
2015-11-13 21:44:49 -05:00
|
|
|
|
2017-01-17 02:00:42 -05:00
|
|
|
// ISM 868
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 868000000, 868200000 }, // Center: 868.2MHz BW: 40kHz
|
2016-12-01 00:58:47 -05:00
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
// GPS L1
|
|
|
|
{ true, 1575420000 - 500000, 1575420000 + 500000 }, // BW: 1MHz
|
|
|
|
// GPS L2
|
2017-08-12 02:07:21 -04:00
|
|
|
{ true, 1227600000 - 1000000, 1227600000 + 1000000 }, // BW: 2MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
|
|
|
|
// WLAN 2.4G CH1
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2412000000 - 11000000, 2412000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH2
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2417000000 - 11000000, 2417000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH3
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2422000000 - 11000000, 2422000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH4
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2427000000 - 11000000, 2427000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH5
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2432000000 - 11000000, 2432000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH6
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2437000000 - 11000000, 2437000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH7
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2442000000 - 11000000, 2442000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH8
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2447000000 - 11000000, 2447000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH9
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2452000000 - 11000000, 2452000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH10
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2457000000 - 11000000, 2457000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH11
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2462000000 - 11000000, 2462000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH12
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2467000000 - 11000000, 2467000000 + 11000000}, // BW: 22MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
// WLAN 2.4G CH13
|
2017-08-11 19:27:05 -04:00
|
|
|
{ true, 2472000000 - 11000000, 2472000000 + 11000000}, // BW: 22MHz
|
|
|
|
};
|
|
|
|
|
|
|
|
Labels labels {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ { 1 * 8, 4 * 8 }, "Preset:", Color::light_grey() },
|
|
|
|
{ { 2 * 8, 9 * 8 + 4 }, "Start", Color::light_grey() },
|
|
|
|
{ { 23 * 8, 9 * 8 + 4 }, "Stop", Color::light_grey() },
|
|
|
|
{ { 12 * 8, 6 * 8 }, "Center", Color::light_grey() },
|
|
|
|
{ { 12 * 8 + 4, 14 * 8 }, "Width", Color::light_grey() }
|
2017-08-11 19:27:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Checkbox check_enabled {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 7 * 8, 4 },
|
2017-08-11 19:27:05 -04:00
|
|
|
12,
|
|
|
|
"Enable range",
|
|
|
|
false
|
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_preset {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 9 * 8, 4 * 8 },
|
2017-08-11 19:27:05 -04:00
|
|
|
19,
|
|
|
|
{
|
|
|
|
{ "GSM900 Orange FR", 0 },
|
|
|
|
{ "GSM1800 Orange FR", 1 },
|
|
|
|
{ "GSM900 SFR FR", 2 },
|
|
|
|
{ "GSM1800 SFR FR", 3 },
|
|
|
|
{ "GSM900 Bouygues FR", 4 },
|
|
|
|
{ "GSM1800 Bouygues FR", 5 },
|
2017-08-12 02:07:21 -04:00
|
|
|
{ "GSM Free FR", 6 },
|
|
|
|
{ "GSM-R FR", 7 },
|
|
|
|
{ "DECT", 8 },
|
|
|
|
{ "Optifib", 9 },
|
|
|
|
{ "ISM 433", 10 },
|
|
|
|
{ "ISM 868", 11 },
|
|
|
|
{ "GPS L1", 12 },
|
|
|
|
{ "GPS L2", 13 },
|
|
|
|
{ "WLAN 2.4G CH1", 14 },
|
|
|
|
{ "WLAN 2.4G CH2", 15 },
|
|
|
|
{ "WLAN 2.4G CH3", 16 },
|
|
|
|
{ "WLAN 2.4G CH4", 17 },
|
|
|
|
{ "WLAN 2.4G CH5", 18 },
|
|
|
|
{ "WLAN 2.4G CH6", 19 },
|
|
|
|
{ "WLAN 2.4G CH7", 20 },
|
|
|
|
{ "WLAN 2.4G CH8", 21 },
|
|
|
|
{ "WLAN 2.4G CH9", 22 },
|
|
|
|
{ "WLAN 2.4G CH10", 23 },
|
|
|
|
{ "WLAN 2.4G CH11", 24 },
|
|
|
|
{ "WLAN 2.4G CH12", 25 },
|
|
|
|
{ "WLAN 2.4G CH13", 26 }
|
2017-08-11 19:27:05 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_min {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 0 * 8, 6 * 16, 11 * 8, 28 },
|
2017-08-11 19:27:05 -04:00
|
|
|
""
|
|
|
|
};
|
|
|
|
Button button_max {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 19 * 8, 6 * 16, 11 * 8, 28 },
|
2017-08-11 19:27:05 -04:00
|
|
|
""
|
|
|
|
};
|
2017-08-12 02:07:21 -04:00
|
|
|
Button button_center {
|
|
|
|
{ 76, 4 * 16, 11 * 8, 28 },
|
|
|
|
""
|
|
|
|
};
|
|
|
|
Button button_width {
|
|
|
|
{ 76, 8 * 16, 11 * 8, 28 },
|
2017-08-11 19:27:05 -04:00
|
|
|
""
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
2017-08-11 19:27:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class JammerView : public View {
|
|
|
|
public:
|
|
|
|
JammerView(NavigationView& nav);
|
|
|
|
~JammerView();
|
|
|
|
|
2017-08-12 02:07:21 -04:00
|
|
|
JammerView(const JammerView&) = delete;
|
|
|
|
JammerView(JammerView&&) = delete;
|
|
|
|
JammerView& operator=(const JammerView&) = delete;
|
|
|
|
JammerView& operator=(JammerView&&) = delete;
|
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
void focus() override;
|
|
|
|
|
|
|
|
std::string title() const override { return "Jammer"; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationView& nav_;
|
|
|
|
|
2017-08-12 02:07:21 -04:00
|
|
|
void start_tx();
|
|
|
|
void stop_tx();
|
|
|
|
void set_jammer_channel(uint32_t i, uint32_t width, uint64_t center, uint32_t duration);
|
2017-08-11 19:27:05 -04:00
|
|
|
void on_retune(const rf::Frequency freq, const uint32_t range);
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-12 02:07:21 -04:00
|
|
|
JammerChannel * jammer_channels = (JammerChannel*)shared_memory.bb_data.data;
|
2017-02-13 00:35:13 -05:00
|
|
|
bool jamming { false };
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-08-12 02:07:21 -04:00
|
|
|
static constexpr Style style_val {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::green(),
|
|
|
|
};
|
|
|
|
static constexpr Style style_cancel {
|
|
|
|
.font = font::fixed_8x16,
|
|
|
|
.background = Color::black(),
|
|
|
|
.foreground = Color::red(),
|
|
|
|
};
|
|
|
|
|
2017-08-11 19:27:05 -04:00
|
|
|
RangeView view_range_a { nav_ };
|
|
|
|
RangeView view_range_b { nav_ };
|
|
|
|
RangeView view_range_c { nav_ };
|
|
|
|
|
|
|
|
std::array<RangeView*, 3> range_views { &view_range_a, &view_range_b, &view_range_c };
|
|
|
|
|
|
|
|
TabView tab_view {
|
|
|
|
{ "Range 1", Color::white(), range_views[0] },
|
|
|
|
{ "Range 2", Color::white(), range_views[1] },
|
|
|
|
{ "Range 3", Color::white(), range_views[2] },
|
|
|
|
};
|
|
|
|
|
2017-02-13 00:35:13 -05:00
|
|
|
Labels labels {
|
2017-08-11 19:27:05 -04:00
|
|
|
{ { 3 * 8, 12 * 16 }, "Type:", Color::light_grey() },
|
|
|
|
{ { 2 * 8, 13 * 16 }, "Speed:", Color::light_grey() },
|
|
|
|
{ { 5 * 8, 14 * 16 }, "Hop:", Color::light_grey() }
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
2017-02-13 00:35:13 -05:00
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
OptionsField options_type {
|
2017-08-11 19:27:05 -04:00
|
|
|
{ 9 * 8, 12 * 16 },
|
2017-08-12 02:07:21 -04:00
|
|
|
8,
|
2015-11-12 19:19:05 -05:00
|
|
|
{
|
2017-08-12 02:07:21 -04:00
|
|
|
{ "Rand FSK", 0 },
|
|
|
|
{ "FM tone", 1 },
|
|
|
|
{ "CW sweep", 2 },
|
|
|
|
{ "Rand CW", 3 },
|
2015-11-12 19:19:05 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-17 03:42:35 -05:00
|
|
|
Text text_range_number {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 22 * 8, 12 * 16, 2 * 8, 16 },
|
2017-02-02 04:29:14 -05:00
|
|
|
"--"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
Text text_range_total {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 24 * 8, 12 * 16, 3 * 8, 16 },
|
2017-02-02 04:29:14 -05:00
|
|
|
"/--"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
OptionsField options_speed {
|
2017-08-11 19:27:05 -04:00
|
|
|
{ 9 * 8, 13 * 16 },
|
2017-01-29 03:29:16 -05:00
|
|
|
6,
|
2015-11-12 19:19:05 -05:00
|
|
|
{
|
2017-02-13 00:35:13 -05:00
|
|
|
{ "10Hz ", 10 },
|
|
|
|
{ "100Hz ", 100 },
|
|
|
|
{ "1kHz ", 1000 },
|
|
|
|
{ "10kHz ", 10000 },
|
|
|
|
{ "100kHz", 100000 }
|
2015-11-12 19:19:05 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
OptionsField options_hop {
|
2017-08-11 19:27:05 -04:00
|
|
|
{ 9 * 8, 14 * 16 },
|
2017-01-29 03:29:16 -05:00
|
|
|
5,
|
|
|
|
{
|
|
|
|
{ "10ms ", 1 },
|
|
|
|
{ "50ms ", 5 },
|
|
|
|
{ "100ms", 10 },
|
|
|
|
{ "1s ", 100 },
|
|
|
|
{ "2s ", 200 },
|
|
|
|
{ "5s ", 500 },
|
|
|
|
{ "10s ", 1000 }
|
|
|
|
}
|
|
|
|
};
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
Button button_transmit {
|
2017-08-12 02:07:21 -04:00
|
|
|
{ 9 * 8, 16 * 16, 96, 48 },
|
2015-11-12 19:19:05 -05:00
|
|
|
"START"
|
|
|
|
};
|
|
|
|
|
2016-07-26 21:03:40 -04:00
|
|
|
MessageHandlerRegistration message_handler_retune {
|
|
|
|
Message::ID::Retune,
|
|
|
|
[this](Message* const p) {
|
|
|
|
const auto message = static_cast<const RetuneMessage*>(p);
|
2017-01-17 03:42:35 -05:00
|
|
|
this->on_retune(message->freq, message->range);
|
2016-07-26 21:03:40 -04:00
|
|
|
}
|
2016-12-01 00:58:47 -05:00
|
|
|
};
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|