Hid app improvements

- Move new mouse jiggler into mouse jiggler stealth
- Set stealth jiggler max time default value to 4 min and min value to 1 min
- Various UI fixes
- Merge changes from OFW commit 11d7f53854

([FL-3770, FL-3680] HID App improvements and little extra (3518))
This commit is contained in:
MX 2024-05-15 19:08:10 +03:00
parent fb8f59fa1d
commit 3005f6cd9a
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
20 changed files with 428 additions and 353 deletions

View file

@ -20,6 +20,7 @@ enum HidDebugSubmenuIndex {
HidSubmenuIndexMouse,
HidSubmenuIndexMouseClicker,
HidSubmenuIndexMouseJiggler,
HidSubmenuIndexMouseJigglerStealth,
HidSubmenuIndexPushToTalk,
HidSubmenuIndexRemovePairing,
};
@ -34,7 +35,6 @@ bool hid_back_event_callback(void* context) {
furi_assert(context);
Hid* app = context;
FURI_LOG_D("HID", "Back event");
app->view_id = HidViewSubmenu;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu);
return true;
}
@ -57,42 +57,32 @@ static void hid_submenu_callback(void* context, uint32_t index) {
furi_assert(context);
Hid* app = context;
if(index == HidSubmenuIndexKeynote) {
app->view_id = HidViewKeynote;
hid_keynote_set_orientation(app->hid_keynote, false);
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeynote);
} else if(index == HidSubmenuIndexKeynoteVertical) {
app->view_id = HidViewKeynote;
hid_keynote_set_orientation(app->hid_keynote, true);
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeynote);
} else if(index == HidSubmenuIndexKeyboard) {
app->view_id = HidViewKeyboard;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewKeyboard);
} else if(index == HidSubmenuIndexNumpad) {
app->view_id = HidViewNumpad;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewNumpad);
} else if(index == HidSubmenuIndexMedia) {
app->view_id = HidViewMedia;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMedia);
} else if(index == HidSubmenuIndexMusicMacOs) {
app->view_id = HidViewMusicMacOs;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMusicMacOs);
} else if(index == HidSubmenuIndexMovie) {
app->view_id = HidViewMovie;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMovie);
} else if(index == HidSubmenuIndexMouse) {
app->view_id = HidViewMouse;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouse);
} else if(index == HidSubmenuIndexTikTok) {
app->view_id = BtHidViewTikTok;
view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewTikTok);
} else if(index == HidSubmenuIndexMouseClicker) {
app->view_id = HidViewMouseClicker;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseClicker);
} else if(index == HidSubmenuIndexMouseJiggler) {
app->view_id = HidViewMouseJiggler;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseJiggler);
} else if(index == HidSubmenuIndexMouseJigglerStealth) {
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewMouseJigglerStealth);
} else if(index == HidSubmenuIndexPushToTalk) {
app->view_id = HidViewPushToTalkMenu;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewPushToTalkMenu);
} else if(index == HidSubmenuIndexRemovePairing) {
scene_manager_next_scene(app->scene_manager, HidSceneUnpair);
@ -119,6 +109,7 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
hid_mouse_set_connected_status(hid->hid_mouse, connected);
hid_mouse_clicker_set_connected_status(hid->hid_mouse_clicker, connected);
hid_mouse_jiggler_set_connected_status(hid->hid_mouse_jiggler, connected);
hid_mouse_jiggler_stealth_set_connected_status(hid->hid_mouse_jiggler_stealth, connected);
hid_ptt_set_connected_status(hid->hid_ptt, connected);
hid_tiktok_set_connected_status(hid->hid_tiktok, connected);
}
@ -156,67 +147,41 @@ Hid* hid_alloc(void) {
app->scene_manager = scene_manager_alloc(&hid_scene_handlers, app);
// Device Type Submenu view
app->device_type_submenu = submenu_alloc();
app->submenu = submenu_alloc();
submenu_add_item(app->submenu, "Keynote", HidSubmenuIndexKeynote, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Keynote", HidSubmenuIndexKeynote, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu,
app->submenu,
"Keynote Vertical",
HidSubmenuIndexKeynoteVertical,
hid_submenu_callback,
app);
submenu_add_item(app->submenu, "Keyboard", HidSubmenuIndexKeyboard, hid_submenu_callback, app);
submenu_add_item(app->submenu, "Numpad", HidSubmenuIndexNumpad, hid_submenu_callback, app);
submenu_add_item(app->submenu, "Media", HidSubmenuIndexMedia, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Keyboard", HidSubmenuIndexKeyboard, hid_submenu_callback, app);
app->submenu, "Apple Music macOS", HidSubmenuIndexMusicMacOs, hid_submenu_callback, app);
submenu_add_item(app->submenu, "Movie", HidSubmenuIndexMovie, hid_submenu_callback, app);
submenu_add_item(app->submenu, "Mouse", HidSubmenuIndexMouse, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Numpad", HidSubmenuIndexNumpad, hid_submenu_callback, app);
app->submenu, "TikTok / YT Shorts", HidSubmenuIndexTikTok, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Media", HidSubmenuIndexMedia, hid_submenu_callback, app);
app->submenu, "Mouse Clicker", HidSubmenuIndexMouseClicker, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu,
"Apple Music macOS",
HidSubmenuIndexMusicMacOs,
app->submenu, "Mouse Jiggler", HidSubmenuIndexMouseJiggler, hid_submenu_callback, app);
submenu_add_item(
app->submenu,
"Mouse Jiggler Stealth",
HidSubmenuIndexMouseJigglerStealth,
hid_submenu_callback,
app);
submenu_add_item(
app->device_type_submenu, "Movie", HidSubmenuIndexMovie, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Mouse", HidSubmenuIndexMouse, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu,
"TikTok / YT Shorts",
HidSubmenuIndexTikTok,
hid_submenu_callback,
app);
submenu_add_item(
app->device_type_submenu,
"Mouse Clicker",
HidSubmenuIndexMouseClicker,
hid_submenu_callback,
app);
submenu_add_item(
app->device_type_submenu,
"Mouse Jiggler",
HidSubmenuIndexMouseJiggler,
hid_submenu_callback,
app);
submenu_add_item(
app->device_type_submenu,
"PushToTalk",
HidSubmenuIndexPushToTalk,
hid_submenu_callback,
app);
app->submenu, "PushToTalk", HidSubmenuIndexPushToTalk, hid_submenu_callback, app);
#ifdef HID_TRANSPORT_BLE
submenu_add_item(
app->device_type_submenu,
"Remove Pairing",
HidSubmenuIndexRemovePairing,
hid_submenu_callback,
app);
app->submenu, "Remove Pairing", HidSubmenuIndexRemovePairing, hid_submenu_callback, app);
#endif
view_set_previous_callback(submenu_get_view(app->device_type_submenu), hid_exit);
view_dispatcher_add_view(
app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->device_type_submenu));
app->view_id = HidViewSubmenu;
view_set_previous_callback(submenu_get_view(app->submenu), hid_exit);
view_dispatcher_add_view(app->view_dispatcher, HidViewSubmenu, submenu_get_view(app->submenu));
return app;
}
@ -285,6 +250,12 @@ Hid* hid_app_alloc_view(void* context) {
app->view_dispatcher,
HidViewMouseJiggler,
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler));
// Mouse jiggler stealth view
app->hid_mouse_jiggler_stealth = hid_mouse_jiggler_stealth_alloc(app);
view_dispatcher_add_view(
app->view_dispatcher,
HidViewMouseJigglerStealth,
hid_mouse_jiggler_stealth_get_view(app->hid_mouse_jiggler_stealth));
// PushToTalk view
app->hid_ptt_menu = hid_ptt_menu_alloc(app);
@ -307,7 +278,7 @@ void hid_free(Hid* app) {
#endif
// Free views
view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
submenu_free(app->device_type_submenu);
submenu_free(app->submenu);
view_dispatcher_remove_view(app->view_dispatcher, HidViewDialog);
dialog_ex_free(app->dialog);
view_dispatcher_remove_view(app->view_dispatcher, HidViewPopup);
@ -330,6 +301,8 @@ void hid_free(Hid* app) {
hid_mouse_clicker_free(app->hid_mouse_clicker);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouseJiggler);
hid_mouse_jiggler_free(app->hid_mouse_jiggler);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouseJigglerStealth);
hid_mouse_jiggler_stealth_free(app->hid_mouse_jiggler_stealth);
view_dispatcher_remove_view(app->view_dispatcher, HidViewPushToTalkMenu);
hid_ptt_menu_free(app->hid_ptt_menu);
view_dispatcher_remove_view(app->view_dispatcher, HidViewPushToTalk);

