bt_trigger.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 <extra_profiles/hid_profile.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/hid_ble/.bt_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. FuriHalBleProfileBase* ble_hid_profile;
  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(void* ctx);
  43. static void bt_hid_connection_status_changed_callback(BtStatus status, void* context);
  44. AppStruct* appStructAlloc();
  45. void cleanUpBeforeYouLeave(AppStruct* app);