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"
|
2015-11-12 19:19:05 -05:00
|
|
|
#include "message.hpp"
|
2016-12-01 00:58:47 -05:00
|
|
|
#include "transmitter_model.hpp"
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class JammerView : public View {
|
|
|
|
public:
|
2016-02-04 04:27:53 -05:00
|
|
|
JammerView(NavigationView& nav);
|
2015-11-12 19:19:05 -05:00
|
|
|
~JammerView();
|
|
|
|
|
|
|
|
void focus() override;
|
2016-07-26 21:03:40 -04:00
|
|
|
|
|
|
|
std::string title() const override { return "Jammer"; };
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
private:
|
2017-01-29 03:29:16 -05:00
|
|
|
typedef struct jammer_range {
|
2016-12-05 06:56:41 -05:00
|
|
|
bool enabled;
|
2015-11-12 19:19:05 -05:00
|
|
|
rf::Frequency min;
|
|
|
|
rf::Frequency max;
|
2017-01-29 03:29:16 -05:00
|
|
|
} jammer_range_t;
|
2016-12-05 06:56:41 -05:00
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
jammer_range_t frequency_range[3];
|
2015-11-12 19:19:05 -05:00
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
void update_range(const uint32_t n);
|
|
|
|
void update_button(const uint32_t n);
|
2017-01-17 03:42:35 -05:00
|
|
|
void on_retune(const rf::Frequency freq, const uint32_t range);
|
2017-01-29 03:29:16 -05:00
|
|
|
|
|
|
|
const jammer_range_t range_presets[23][3] = {
|
2015-11-12 19:19:05 -05:00
|
|
|
// Orange
|
2017-01-29 03:29:16 -05:00
|
|
|
{{ true, 935000000, 945000000 }, // GSM 900 BW:10M
|
|
|
|
{ false, 1808000000, 1832000000 }, // GSM 1800 BW:24M
|
|
|
|
{ false, 0, 0 }},
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// SFR
|
2017-01-29 03:29:16 -05:00
|
|
|
{{ true, 950000000, 960000000 }, // GSM 900 BW:10M
|
|
|
|
{ false, 1832000000, 1853000000 }, // GSM 1800 BW:21M
|
|
|
|
{ false, 0, 0 }},
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// Bouygues
|
2017-01-29 03:29:16 -05:00
|
|
|
{{ true, 925000000, 935000000 }, // GSM 900 BW:10M
|
|
|
|
{ false, 1858000000, 1880000000 }, // GSM 1800 BW:22M
|
|
|
|
{ false, 0, 0 }},
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// Free
|
2017-01-29 03:29:16 -05:00
|
|
|
{{ true, 945000000, 950000000 }, // GSM 900 BW:5M
|
|
|
|
{ false, 0, 0 },
|
2017-02-02 04:29:14 -05:00
|
|
|
{ false, 0, 0 }},
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// GSM-R
|
2017-01-29 03:29:16 -05:00
|
|
|
{{ true, 921000000, 925000000 }, // GSM 900 BW:4M
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
// DECT
|
|
|
|
{{ true, 1880000000, 1900000000 }, // BW: 20MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
|
2016-12-01 00:58:47 -05:00
|
|
|
// PMV AFSK
|
2015-11-12 19:19:05 -05:00
|
|
|
{{ true, 162930000, 162970000 }, // BW: 40kHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
|
|
|
|
// ISM 433
|
2016-12-05 06:56:41 -05:00
|
|
|
{{ true, 433050000, 434790000 }, // Center: 433.92MHz BW: 0.2%
|
2015-11-12 19:19:05 -05:00
|
|
|
{ false, 0, 0 },
|
2015-11-13 21:44:49 -05:00
|
|
|
{ false, 0, 0 }},
|
|
|
|
|
2017-01-17 02:00:42 -05:00
|
|
|
// ISM 868
|
2016-12-06 07:31:38 -05:00
|
|
|
{{ true, 868000000, 868200000 }, // Center: 868.2MHz BW: 40kHz
|
2016-12-01 00:58:47 -05:00
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
|
2016-07-25 10:21:27 -04:00
|
|
|
// GPS L1 & L2
|
2017-01-17 09:27:37 -05:00
|
|
|
{{ true, 1575420000 - 500000, 1575420000 + 500000 }, // BW: 1MHz
|
|
|
|
{ false, 1227600000 - 1000000, 1227600000 + 1000000 }, // BW: 2MHz
|
2017-01-17 02:00:42 -05:00
|
|
|
{ false, 0, 0 }},
|
|
|
|
|
|
|
|
// WLAN 2.4G CH1
|
|
|
|
{{ true, 2412000000 - 11000000, 2412000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH2
|
|
|
|
{{ true, 2417000000 - 11000000, 2417000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH3
|
|
|
|
{{ true, 2422000000 - 11000000, 2422000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH4
|
|
|
|
{{ true, 2427000000 - 11000000, 2427000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH5
|
|
|
|
{{ true, 2432000000 - 11000000, 2432000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH6
|
|
|
|
{{ true, 2437000000 - 11000000, 2437000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH7
|
|
|
|
{{ true, 2442000000 - 11000000, 2442000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH8
|
|
|
|
{{ true, 2447000000 - 11000000, 2447000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH9
|
|
|
|
{{ true, 2452000000 - 11000000, 2452000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH10
|
|
|
|
{{ true, 2457000000 - 11000000, 2457000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH11
|
|
|
|
{{ true, 2462000000 - 11000000, 2462000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH12
|
|
|
|
{{ true, 2467000000 - 11000000, 2467000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
|
|
|
// WLAN 2.4G CH13
|
|
|
|
{{ true, 2472000000 - 11000000, 2472000000 + 11000000}, // BW: 22MHz
|
|
|
|
{ false, 0, 0 },
|
|
|
|
{ false, 0, 0 }},
|
2016-07-25 10:21:27 -04:00
|
|
|
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
bool jamming = false;
|
|
|
|
|
|
|
|
Text text_type {
|
2017-01-29 03:29:16 -05:00
|
|
|
{ 3 * 8, 4, 5 * 8, 16 },
|
2015-11-12 19:19:05 -05:00
|
|
|
"Type:"
|
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
OptionsField options_type {
|
|
|
|
{ 9 * 8, 4 },
|
|
|
|
5,
|
2015-11-12 19:19:05 -05:00
|
|
|
{
|
|
|
|
{ "Ramp ", 0 },
|
2017-01-29 03:29:16 -05:00
|
|
|
{ "Noise", 1 },
|
|
|
|
{ "Tones", 2 }
|
2015-11-12 19:19:05 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-01-17 03:42:35 -05:00
|
|
|
Text text_range_number {
|
2017-02-02 04:29:14 -05:00
|
|
|
{ 18 * 8, 4, 2 * 8, 16 },
|
|
|
|
"--"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
Text text_range_total {
|
2017-02-02 04:29:14 -05:00
|
|
|
{ 20 * 8, 4, 3 * 8, 16 },
|
|
|
|
"/--"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
|
|
|
|
2017-01-29 03:29:16 -05:00
|
|
|
Text text_speed {
|
|
|
|
{ 2 * 8, 20, 6 * 8, 16 },
|
|
|
|
"Speed:"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
OptionsField options_speed {
|
|
|
|
{ 9 * 8, 20 },
|
|
|
|
6,
|
2015-11-12 19:19:05 -05:00
|
|
|
{
|
2017-01-29 03:29:16 -05:00
|
|
|
{ "10Hz ", 0 },
|
|
|
|
{ "100Hz ", 1 },
|
|
|
|
{ "1kHz ", 2 },
|
|
|
|
{ "10kHz ", 3 },
|
|
|
|
{ "100kHz", 4 }
|
2015-11-12 19:19:05 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Text text_preset {
|
2017-01-29 03:29:16 -05:00
|
|
|
{ 1 * 8, 36, 7 * 8, 16 },
|
|
|
|
"Preset:"
|
2015-11-12 19:19:05 -05:00
|
|
|
};
|
|
|
|
OptionsField options_preset {
|
2017-01-29 03:29:16 -05:00
|
|
|
{ 9 * 8, 36 },
|
2017-01-17 02:00:42 -05:00
|
|
|
16,
|
2015-11-12 19:19:05 -05:00
|
|
|
{
|
2017-01-17 02:00:42 -05:00
|
|
|
{ "GSM Orange FR ", 0 },
|
|
|
|
{ "GSM SFR FR ", 1 },
|
|
|
|
{ "GSM Bouygues FR", 2 },
|
|
|
|
{ "GSM Free FR ", 3 },
|
|
|
|
{ "GSM-R FR ", 4 },
|
|
|
|
{ "DECT ", 5 },
|
|
|
|
{ "Optifib ", 6 },
|
|
|
|
{ "ISM 433 ", 7 },
|
|
|
|
{ "ISM 868 ", 8 },
|
|
|
|
{ "GPS ", 9 },
|
|
|
|
{ "WLAN 2.4G CH1 ", 10 },
|
|
|
|
{ "WLAN 2.4G CH2 ", 11 },
|
|
|
|
{ "WLAN 2.4G CH3 ", 12 },
|
|
|
|
{ "WLAN 2.4G CH4 ", 13 },
|
|
|
|
{ "WLAN 2.4G CH5 ", 14 },
|
|
|
|
{ "WLAN 2.4G CH6 ", 15 },
|
|
|
|
{ "WLAN 2.4G CH7 ", 16 },
|
|
|
|
{ "WLAN 2.4G CH8 ", 17 },
|
|
|
|
{ "WLAN 2.4G CH9 ", 18 },
|
|
|
|
{ "WLAN 2.4G CH10 ", 19 },
|
|
|
|
{ "WLAN 2.4G CH11 ", 20 },
|
|
|
|
{ "WLAN 2.4G CH12 ", 21 },
|
|
|
|
{ "WLAN 2.4G CH13 ", 22 }
|
2015-11-12 19:19:05 -05:00
|
|
|
}
|
|
|
|
};
|
2017-01-29 03:29:16 -05:00
|
|
|
|
|
|
|
Text text_hop {
|
|
|
|
{ 5 * 8, 52, 10 * 8, 16 },
|
|
|
|
"Hop:"
|
|
|
|
};
|
|
|
|
OptionsField options_hop {
|
|
|
|
{ 9 * 8, 52 },
|
|
|
|
5,
|
|
|
|
{
|
|
|
|
{ "10ms ", 1 },
|
|
|
|
{ "50ms ", 5 },
|
|
|
|
{ "100ms", 10 },
|
|
|
|
{ "1s ", 100 },
|
|
|
|
{ "2s ", 200 },
|
|
|
|
{ "5s ", 500 },
|
|
|
|
{ "10s ", 1000 }
|
|
|
|
}
|
|
|
|
};
|
2017-01-17 09:27:37 -05:00
|
|
|
|
|
|
|
std::array<Checkbox, 3> checkboxes { };
|
2017-01-17 03:42:35 -05:00
|
|
|
std::array<Button, 6> buttons_freq { };
|
2017-01-17 09:27:37 -05:00
|
|
|
std::array<Text, 3> texts_info { };
|
2015-11-12 19:19:05 -05:00
|
|
|
|
|
|
|
Button button_transmit {
|
2017-01-29 03:29:16 -05:00
|
|
|
{ 1 * 8, 16 * 16, 80, 48 },
|
2015-11-12 19:19:05 -05:00
|
|
|
"START"
|
|
|
|
};
|
|
|
|
|
|
|
|
Button button_exit {
|
2017-01-29 03:29:16 -05:00
|
|
|
{ 19 * 8, 16 * 16, 80, 48 },
|
2015-11-12 19:19:05 -05:00
|
|
|
"Exit"
|
|
|
|
};
|
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 */
|