virtual_portal.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include <notification/notification_messages.h>
  3. #include <furi_hal_light.h>
  4. #include "pof_token.h"
  5. #define POF_TOKEN_LIMIT 16
  6. typedef enum {
  7. PoFHid,
  8. PoFXbox360
  9. } PoFType;
  10. typedef enum {
  11. EventExit = (1 << 0),
  12. EventReset = (1 << 1),
  13. EventRx = (1 << 2),
  14. EventTx = (1 << 3),
  15. EventTxComplete = (1 << 4),
  16. EventResetSio = (1 << 5),
  17. EventTxImmediate = (1 << 6),
  18. EventAll = EventExit | EventReset | EventRx | EventTx | EventTxComplete | EventResetSio |
  19. EventTxImmediate,
  20. } PoFEvent;
  21. typedef struct {
  22. PoFToken* tokens[POF_TOKEN_LIMIT];
  23. uint8_t sequence_number;
  24. bool active;
  25. bool speaker;
  26. NotificationApp* notifications;
  27. PoFType type;
  28. FuriThread* thread;
  29. } VirtualPortal;
  30. VirtualPortal* virtual_portal_alloc(NotificationApp* notifications);
  31. void virtual_portal_free(VirtualPortal* virtual_portal);
  32. void virtual_portal_cleanup(VirtualPortal* virtual_portal);
  33. void virtual_portal_load_token(VirtualPortal* virtual_portal, PoFToken* pof_token);
  34. int virtual_portal_process_message(
  35. VirtualPortal* virtual_portal,
  36. uint8_t* message,
  37. uint8_t* response);
  38. int virtual_portal_send_status(VirtualPortal* virtual_portal, uint8_t* response);