View file

@ -27,6 +27,7 @@
#include "views/hid_mouse.h"
#include "views/hid_mouse_clicker.h"
#include "views/hid_mouse_jiggler.h"
#include "views/hid_mouse_jiggler_stealth.h"
#include "views/hid_tiktok.h"
#include "views/hid_ptt.h"
#include "views/hid_ptt_menu.h"
@ -35,11 +36,6 @@
#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys"
typedef enum {
HidTransportUsb,
HidTransportBle,
} HidTransport;
typedef struct Hid Hid;
struct Hid {
@ -49,7 +45,7 @@ struct Hid {
NotificationApp* notifications;
ViewDispatcher* view_dispatcher;
SceneManager* scene_manager;
Submenu* device_type_submenu;
Submenu* submenu;
DialogEx* dialog;
Popup* popup;
HidKeynote* hid_keynote;
@ -61,12 +57,10 @@ struct Hid {
HidMouse* hid_mouse;
HidMouseClicker* hid_mouse_clicker;
HidMouseJiggler* hid_mouse_jiggler;
HidMouseJigglerStealth* hid_mouse_jiggler_stealth;
HidTikTok* hid_tiktok;
HidPushToTalk* hid_ptt;
HidPushToTalkMenu* hid_ptt_menu;
HidTransport transport;
uint32_t view_id;
};
void bt_hid_remove_pairing(Hid* app);

View file

@ -1,3 +1,2 @@
ADD_SCENE(hid, main, Main)
ADD_SCENE(hid, unpair, Unpair)
ADD_SCENE(hid, exit_confirm, ExitConfirm)
ADD_SCENE(hid, unpair, Unpair)

View file

@ -1,45 +0,0 @@
#include "../hid.h"
#include "../views.h"
static void hid_scene_exit_confirm_dialog_callback(DialogExResult result, void* context) {
furi_assert(context);
Hid* app = context;
if(result == DialogExResultLeft) {
view_dispatcher_stop(app->view_dispatcher);
} else if(result == DialogExResultRight) {
scene_manager_previous_scene(app->scene_manager);
} else if(result == DialogExResultCenter) {
scene_manager_search_and_switch_to_previous_scene(app->scene_manager, HidSceneMain);
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewSubmenu);
}
}
void hid_scene_exit_confirm_on_enter(void* context) {
Hid* app = context;
// Exit dialog view
dialog_ex_reset(app->dialog);
dialog_ex_set_result_callback(app->dialog, hid_scene_exit_confirm_dialog_callback);
dialog_ex_set_context(app->dialog, app);
dialog_ex_set_left_button_text(app->dialog, "Exit");
dialog_ex_set_right_button_text(app->dialog, "Stay");
dialog_ex_set_center_button_text(app->dialog, "Menu");
dialog_ex_set_header(app->dialog, "Close Current App?", 16, 12, AlignLeft, AlignTop);
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewDialog);
}
bool hid_scene_exit_confirm_on_event(void* context, SceneManagerEvent event) {
Hid* app = context;
bool consumed = false;
UNUSED(app);
UNUSED(event);
return consumed;
}
void hid_scene_exit_confirm_on_exit(void* context) {
Hid* app = context;
dialog_ex_reset(app->dialog);
}

