picopass_i.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #include "picopass.h"
  3. #include "picopass_worker.h"
  4. #include "picopass_device.h"
  5. #include "rfal_picopass.h"
  6. #include <furi.h>
  7. #include <gui/gui.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/scene_manager.h>
  10. #include <notification/notification_messages.h>
  11. #include <gui/modules/submenu.h>
  12. #include <gui/modules/popup.h>
  13. #include <gui/modules/loading.h>
  14. #include <gui/modules/text_input.h>
  15. #include <gui/modules/widget.h>
  16. #include <input/input.h>
  17. #include "scenes/picopass_scene.h"
  18. #include "views/dict_attack.h"
  19. #include <storage/storage.h>
  20. #include <lib/toolbox/path.h>
  21. #include <picopass_icons.h>
  22. #define PICOPASS_TEXT_STORE_SIZE 128
  23. enum PicopassCustomEvent {
  24. // Reserve first 100 events for button types and indexes, starting from 0
  25. PicopassCustomEventReserved = 100,
  26. PicopassCustomEventViewExit,
  27. PicopassCustomEventWorkerExit,
  28. PicopassCustomEventByteInputDone,
  29. PicopassCustomEventTextInputDone,
  30. PicopassCustomEventDictAttackSkip,
  31. };
  32. typedef enum {
  33. EventTypeTick,
  34. EventTypeKey,
  35. } EventType;
  36. struct Picopass {
  37. PicopassWorker* worker;
  38. ViewDispatcher* view_dispatcher;
  39. Gui* gui;
  40. NotificationApp* notifications;
  41. SceneManager* scene_manager;
  42. PicopassDevice* dev;
  43. char text_store[PICOPASS_TEXT_STORE_SIZE + 1];
  44. FuriString* text_box_store;
  45. // Common Views
  46. Submenu* submenu;
  47. Popup* popup;
  48. Loading* loading;
  49. TextInput* text_input;
  50. Widget* widget;
  51. DictAttack* dict_attack;
  52. };
  53. typedef enum {
  54. PicopassViewMenu,
  55. PicopassViewPopup,
  56. PicopassViewLoading,
  57. PicopassViewTextInput,
  58. PicopassViewWidget,
  59. PicopassViewDictAttack,
  60. } PicopassView;
  61. Picopass* picopass_alloc();
  62. void picopass_text_store_set(Picopass* picopass, const char* text, ...);
  63. void picopass_text_store_clear(Picopass* picopass);
  64. void picopass_blink_start(Picopass* picopass);
  65. void picopass_blink_stop(Picopass* picopass);
  66. void picopass_show_loading_popup(void* context, bool show);
  67. /** Check if memory is set to pattern
  68. *
  69. * @warning zero size will return false
  70. *
  71. * @param[in] data Pointer to the byte array
  72. * @param[in] pattern The pattern
  73. * @param[in] size The byte array size
  74. *
  75. * @return True if memory is set to pattern, false otherwise
  76. */
  77. bool picopass_is_memset(const uint8_t* data, const uint8_t pattern, size_t size);