Skip to content

Commit

Permalink
HID remote: added latest changes + movie and PTT
Browse files Browse the repository at this point in the history
  • Loading branch information
hryamzik committed Nov 17, 2023
1 parent 4b3e8ab commit 4a2a326
Show file tree
Hide file tree
Showing 45 changed files with 1,550 additions and 360 deletions.
Binary file removed applications/system/hid_app/assets/Alt_11x7.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed applications/system/hid_app/assets/Cmd_15x7.png
Binary file not shown.
Binary file removed applications/system/hid_app/assets/Ctrl_15x7.png
Binary file not shown.
Binary file removed applications/system/hid_app/assets/Del_12x7.png
Binary file not shown.
Binary file removed applications/system/hid_app/assets/Esc_14x7.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added applications/system/hid_app/assets/Mic_btn_8x10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added applications/system/hid_app/assets/S_UP_31x15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed applications/system/hid_app/assets/Tab_15x7.png
Binary file not shown.
Binary file modified applications/system/hid_app/assets/Voldwn_6x6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified applications/system/hid_app/assets/Volup_8x6.png
86 changes: 68 additions & 18 deletions applications/system/hid_app/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ enum HidDebugSubmenuIndex {
HidSubmenuIndexKeynote,
HidSubmenuIndexKeynoteVertical,
HidSubmenuIndexKeyboard,
HidSubmenuIndexNumpad,
HidSubmenuIndexMedia,
HidSubmenuIndexTikTok,
HidSubmenuIndexMovie,
HidSubmenuIndexTikShorts,
HidSubmenuIndexMouse,
HidSubmenuIndexMouseClicker,
HidSubmenuIndexMouseJiggler,
HidSubmenuIndexPtt,
};

static void hid_submenu_callback(void* context, uint32_t index) {
Expand All @@ -30,21 +33,30 @@ static void hid_submenu_callback(void* context, uint32_t index) {
} 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 == 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 == HidSubmenuIndexTikShorts) {
app->view_id = BtHidViewTikShorts;
view_dispatcher_switch_to_view(app->view_dispatcher, BtHidViewTikShorts);
} 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 == HidSubmenuIndexPtt) {
app->view_id = HidViewPtt;
view_dispatcher_switch_to_view(app->view_dispatcher, HidViewPtt);
}
}

Expand All @@ -61,11 +73,14 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
}
hid_keynote_set_connected_status(hid->hid_keynote, connected);
hid_keyboard_set_connected_status(hid->hid_keyboard, connected);
hid_numpad_set_connected_status(hid->hid_numpad, connected);
hid_media_set_connected_status(hid->hid_media, connected);
hid_movie_set_connected_status(hid->hid_movie, connected);
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_tiktok_set_connected_status(hid->hid_tiktok, connected);
hid_ptt_set_connected_status(hid->hid_ptt, connected);
hid_tikshorts_set_connected_status(hid->hid_tikshorts, connected);
}

static void hid_dialog_callback(DialogExResult result, void* context) {
Expand All @@ -80,6 +95,11 @@ static void hid_dialog_callback(DialogExResult result, void* context) {
}
}

static uint32_t hid_menu_view(void* context) {
UNUSED(context);
return HidViewSubmenu;
}

