seos_i.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. #include <bt/bt_service/bt.h>
  34. #include "seos_profile.h"
  35. #define SEOS_TEXT_STORE_SIZE 128
  36. enum SeosCustomEvent {
  37. // Reserve first 100 events for button types and indexes, starting from 0
  38. SeosCustomEventReserved = 100,
  39. SeosCustomEventViewExit,
  40. SeosCustomEventTextInputDone,
  41. // Read card events
  42. SeosCustomEventReaderError,
  43. SeosCustomEventReaderSuccess,
  44. SeosCustomEventHCIInit,
  45. // Events during emulating or reading
  46. SeosCustomEventScan,
  47. SeosCustomEventFound,
  48. SeosCustomEventEmulate,
  49. SeosCustomEventADFMatched,
  50. SeosCustomEventAIDSelected,
  51. SeosCustomEventConnected,
  52. SeosCustomEventAuthenticated,
  53. SeosCustomEventSIORequested,
  54. SeosCustomEventAdvertising,
  55. };
  56. struct Seos {
  57. bool is_debug_enabled;
  58. ViewDispatcher* view_dispatcher;
  59. Gui* gui;
  60. NotificationApp* notifications;
  61. SceneManager* scene_manager;
  62. Storage* storage;
  63. char text_store[SEOS_TEXT_STORE_SIZE + 1];
  64. FuriString* text_box_store;
  65. // Common Views
  66. Submenu* submenu;
  67. Popup* popup;
  68. Loading* loading;
  69. TextInput* text_input;
  70. TextBox* text_box;
  71. Widget* widget;
  72. Nfc* nfc;
  73. NfcListener* listener;
  74. NfcPoller* poller;
  75. NfcDevice* nfc_device;
  76. SeosCredential credential;
  77. // NFC
  78. SeosEmulator* seos_emulator;
  79. SeosReader* seos_reader;
  80. // BLE
  81. bool has_ble;
  82. SeosCharacteristic* seos_characteristic;
  83. SeosCentral* seos_central;
  84. FlowMode flow_mode;
  85. char dev_name[SEOS_FILE_NAME_MAX_LENGTH + 1];
  86. FuriString* load_path;
  87. DialogsApp* dialogs;
  88. bool keys_loaded;
  89. Bt* bt;
  90. FuriHalBleProfileBase* ble_profile;
  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);