[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:
parent
5eeb672dd4
commit
e5fdb2e069
@ -15,6 +15,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <m-dict.h>
|
#include <m-dict.h>
|
||||||
|
|
||||||
|
#include <bt/bt_service/bt.h>
|
||||||
|
|
||||||
#define TAG "RpcSrv"
|
#define TAG "RpcSrv"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -316,6 +318,15 @@ static int32_t rpc_session_worker(void* context) {
|
|||||||
session->closed_callback(session->context);
|
session->closed_callback(session->context);
|
||||||
}
|
}
|
||||||
furi_mutex_release(session->callbacks_mutex);
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user