[FL-2580] FuriHal: add more supported radio stacks (#1301)

* FuriHal: add more supported radio stacks
* Bt: correct ble stack enum value
* Bt: update cli testing commands implementation
* Scripts: always emitting ob data to update manifest; added ob_custradio.data for non-light radio stacks
* Scripts: added stack type whitelist & disclaimer message
* ble: remove scanner
* ble: remove HCI and advances ble stacks support
* bt: correctly close RPC session before bt reinit
* Scripts: update bundler: estimating flash layout & refusing to build dangerous packages; app frame: not adding redundant log handlers
* Docs: additional details on bundling updates; fixed updater error codes
* Docs: wording fixes for OTA.md

Co-authored-by: hedger <hedger@nanode.su>
Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
あく
2022-06-09 18:07:42 +09:00
committed by GitHub
parent 2bd4efd044
commit 936a2f64b2
18 changed files with 280 additions and 192 deletions

45
firmware/targets/f7/furi_hal/furi_hal_bt.c Executable file → Normal file
View File

@@ -104,15 +104,18 @@ void furi_hal_bt_unlock_core2() {
static bool furi_hal_bt_radio_stack_is_supported(const BleGlueC2Info* info) {
bool supported = false;
if(info->StackType == INFO_STACK_TYPE_BLE_HCI) {
furi_hal_bt_stack = FuriHalBtStackHciLayer;
supported = true;
} else if(info->StackType == INFO_STACK_TYPE_BLE_LIGHT) {
if(info->StackType == INFO_STACK_TYPE_BLE_LIGHT) {
if(info->VersionMajor >= FURI_HAL_BT_STACK_VERSION_MAJOR &&
info->VersionMinor >= FURI_HAL_BT_STACK_VERSION_MINOR) {
furi_hal_bt_stack = FuriHalBtStackLight;
supported = true;
}
} else if(info->StackType == INFO_STACK_TYPE_BLE_FULL) {
if(info->VersionMajor >= FURI_HAL_BT_STACK_VERSION_MAJOR &&
info->VersionMinor >= FURI_HAL_BT_STACK_VERSION_MINOR) {
furi_hal_bt_stack = FuriHalBtStackFull;
supported = true;
}
} else {
furi_hal_bt_stack = FuriHalBtStackUnknown;
}
@@ -168,6 +171,22 @@ FuriHalBtStack furi_hal_bt_get_radio_stack() {
return furi_hal_bt_stack;
}
bool furi_hal_bt_is_ble_gatt_gap_supported() {
if(furi_hal_bt_stack == FuriHalBtStackLight || furi_hal_bt_stack == FuriHalBtStackFull) {
return true;
} else {
return false;
}
}
bool furi_hal_bt_is_testing_supported() {
if(furi_hal_bt_stack == FuriHalBtStackFull) {
return true;
} else {
return false;
}
}
bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb, void* context) {
furi_assert(event_cb);
furi_assert(profile < FuriHalBtProfileNumber);
@@ -178,7 +197,7 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb,
FURI_LOG_E(TAG, "Can't start BLE App - radio stack did not start");
break;
}
if(furi_hal_bt_stack != FuriHalBtStackLight) {
if(!furi_hal_bt_is_ble_gatt_gap_supported()) {
FURI_LOG_E(TAG, "Can't start Ble App - unsupported radio stack");
break;
}
@@ -209,7 +228,7 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb,
break;
}
// Start selected profile services
if(furi_hal_bt_stack == FuriHalBtStackLight) {
if(furi_hal_bt_is_ble_gatt_gap_supported()) {
profile_config[profile].start();
}
ret = true;
@@ -411,20 +430,6 @@ void furi_hal_bt_stop_rx() {
aci_hal_rx_stop();
}
bool furi_hal_bt_start_scan(GapScanCallback callback, void* context) {
if(furi_hal_bt_stack != FuriHalBtStackHciLayer) {
return false;
}
gap_start_scan(callback, context);
return true;
}
void furi_hal_bt_stop_scan() {
if(furi_hal_bt_stack == FuriHalBtStackHciLayer) {
gap_stop_scan();
}
}
bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode) {
BleGlueCommandResult fw_start_res = ble_glue_force_c2_mode(mode);
if(fw_start_res == BleGlueCommandResultOK) {