desktop_locked.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 200
  8. #define UNLOCK_CNT 2 // 3 actually
  9. typedef enum {
  10. DesktopLockedEventUnlock,
  11. DesktopLockedEventUpdate,
  12. } DesktopLockedEvent;
  13. typedef struct DesktopLockedView DesktopLockedView;
  14. typedef void (*DesktopLockedViewCallback)(DesktopLockedEvent event, void* context);
  15. struct DesktopLockedView {
  16. View* view;
  17. DesktopLockedViewCallback callback;
  18. void* context;
  19. osTimerId_t timer;
  20. uint8_t lock_count;
  21. uint32_t lock_lastpress;
  22. };
  23. typedef struct {
  24. IconAnimation* animation;
  25. uint8_t scene_num;
  26. int8_t door_left_x;
  27. int8_t door_right_x;
  28. uint8_t hint_timeout;
  29. bool animation_seq_end;
  30. } DesktopLockedViewModel;
  31. void desktop_locked_set_callback(
  32. DesktopLockedView* locked_view,
  33. DesktopLockedViewCallback callback,
  34. void* context);
  35. void desktop_locked_update_hint_timeout(DesktopLockedView* locked_view);
  36. void desktop_locked_reset_counter(DesktopLockedView* locked_view);
  37. void desktop_locked_reset_door_pos(DesktopLockedView* locked_view);
  38. void desktop_locked_manage_redraw(DesktopLockedView* locked_view);
  39. View* desktop_locked_get_view(DesktopLockedView* locked_view);
  40. DesktopLockedView* desktop_locked_alloc();
  41. void desktop_locked_free(DesktopLockedView* locked_view);
  42. void desktop_main_unlocked(DesktopMainView* main_view);
  43. void desktop_main_reset_hint(DesktopMainView* main_view);