diff --git a/applications/services/rpc/rpc.c b/applications/services/rpc/rpc.c index b3ed4417..3e9665ad 100644 --- a/applications/services/rpc/rpc.c +++ b/applications/services/rpc/rpc.c @@ -15,6 +15,8 @@ #include #include +#include + #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"); + } } }