Skip to content

Commit 05289be

Browse files
committed
BLE LinkLossService: use new EventHandler API to handle disconnection
1 parent 3702b20 commit 05289be

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

features/FEATURE_BLE/ble/services/LinkLossService.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.link_loss.xml
2828
* Alertness Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.alert_level.xml
2929
*/
30-
class LinkLossService {
30+
class LinkLossService : public ble::Gap::EventHandler
31+
{
3132
public:
3233
enum AlertLevel_t {
3334
NO_ALERT = 0,
@@ -59,7 +60,7 @@ class LinkLossService {
5960
ble.gattServer().addService(linkLossService);
6061
serviceAdded = true;
6162

62-
ble.gap().onDisconnection(this, &LinkLossService::onDisconnectionFilter);
63+
ble.gap().setEventHandler(this);
6364
ble.gattServer().onDataWritten(this, &LinkLossService::onDataWritten);
6465
}
6566

@@ -90,7 +91,7 @@ class LinkLossService {
9091
}
9192
}
9293

93-
void onDisconnectionFilter(const Gap::DisconnectionCallbackParams_t *params) {
94+
virtual void onDisconnectionComplete(const ble::DisconnectionCompleteEvent &) {
9495
if (alertLevel != NO_ALERT) {
9596
callback(alertLevel);
9697
}

0 commit comments

Comments
 (0)