This commit is contained in:
Willy-JL
2024-02-16 11:27:05 +00:00
91 changed files with 3578 additions and 2228 deletions

View File

@@ -2,7 +2,8 @@
#include <stdint.h>
#include <stdbool.h>
#include <furi_hal_bt.h>
#include <furi_ble/profile_interface.h>
#include <core/common_defines.h>
#ifdef __cplusplus
extern "C" {
@@ -19,11 +20,6 @@ typedef enum {
BtStatusConnected,
} BtStatus;
typedef enum {
BtProfileSerial,
BtProfileHidKeyboard,
} BtProfile;
typedef struct {
uint8_t rssi;
uint32_t since;
@@ -34,12 +30,25 @@ typedef void (*BtStatusChangedCallback)(BtStatus status, void* context);
/** Change BLE Profile
* @note Call of this function leads to 2nd core restart
*
* @param bt Bt instance
* @param profile BtProfile
* @param bt Bt instance
* @param profile_template Profile template to change to
* @param params Profile parameters. Can be NULL
*
* @return true on success
*/
bool bt_set_profile(Bt* bt, BtProfile profile);
FURI_WARN_UNUSED FuriHalBleProfileBase* bt_profile_start(
Bt* bt,
const FuriHalBleProfileTemplate* profile_template,
FuriHalBleProfileParams params);
/** Stop current BLE Profile and restore default profile
* @note Call of this function leads to 2nd core restart
*
* @param bt Bt instance
*
* @return true on success
*/
bool bt_profile_restore_default(Bt* bt);
/** Disconnect from Central
*
@@ -75,30 +84,8 @@ void bt_keys_storage_set_storage_path(Bt* bt, const char* keys_storage_path);
*/
void bt_keys_storage_set_default_path(Bt* bt);
void bt_set_profile_adv_name(Bt* bt, const char* fmt, ...);
const char* bt_get_profile_adv_name(Bt* bt);
void bt_set_profile_mac_address(Bt* bt, const uint8_t mac[6]);
const uint8_t* bt_get_profile_mac_address(Bt* bt);
bool bt_remote_rssi(Bt* bt, uint8_t* rssi);
void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method);
GapPairing bt_get_profile_pairing_method(Bt* bt);
/** Stop saving new peer key to flash (in .bt.keys file)
*
*/
void bt_disable_peer_key_update(Bt* bt);
/** Enable saving peer key to internal flash (enable by default)
*
* @note This function should be called if bt_disable_peer_key_update was called before
*/
void bt_enable_peer_key_update(Bt* bt);
/**
*
* (Probably bad) way of opening the RPC connection, everywhereTM