mass_storage_app_i.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #include "mass_storage_app.h"
  3. #include "scenes/mass_storage_scene.h"
  4. #include "helpers/mass_storage_usb.h"
  5. #include <furi_hal.h>
  6. #include <gui/gui.h>
  7. #include <gui/view_dispatcher.h>
  8. #include <gui/scene_manager.h>
  9. #include <gui/modules/submenu.h>
  10. #include <dialogs/dialogs.h>
  11. #include <gui/modules/variable_item_list.h>
  12. #include <gui/modules/text_input.h>
  13. #include <gui/modules/loading.h>
  14. #include <storage/storage.h>
  15. #include "views/mass_storage_view.h"
  16. #define MASS_STORAGE_APP_PATH_FOLDER STORAGE_APP_DATA_PATH_PREFIX
  17. #define MASS_STORAGE_APP_EXTENSION ".img"
  18. #define MASS_STORAGE_FILE_NAME_LEN 40
  19. struct MassStorageApp {
  20. Gui* gui;
  21. Storage* fs_api;
  22. ViewDispatcher* view_dispatcher;
  23. SceneManager* scene_manager;
  24. DialogsApp* dialogs;
  25. TextInput* text_input;
  26. VariableItemList* variable_item_list;
  27. Loading* loading;
  28. FuriString* file_path;
  29. File* file;
  30. MassStorage* mass_storage_view;
  31. FuriMutex* usb_mutex;
  32. MassStorageUsb* usb;
  33. char new_file_name[MASS_STORAGE_FILE_NAME_LEN + 1];
  34. uint32_t new_file_size;
  35. };
  36. typedef enum {
  37. MassStorageAppViewStart,
  38. MassStorageAppViewTextInput,
  39. MassStorageAppViewWork,
  40. MassStorageAppViewLoading,
  41. } MassStorageAppView;
  42. enum MassStorageCustomEvent {
  43. // Reserve first 100 events for button types and indexes, starting from 0
  44. MassStorageCustomEventReserved = 100,
  45. MassStorageCustomEventFileSelect,
  46. MassStorageCustomEventNewImage,
  47. MassStorageCustomEventNameInput,
  48. };
  49. void mass_storage_app_show_loading_popup(MassStorageApp* app, bool show);