static uint32_t hid_exit_confirm_view(void* context) {
UNUSED(context);
return HidViewExitConfirm;
Expand Down Expand Up @@ -119,15 +139,19 @@ Hid* hid_alloc(HidTransport transport) {
app);
submenu_add_item(
app->device_type_submenu, "Keyboard", HidSubmenuIndexKeyboard, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Numpad", HidSubmenuIndexNumpad, hid_submenu_callback, app);
submenu_add_item(
app->device_type_submenu, "Media", HidSubmenuIndexMedia, 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);
if(app->transport == HidTransportBle) {
submenu_add_item(
app->device_type_submenu,
"TikTok Controller",
HidSubmenuIndexTikTok,
"TikTok / YT Shorts",
HidSubmenuIndexTikShorts,
hid_submenu_callback,
app);
}
Expand All @@ -143,6 +167,8 @@ Hid* hid_alloc(HidTransport transport) {
HidSubmenuIndexMouseJiggler,
hid_submenu_callback,
app);
submenu_add_item(
app->device_type_submenu, "PTT", HidSubmenuIndexPtt, hid_submenu_callback, app);
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));
Expand All @@ -167,27 +193,39 @@ Hid* hid_app_alloc_view(void* context) {

// Keynote view
app->hid_keynote = hid_keynote_alloc(app);
view_set_previous_callback(hid_keynote_get_view(app->hid_keynote), hid_exit_confirm_view);
view_set_previous_callback(hid_keynote_get_view(app->hid_keynote), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewKeynote, hid_keynote_get_view(app->hid_keynote));

// Keyboard view
app->hid_keyboard = hid_keyboard_alloc(app);
view_set_previous_callback(hid_keyboard_get_view(app->hid_keyboard), hid_exit_confirm_view);
view_set_previous_callback(hid_keyboard_get_view(app->hid_keyboard), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewKeyboard, hid_keyboard_get_view(app->hid_keyboard));

//Numpad keyboard view
app->hid_numpad = hid_numpad_alloc(app);
view_set_previous_callback(hid_numpad_get_view(app->hid_numpad), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewNumpad, hid_numpad_get_view(app->hid_numpad));

// Media view
app->hid_media = hid_media_alloc(app);
view_set_previous_callback(hid_media_get_view(app->hid_media), hid_exit_confirm_view);
view_set_previous_callback(hid_media_get_view(app->hid_media), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewMedia, hid_media_get_view(app->hid_media));

// Movie view
app->hid_movie = hid_movie_alloc(app);
view_set_previous_callback(hid_movie_get_view(app->hid_movie), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewMovie, hid_movie_get_view(app->hid_movie));

// TikTok view
app->hid_tiktok = hid_tiktok_alloc(app);
view_set_previous_callback(hid_tiktok_get_view(app->hid_tiktok), hid_exit_confirm_view);
// TikTok / YT Shorts view
app->hid_tikshorts = hid_tikshorts_alloc(app);
view_set_previous_callback(hid_tikshorts_get_view(app->hid_tikshorts), hid_exit_confirm_view);
view_dispatcher_add_view(
app->view_dispatcher, BtHidViewTikTok, hid_tiktok_get_view(app->hid_tiktok));
app->view_dispatcher, BtHidViewTikShorts, hid_tikshorts_get_view(app->hid_tikshorts));

// Mouse view
app->hid_mouse = hid_mouse_alloc(app);
Expand All @@ -198,7 +236,7 @@ Hid* hid_app_alloc_view(void* context) {
// Mouse clicker view
app->hid_mouse_clicker = hid_mouse_clicker_alloc(app);
view_set_previous_callback(
hid_mouse_clicker_get_view(app->hid_mouse_clicker), hid_exit_confirm_view);
hid_mouse_clicker_get_view(app->hid_mouse_clicker), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher,
HidViewMouseClicker,
Expand All @@ -207,12 +245,18 @@ Hid* hid_app_alloc_view(void* context) {
// Mouse jiggler view
app->hid_mouse_jiggler = hid_mouse_jiggler_alloc(app);
view_set_previous_callback(
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler), hid_exit_confirm_view);
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher,
HidViewMouseJiggler,
hid_mouse_jiggler_get_view(app->hid_mouse_jiggler));

// Ptt view
app->hid_ptt = hid_ptt_alloc(app);
view_set_previous_callback(hid_ptt_get_view(app->hid_ptt), hid_menu_view);
view_dispatcher_add_view(
app->view_dispatcher, HidViewPtt, hid_ptt_get_view(app->hid_ptt));

return app;
}

Expand All @@ -233,16 +277,22 @@ void hid_free(Hid* app) {
hid_keynote_free(app->hid_keynote);
view_dispatcher_remove_view(app->view_dispatcher, HidViewKeyboard);
hid_keyboard_free(app->hid_keyboard);
view_dispatcher_remove_view(app->view_dispatcher, HidViewNumpad);
hid_numpad_free(app->hid_numpad);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMedia);
hid_media_free(app->hid_media);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMovie);
hid_movie_free(app->hid_movie);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouse);
hid_mouse_free(app->hid_mouse);
view_dispatcher_remove_view(app->view_dispatcher, HidViewMouseClicker);
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, BtHidViewTikTok);
hid_tiktok_free(app->hid_tiktok);
view_dispatcher_remove_view(app->view_dispatcher, HidViewPtt);
hid_ptt_free(app->hid_ptt);
view_dispatcher_remove_view(app->view_dispatcher, BtHidViewTikShorts);
hid_tikshorts_free(app->hid_tikshorts);
view_dispatcher_free(app->view_dispatcher);

