hex_viewer.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <gui/gui.h>
  5. #include <input/input.h>
  6. #include <stdlib.h>
  7. #include <assets_icons.h>
  8. #include <hex_viewer_icons.h>
  9. #include <dialogs/dialogs.h>
  10. #include <notification/notification_messages.h>
  11. #include <gui/view_dispatcher.h>
  12. #include <gui/modules/submenu.h>
  13. #include <gui/scene_manager.h>
  14. #include <gui/modules/variable_item_list.h>
  15. #include <gui/modules/button_menu.h>
  16. #include <gui/modules/dialog_ex.h>
  17. #include "scenes/hex_viewer_scene.h"
  18. #include "views/hex_viewer_startscreen.h"
  19. #include "views/hex_viewer_scene_1.h"
  20. #include "views/hex_viewer_scene_2.h"
  21. #include "helpers/hex_viewer_storage.h"
  22. #include <storage/storage.h>
  23. #include <stream/stream.h>
  24. #include <stream/buffered_file_stream.h>
  25. #include <toolbox/stream/file_stream.h>
  26. #define TAG "HexViewer"
  27. // #define SUBGHZ_APP_EXTENSION ".sub"
  28. // #define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
  29. #define HEX_VIEWER_APP_PATH_FOLDER "/any" // TODO ANY_PATH
  30. #define HEX_VIEWER_APP_EXTENSION "*"
  31. #define HEX_VIEWER_BYTES_PER_LINE 4u
  32. #define HEX_VIEWER_LINES_ON_SCREEN 4u
  33. #define HEX_VIEWER_BUF_SIZE (HEX_VIEWER_LINES_ON_SCREEN * HEX_VIEWER_BYTES_PER_LINE)
  34. // typedef struct HexViewerModel HexViewerModel;
  35. // typedef struct HexViewer HexViewer;
  36. typedef struct {
  37. uint8_t file_bytes[HEX_VIEWER_LINES_ON_SCREEN][HEX_VIEWER_BYTES_PER_LINE];
  38. uint32_t file_offset;
  39. uint32_t file_read_bytes;
  40. uint32_t file_size;
  41. Stream* stream;
  42. } HexViewerModel;
  43. // TODO Clean
  44. typedef struct {
  45. HexViewerModel* model;
  46. //FuriMutex** mutex; // TODO Don't need?
  47. Gui* gui;
  48. Storage* storage;
  49. NotificationApp* notification;
  50. ViewDispatcher* view_dispatcher;
  51. Submenu* submenu;
  52. SceneManager* scene_manager;
  53. VariableItemList* variable_item_list;
  54. HexViewerStartscreen* hex_viewer_startscreen;
  55. HexViewerScene1* hex_viewer_scene_1;
  56. HexViewerScene2* hex_viewer_scene_2;
  57. DialogsApp* dialogs; // File Browser
  58. FuriString* file_path; // File Browser
  59. uint32_t haptic;
  60. uint32_t speaker;
  61. uint32_t led;
  62. uint32_t save_settings;
  63. ButtonMenu* button_menu; // Button Menu
  64. } HexViewer;
  65. typedef enum {
  66. HexViewerViewIdStartscreen,
  67. HexViewerViewIdMenu,
  68. HexViewerViewIdScene1,
  69. HexViewerViewIdScene2,
  70. HexViewerViewIdScene3,
  71. HexViewerViewIdScene4,
  72. HexViewerViewIdScene5,
  73. HexViewerViewIdSettings,
  74. } HexViewerViewId;
  75. typedef enum {
  76. HexViewerHapticOff,
  77. HexViewerHapticOn,
  78. } HexViewerHapticState;
  79. typedef enum {
  80. HexViewerSpeakerOff,
  81. HexViewerSpeakerOn,
  82. } HexViewerSpeakerState;
  83. typedef enum {
  84. HexViewerLedOff,
  85. HexViewerLedOn,
  86. } HexViewerLedState;
  87. typedef enum {
  88. HexViewerSettingsOff,
  89. HexViewerSettingsOn,
  90. } HexViewerSettingsStoreState;