seos_i.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 <gui/modules/submenu.h>
  9. #include <gui/modules/popup.h>
  10. #include <gui/modules/loading.h>
  11. #include <gui/modules/text_input.h>
  12. #include <gui/modules/text_box.h>
  13. #include <gui/modules/widget.h>
  14. #include <input/input.h>
  15. #include <lib/nfc/nfc.h>
  16. #include <nfc/nfc_listener.h>
  17. #include <nfc/nfc_poller.h>
  18. #include <nfc/nfc_device.h>
  19. /* generated by fbt from .png files in images folder */
  20. #include <seos_icons.h>
  21. #include "seos.h"
  22. #include "keys.h"
  23. #include "seos_hci.h"
  24. #include "seos_credential.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. 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_external_ble;
  80. SeosCharacteristic* seos_characteristic;
  81. SeosCentral* seos_central;
  82. FlowMode flow_mode;
  83. bool keys_loaded;
  84. Bt* bt;
  85. FuriHalBleProfileBase* ble_profile;
  86. SeosNativePeripheral* native_peripheral;
  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);