barcode_app.h 2.0 KB

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