Share via


BluetoothLEDevice.GattServicesChanged Event

Definition

Raised when the list of GATT services supported by the device has changed.

// Register
event_token GattServicesChanged(TypedEventHandler<BluetoothLEDevice, IInspectable const&> const& handler) const;

// Revoke with event_token
void GattServicesChanged(event_token const* cookie) const;

// Revoke with event_revoker
BluetoothLEDevice::GattServicesChanged_revoker GattServicesChanged(auto_revoke_t, TypedEventHandler<BluetoothLEDevice, IInspectable const&> const& handler) const;
public event TypedEventHandler<BluetoothLEDevice,object> GattServicesChanged;
function onGattServicesChanged(eventArgs) { /* Your code */ }
bluetoothLEDevice.addEventListener("gattserviceschanged", onGattServicesChanged);
bluetoothLEDevice.removeEventListener("gattserviceschanged", onGattServicesChanged);
- or -
bluetoothLEDevice.ongattserviceschanged = onGattServicesChanged;
Public Custom Event GattServicesChanged As TypedEventHandler(Of BluetoothLEDevice, Object) 

Event Type

Windows requirements

App capabilities
bluetooth

Remarks

This event is raised when the remote device changes its services, or an unpaired device is disconnecting. All services are cleared because unpaired device services can't be cached between connections.

The object parameter in this event is null for every event that is raised.

In your handler for this event, do the following in order to get the services available. Call BluetoothLEDevice.GetGattServicesAsync on the BluetoothLEDevice that's passed to your handler. When calling GetGattServicesAsync, use the Cached option. This can be used to refresh the list of services and re-initialize the services on the device if they are gone.

Applies to