Merge pull request #461 from notpike/touchtunes

Touchtunes EW Mode Feature
This commit is contained in:
Erwin Ried 2022-01-04 10:55:22 +01:00 committed by GitHub
commit dfa7dfb024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 330 additions and 258 deletions

5
.gitignore vendored
View File

@ -64,4 +64,9 @@ CMakeFiles/
# Host OS leftovers # Host OS leftovers
.DS_Store .DS_Store
/firmware/CMakeCache.txt /firmware/CMakeCache.txt
# Python env
env/
# Other
*.bak *.bak

View File

@ -6,7 +6,8 @@ namespace ui
{ {
add_children({&console, &button_ok}); add_children({&console, &button_ok});
button_ok.on_select = [&nav](Button &) { button_ok.on_select = [&nav](Button &)
{
nav.pop(); nav.pop();
}; };
@ -34,6 +35,7 @@ namespace ui
console.writeln("zhang00963,RedFox-Fr,aldude999"); console.writeln("zhang00963,RedFox-Fr,aldude999");
console.writeln("East2West,fossum,ArjanOnwezen"); console.writeln("East2West,fossum,ArjanOnwezen");
console.writeln("vXxOinvizioNxX,teixeluis"); console.writeln("vXxOinvizioNxX,teixeluis");
console.writeln("Brumi-2021,texasyojimbo");
console.writeln("heurist1,intoxsick"); console.writeln("heurist1,intoxsick");
console.writeln(""); console.writeln("");
break; break;
@ -41,7 +43,7 @@ namespace ui
case 2: case 2:
// https://github.com/eried/portapack-mayhem/graphs/contributors?to=2020-04-12&from=2015-07-31&type=c // https://github.com/eried/portapack-mayhem/graphs/contributors?to=2020-04-12&from=2015-07-31&type=c
console.writeln("\x1B\x06Havoc:\x1B\x10"); console.writeln("\x1B\x06Havoc:\x1B\x10");
console.writeln("furrtek,mrmookie,notpike"); console.writeln("furrtek,mrmookie,NotPike");
console.writeln("mjwaxios,ImDroided,Giorgiofox"); console.writeln("mjwaxios,ImDroided,Giorgiofox");
console.writeln("F4GEV,z4ziggy,xmycroftx"); console.writeln("F4GEV,z4ziggy,xmycroftx");
console.writeln("troussos,silascutler"); console.writeln("troussos,silascutler");

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2017 Furrtek * Copyright (C) 2017 Furrtek
* Copyright (C) 2017 NotPike * Copyright (C) 2022 NotPike
* *
* This file is part of PortaPack. * This file is part of PortaPack.
* *
@ -27,6 +27,7 @@
#include "baseband_api.hpp" #include "baseband_api.hpp"
#include "string_format.hpp" #include "string_format.hpp"
using namespace portapack; using namespace portapack;
using namespace encoders; using namespace encoders;
@ -45,7 +46,13 @@ void TouchTunesView::stop_tx() {
transmitter_model.disable(); transmitter_model.disable();
tx_mode = IDLE; tx_mode = IDLE;
progressbar.set_value(0); progressbar.set_value(0);
text_status.set("Ready");
// EW Mode Check
if(check_ew.value()) {
start_ew();
} else {
text_status.set("Ready");
}
} }
void TouchTunesView::on_tx_progress(const uint32_t progress, const bool done) { void TouchTunesView::on_tx_progress(const uint32_t progress, const bool done) {
@ -72,7 +79,43 @@ void TouchTunesView::on_tx_progress(const uint32_t progress, const bool done) {
} }
} }
// EW (Electronic Warfare) Mode will jam the receiving jukebox
// while still alowing you (the hacker) to send commands
// to the target jukebox.
// EW Mode works by transmitting a CW on 433.92MHz inbetween
// transmission events.
void TouchTunesView::start_ew() {
// Radio
transmitter_model.set_tuning_frequency(433920000);
transmitter_model.set_sampling_rate(3072000U);
transmitter_model.set_rf_amp(true);
transmitter_model.set_baseband_bandwidth(3500000U);
transmitter_model.set_tx_gain(47);
transmitter_model.enable();
//UI
text_status.set("Jamming...");
progressbar.set_max(1);
progressbar.set_value(1);
}
void TouchTunesView::stop_ew() {
// Radio
transmitter_model.disable();
// UI
text_status.set("Ready");
progressbar.set_value(0);
}
void TouchTunesView::start_tx(const uint32_t button_index) { void TouchTunesView::start_tx(const uint32_t button_index) {
// Check EW Mode
if(check_ew.value()) {
stop_ew();
}
std::string fragments = { "" }; std::string fragments = { "" };
size_t bit; size_t bit;
uint64_t frame_data; uint64_t frame_data;
@ -136,6 +179,7 @@ TouchTunesView::TouchTunesView(
&labels, &labels,
&field_pin, &field_pin,
&check_scan, &check_scan,
&check_ew,
&text_status, &text_status,
&progressbar &progressbar
}); });
@ -145,6 +189,15 @@ TouchTunesView::TouchTunesView(
field_pin.on_change = [this](int32_t v) { field_pin.on_change = [this](int32_t v) {
pin = v; pin = v;
}; };
// EW Mode
check_ew.on_select = [this](Checkbox&, bool v) {
if(v){
start_ew();
} else {
stop_ew();
}
};
const auto button_fn = [this](Button& button) { const auto button_fn = [this](Button& button) {
start_tx(button.id); start_tx(button.id);

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2017 Furrtek * Copyright (C) 2017 Furrtek
* Copyright (C) 2018 NotPike * Copyright (C) 2022 NotPike
* *
* This file is part of PortaPack. * This file is part of PortaPack.
* *
@ -127,6 +127,8 @@ private:
void start_tx(const uint32_t button_index); void start_tx(const uint32_t button_index);
void stop_tx(); void stop_tx();
void on_tx_progress(const uint32_t progress, const bool done); void on_tx_progress(const uint32_t progress, const bool done);
void start_ew();
void stop_ew();
struct remote_layout_t { struct remote_layout_t {
Point position; Point position;
@ -191,11 +193,17 @@ private:
}; };
Checkbox check_scan { Checkbox check_scan {
{ 2 * 8, 27 * 8 }, { 2 * 8, 25 * 8 },
4, 4,
"Scan" "Scan"
}; };
Checkbox check_ew {
{ 2 * 8, 29 * 8 },
4,
"EW Mode"
};
Text text_status { Text text_status {
{ 2 * 8, 33 * 8, 128, 16 }, { 2 * 8, 33 * 8, 128, 16 },
"Ready" "Ready"

View File

@ -45,255 +45,252 @@
using namespace sd_card; using namespace sd_card;
namespace ui { namespace ui
{
enum modal_t { enum modal_t
INFO = 0, {
YESNO, INFO = 0,
YESCANCEL, YESNO,
ABORT YESCANCEL,
}; ABORT
class NavigationView : public View {
public:
std::function<void(const View&)> on_view_changed { };
NavigationView() = default;
NavigationView(const NavigationView&) = delete;
NavigationView(NavigationView&&) = delete;
NavigationView& operator=(const NavigationView&) = delete;
NavigationView& operator=(NavigationView&&) = delete;
bool is_top() const;
template<class T, class... Args>
T* push(Args&&... args) {
return reinterpret_cast<T*>(push_view(std::unique_ptr<View>(new T(*this, std::forward<Args>(args)...))));
}
template<class T, class... Args>
T* replace(Args&&... args) {
pop();
return reinterpret_cast<T*>(push_view(std::unique_ptr<View>(new T(*this, std::forward<Args>(args)...))));
}
void push(View* v);
void replace(View* v);
void pop();
void pop_modal();
void display_modal(const std::string& title, const std::string& message);
void display_modal(const std::string& title, const std::string& message, const modal_t type, const std::function<void(bool)> on_choice = nullptr);
void focus() override;
private:
std::vector<std::unique_ptr<View>> view_stack { };
Widget* modal_view { nullptr };
Widget* view() const;
void free_view();
void update_view();
View* push_view(std::unique_ptr<View> new_view);
};
class SystemStatusView : public View {
public:
std::function<void(void)> on_back { };
SystemStatusView(NavigationView& nav);
void set_back_enabled(bool new_value);
void set_title_image_enabled(bool new_value);
void set_title(const std::string new_value);
private:
static constexpr auto default_title = "";
NavigationView& nav_;
Rectangle backdrop {
{ 0 * 8, 0 * 16, 240, 16 },
Color::dark_grey()
}; };
ImageButton button_back { class NavigationView : public View
{ 2, 0 * 16, 16, 16 }, {
&bitmap_icon_previous, public:
Color::white(), std::function<void(const View &)> on_view_changed{};
Color::dark_grey()
NavigationView() = default;
NavigationView(const NavigationView &) = delete;
NavigationView(NavigationView &&) = delete;
NavigationView &operator=(const NavigationView &) = delete;
NavigationView &operator=(NavigationView &&) = delete;
bool is_top() const;
template <class T, class... Args>
T *push(Args &&...args)
{
return reinterpret_cast<T *>(push_view(std::unique_ptr<View>(new T(*this, std::forward<Args>(args)...))));
}
template <class T, class... Args>
T *replace(Args &&...args)
{
pop();
return reinterpret_cast<T *>(push_view(std::unique_ptr<View>(new T(*this, std::forward<Args>(args)...))));
}
void push(View *v);
void replace(View *v);
void pop();
void pop_modal();
void display_modal(const std::string &title, const std::string &message);
void display_modal(const std::string &title, const std::string &message, const modal_t type, const std::function<void(bool)> on_choice = nullptr);
void focus() override;
private:
std::vector<std::unique_ptr<View>> view_stack{};
Widget *modal_view{nullptr};
Widget *view() const;
void free_view();
void update_view();
View *push_view(std::unique_ptr<View> new_view);
}; };
Text title { class SystemStatusView : public View
{ 20, 0, 14 * 8, 1 * 16 }, {
default_title, public:
}; std::function<void(void)> on_back{};
ImageButton button_title { SystemStatusView(NavigationView &nav);
{2, 0, 80, 16},
&bitmap_titlebar_image,
Color::white(),
Color::dark_grey()
};
ImageButton button_speaker { void set_back_enabled(bool new_value);
{ 17 * 8, 0, 2 * 8, 1 * 16 }, void set_title_image_enabled(bool new_value);
&bitmap_icon_speaker_mute, void set_title(const std::string new_value);
Color::light_grey(),
Color::dark_grey() private:
}; static constexpr auto default_title = "";
ImageButton button_stealth { NavigationView &nav_;
{ 19 * 8, 0, 2 * 8, 1 * 16 },
&bitmap_icon_stealth, Rectangle backdrop{
Color::light_grey(), {0 * 8, 0 * 16, 240, 16},
Color::dark_grey() Color::dark_grey()};
};
ImageButton button_back{
/*ImageButton button_textentry { {2, 0 * 16, 16, 16},
&bitmap_icon_previous,
Color::white(),
Color::dark_grey()};
Text title{
{20, 0, 14 * 8, 1 * 16},
default_title,
};
ImageButton button_title{
{2, 0, 80, 16},
&bitmap_titlebar_image,
Color::white(),
Color::dark_grey()};
ImageButton button_speaker{
{17 * 8, 0, 2 * 8, 1 * 16},
&bitmap_icon_speaker_mute,
Color::light_grey(),
Color::dark_grey()};
ImageButton button_stealth{
{19 * 8, 0, 2 * 8, 1 * 16},
&bitmap_icon_stealth,
Color::light_grey(),
Color::dark_grey()};
/*ImageButton button_textentry {
{ 170, 0, 2 * 8, 1 * 16 }, { 170, 0, 2 * 8, 1 * 16 },
&bitmap_icon_unistroke, &bitmap_icon_unistroke,
Color::white(), Color::white(),
Color::dark_grey() Color::dark_grey()
};*/ };*/
ImageButton button_camera { ImageButton button_camera{
{ 21 * 8, 0, 2 * 8, 1 * 16 }, {21 * 8, 0, 2 * 8, 1 * 16},
&bitmap_icon_camera, &bitmap_icon_camera,
Color::white(), Color::white(),
Color::dark_grey() Color::dark_grey()};
ImageButton button_sleep{
{23 * 8, 0, 2 * 8, 1 * 16},
&bitmap_icon_sleep,
Color::white(),
Color::dark_grey()};
ImageButton button_bias_tee{
{25 * 8, 0, 12, 1 * 16},
&bitmap_icon_biast_off,
Color::light_grey(),
Color::dark_grey()};
ImageButton button_clock_status{
{27 * 8, 0 * 16, 2 * 8, 1 * 16},
&bitmap_icon_clk_int,
Color::light_grey(),
Color::dark_grey()};
SDCardStatusView sd_card_status_view{
{28 * 8, 0 * 16, 2 * 8, 1 * 16}};
void on_speaker();
void on_stealth();
void on_bias_tee();
//void on_textentry();
void on_camera();
void on_title();
void refresh();
void on_clk();
MessageHandlerRegistration message_handler_refresh{
Message::ID::StatusRefresh,
[this](const Message *const p)
{
(void)p;
this->refresh();
}};
}; };
ImageButton button_sleep { class InformationView : public View
{ 23 * 8, 0, 2 * 8, 1 * 16 }, {
&bitmap_icon_sleep, public:
Color::white(), InformationView(NavigationView &nav);
Color::dark_grey() void refresh();
};
private:
ImageButton button_bias_tee { static constexpr auto version_string = "v1.4.2";
{ 25 * 8, 0, 12, 1 * 16 }, NavigationView &nav_;
&bitmap_icon_biast_off,
Color::light_grey(), Rectangle backdrop{
Color::dark_grey() {0, 0 * 16, 240, 16},
}; {33, 33, 33}};
ImageButton button_clock_status { Text version{
{ 27 * 8, 0 * 16, 2 * 8, 1 * 16 }, {2, 0, 11 * 8, 16},
&bitmap_icon_clk_int, version_string};
Color::light_grey(),
Color::dark_grey() LiveDateTime ltime{
}; {86, 0, 19 * 8, 16}};
SDCardStatusView sd_card_status_view {
{ 28 * 8, 0 * 16, 2 * 8, 1 * 16 }
}; };
void on_speaker(); class BMPView : public View
void on_stealth(); {
void on_bias_tee(); public:
//void on_textentry(); BMPView(NavigationView &nav);
void on_camera(); void paint(Painter &) override;
void on_title(); void focus() override;
void refresh();
void on_clk();
MessageHandlerRegistration message_handler_refresh {
Message::ID::StatusRefresh,
[this](const Message* const p) {
(void)p;
this->refresh();
}
};
};
class InformationView : public View { private:
public: Text text_info{
InformationView(NavigationView& nav); {4 * 8, 284, 20 * 8, 16},
void refresh(); "Version " VERSION_STRING};
private:
static constexpr auto version_string = "v1.4.2";
NavigationView& nav_;
Rectangle backdrop { Button button_done{
{ 0, 0 * 16, 240, 16 }, {240, 0, 1, 1},
{33, 33, 33} ""};
}; };
Text version { class ReceiversMenuView : public BtnGridView
{2, 0, 11 * 8, 16}, {
version_string public:
ReceiversMenuView(NavigationView &nav);
std::string title() const override { return "Receivers"; };
}; };
LiveDateTime ltime { class TransmittersMenuView : public BtnGridView
{86, 0, 19 * 8, 16} {
public:
TransmittersMenuView(NavigationView &nav);
std::string title() const override { return "Transmitters"; };
}; };
}; class UtilitiesMenuView : public BtnGridView
{
class BMPView : public View { public:
public: UtilitiesMenuView(NavigationView &nav);
BMPView(NavigationView& nav); std::string title() const override { return "Utilities"; };
void paint(Painter&) override;
void focus() override;
private:
Text text_info {
{ 4*8, 284, 20 * 8, 16 },
"Version " VERSION_STRING
}; };
Button button_done { class SystemMenuView : public BtnGridView
{ 240, 0, 1, 1 }, {
"" public:
SystemMenuView(NavigationView &nav);
private:
void hackrf_mode(NavigationView &nav);
}; };
};
class ReceiversMenuView : public BtnGridView { class SystemView : public View
public: {
ReceiversMenuView(NavigationView& nav); public:
std::string title() const override { return "Receivers"; }; SystemView(
}; Context &context,
const Rect parent_rect);
class TransmittersMenuView : public BtnGridView { Context &context() const override;
public:
TransmittersMenuView(NavigationView& nav);
std::string title() const override { return "Transmitters"; };
};
class UtilitiesMenuView : public BtnGridView { private:
public: SystemStatusView status_view{navigation_view};
UtilitiesMenuView(NavigationView& nav); InformationView info_view{navigation_view};
std::string title() const override { return "Utilities"; }; NavigationView navigation_view{};
}; Context &context_;
};
class SystemMenuView : public BtnGridView { /*class NotImplementedView : public View {
public:
SystemMenuView(NavigationView& nav);
private:
void hackrf_mode(NavigationView& nav);
};
class SystemView : public View {
public:
SystemView(
Context& context,
const Rect parent_rect
);
Context& context() const override;
private:
SystemStatusView status_view { navigation_view };
InformationView info_view { navigation_view };
NavigationView navigation_view { };
Context& context_;
};
/*class NotImplementedView : public View {
public: public:
NotImplementedView(NavigationView& nav); NotImplementedView(NavigationView& nav);
@ -311,43 +308,43 @@ private:
}; };
};*/ };*/
class ModalMessageView : public View { class ModalMessageView : public View
public: {
ModalMessageView( public:
NavigationView& nav, ModalMessageView(
const std::string& title, NavigationView &nav,
const std::string& message, const std::string &title,
const modal_t type, const std::string &message,
const std::function<void(bool)> on_choice const modal_t type,
); const std::function<void(bool)> on_choice);
void paint(Painter& painter) override;
void focus() override;
std::string title() const override { return title_; }; void paint(Painter &painter) override;
void focus() override;
private: std::string title() const override { return title_; };
const std::string title_;
const std::string message_;
const modal_t type_;
const std::function<void(bool)> on_choice_;
Button button_ok { private:
{ 10 * 8, 14 * 16, 10 * 8, 48 }, const std::string title_;
"OK", const std::string message_;
const modal_t type_;
const std::function<void(bool)> on_choice_;
Button button_ok{
{10 * 8, 14 * 16, 10 * 8, 48},
"OK",
};
Button button_yes{
{5 * 8, 14 * 16, 8 * 8, 48},
"YES",
};
Button button_no{
{17 * 8, 14 * 16, 8 * 8, 48},
"NO",
};
}; };
Button button_yes {
{ 5 * 8, 14 * 16, 8 * 8, 48 },
"YES",
};
Button button_no {
{ 17 * 8, 14 * 16, 8 * 8, 48 },
"NO",
};
};
} /* namespace ui */ } /* namespace ui */
#endif/*__UI_NAVIGATION_H__*/ #endif /*__UI_NAVIGATION_H__*/

View File

@ -0,0 +1,7 @@
Enclosure
https://www.thingiverse.com/thing:4260973
Cover
https://www.thingiverse.com/thing:4278961