bt_trigger.h 1.3 KB

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