2022-03-24 15:45:03 +00:00
|
|
|
#include "../gpio_app_i.h"
|
|
|
|
#include "../gpio_custom_event.h"
|
|
|
|
|
|
|
|
void gpio_scene_usb_uart_close_rpc_on_enter(void* context) {
|
|
|
|
GpioApp* app = context;
|
|
|
|
|
2022-07-25 12:11:34 +00:00
|
|
|
widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
|
|
|
|
widget_add_string_multiline_element(
|
|
|
|
app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!");
|
2022-03-24 15:45:03 +00:00
|
|
|
widget_add_string_multiline_element(
|
|
|
|
app->widget,
|
2022-07-25 12:11:34 +00:00
|
|
|
3,
|
|
|
|
30,
|
|
|
|
AlignLeft,
|
2022-03-24 15:45:03 +00:00
|
|
|
AlignTop,
|
|
|
|
FontSecondary,
|
2022-07-25 12:11:34 +00:00
|
|
|
"Disconnect from\nPC or phone to\nuse this function.");
|
2022-03-24 15:45:03 +00:00
|
|
|
|
|
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUartCloseRpc);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool gpio_scene_usb_uart_close_rpc_on_event(void* context, SceneManagerEvent event) {
|
|
|
|
GpioApp* app = context;
|
|
|
|
bool consumed = false;
|
|
|
|
|
|
|
|
if(event.type == SceneManagerEventTypeCustom) {
|
|
|
|
if(event.event == GpioCustomEventErrorBack) {
|
|
|
|
if(!scene_manager_previous_scene(app->scene_manager)) {
|
|
|
|
scene_manager_stop(app->scene_manager);
|
|
|
|
view_dispatcher_stop(app->view_dispatcher);
|
|
|
|
}
|
|
|
|
consumed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return consumed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gpio_scene_usb_uart_close_rpc_on_exit(void* context) {
|
|
|
|
GpioApp* app = context;
|
|
|
|
widget_reset(app->widget);
|
|
|
|
}
|