ibutton_i.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #include "ibutton.h"
  3. #include <gui/gui.h>
  4. #include <gui/view.h>
  5. #include <gui/scene_manager.h>
  6. #include <gui/view_dispatcher.h>
  7. #include <ibutton/ibutton_worker.h>
  8. #include <ibutton/ibutton_protocols.h>
  9. #include <rpc/rpc_app.h>
  10. #include <storage/storage.h>
  11. #include <dialogs/dialogs.h>
  12. #include <notification/notification.h>
  13. #include <notification/notification_messages.h>
  14. #include <gui/modules/submenu.h>
  15. #include <gui/modules/popup.h>
  16. #include <gui/modules/text_input.h>
  17. #include <gui/modules/byte_input.h>
  18. #include <gui/modules/widget.h>
  19. #include <gui/modules/loading.h>
  20. #include <assets_icons.h>
  21. #include "ibutton_custom_event.h"
  22. #include "scenes/ibutton_scene.h"
  23. #define IBUTTON_APP_FOLDER ANY_PATH("ibutton")
  24. #define IBUTTON_APP_EXTENSION ".ibtn"
  25. #define IBUTTON_KEY_NAME_SIZE 22
  26. typedef enum {
  27. iButtonWriteModeInvalid,
  28. iButtonWriteModeBlank,
  29. iButtonWriteModeCopy,
  30. } iButtonWriteMode;
  31. struct iButton {
  32. SceneManager* scene_manager;
  33. ViewDispatcher* view_dispatcher;
  34. Gui* gui;
  35. Storage* storage;
  36. DialogsApp* dialogs;
  37. NotificationApp* notifications;
  38. RpcAppSystem* rpc;
  39. iButtonKey* key;
  40. iButtonWorker* worker;
  41. iButtonProtocols* protocols;
  42. iButtonWriteMode write_mode;
  43. FuriString* file_path;
  44. char key_name[IBUTTON_KEY_NAME_SIZE + 1];
  45. Submenu* submenu;
  46. ByteInput* byte_input;
  47. TextInput* text_input;
  48. Popup* popup;
  49. Widget* widget;
  50. Loading* loading;
  51. };
  52. typedef enum {
  53. iButtonViewSubmenu,
  54. iButtonViewByteInput,
  55. iButtonViewTextInput,
  56. iButtonViewPopup,
  57. iButtonViewWidget,
  58. iButtonViewLoading,
  59. } iButtonView;
  60. typedef enum {
  61. iButtonNotificationMessageError,
  62. iButtonNotificationMessageSuccess,
  63. iButtonNotificationMessageReadStart,
  64. iButtonNotificationMessageEmulateStart,
  65. iButtonNotificationMessageYellowBlink,
  66. iButtonNotificationMessageEmulateBlink,
  67. iButtonNotificationMessageRedOn,
  68. iButtonNotificationMessageRedOff,
  69. iButtonNotificationMessageGreenOn,
  70. iButtonNotificationMessageGreenOff,
  71. iButtonNotificationMessageBlinkStop,
  72. } iButtonNotificationMessage;
  73. bool ibutton_select_and_load_key(iButton* ibutton);
  74. bool ibutton_load_key(iButton* ibutton);
  75. bool ibutton_save_key(iButton* ibutton);
  76. bool ibutton_delete_key(iButton* ibutton);
  77. void ibutton_reset_key(iButton* ibutton);
  78. void ibutton_notification_message(iButton* ibutton, uint32_t message);
  79. void ibutton_submenu_callback(void* context, uint32_t index);
  80. void ibutton_widget_callback(GuiButtonType result, InputType type, void* context);