bt_trigger.h 1.3 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. #include <assets_icons.h>
  16. //#include "ios_trigger_icons.h"
  17. #define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps_data/bt_trigger/hid.keys")
  18. #define TAG "bt_trigger"
  19. //Enum of allowed event types
  20. typedef enum {
  21. EventTypeTick,
  22. EventTypeInput,
  23. } EventType;
  24. //Struct to store an event and its type
  25. typedef struct {
  26. EventType type;
  27. InputEvent input;
  28. } IosTriggerEvent;
  29. typedef struct {
  30. Bt* bt;
  31. Gui* gui;
  32. NotificationApp* notifications;
  33. ViewPort* view_port;
  34. bool connected;
  35. bool running;
  36. bool shooting;
  37. int shots;
  38. int delay; //in ms
  39. } AppStruct;
  40. static void draw_callback(Canvas* canvas, void* ctx);
  41. static void input_callback(InputEvent* input_event, void* ctx);
  42. static void timer_callback(FuriMessageQueue* event_queue);
  43. static void bt_hid_connection_status_changed_callback(BtStatus status, void* context);
  44. AppStruct* appStructAlloc();
  45. void cleanUpBeforeYouLeave(AppStruct* app);