desktop_locked.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include "desktop_events.h"
  8. #define UNLOCK_RST_TIMEOUT 300
  9. #define UNLOCK_CNT 2 // 3 actually
  10. #define DOOR_L_POS -57
  11. #define DOOR_L_POS_MAX 0
  12. #define DOOR_R_POS 115
  13. #define DOOR_R_POS_MIN 60
  14. typedef enum {
  15. DesktopLockedWithPin,
  16. DesktopLockedNoPin,
  17. } DesktopLockedSceneState;
  18. typedef struct DesktopLockedView DesktopLockedView;
  19. typedef void (*DesktopLockedViewCallback)(DesktopEvent event, void* context);
  20. struct DesktopLockedView {
  21. View* view;
  22. DesktopLockedViewCallback callback;
  23. void* context;
  24. osTimerId_t timer;
  25. uint8_t lock_count;
  26. uint32_t lock_lastpress;
  27. };
  28. typedef struct {
  29. IconAnimation* animation;
  30. uint32_t hint_expire_at;
  31. bool status_bar_background_black;
  32. uint8_t scene_num;
  33. int8_t door_left_x;
  34. int8_t door_right_x;
  35. bool animation_seq_end;
  36. bool pin_lock;
  37. } DesktopLockedViewModel;
  38. void desktop_locked_set_callback(
  39. DesktopLockedView* locked_view,
  40. DesktopLockedViewCallback callback,
  41. void* context);
  42. void desktop_locked_update_hint_timeout(DesktopLockedView* locked_view);
  43. void desktop_locked_reset_counter(DesktopLockedView* locked_view);
  44. void desktop_locked_reset_door_pos(DesktopLockedView* locked_view);
  45. void desktop_locked_manage_redraw(DesktopLockedView* locked_view);
  46. View* desktop_locked_get_view(DesktopLockedView* locked_view);
  47. DesktopLockedView* desktop_locked_alloc();
  48. void desktop_locked_free(DesktopLockedView* locked_view);
  49. void desktop_locked_with_pin(DesktopLockedView* lock_menu, bool locked);