GattServiceProvider GattServiceProvider GattServiceProvider GattServiceProvider Class

Definition

This class is used to advertise a GATT service.

public : sealed class GattServiceProvider : IGattServiceProvider
public sealed class GattServiceProvider : IGattServiceProvider
Public NotInheritable Class GattServiceProvider Implements IGattServiceProvider
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

Properties

AdvertisementStatus AdvertisementStatus AdvertisementStatus AdvertisementStatus

Gets the advertisement status of this GATT service.

public : GattServiceProviderAdvertisementStatus AdvertisementStatus { get; }
public GattServiceProviderAdvertisementStatus AdvertisementStatus { get; }
Public ReadOnly Property AdvertisementStatus As GattServiceProviderAdvertisementStatus
var gattServiceProviderAdvertisementStatus = gattServiceProvider.advertisementStatus;
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

Service Service Service Service

Gets the GATT service.

public : GattLocalService Service { get; }
public GattLocalService Service { get; }
Public ReadOnly Property Service As GattLocalService
var gattLocalService = gattServiceProvider.service;
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

Methods

CreateAsync(Guid) CreateAsync(Guid) CreateAsync(Guid) CreateAsync(Guid)

Creates a new GATT service with the specified serviceUuid

public : static IAsyncOperation<GattServiceProviderResult> CreateAsync(Platform::Guid serviceUuid)
public static IAsyncOperation<GattServiceProviderResult> CreateAsync(Guid serviceUuid)
Public Static Function CreateAsync(serviceUuid As Guid) As IAsyncOperation( Of GattServiceProviderResult )
Windows.Devices.Bluetooth.GenericAttributeProfile.GattServiceProvider.createAsync(serviceUuid).done( /* Your success and error handlers */ );
Parameters
serviceUuid
Platform::Guid Guid Guid Guid

The service UUID.

Returns
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

StartAdvertising() StartAdvertising() StartAdvertising() StartAdvertising()

Start advertising the GATT service.

public : void StartAdvertising()
public void StartAdvertising()
Public Function StartAdvertising() As void
gattServiceProvider.startAdvertising();
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

StartAdvertising(GattServiceProviderAdvertisingParameters) StartAdvertising(GattServiceProviderAdvertisingParameters) StartAdvertising(GattServiceProviderAdvertisingParameters) StartAdvertising(GattServiceProviderAdvertisingParameters)

Start advertising the GATT service.

public : void StartAdvertising(GattServiceProviderAdvertisingParameters parameters)
public void StartAdvertising(GattServiceProviderAdvertisingParameters parameters)
Public Function StartAdvertising(parameters As GattServiceProviderAdvertisingParameters) As void
gattServiceProvider.startAdvertising(parameters);
Parameters
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

StopAdvertising() StopAdvertising() StopAdvertising() StopAdvertising()

Stop advertising the GATT service.

public : void StopAdvertising()
public void StopAdvertising()
Public Function StopAdvertising() As void
gattServiceProvider.stopAdvertising();
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth

Events

AdvertisementStatusChanged AdvertisementStatusChanged AdvertisementStatusChanged AdvertisementStatusChanged

An event that is triggered when the advertisement status has changed.

public : event TypedEventHandler AdvertisementStatusChanged<GattServiceProvider, GattServiceProviderAdvertisementStatusChangedEventArgs>
public event TypedEventHandler AdvertisementStatusChanged<GattServiceProvider, GattServiceProviderAdvertisementStatusChangedEventArgs>
Public Event TypedEventHandler AdvertisementStatusChanged( Of ( Of GattServiceProvider ), ( Of GattServiceProviderAdvertisementStatusChangedEventArgs ))
function onAdvertisementStatusChanged(eventArgs){/* Your code */}


gattServiceProvider.addEventListener("advertisementStatusChanged", onAdvertisementStatusChanged);
gattServiceProvider.removeEventListener("advertisementStatusChanged", onAdvertisementStatusChanged);
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)
Capabilities
bluetooth