virtual_portal.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. EventLed = (1 << 7),
  19. EventAll = EventExit | EventReset | EventRx | EventTx | EventTxComplete | EventResetSio |
  20. EventTxImmediate | EventLed,
  21. } PoFEvent;
  22. typedef struct {
  23. PoFToken* tokens[POF_TOKEN_LIMIT];
  24. uint8_t sequence_number;
  25. bool active;
  26. bool speaker;
  27. NotificationApp* notifications;
  28. PoFType type;
  29. FuriThread* thread;
  30. uint8_t r;
  31. uint8_t g;
  32. uint8_t b;
  33. uint16_t delay;
  34. } VirtualPortal;
  35. VirtualPortal* virtual_portal_alloc(NotificationApp* notifications);
  36. void virtual_portal_free(VirtualPortal* virtual_portal);
  37. void virtual_portal_cleanup(VirtualPortal* virtual_portal);
  38. void virtual_portal_load_token(VirtualPortal* virtual_portal, PoFToken* pof_token);
  39. int virtual_portal_process_message(
  40. VirtualPortal* virtual_portal,
  41. uint8_t* message,
  42. uint8_t* response);
  43. int virtual_portal_send_status(VirtualPortal* virtual_portal, uint8_t* response);