[FL-3314] Disconnect from BLE on protobuf error (#2955)

* Disconnect from BLE on protobuf error
* Set profile instead of disconnecting and add logging

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Astra 2023-09-01 13:54:12 +09:00 committed by GitHub
parent 5eeb672dd4
commit e5fdb2e069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,8 @@
#include <stdio.h>
#include <m-dict.h>
#include <bt/bt_service/bt.h>
#define TAG "RpcSrv"
typedef enum {
@ -316,6 +318,15 @@ static int32_t rpc_session_worker(void* context) {
session->closed_callback(session->context);
}
furi_mutex_release(session->callbacks_mutex);
if(session->owner == RpcOwnerBle) {
// Disconnect BLE session
FURI_LOG_E("RPC", "BLE session closed due to a decode error");
Bt* bt = furi_record_open(RECORD_BT);
bt_set_profile(bt, BtProfileSerial);
furi_record_close(RECORD_BT);
FURI_LOG_E("RPC", "Finished disconnecting the BLE session");
}
}
}