File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
libraries/cordio_stack/ble-host/sources/stack/dm Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -1227,6 +1227,7 @@ void dmExtAdvActHciEnableCmpl(hciEvt_t *pEvent)
12271227 /* prepare the message for callback */
12281228 dmMsg .advSetStop .numComplEvts = 0 ; /* this value is invalid, we zero it to avoid confusing the user */
12291229 dmMsg .advSetStop .handle = DM_CONN_ID_NONE ;
1230+ dmMsg .advSetStop .handle = DM_ADV_HCI_HANDLE_NONE ;
12301231 dmMsg .advSetStop .status = dmMsg .hdr .status ;
12311232 dmMsg .advSetStop .advHandle = i ;
12321233
Original file line number Diff line number Diff line change @@ -870,14 +870,17 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg)
870870 }
871871
872872 hci_error_code_t status = hci_error_code_t (evt->status );
873- if (status == hci_error_code_t ::SUCCESS && evt->handle == DM_CONN_ID_NONE) {
874- /* we stopped advertising without a connection, reflect that in the status */
875- status = hci_error_code_t ::OPERATION_CANCELLED_BY_HOST;
873+ connection_handle_t connection_handle = DM_CONN_ID_NONE;
874+ /* the way we distinguish between local close and connection is the invalid HCI conn handle */
875+ if (evt->handle != DM_CONN_HCI_HANDLE_NONE) {
876+ /* use the translated conn handle */
877+ connection_handle = evt->hdr .param ;
876878 }
879+
877880 handler->on_advertising_set_terminated (
878881 status,
879882 evt->advHandle ,
880- evt-> handle ,
883+ connection_handle ,
881884 evt->numComplEvts
882885 );
883886 } break ;
Original file line number Diff line number Diff line change @@ -3479,16 +3479,14 @@ void Gap::on_advertising_set_terminated(
34793479 connection_handle,
34803480 to_string (status),
34813481 number_of_completed_extended_advertising_events);
3482-
3482+
34833483 ble_error_t error_code = BLE_ERROR_UNSPECIFIED;
34843484 bool connected = false ;
34853485
3486- if (status == hci_error_code_t ::SUCCESS) {
3487- /* hci code success means connection terminated it */
3486+ if (status == hci_error_code_t ::SUCCESS && connection_handle != DM_CONN_ID_NONE) {
34883487 connected = true ;
34893488 error_code = BLE_ERROR_NONE;
3490- } else if (status == hci_error_code_t ::OPERATION_CANCELLED_BY_HOST) {
3491- /* if we stopped the set ourselves this is not an error */
3489+ } else if (status == hci_error_code_t ::ADVERTISING_TIMEOUT) {
34923490 error_code = BLE_ERROR_NONE;
34933491 }
34943492
You can’t perform that action at this time.
0 commit comments