barcode_app.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <gui/gui.h>
  5. #include <gui/elements.h>
  6. #include <input/input.h>
  7. #include <dialogs/dialogs.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/modules/widget.h>
  11. #include <gui/modules/text_input.h>
  12. #include <gui/modules/text_input.h>
  13. #include <flipper_format/flipper_format.h>
  14. #include "barcode_utils.h"
  15. #define TAG "BARCODE"
  16. #define VERSION "1.1"
  17. #define FILE_VERSION "1"
  18. #define TEXT_BUFFER_SIZE 128
  19. #define BARCODE_HEIGHT 50
  20. #define BARCODE_Y_START 3
  21. //the folder where the codabar encoding table is located
  22. #define CODABAR_DICT_FILE_PATH APP_ASSETS_PATH("codabar_encodings.txt")
  23. //the folder where the code 39 encoding table is located
  24. #define CODE39_DICT_FILE_PATH APP_ASSETS_PATH("code39_encodings.txt")
  25. //the folder where the code 128 encoding table is located
  26. #define CODE128_DICT_FILE_PATH APP_ASSETS_PATH("code128_encodings.txt")
  27. //the folder where the code 128 C encoding table is located
  28. #define CODE128C_DICT_FILE_PATH APP_ASSETS_PATH("code128c_encodings.txt")
  29. //the folder where the user stores their barcodes
  30. #define DEFAULT_USER_BARCODES EXT_PATH("apps_data/barcodes")
  31. //The extension barcode files use
  32. #define BARCODE_EXTENSION ".txt"
  33. #define BARCODE_EXTENSION_LENGTH 4
  34. #include "views/barcode_view.h"
  35. #include "views/create_view.h"
  36. #include "views/message_view.h"
  37. #include "barcode_validator.h"
  38. typedef struct BarcodeApp BarcodeApp;
  39. struct BarcodeApp {
  40. Submenu* main_menu;
  41. ViewDispatcher* view_dispatcher;
  42. Gui* gui;
  43. FuriMessageQueue* event_queue;
  44. CreateView* create_view;
  45. Barcode* barcode_view;
  46. Widget* about_widget;
  47. Widget* error_codes_widget;
  48. MessageView* message_view;
  49. TextInput* text_input;
  50. };
  51. enum SubmenuItems {
  52. SelectBarcodeItem,
  53. EditBarcodeItem,
  54. CreateBarcodeItem,
  55. ErrorCodesWidgetItem,
  56. AboutWidgetItem
  57. };
  58. enum Views {
  59. TextInputView,
  60. AboutWidgetView,
  61. ErrorCodesWidgetView,
  62. MessageErrorView,
  63. MainMenuView,
  64. CreateBarcodeView,
  65. BarcodeView
  66. };
  67. void submenu_callback(void* context, uint32_t index);
  68. uint32_t main_menu_callback(void* context);
  69. uint32_t exit_callback(void* context);
  70. int32_t barcode_main(void* p);