mirror of https://github.com/ARMmbed/mbed-os.git
BLE: Add gap handlers to be informed when advertising as started or been stopped
parent
23f7a187fb
commit
313676a089
|
@ -639,6 +639,20 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg)
|
|||
break;
|
||||
#endif // BLE_FEATURE_PERIODIC_ADVERTISING
|
||||
|
||||
case DM_ADV_START_IND:
|
||||
if (!handler) {
|
||||
break;
|
||||
}
|
||||
handler->on_legacy_advertising_started();
|
||||
break;
|
||||
|
||||
case DM_ADV_STOP_IND:
|
||||
if (!handler) {
|
||||
break;
|
||||
}
|
||||
handler->on_legacy_advertising_stopped();
|
||||
break;
|
||||
|
||||
#if BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_BROADCASTER
|
||||
case DM_SCAN_REQ_RCVD_IND: {
|
||||
if (!handler) {
|
||||
|
@ -651,8 +665,16 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg)
|
|||
connection_peer_address_type_t(evt->scanAddrType),
|
||||
evt->scanAddr
|
||||
);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case DM_ADV_SET_START_IND: {
|
||||
if (!handler) {
|
||||
break;
|
||||
}
|
||||
const auto *evt = (const dmAdvSetStartEvt_t *) msg;
|
||||
handler->on_advertising_set_started({evt->advHandle, evt->numSets});
|
||||
} break;
|
||||
|
||||
|
||||
case DM_ADV_SET_STOP_IND: {
|
||||
const auto *evt = (const hciLeAdvSetTermEvt_t *) msg;
|
||||
|
@ -676,8 +698,7 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg)
|
|||
evt->handle,
|
||||
evt->numComplEvts
|
||||
);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_BROADCASTER
|
||||
|
||||
#if BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_OBSERVER
|
||||
|
|
|
@ -2466,6 +2466,17 @@ void Gap::on_periodic_advertising_sync_loss(sync_handle_t sync_handle)
|
|||
);
|
||||
}
|
||||
|
||||
void Gap::on_legacy_advertising_started()
|
||||
{
|
||||
}
|
||||
|
||||
void Gap::on_legacy_advertising_stopped()
|
||||
{
|
||||
}
|
||||
|
||||
void Gap::on_advertising_set_started(const mbed::Span<const uint8_t>& handles)
|
||||
{
|
||||
}
|
||||
|
||||
void Gap::on_advertising_set_terminated(
|
||||
hci_error_code_t status,
|
||||
|
|
|
@ -494,6 +494,12 @@ private:
|
|||
|
||||
void on_periodic_advertising_sync_loss(sync_handle_t sync_handle) override;
|
||||
|
||||
void on_legacy_advertising_started() override;
|
||||
|
||||
void on_legacy_advertising_stopped() override;
|
||||
|
||||
void on_advertising_set_started(const mbed::Span<const uint8_t>& handles) override;
|
||||
|
||||
void on_advertising_set_terminated(
|
||||
hci_error_code_t status,
|
||||
advertising_handle_t advertising_handle,
|
||||
|
|
|
@ -198,6 +198,21 @@ public:
|
|||
*/
|
||||
virtual void on_scan_timeout( ) = 0;
|
||||
|
||||
/**
|
||||
* Called when legacy advertising has been effectively started.
|
||||
*/
|
||||
virtual void on_legacy_advertising_started() = 0;
|
||||
|
||||
/**
|
||||
* Called when legacy advertising has been stopped.
|
||||
*/
|
||||
virtual void on_legacy_advertising_stopped() = 0;
|
||||
|
||||
/**
|
||||
* Called when extended advertising has been started.
|
||||
*/
|
||||
virtual void on_advertising_set_started(const mbed::Span<const uint8_t>& handles) = 0;
|
||||
|
||||
/** Called when advertising set stops advertising.
|
||||
*
|
||||
* @param status SUCCESS if connection has been established.
|
||||
|
|
Loading…
Reference in New Issue