mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
gap: return command disallowed if disconnect already requested
This commit is contained in:
parent
66093044db
commit
61972f0a59
@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- HID Host: return complete HID report
|
- HID Host: return complete HID report
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- GAP: return command disallowed if disconnect already requested
|
||||||
|
|
||||||
|
|
||||||
## Release v1.6.1
|
## Release v1.6.1
|
||||||
|
|
||||||
|
22
src/hci.c
22
src/hci.c
@ -9035,13 +9035,23 @@ uint8_t gap_disconnect(hci_con_handle_t handle){
|
|||||||
hci_emit_disconnection_complete(handle, 0);
|
hci_emit_disconnection_complete(handle, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// ignore if already disconnected
|
uint8_t status = ERROR_CODE_SUCCESS;
|
||||||
if (conn->state == RECEIVED_DISCONNECTION_COMPLETE){
|
switch (conn->state){
|
||||||
return 0;
|
case RECEIVED_DISCONNECTION_COMPLETE:
|
||||||
|
// ignore if remote just disconnected
|
||||||
|
break;
|
||||||
|
case SEND_DISCONNECT:
|
||||||
|
case SENT_DISCONNECT:
|
||||||
|
// disconnect already requested or sent
|
||||||
|
status = ERROR_CODE_COMMAND_DISALLOWED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// trigger hci_disconnect
|
||||||
|
conn->state = SEND_DISCONNECT;
|
||||||
|
hci_run();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
conn->state = SEND_DISCONNECT;
|
return status;
|
||||||
hci_run();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gap_read_rssi(hci_con_handle_t con_handle){
|
int gap_read_rssi(hci_con_handle_t con_handle){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user