ibutton_i.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #pragma once
  2. #include "ibutton.h"
  3. #include <gui/gui.h>
  4. #include <gui/view.h>
  5. #include <gui/view_dispatcher.h>
  6. #include <gui/scene_manager.h>
  7. #include <notification/notification_messages.h>
  8. #include <one_wire/ibutton/ibutton_worker.h>
  9. #include <storage/storage.h>
  10. #include <dialogs/dialogs.h>
  11. #include <gui/modules/submenu.h>
  12. #include <gui/modules/popup.h>
  13. #include <gui/modules/dialog_ex.h>
  14. #include <gui/modules/text_input.h>
  15. #include <gui/modules/byte_input.h>
  16. #include <gui/modules/widget.h>
  17. #include "ibutton_custom_event.h"
  18. #include "scenes/ibutton_scene.h"
  19. #define IBUTTON_FILE_NAME_SIZE 100
  20. #define IBUTTON_TEXT_STORE_SIZE 128
  21. #define IBUTTON_APP_FOLDER ANY_PATH("ibutton")
  22. #define IBUTTON_APP_EXTENSION ".ibtn"
  23. #define IBUTTON_APP_FILE_TYPE "Flipper iButton key"
  24. struct iButton {
  25. SceneManager* scene_manager;
  26. ViewDispatcher* view_dispatcher;
  27. Gui* gui;
  28. Storage* storage;
  29. DialogsApp* dialogs;
  30. NotificationApp* notifications;
  31. iButtonWorker* key_worker;
  32. iButtonKey* key;
  33. string_t file_path;
  34. char text_store[IBUTTON_TEXT_STORE_SIZE + 1];
  35. Submenu* submenu;
  36. ByteInput* byte_input;
  37. TextInput* text_input;
  38. Popup* popup;
  39. Widget* widget;
  40. DialogEx* dialog_ex;
  41. void* rpc_ctx;
  42. };
  43. typedef enum {
  44. iButtonViewSubmenu,
  45. iButtonViewByteInput,
  46. iButtonViewTextInput,
  47. iButtonViewPopup,
  48. iButtonViewWidget,
  49. iButtonViewDialogEx,
  50. } iButtonView;
  51. typedef enum {
  52. iButtonNotificationMessageError,
  53. iButtonNotificationMessageSuccess,
  54. iButtonNotificationMessageReadStart,
  55. iButtonNotificationMessageEmulateStart,
  56. iButtonNotificationMessageYellowBlink,
  57. iButtonNotificationMessageEmulateBlink,
  58. iButtonNotificationMessageRedOn,
  59. iButtonNotificationMessageRedOff,
  60. iButtonNotificationMessageGreenOn,
  61. iButtonNotificationMessageGreenOff,
  62. iButtonNotificationMessageBlinkStop,
  63. } iButtonNotificationMessage;
  64. bool ibutton_file_select(iButton* ibutton);
  65. bool ibutton_load_key_data(iButton* ibutton, string_t key_path, bool show_dialog);
  66. bool ibutton_save_key(iButton* ibutton, const char* key_name);
  67. bool ibutton_delete_key(iButton* ibutton);
  68. void ibutton_text_store_set(iButton* ibutton, const char* text, ...);
  69. void ibutton_text_store_clear(iButton* ibutton);
  70. void ibutton_switch_to_previous_scene_one_of(
  71. iButton* ibutton,
  72. const uint32_t* scene_ids,
  73. size_t scene_ids_size);
  74. void ibutton_notification_message(iButton* ibutton, uint32_t message);