seos_i.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <gui/gui.h>
  5. #include <gui/view_dispatcher.h>
  6. #include <gui/scene_manager.h>
  7. #include <notification/notification_messages.h>
  8. #include <storage/storage.h>
  9. #include <gui/modules/submenu.h>
  10. #include <gui/modules/popup.h>
  11. #include <gui/modules/loading.h>
  12. #include <gui/modules/text_input.h>
  13. #include <gui/modules/text_box.h>
  14. #include <gui/modules/widget.h>
  15. #include <input/input.h>
  16. #include <lib/nfc/nfc.h>
  17. #include <nfc/nfc_listener.h>
  18. #include <nfc/nfc_poller.h>
  19. #include <nfc/nfc_device.h>
  20. /* generated by fbt from .png files in images folder */
  21. #include <seos_icons.h>
  22. #include "seos.h"
  23. #include "keys.h"
  24. #include "seos_hci.h"
  25. #include "seos_characteristic.h"
  26. #include "seos_central.h"
  27. #include "seos_common.h"
  28. #include "seos_reader.h"
  29. #include "seos_emulator.h"
  30. #include "scenes/seos_scene.h"
  31. #include "des_cmac.h"
  32. #include "aes_cmac.h"
  33. #define SEOS_TEXT_STORE_SIZE 128
  34. enum SeosCustomEvent {
  35. // Reserve first 100 events for button types and indexes, starting from 0
  36. SeosCustomEventReserved = 100,
  37. SeosCustomEventViewExit,
  38. SeosCustomEventTextInputDone,
  39. // Read card events
  40. SeosCustomEventReaderError,
  41. SeosCustomEventReaderSuccess,
  42. SeosCustomEventHCIInit,
  43. // Events during emulating or reading
  44. SeosCustomEventScan,
  45. SeosCustomEventFound,
  46. SeosCustomEventEmulate,
  47. SeosCustomEventADFMatched,
  48. SeosCustomEventAIDSelected,
  49. SeosCustomEventConnected,
  50. SeosCustomEventAuthenticated,
  51. SeosCustomEventSIORequested,
  52. SeosCustomEventAdvertising,
  53. };
  54. struct Seos {
  55. bool is_debug_enabled;
  56. ViewDispatcher* view_dispatcher;
  57. Gui* gui;
  58. NotificationApp* notifications;
  59. SceneManager* scene_manager;
  60. Storage* storage;
  61. char text_store[SEOS_TEXT_STORE_SIZE + 1];
  62. FuriString* text_box_store;
  63. // Common Views
  64. Submenu* submenu;
  65. Popup* popup;
  66. Loading* loading;
  67. TextInput* text_input;
  68. TextBox* text_box;
  69. Widget* widget;
  70. Nfc* nfc;
  71. NfcListener* listener;
  72. NfcPoller* poller;
  73. NfcDevice* nfc_device;
  74. SeosCredential credential;
  75. // NFC
  76. SeosEmulator* seos_emulator;
  77. SeosReader* seos_reader;
  78. // BLE
  79. bool has_ble;
  80. SeosCharacteristic* seos_characteristic;
  81. SeosCentral* seos_central;
  82. FlowMode flow_mode;
  83. char dev_name[SEOS_FILE_NAME_MAX_LENGTH + 1];
  84. FuriString* load_path;
  85. DialogsApp* dialogs;
  86. bool keys_loaded;
  87. };
  88. typedef enum {
  89. SeosViewMenu,
  90. SeosViewPopup,
  91. SeosViewLoading,
  92. SeosViewTextInput,
  93. SeosViewTextBox,
  94. SeosViewWidget,
  95. } SeosView;
  96. void seos_text_store_set(Seos* seos, const char* text, ...);
  97. void seos_text_store_clear(Seos* seos);
  98. void seos_blink_start(Seos* seos);
  99. void seos_blink_stop(Seos* seos);
  100. void seos_show_loading_popup(void* context, bool show);