weebo_i.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <gui/gui.h>
  5. #include <gui/view_dispatcher.h>
  6. #include <gui/scene_manager.h>
  7. #include <notification/notification_messages.h>
  8. #include <storage/storage.h>
  9. #include <dialogs/dialogs.h>
  10. #include <gui/modules/submenu.h>
  11. #include <gui/modules/popup.h>
  12. #include <gui/modules/loading.h>
  13. #include <gui/modules/text_input.h>
  14. #include <gui/modules/number_input.h>
  15. #include <gui/modules/text_box.h>
  16. #include <gui/modules/widget.h>
  17. #include <input/input.h>
  18. #include <lib/flipper_format/flipper_format.h>
  19. #include <lib/nfc/nfc.h>
  20. #include <nfc/nfc_poller.h>
  21. #include <nfc/nfc_device.h>
  22. #include <lib/toolbox/stream/stream.h>
  23. #include <lib/toolbox/stream/file_stream.h>
  24. /* generated by fbt from .png files in images folder */
  25. #include <weebo_icons.h>
  26. #include <amiibo.h>
  27. #include "weebo.h"
  28. #include "scenes/weebo_scene.h"
  29. #define WEEBO_TEXT_STORE_SIZE 128
  30. #define WEEBO_FILE_NAME_MAX_LENGTH 64
  31. #define NTAG215_SIZE 540
  32. #define NFC3D_UID_OFFSET 0x1D4
  33. #define PAGE_SIZE 4
  34. enum WeeboCustomEvent {
  35. // Reserve first 100 events for button types and indexes, starting from 0
  36. WeeboCustomEventReserved = 100,
  37. WeeboCustomEventViewExit,
  38. WeeboCustomEventTextInputDone,
  39. WeeboCustomEventNumberInputDone,
  40. };
  41. struct Weebo {
  42. ViewDispatcher* view_dispatcher;
  43. Gui* gui;
  44. NotificationApp* notifications;
  45. SceneManager* scene_manager;
  46. Storage* storage;
  47. char text_store[WEEBO_TEXT_STORE_SIZE + 1];
  48. FuriString* text_box_store;
  49. // Common Views
  50. Submenu* submenu;
  51. Popup* popup;
  52. Loading* loading;
  53. TextInput* text_input;
  54. NumberInput* number_input;
  55. TextBox* text_box;
  56. Widget* widget;
  57. DialogsApp* dialogs;
  58. Nfc* nfc;
  59. NfcPoller* poller;
  60. NfcDevice* nfc_device;
  61. FuriString* load_path;
  62. char file_name[WEEBO_FILE_NAME_MAX_LENGTH + 1];
  63. bool keys_loaded;
  64. nfc3d_amiibo_keys amiiboKeys;
  65. };
  66. typedef enum {
  67. WeeboViewMenu,
  68. WeeboViewPopup,
  69. WeeboViewLoading,
  70. WeeboViewTextInput,
  71. WeeboViewNumberInput,
  72. WeeboViewTextBox,
  73. WeeboViewWidget,
  74. } WeeboView;
  75. void weebo_text_store_set(Weebo* weebo, const char* text, ...);
  76. void weebo_text_store_clear(Weebo* weebo);
  77. void weebo_blink_start(Weebo* weebo);
  78. void weebo_blink_stop(Weebo* weebo);
  79. void weebo_show_loading_popup(void* context, bool show);