View file

@ -4,7 +4,8 @@
void hid_scene_main_on_enter(void* context) {
Hid* app = context;
view_dispatcher_switch_to_view(app->view_dispatcher, app->view_id);
view_dispatcher_switch_to_view(
app->view_dispatcher, scene_manager_get_scene_state(app->scene_manager, HidSceneMain));
}
bool hid_scene_main_on_event(void* context, SceneManagerEvent event) {

View file

@ -9,6 +9,7 @@ typedef enum {
HidViewMouse,
HidViewMouseClicker,
HidViewMouseJiggler,
HidViewMouseJigglerStealth,
BtHidViewTikTok,
HidViewPushToTalk,
HidViewPushToTalkMenu,

View file

@ -23,7 +23,6 @@ typedef struct {
bool ok_pressed;
bool back_pressed;
bool connected;
HidTransport transport;
} HidKeyboardModel;
typedef struct {
@ -229,8 +228,9 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeyboardModel* model = context;
// Header
if((!model->connected) && (model->transport == HidTransportBle)) {
// Header
#ifdef HID_TRANSPORT_BLE
if((!model->connected)) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard");
@ -243,6 +243,7 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
canvas, 4, 60, AlignLeft, AlignBottom, "Waiting for Connection...");
return; // Dont render the keyboard if we are not yet connected
}
#endif
canvas_set_font(canvas, FontKeyboard);
// Start shifting the all keys up if on the next row (Scrolling)
@ -400,13 +401,7 @@ HidKeyboard* hid_keyboard_alloc(Hid* bt_hid) {
view_set_input_callback(hid_keyboard->view, hid_keyboard_input_callback);
with_view_model(
hid_keyboard->view,
HidKeyboardModel * model,
{
model->transport = bt_hid->transport;
model->y = 1;
},
true);
hid_keyboard->view, HidKeyboardModel * model, { model->y = 1; }, true);
return hid_keyboard;
}

View file

@ -19,7 +19,6 @@ typedef struct {
bool ok_pressed;
bool back_pressed;
bool connected;
HidTransport transport;
} HidKeynoteModel;
static void hid_keynote_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
@ -39,14 +38,14 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeynoteModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keynote");
@ -92,12 +91,12 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) {
canvas_set_color(canvas, ColorBlack);
// Ok
canvas_draw_icon(canvas, 63, 25, &I_Space_65x18);
canvas_draw_icon(canvas, 63, 24, &I_Space_65x18);
if(model->ok_pressed) {
elements_slightly_rounded_box(canvas, 66, 27, 60, 13);
elements_slightly_rounded_box(canvas, 66, 26, 60, 13);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 74, 29, &I_Ok_btn_9x9);
canvas_draw_icon(canvas, 74, 28, &I_Ok_btn_9x9);
elements_multiline_text_aligned(canvas, 91, 36, AlignLeft, AlignBottom, "Space");
canvas_set_color(canvas, ColorBlack);
@ -115,19 +114,19 @@ static void hid_keynote_draw_vertical_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidKeynoteModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Keynote");
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Keynote");
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Keynote");
#else
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Keynote");
#endif
canvas_draw_icon(canvas, 2, 18, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
@ -275,9 +274,6 @@ HidKeynote* hid_keynote_alloc(Hid* hid) {
view_set_draw_callback(hid_keynote->view, hid_keynote_draw_callback);
view_set_input_callback(hid_keynote->view, hid_keynote_input_callback);
with_view_model(
hid_keynote->view, HidKeynoteModel * model, { model->transport = hid->transport; }, true);
return hid_keynote;
}

View file

@ -22,7 +22,6 @@ typedef struct {
bool ok_pressed;
bool connected;
bool back_pressed;
HidTransport transport;
} HidMediaModel;
static void hid_media_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
@ -42,14 +41,14 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMediaModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Media");
@ -60,9 +59,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Up
if(model->up_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 6, &I_S_UP_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 79, 9, &I_Volup_8x6);
@ -70,9 +69,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Down
if(model->down_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 68, 36, &I_S_DOWN_31x15);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 80, 41, &I_Voldwn_6x6);
@ -80,9 +79,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Left
if(model->left_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 61, 13, &I_S_LEFT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 67, 28, CanvasDirectionRightToLeft);
@ -92,9 +91,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Right
if(model->right_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 91, 13, &I_S_RIGHT_15x31);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 96, 28, CanvasDirectionLeftToRight);
@ -104,9 +103,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Ok
if(model->ok_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 74, 19, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
hid_media_draw_arrow(canvas, 80, 28, CanvasDirectionLeftToRight);
@ -116,9 +115,9 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
// Exit
if(model->back_pressed) {
canvas_set_bitmap_mode(canvas, 1);
canvas_set_bitmap_mode(canvas, true);
canvas_draw_icon(canvas, 107, 33, &I_Pressed_Button_19x19);
canvas_set_bitmap_mode(canvas, 0);
canvas_set_bitmap_mode(canvas, false);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 111, 38, &I_Pin_back_arrow_10x10);
@ -210,9 +209,6 @@ HidMedia* hid_media_alloc(Hid* hid) {
view_set_draw_callback(hid_media->view, hid_media_draw_callback);
view_set_input_callback(hid_media->view, hid_media_input_callback);
with_view_model(
hid_media->view, HidMediaModel * model, { model->transport = hid->transport; }, true);
return hid_media;
}

View file

@ -21,21 +21,20 @@ typedef struct {
bool right_mouse_pressed;
bool connected;
uint8_t acceleration;
HidTransport transport;
} HidMouseModel;
static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse");
@ -219,9 +218,6 @@ HidMouse* hid_mouse_alloc(Hid* hid) {
view_set_draw_callback(hid_mouse->view, hid_mouse_draw_callback);
view_set_input_callback(hid_mouse->view, hid_mouse_input_callback);
with_view_model(
hid_mouse->view, HidMouseModel * model, { model->transport = hid->transport; }, true);
return hid_mouse;
}

View file

@ -18,7 +18,6 @@ typedef struct {
bool connected;
bool running;
int rate;
HidTransport transport;
} HidMouseClickerModel;
static void hid_mouse_clicker_start_or_restart_timer(void* context) {
@ -43,17 +42,17 @@ static void hid_mouse_clicker_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseClickerModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Clicker");
elements_multiline_text_aligned(canvas, 27, 3, AlignLeft, AlignTop, "Mouse Clicker");
// Ok
canvas_draw_icon(canvas, 63, 25, &I_Space_65x18);
@ -179,10 +178,7 @@ HidMouseClicker* hid_mouse_clicker_alloc(Hid* hid) {
with_view_model(
hid_mouse_clicker->view,
HidMouseClickerModel * model,
{
model->transport = hid->transport;
model->rate = DEFAULT_CLICK_RATE;
},
{ model->rate = DEFAULT_CLICK_RATE; },
true);
return hid_mouse_clicker;

View file

@ -15,44 +15,41 @@ struct HidMouseJiggler {
typedef struct {
bool connected;
bool running;
int min_interval; // Minimum interval for random range
int max_interval; // Maximum interval for random range
HidTransport transport;
int interval_idx;
uint8_t counter;
} HidMouseJigglerModel;
const int intervals[6] = {500, 2000, 5000, 10000, 30000, 60000};
static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseJigglerModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
// Title "Mouse Jiggler"
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 2, AlignLeft, AlignTop, "Mouse Jiggler");
elements_multiline_text_aligned(canvas, 27, 2, AlignLeft, AlignTop, "Mouse Jiggler");
// Display the current min interval in minutes
canvas_set_font(canvas, FontSecondary); // Assuming there's a smaller font available
FuriString* min_interval_str = furi_string_alloc_printf("Min: %d min", model->min_interval);
elements_multiline_text_aligned(
canvas, 0, 16, AlignLeft, AlignTop, furi_string_get_cstr(min_interval_str));
furi_string_free(min_interval_str);
// Timeout
elements_multiline_text(canvas, AlignLeft, 26, "Interval (ms):");
canvas_set_font(canvas, FontSecondary);
if(model->interval_idx != 0) canvas_draw_icon(canvas, 74, 19, &I_ButtonLeft_4x7);
if(model->interval_idx != (int)COUNT_OF(intervals) - 1)
canvas_draw_icon(canvas, 80, 19, &I_ButtonRight_4x7);
FuriString* interval_str = furi_string_alloc_printf("%d", intervals[model->interval_idx]);
elements_multiline_text(canvas, 91, 26, furi_string_get_cstr(interval_str));
furi_string_free(interval_str);
// Display the current max interval in minutes
FuriString* max_interval_str = furi_string_alloc_printf("Max: %d min", model->max_interval);
elements_multiline_text_aligned(
canvas, 0, 28, AlignLeft, AlignTop, furi_string_get_cstr(max_interval_str));
furi_string_free(max_interval_str);
// "Press Start to jiggle"
canvas_set_font(canvas, FontPrimary);
elements_multiline_text(canvas, AlignLeft, 50, "Press Start\nto jiggle");
elements_multiline_text(canvas, AlignLeft, 40, "Press Start\nto jiggle");
canvas_set_font(canvas, FontSecondary);
// Ok
canvas_draw_icon(canvas, 63, 30, &I_Space_65x18);
@ -81,20 +78,11 @@ static void hid_mouse_jiggler_timer_callback(void* context) {
HidMouseJigglerModel * model,
{
if(model->running) {
// Generate a random interval in minutes and convert to milliseconds
int randomIntervalMinutes =
model->min_interval + rand() % (model->max_interval - model->min_interval + 1);
// Randomize the mouse movement distance and direction
int move_x = (rand() % 2001) - 1000; // Randomly between -1000 and 1000
int move_y = (rand() % 2001) - 1000; // Randomly between -1000 and 1000
// Perform the mouse move with the randomized values
hid_hal_mouse_move(hid_mouse_jiggler->hid, move_x, move_y);
// Restart timer with the new random interval
furi_timer_stop(hid_mouse_jiggler->timer);
furi_timer_start(hid_mouse_jiggler->timer, randomIntervalMinutes * 60000);
model->counter++;
hid_hal_mouse_move(
hid_mouse_jiggler->hid,
(model->counter % 2 == 0) ? MOUSE_MOVE_SHORT : -MOUSE_MOVE_SHORT,
0);
}
},
false);
@ -116,51 +104,23 @@ static bool hid_mouse_jiggler_input_callback(InputEvent* event, void* context) {
hid_mouse_jiggler->view,
HidMouseJigglerModel * model,
{
if(event->type == InputTypePress) {
switch(event->key) {
case InputKeyOk:
model->running = !model->running;
if(model->running) {
furi_timer_stop(hid_mouse_jiggler->timer);
int randomIntervalMinutes =
model->min_interval +
rand() % (model->max_interval - model->min_interval + 1);
furi_timer_start(hid_mouse_jiggler->timer, randomIntervalMinutes * 60000);
}
consumed = true;
break;
case InputKeyUp:
if(!model->running && model->min_interval < model->max_interval) {
model->min_interval++; // Increment min interval by 1 minute
}
consumed = true;
break;
case InputKeyDown:
if(!model->running && model->min_interval > 1) { // Minimum 1 minute
model->min_interval--; // Decrement min interval by 1 minute
}
consumed = true;
break;
case InputKeyRight:
if(!model->running && model->max_interval < 30) { // Maximum 30 minutes
model->max_interval++; // Increment max interval by 1 minute
}
consumed = true;
break;
case InputKeyLeft:
if(!model->running && model->max_interval > model->min_interval + 1) {
model->max_interval--; // Decrement max interval by 1 minute
}
consumed = true;
break;
default:
break;
}
if(event->type == InputTypePress && event->key == InputKeyOk) {
model->running = !model->running;
if(model->running) {
furi_timer_stop(hid_mouse_jiggler->timer);
furi_timer_start(hid_mouse_jiggler->timer, intervals[model->interval_idx]);
};
consumed = true;
}
if(event->type == InputTypePress && event->key == InputKeyRight && !model->running &&
model->interval_idx < (int)COUNT_OF(intervals) - 1) {
model->interval_idx++;
consumed = true;
}
if(event->type == InputTypePress && event->key == InputKeyLeft && !model->running &&
model->interval_idx > 0) {
model->interval_idx--;
consumed = true;
}
},
true);
@ -185,14 +145,7 @@ HidMouseJiggler* hid_mouse_jiggler_alloc(Hid* hid) {
hid_mouse_jiggler_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler);
with_view_model(
hid_mouse_jiggler->view,
HidMouseJigglerModel * model,
{
// Initialize the min and max interval values
model->min_interval = 2; // 2 minutes
model->max_interval = 15; // 15 minutes
},
true);
hid_mouse_jiggler->view, HidMouseJigglerModel * model, { model->interval_idx = 2; }, true);
return hid_mouse_jiggler;
}

View file

@ -2,6 +2,8 @@
#include <gui/view.h>
#define MOUSE_MOVE_SHORT 5
typedef struct Hid Hid;
typedef struct HidMouseJiggler HidMouseJiggler;

View file

@ -0,0 +1,224 @@
#include "hid_mouse_jiggler_stealth.h"
#include <gui/elements.h>
#include "../hid.h"
#include "hid_icons.h"
#define TAG "HidMouseJigglerStealth"
struct HidMouseJigglerStealth {
View* view;
Hid* hid;
FuriTimer* timer;
};
typedef struct {
bool connected;
bool running;
int min_interval; // Minimum interval for random range
int max_interval; // Maximum interval for random range
} HidMouseJigglerStealthModel;
static void hid_mouse_jiggler_stealth_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
HidMouseJigglerStealthModel* model = context;
// Header
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
// Title "Mouse Jiggler"
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 10, 2, AlignLeft, AlignTop, "Mouse Jiggler Stealth");
// Display the current min interval in minutes
canvas_set_font(canvas, FontSecondary); // Assuming there's a smaller font available
FuriString* min_interval_str = furi_string_alloc_printf("Min: %d min", model->min_interval);
elements_multiline_text_aligned(
canvas, 0, 16, AlignLeft, AlignTop, furi_string_get_cstr(min_interval_str));
furi_string_free(min_interval_str);
// Display the current max interval in minutes
FuriString* max_interval_str = furi_string_alloc_printf("Max: %d min", model->max_interval);
elements_multiline_text_aligned(
canvas, 0, 28, AlignLeft, AlignTop, furi_string_get_cstr(max_interval_str));
furi_string_free(max_interval_str);
// "Press Start to jiggle"
canvas_set_font(canvas, FontPrimary);
elements_multiline_text(canvas, AlignLeft, 50, "Press Start\nto jiggle");
// Ok
canvas_draw_icon(canvas, 63, 30, &I_Space_65x18);
if(model->running) {
elements_slightly_rounded_box(canvas, 66, 32, 60, 13);
canvas_set_color(canvas, ColorWhite);
}
canvas_draw_icon(canvas, 74, 34, &I_Ok_btn_9x9);
if(model->running) {
elements_multiline_text_aligned(canvas, 91, 41, AlignLeft, AlignBottom, "Stop");
} else {
elements_multiline_text_aligned(canvas, 91, 41, AlignLeft, AlignBottom, "Start");
}
canvas_set_color(canvas, ColorBlack);
// Back
canvas_draw_icon(canvas, 74, 54, &I_Pin_back_arrow_10x8);
elements_multiline_text_aligned(canvas, 91, 62, AlignLeft, AlignBottom, "Quit");
}
static void hid_mouse_jiggler_stealth_timer_callback(void* context) {
furi_assert(context);
HidMouseJigglerStealth* hid_mouse_jiggler = context;
with_view_model(
hid_mouse_jiggler->view,
HidMouseJigglerStealthModel * model,
{
if(model->running) {
// Generate a random interval in minutes and convert to milliseconds
int randomIntervalMinutes =
model->min_interval + rand() % (model->max_interval - model->min_interval + 1);
// Randomize the mouse movement distance and direction
int move_x = (rand() % 2001) - 1000; // Randomly between -1000 and 1000
int move_y = (rand() % 2001) - 1000; // Randomly between -1000 and 1000
// Perform the mouse move with the randomized values
hid_hal_mouse_move(hid_mouse_jiggler->hid, move_x, move_y);
// Restart timer with the new random interval
furi_timer_stop(hid_mouse_jiggler->timer);
furi_timer_start(hid_mouse_jiggler->timer, randomIntervalMinutes * 60000);
}
},
false);
}
static void hid_mouse_jiggler_stealth_exit_callback(void* context) {
furi_assert(context);
HidMouseJigglerStealth* hid_mouse_jiggler = context;
furi_timer_stop(hid_mouse_jiggler->timer);
}
static bool hid_mouse_jiggler_stealth_input_callback(InputEvent* event, void* context) {
furi_assert(context);
HidMouseJigglerStealth* hid_mouse_jiggler = context;
bool consumed = false;
with_view_model(
hid_mouse_jiggler->view,
HidMouseJigglerStealthModel * model,
{
if(event->type == InputTypePress) {
switch(event->key) {
case InputKeyOk:
model->running = !model->running;
if(model->running) {
furi_timer_stop(hid_mouse_jiggler->timer);
int randomIntervalMinutes =
model->min_interval +
rand() % (model->max_interval - model->min_interval + 1);
furi_timer_start(hid_mouse_jiggler->timer, randomIntervalMinutes * 60000);
}
consumed = true;
break;
case InputKeyUp:
if(!model->running && model->min_interval < model->max_interval) {
model->min_interval++; // Increment min interval by 1 minute
}
consumed = true;
break;
case InputKeyDown:
if(!model->running && model->min_interval > 1) { // Minimum 1 minute
model->min_interval--; // Decrement min interval by 1 minute
}
consumed = true;
break;
case InputKeyRight:
if(!model->running && model->max_interval < 30) { // Maximum 30 minutes
model->max_interval++; // Increment max interval by 1 minute
}
consumed = true;
break;
case InputKeyLeft:
if(!model->running && model->max_interval > model->min_interval + 1) {
model->max_interval--; // Decrement max interval by 1 minute
}
consumed = true;
break;
default:
break;
}
}
},
true);
return consumed;
}
HidMouseJigglerStealth* hid_mouse_jiggler_stealth_alloc(Hid* hid) {
HidMouseJigglerStealth* hid_mouse_jiggler = malloc(sizeof(HidMouseJigglerStealth));
hid_mouse_jiggler->view = view_alloc();
view_set_context(hid_mouse_jiggler->view, hid_mouse_jiggler);
view_allocate_model(
hid_mouse_jiggler->view, ViewModelTypeLocking, sizeof(HidMouseJigglerStealthModel));
view_set_draw_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_stealth_draw_callback);
view_set_input_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_stealth_input_callback);
view_set_exit_callback(hid_mouse_jiggler->view, hid_mouse_jiggler_stealth_exit_callback);
hid_mouse_jiggler->hid = hid;
hid_mouse_jiggler->timer = furi_timer_alloc(
hid_mouse_jiggler_stealth_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler);
with_view_model(
hid_mouse_jiggler->view,
HidMouseJigglerStealthModel * model,
{
// Initialize the min and max interval values
model->min_interval = 1; // 1 minutes
model->max_interval = 4; // 4 minutes
},
true);
return hid_mouse_jiggler;
}
void hid_mouse_jiggler_stealth_free(HidMouseJigglerStealth* hid_mouse_jiggler) {
furi_assert(hid_mouse_jiggler);
furi_timer_stop(hid_mouse_jiggler->timer);
furi_timer_free(hid_mouse_jiggler->timer);
view_free(hid_mouse_jiggler->view);
free(hid_mouse_jiggler);
}
View* hid_mouse_jiggler_stealth_get_view(HidMouseJigglerStealth* hid_mouse_jiggler) {
furi_assert(hid_mouse_jiggler);
return hid_mouse_jiggler->view;
}
void hid_mouse_jiggler_stealth_set_connected_status(
HidMouseJigglerStealth* hid_mouse_jiggler,
bool connected) {
furi_assert(hid_mouse_jiggler);
with_view_model(
hid_mouse_jiggler->view,
HidMouseJigglerStealthModel * model,
{ model->connected = connected; },
true);
}

