mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
Bluetooth timeout is now dynamic thanks to rssi analyzing
This commit is contained in:
@@ -428,6 +428,22 @@ const uint8_t *bt_get_profile_mac_address(Bt *bt) {
|
||||
}
|
||||
}
|
||||
|
||||
bool bt_remote_rssi(Bt *bt, BtRssi *rssi) {
|
||||
furi_assert(bt);
|
||||
UNUSED(rssi);
|
||||
|
||||
uint8_t rssi_val;
|
||||
uint32_t since = furi_hal_bt_get_conn_rssi(&rssi_val);
|
||||
|
||||
if (since == 0)
|
||||
return false;
|
||||
|
||||
rssi->rssi = rssi_val;
|
||||
rssi->since = since;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t bt_srv(void* p) {
|
||||
UNUSED(p);
|
||||
Bt* bt = bt_alloc();
|
||||
|
||||
@@ -23,6 +23,12 @@ typedef enum {
|
||||
BtProfileHidKeyboard,
|
||||
} BtProfile;
|
||||
|
||||
typedef struct {
|
||||
uint8_t rssi;
|
||||
uint32_t since;
|
||||
} BtRssi;
|
||||
|
||||
|
||||
typedef void (*BtStatusChangedCallback)(BtStatus status, void* context);
|
||||
|
||||
/** Change BLE Profile
|
||||
@@ -42,6 +48,8 @@ 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, BtRssi *rssi);
|
||||
|
||||
|
||||
/** Disconnect from Central
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user