// Close records
Expand Down
12 changes: 9 additions & 3 deletions applications/system/hid_app/hid.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
#include <gui/modules/popup.h>
#include "views/hid_keynote.h"
#include "views/hid_keyboard.h"
#include "views/hid_numpad.h"
#include "views/hid_media.h"
#include "views/hid_movie.h"
#include "views/hid_mouse.h"
#include "views/hid_mouse_clicker.h"
#include "views/hid_mouse_jiggler.h"
#include "views/hid_tiktok.h"
#include "views/hid_tikshorts.h"
#include "views/hid_ptt.h"

#define HID_BT_KEYS_STORAGE_NAME ".bt_hid.keys"

Expand All @@ -42,11 +45,14 @@ struct Hid {
DialogEx* dialog;
HidKeynote* hid_keynote;
HidKeyboard* hid_keyboard;
HidNumpad* hid_numpad;
HidMedia* hid_media;
HidMovie* hid_movie;
HidMouse* hid_mouse;
HidMouseClicker* hid_mouse_clicker;
HidMouseJiggler* hid_mouse_jiggler;
HidTikTok* hid_tiktok;
HidTikShorts* hid_tikshorts;
HidPtt* hid_ptt;

HidTransport transport;
uint32_t view_id;
Expand All @@ -64,4 +70,4 @@ void hid_hal_mouse_move(Hid* instance, int8_t dx, int8_t dy);
void hid_hal_mouse_scroll(Hid* instance, int8_t delta);
void hid_hal_mouse_press(Hid* instance, uint16_t event);
void hid_hal_mouse_release(Hid* instance, uint16_t event);
void hid_hal_mouse_release_all(Hid* instance);
void hid_hal_mouse_release_all(Hid* instance);
7 changes: 5 additions & 2 deletions applications/system/hid_app/views.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ typedef enum {
HidViewSubmenu,
HidViewKeynote,
HidViewKeyboard,
HidViewNumpad,
HidViewMedia,
HidViewMovie,
HidViewMouse,
HidViewMouseClicker,
HidViewMouseJiggler,
BtHidViewTikTok,
BtHidViewTikShorts,
HidViewPtt,
HidViewExitConfirm,
} HidView;
} HidView;
24 changes: 12 additions & 12 deletions applications/system/hid_app/views/hid_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ const HidKeyboardKey hid_keyboard_keyset[ROW_COUNT][COLUMN_COUNT] = {
{.width = 1, .icon = &I_ButtonRight_4x7, .value = HID_KEYBOARD_RIGHT_ARROW},
},
{
{.width = 2, .icon = &I_Ctrl_15x7, .value = HID_KEYBOARD_L_CTRL},
{.width = 0, .value = HID_KEYBOARD_L_CTRL},
{.width = 2, .icon = &I_Alt_11x7, .value = HID_KEYBOARD_L_ALT},
{.width = 0, .value = HID_KEYBOARD_L_ALT},
{.width = 2, .icon = &I_Cmd_15x7, .value = HID_KEYBOARD_L_GUI},
{.width = 0, .value = HID_KEYBOARD_L_GUI},
{.width = 2, .icon = &I_Tab_15x7, .value = HID_KEYBOARD_TAB},
{.width = 0, .value = HID_KEYBOARD_TAB},
{.width = 2, .icon = &I_Esc_14x7, .value = HID_KEYBOARD_ESCAPE},
{.width = 0, .value = HID_KEYBOARD_ESCAPE},
{.width = 2, .icon = &I_Del_12x7, .value = HID_KEYBOARD_DELETE_FORWARD},
{.width = 0, .value = HID_KEYBOARD_DELETE_FORWARD},
{.width = 2, .icon = &I_KB_key_Ctl_17x10, .value = HID_KEYBOARD_L_CTRL},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_CTRL},
{.width = 2, .icon = &I_KB_key_Alt_17x10, .value = HID_KEYBOARD_L_ALT},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_ALT},
{.width = 2, .icon = &I_KB_key_Cmd_17x10, .value = HID_KEYBOARD_L_GUI},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_GUI},
{.width = 2, .icon = &I_KB_key_Tab_17x10, .value = HID_KEYBOARD_TAB},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_TAB},
{.width = 2, .icon = &I_KB_key_Esc_17x10, .value = HID_KEYBOARD_ESCAPE},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_ESCAPE},
{.width = 2, .icon = &I_KB_key_Del_17x10, .value = HID_KEYBOARD_DELETE_FORWARD},
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_DELETE_FORWARD},
},
};

Expand Down
4 changes: 2 additions & 2 deletions applications/system/hid_app/views/hid_keynote.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ static void hid_keynote_draw_vertical_callback(Canvas* canvas, void* context) {
HidKeynoteModel* model = 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);
}
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");
}

Expand Down
Loading

0 comments on commit 4a2a326

Please sign in to comment.