gpio_scene_usb_uart_close_rpc.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "../gpio_app_i.h"
  2. #include "../gpio_custom_event.h"
  3. void gpio_scene_usb_uart_close_rpc_on_enter(void* context) {
  4. GpioApp* app = context;
  5. widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
  6. widget_add_string_multiline_element(
  7. app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!");
  8. widget_add_string_multiline_element(
  9. app->widget,
  10. 3,
  11. 30,
  12. AlignLeft,
  13. AlignTop,
  14. FontSecondary,
  15. "Disconnect from\nPC or phone to\nuse this function.");
  16. view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUartCloseRpc);
  17. }
  18. bool gpio_scene_usb_uart_close_rpc_on_event(void* context, SceneManagerEvent event) {
  19. GpioApp* app = context;
  20. bool consumed = false;
  21. if(event.type == SceneManagerEventTypeCustom) {
  22. if(event.event == GpioCustomEventErrorBack) {
  23. if(!scene_manager_previous_scene(app->scene_manager)) {
  24. scene_manager_stop(app->scene_manager);
  25. view_dispatcher_stop(app->view_dispatcher);
  26. }
  27. consumed = true;
  28. }
  29. }
  30. return consumed;
  31. }
  32. void gpio_scene_usb_uart_close_rpc_on_exit(void* context) {
  33. GpioApp* app = context;
  34. widget_reset(app->widget);
  35. }