mass_storage_app_i.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 <gui/modules/widget.h>
  15. #include <storage/storage.h>
  16. #include "views/mass_storage_view.h"
  17. #include <mass_storage_icons.h>
  18. #define MASS_STORAGE_APP_PATH_FOLDER STORAGE_APP_DATA_PATH_PREFIX
  19. #define MASS_STORAGE_APP_EXTENSION ".img"
  20. #define MASS_STORAGE_FILE_NAME_LEN 40
  21. struct MassStorageApp {
  22. Gui* gui;
  23. Storage* fs_api;
  24. ViewDispatcher* view_dispatcher;
  25. SceneManager* scene_manager;
  26. Widget* widget;
  27. DialogsApp* dialogs;
  28. TextInput* text_input;
  29. VariableItemList* variable_item_list;
  30. Loading* loading;
  31. FuriString* file_path;
  32. File* file;
  33. MassStorage* mass_storage_view;
  34. FuriMutex* usb_mutex;
  35. MassStorageUsb* usb;
  36. char new_file_name[MASS_STORAGE_FILE_NAME_LEN + 1];
  37. uint32_t new_file_size;
  38. uint32_t bytes_read, bytes_written;
  39. };
  40. typedef enum {
  41. MassStorageAppViewStart,
  42. MassStorageAppViewTextInput,
  43. MassStorageAppViewWork,
  44. MassStorageAppViewLoading,
  45. MassStorageAppViewWidget,
  46. } MassStorageAppView;
  47. enum MassStorageCustomEvent {
  48. // Reserve first 100 events for button types and indexes, starting from 0
  49. MassStorageCustomEventReserved = 100,
  50. MassStorageCustomEventEject,
  51. MassStorageCustomEventFileSelect,
  52. MassStorageCustomEventNewImage,
  53. MassStorageCustomEventNameInput,
  54. };
  55. void mass_storage_app_show_loading_popup(MassStorageApp* app, bool show);