mass_storage_app_i.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. uint32_t bytes_read, bytes_written;
  36. };
  37. typedef enum {
  38. MassStorageAppViewStart,
  39. MassStorageAppViewTextInput,
  40. MassStorageAppViewWork,
  41. MassStorageAppViewLoading,
  42. } MassStorageAppView;
  43. enum MassStorageCustomEvent {
  44. // Reserve first 100 events for button types and indexes, starting from 0
  45. MassStorageCustomEventReserved = 100,
  46. MassStorageCustomEventFileSelect,
  47. MassStorageCustomEventNewImage,
  48. MassStorageCustomEventNameInput,
  49. };
  50. void mass_storage_app_show_loading_popup(MassStorageApp* app, bool show);