bt.h 936 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. typedef struct Bt Bt;
  8. typedef enum {
  9. BtStatusUnavailable,
  10. BtStatusOff,
  11. BtStatusAdvertising,
  12. BtStatusConnected,
  13. } BtStatus;
  14. typedef enum {
  15. BtProfileSerial,
  16. BtProfileHidKeyboard,
  17. } BtProfile;
  18. typedef void (*BtStatusChangedCallback)(BtStatus status, void* context);
  19. /** Change BLE Profile
  20. * @note Call of this function leads to 2nd core restart
  21. *
  22. * @param bt Bt instance
  23. * @param profile BtProfile
  24. *
  25. * @return true on success
  26. */
  27. bool bt_set_profile(Bt* bt, BtProfile profile);
  28. /** Set callback for Bluetooth status change notification
  29. *
  30. * @param bt Bt instance
  31. * @param callback BtStatusChangedCallback instance
  32. * @param context pointer to context
  33. */
  34. void bt_set_status_changed_callback(Bt* bt, BtStatusChangedCallback callback, void* context);
  35. #ifdef __cplusplus
  36. }
  37. #endif