ios_trigger.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <stdio.h>
  3. #include <furi.h>
  4. #include <furi_hal_bt.h>
  5. #include <furi_hal_usb_hid.h>
  6. #include <furi_hal_bt_hid.h>
  7. #include <gui/gui.h>
  8. #include <input/input.h>
  9. #include <notification/notification_messages.h>
  10. #include <bt/bt_service/bt.h>
  11. #include <storage/storage.h>
  12. #include <gui/modules/dialog_ex.h>
  13. #include <gui/modules/popup.h>
  14. #include <dolphin/dolphin.h>
  15. #define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Dev/bt_hid.keys")
  16. #define TAG "HidApp"
  17. //Enum of allowed event types
  18. typedef enum{
  19. EventTypeTick,
  20. EventTypeInput,
  21. } EventType;
  22. //Struct to store an event and its type
  23. typedef struct {
  24. EventType type;
  25. InputEvent input;
  26. } IosTriggerEvent;
  27. typedef struct {
  28. Bt* bt;
  29. Gui* gui;
  30. NotificationApp* notifications;
  31. ViewPort* view_port;
  32. bool connected;
  33. bool running;
  34. bool shooting;
  35. int shots;
  36. int delay;//in ms
  37. } AppStruct;
  38. static void draw_callback(Canvas* canvas, void* ctx);
  39. static void input_callback(InputEvent* input_event, void* ctx);
  40. static void timer_callback(FuriMessageQueue* event_queue);
  41. static void bt_hid_connection_status_changed_callback(BtStatus status, void* context);
  42. AppStruct* appStructAlloc();
  43. void cleanUpBeforeYouLeave(AppStruct* app);