xremote_scene_ir_timer.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "../xremote.h"
  2. #include "../models/cross/xremote_cross_remote.h"
  3. void xremote_scene_ir_timer_callback(void* context) {
  4. XRemote* app = context;
  5. view_dispatcher_send_custom_event(app->view_dispatcher, XRemoteCustomEventTextInput);
  6. }
  7. void xremote_scene_ir_timer_on_enter(void* context) {
  8. furi_assert(context);
  9. XRemote* app = context;
  10. IntInput* int_input = app->int_input;
  11. size_t enter_name_length = 5;
  12. char* str = "Transmit in ms (0 - 9999)";
  13. const char* constStr = str;
  14. int_input_set_header_text(int_input, constStr);
  15. snprintf(app->text_store[0], 5, "%u", 5);
  16. int_input_set_result_callback(
  17. int_input,
  18. xremote_scene_ir_timer_callback,
  19. context,
  20. app->text_store[0],
  21. enter_name_length,
  22. false);
  23. view_dispatcher_switch_to_view(app->view_dispatcher, XRemoteViewIdIntInput);
  24. }
  25. bool xremote_scene_ir_timer_on_event(void* context, SceneManagerEvent event) {
  26. XRemote* app = context;
  27. bool consumed = false;
  28. if(event.type == SceneManagerEventTypeBack) {
  29. scene_manager_previous_scene(app->scene_manager);
  30. return true;
  31. } else if(event.type == SceneManagerEventTypeCustom) {
  32. //app->first_station = atoi(app->text_store[0]);
  33. /*if(app->first_station > app->max_station) {
  34. app->first_station = app->max_station;
  35. snprintf(app->text_store[0], 5, "%lu", app->first_station);
  36. }*/
  37. scene_manager_previous_scene(app->scene_manager);
  38. return true;
  39. }
  40. return consumed;
  41. }
  42. void xremote_scene_ir_timer_on_exit(void* context) {
  43. XRemote* app = context;
  44. UNUSED(app);
  45. }