Skip to content

Commit

Permalink
feat: Thread added for get VIN
Browse files Browse the repository at this point in the history
  • Loading branch information
AdonaiDiazEsparza committed Nov 19, 2024
1 parent 2f3474c commit 7f98c3d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Canbus_app/scenes/UDSMenuOption.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ void uds_menu_callback(void* context, uint32_t index) {
app->scene_manager, app_scene_uds_single_frame_request_sender_option);
break;

case 2: // Request VIN from car
scene_manager_next_scene(app->scene_manager, app_scene_uds_request_vin_option);
break;

default:
break;
}
Expand All @@ -29,6 +33,7 @@ void app_scene_uds_menu_on_enter(void* context) {
submenu_set_header(app->submenu, "UDS Services");
submenu_add_item(app->submenu, "Send Single Frame Request", 0, uds_menu_callback, app);
submenu_add_item(app->submenu, "Send Multiple Frame Request", 1, uds_menu_callback, app);
submenu_add_item(app->submenu, "Get VIN Number", 2, uds_menu_callback, app);

submenu_set_selected_item(app->submenu, selector_option);

Expand Down
42 changes: 40 additions & 2 deletions Canbus_app/scenes/UDSOptions/UDSGetVIN.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,53 @@
#include "../../app_user.h"

static int32_t uds_get_vin_thread(void* context);

/*
UDS get Vin Scene
*/

// Scene on enter
void app_scene_uds_request_vin_on_enter(void* context) {
UNUSED(context);
App* app = context;

widget_reset(app->widget);

widget_add_string_multiline_element(
app->widget, 64, 32, AlignCenter, AlignCenter, FontPrimary, "On\nDevelopment");

app->thread = furi_thread_alloc_ex("ManualUDS", 1024, uds_get_vin_thread, app);
furi_thread_start(app->thread);

view_dispatcher_switch_to_view(app->view_dispatcher, ViewWidget);
}

// Scene on event
bool app_scene_uds_request_vin_on_event(void* context, SceneManagerEvent event) {
UNUSED(context);
UNUSED(event);
return false;
}

// Scene on exit
void app_scene_uds_request_vin_on_exit(void* context) {
UNUSED(context);
App* app = context;

furi_thread_join(app->thread);
furi_thread_free(app->thread);

widget_reset(app->widget);
}

/*
Thread to work with
*/

static int32_t uds_get_vin_thread(void* context) {
App* app = context;

FuriString* text = app->text;

UNUSED(text);

return 0;
}

0 comments on commit 7f98c3d

Please sign in to comment.