View file

@ -0,0 +1,16 @@
#pragma once
#include <gui/view.h>
typedef struct Hid Hid;
typedef struct HidMouseJigglerStealth HidMouseJigglerStealth;
HidMouseJigglerStealth* hid_mouse_jiggler_stealth_alloc(Hid* bt_hid);
void hid_mouse_jiggler_stealth_free(HidMouseJigglerStealth* hid_mouse_jiggler);
View* hid_mouse_jiggler_stealth_get_view(HidMouseJigglerStealth* hid_mouse_jiggler);
void hid_mouse_jiggler_stealth_set_connected_status(
HidMouseJigglerStealth* hid_mouse_jiggler,
bool connected);

View file

@ -22,7 +22,6 @@ typedef struct {
bool ok_pressed;
bool connected;
bool back_pressed;
HidTransport transport;
} HidMovieModel;
static void hid_movie_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
@ -43,13 +42,13 @@ static void hid_movie_draw_callback(Canvas* canvas, void* context) {
HidMovieModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Movie");
@ -211,9 +210,6 @@ HidMovie* hid_movie_alloc(Hid* hid) {
view_set_draw_callback(hid_movie->view, hid_movie_draw_callback);
view_set_input_callback(hid_movie->view, hid_movie_input_callback);
with_view_model(
hid_movie->view, HidMovieModel * model, { model->transport = hid->transport; }, true);
return hid_movie;
}

View file

@ -22,7 +22,6 @@ typedef struct {
bool ok_pressed;
bool connected;
bool back_pressed;
HidTransport transport;
} HidMusicMacosModel;
static void hid_music_macos_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
@ -43,13 +42,13 @@ static void hid_music_macos_draw_callback(Canvas* canvas, void* context) {
HidMusicMacosModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Music");
@ -215,12 +214,6 @@ HidMusicMacos* hid_music_macos_alloc(Hid* hid) {
view_set_draw_callback(hid_music_macos->view, hid_music_macos_draw_callback);
view_set_input_callback(hid_music_macos->view, hid_music_macos_input_callback);
with_view_model(
hid_music_macos->view,
HidMusicMacosModel * model,
{ model->transport = hid->transport; },
true);
return hid_music_macos;
}

View file

@ -23,7 +23,6 @@ typedef struct {
bool back_pressed;
bool connected;
char key_string[5];
HidTransport transport;
} HidNumpadModel;
typedef struct {
@ -135,27 +134,29 @@ static void hid_numpad_draw_callback(Canvas* canvas, void* context) {
// Header
canvas_set_font(canvas, FontPrimary);
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
elements_multiline_text_aligned(
canvas, 7, 60, AlignLeft, AlignBottom, "Waiting for\nConnection...");
}
elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Numpad");
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Numpad");
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
elements_multiline_text_aligned(
canvas, 7, 60, AlignLeft, AlignBottom, "Waiting for\nConnection...");
}
elements_multiline_text_aligned(canvas, 20, 3, AlignLeft, AlignTop, "Numpad");
#else
elements_multiline_text_aligned(canvas, 12, 3, AlignLeft, AlignTop, "Numpad");
#endif
canvas_draw_icon(canvas, 3, 18, &I_Pin_back_arrow_10x8);
canvas_set_font(canvas, FontSecondary);
elements_multiline_text_aligned(canvas, 15, 19, AlignLeft, AlignTop, "Hold to exit");
if(!model->connected && (model->transport == HidTransportBle)) {
#ifdef HID_TRANSPORT_BLE
if(!model->connected) {
return;
}
#endif
canvas_set_font(canvas, FontKeyboard);
uint8_t initY = 0; // = model->y == 0 ? 0 : 1;
@ -289,13 +290,7 @@ HidNumpad* hid_numpad_alloc(Hid* bt_hid) {
view_set_input_callback(hid_numpad->view, hid_numpad_input_callback);
with_view_model(
hid_numpad->view,
HidNumpadModel * model,
{
model->transport = bt_hid->transport;
model->y = 0;
},
true);
hid_numpad->view, HidNumpadModel * model, { model->y = 0; }, true);
return hid_numpad;
}

View file

@ -32,7 +32,6 @@ typedef struct {
size_t osIndex;
size_t appIndex;
size_t window_position;
HidTransport transport;
PushToTalkActionCallback callback_trigger_mute;
PushToTalkActionCallback callback_trigger_camera;
PushToTalkActionCallback callback_trigger_hand;
@ -575,13 +574,13 @@ static void hid_ptt_draw_callback(Canvas* canvas, void* context) {
// Header
canvas_set_font(canvas, FontPrimary);
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
// OS and App labels
canvas_set_font(canvas, FontSecondary);
@ -816,7 +815,6 @@ HidPushToTalk* hid_ptt_alloc(Hid* hid) {
hid_ptt->view,
HidPushToTalkModel * model,
{
model->transport = hid->transport;
model->muted = true; // assume we're muted
model->os = furi_string_alloc();
model->app = furi_string_alloc();

View file

@ -20,7 +20,6 @@ typedef struct {
bool connected;
bool is_cursor_set;
bool back_mouse_pressed;
HidTransport transport;
} HidTikTokModel;
static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
@ -28,13 +27,13 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
HidTikTokModel* model = context;
// Header
if(model->transport == HidTransportBle) {
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#ifdef HID_TRANSPORT_BLE
if(model->connected) {
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
} else {
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
}
#endif
canvas_set_font(canvas, FontPrimary);
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "TikTok /");
@ -234,9 +233,6 @@ HidTikTok* hid_tiktok_alloc(Hid* bt_hid) {
view_set_draw_callback(hid_tiktok->view, hid_tiktok_draw_callback);
view_set_input_callback(hid_tiktok->view, hid_tiktok_input_callback);
with_view_model(
hid_tiktok->view, HidTikTokModel * model, { model->transport = bt_hid->transport; }, true);
return hid_tiktok;
}