desktop_locked.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include <gui/gui_i.h>
  3. #include <gui/view.h>
  4. #include <gui/canvas.h>
  5. #include <gui/elements.h>
  6. #include <furi.h>
  7. #define UNLOCK_RST_TIMEOUT 300
  8. #define UNLOCK_CNT 2 // 3 actually
  9. #define DOOR_L_POS -57
  10. #define DOOR_L_POS_MAX 0
  11. #define DOOR_R_POS 115
  12. #define DOOR_R_POS_MIN 60
  13. typedef enum {
  14. DesktopLockedEventUnlock = 10U,
  15. DesktopLockedEventUpdate = 11U,
  16. DesktopLockedEventInputReset = 12U,
  17. } DesktopLockedEvent;
  18. typedef enum {
  19. DesktopLockedWithPin,
  20. DesktopLockedNoPin,
  21. } DesktopLockedSceneState;
  22. typedef struct DesktopLockedView DesktopLockedView;
  23. typedef void (*DesktopLockedViewCallback)(DesktopLockedEvent event, void* context);
  24. struct DesktopLockedView {
  25. View* view;
  26. DesktopLockedViewCallback callback;
  27. void* context;
  28. osTimerId_t timer;
  29. uint8_t lock_count;
  30. uint32_t lock_lastpress;
  31. };
  32. typedef struct {
  33. IconAnimation* animation;
  34. uint32_t hint_expire_at;
  35. bool status_bar_background_black;
  36. uint8_t scene_num;
  37. int8_t door_left_x;
  38. int8_t door_right_x;
  39. bool animation_seq_end;
  40. bool pin_lock;
  41. } DesktopLockedViewModel;
  42. void desktop_locked_set_callback(
  43. DesktopLockedView* locked_view,
  44. DesktopLockedViewCallback callback,
  45. void* context);
  46. void desktop_locked_set_dolphin_animation(
  47. DesktopLockedView* locked_view,
  48. const Icon* icon,
  49. bool status_bar_background_black);
  50. void desktop_locked_update_hint_timeout(DesktopLockedView* locked_view);
  51. void desktop_locked_reset_counter(DesktopLockedView* locked_view);
  52. void desktop_locked_reset_door_pos(DesktopLockedView* locked_view);
  53. void desktop_locked_manage_redraw(DesktopLockedView* locked_view);
  54. View* desktop_locked_get_view(DesktopLockedView* locked_view);
  55. DesktopLockedView* desktop_locked_alloc();
  56. void desktop_locked_free(DesktopLockedView* locked_view);
  57. void desktop_locked_with_pin(DesktopLockedView* lock_menu, bool locked);