seos_i.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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_native_peripheral.h"
  27. #include "seos_central.h"
  28. #include "seos_common.h"
  29. #include "seos_reader.h"
  30. #include "seos_emulator.h"
  31. #include "scenes/seos_scene.h"
  32. #include "des_cmac.h"
  33. #include "aes_cmac.h"
  34. #define SEOS_TEXT_STORE_SIZE 128
  35. enum SeosCustomEvent {
  36. // Reserve first 100 events for button types and indexes, starting from 0
  37. SeosCustomEventReserved = 100,
  38. SeosCustomEventViewExit,
  39. SeosCustomEventTextInputDone,
  40. // Read card events
  41. SeosCustomEventReaderError,
  42. SeosCustomEventReaderSuccess,
  43. SeosCustomEventHCIInit,
  44. // Events during emulating or reading
  45. SeosCustomEventScan,
  46. SeosCustomEventFound,
  47. SeosCustomEventEmulate,
  48. SeosCustomEventADFMatched,
  49. SeosCustomEventAIDSelected,
  50. SeosCustomEventConnected,
  51. SeosCustomEventAuthenticated,
  52. SeosCustomEventSIORequested,
  53. SeosCustomEventAdvertising,
  54. };
  55. struct Seos {
  56. bool is_debug_enabled;
  57. ViewDispatcher* view_dispatcher;
  58. Gui* gui;
  59. NotificationApp* notifications;
  60. SceneManager* scene_manager;
  61. Storage* storage;
  62. char text_store[SEOS_TEXT_STORE_SIZE + 1];
  63. FuriString* text_box_store;
  64. // Common Views
  65. Submenu* submenu;
  66. Popup* popup;
  67. Loading* loading;
  68. TextInput* text_input;
  69. TextBox* text_box;
  70. Widget* widget;
  71. Nfc* nfc;
  72. NfcListener* listener;
  73. NfcPoller* poller;
  74. NfcDevice* nfc_device;
  75. SeosCredential credential;
  76. // NFC
  77. SeosEmulator* seos_emulator;
  78. SeosReader* seos_reader;
  79. // BLE
  80. bool has_external_ble;
  81. SeosCharacteristic* seos_characteristic;
  82. SeosCentral* seos_central;
  83. FlowMode flow_mode;
  84. char dev_name[SEOS_FILE_NAME_MAX_LENGTH + 1];
  85. FuriString* load_path;
  86. DialogsApp* dialogs;
  87. bool keys_loaded;
  88. Bt* bt;
  89. FuriHalBleProfileBase* ble_profile;
  90. SeosNativePeripheral* native_peripheral;
  91. };
  92. typedef enum {
  93. SeosViewMenu,
  94. SeosViewPopup,
  95. SeosViewLoading,
  96. SeosViewTextInput,
  97. SeosViewTextBox,
  98. SeosViewWidget,
  99. } SeosView;
  100. void seos_text_store_set(Seos* seos, const char* text, ...);
  101. void seos_text_store_clear(Seos* seos);
  102. void seos_blink_start(Seos* seos);
  103. void seos_blink_stop(Seos* seos);
  104. void seos_show_loading_popup(void* context, bool show);