desktop_locked.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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,
  15. DesktopLockedEventUpdate,
  16. } DesktopLockedEvent;
  17. typedef struct DesktopLockedView DesktopLockedView;
  18. typedef void (*DesktopLockedViewCallback)(DesktopLockedEvent event, void* context);
  19. struct DesktopLockedView {
  20. View* view;
  21. DesktopLockedViewCallback callback;
  22. void* context;
  23. osTimerId_t timer;
  24. uint8_t lock_count;
  25. uint32_t lock_lastpress;
  26. };
  27. typedef struct {
  28. IconAnimation* animation;
  29. uint32_t hint_expire_at;
  30. uint8_t scene_num;
  31. int8_t door_left_x;
  32. int8_t door_right_x;
  33. bool animation_seq_end;
  34. } DesktopLockedViewModel;
  35. void desktop_locked_set_callback(
  36. DesktopLockedView* locked_view,
  37. DesktopLockedViewCallback callback,
  38. void* context);
  39. void desktop_locked_set_dolphin_animation(DesktopLockedView* locked_view);
  40. void desktop_locked_update_hint_timeout(DesktopLockedView* locked_view);
  41. void desktop_locked_reset_counter(DesktopLockedView* locked_view);
  42. void desktop_locked_reset_door_pos(DesktopLockedView* locked_view);
  43. void desktop_locked_manage_redraw(DesktopLockedView* locked_view);
  44. View* desktop_locked_get_view(DesktopLockedView* locked_view);
  45. DesktopLockedView* desktop_locked_alloc();
  46. void desktop_locked_free(DesktopLockedView* locked_view);
  47. void desktop_main_unlocked(DesktopMainView* main_view);
  48. void desktop_main_reset_hint(DesktopMainView* main_view);