2020-12-10 14:25:20 +00:00
|
|
|
#pragma once
|
2021-03-11 09:31:07 +00:00
|
|
|
|
2021-09-09 21:11:32 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-03-11 09:31:07 +00:00
|
|
|
typedef struct Bt Bt;
|
2021-09-09 21:11:32 +00:00
|
|
|
|
2021-12-15 17:39:06 +00:00
|
|
|
typedef enum {
|
2022-01-02 22:36:42 +00:00
|
|
|
BtStatusUnavailable,
|
2021-12-15 17:39:06 +00:00
|
|
|
BtStatusOff,
|
|
|
|
BtStatusAdvertising,
|
|
|
|
BtStatusConnected,
|
|
|
|
} BtStatus;
|
|
|
|
|
2021-12-08 11:28:01 +00:00
|
|
|
typedef enum {
|
|
|
|
BtProfileSerial,
|
|
|
|
BtProfileHidKeyboard,
|
|
|
|
} BtProfile;
|
|
|
|
|
2021-12-15 17:39:06 +00:00
|
|
|
typedef void (*BtStatusChangedCallback)(BtStatus status, void* context);
|
|
|
|
|
|
|
|
/** Change BLE Profile
|
2021-12-08 11:28:01 +00:00
|
|
|
* @note Call of this function leads to 2nd core restart
|
|
|
|
*
|
|
|
|
* @param bt Bt instance
|
|
|
|
* @param profile BtProfile
|
|
|
|
*
|
|
|
|
* @return true on success
|
|
|
|
*/
|
|
|
|
bool bt_set_profile(Bt* bt, BtProfile profile);
|
|
|
|
|
2021-12-15 17:39:06 +00:00
|
|
|
/** Set callback for Bluetooth status change notification
|
|
|
|
*
|
|
|
|
* @param bt Bt instance
|
|
|
|
* @param callback BtStatusChangedCallback instance
|
|
|
|
* @param context pointer to context
|
|
|
|
*/
|
|
|
|
void bt_set_status_changed_callback(Bt* bt, BtStatusChangedCallback callback, void* context);
|
|
|
|
|
2021-09-09 21:11:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|