System.Bluetooth.TBluetoothGattServer.AddService

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function AddService(const AService: TBluetoothGattService; ShouldAdvertise: Boolean = True): Boolean;

C++

bool __fastcall AddService(TBluetoothGattService* const AService, bool ShouldAdvertise = true);

Properties

Type Visibility Source Unit Parent
function public
System.Bluetooth.pas
System.Bluetooth.hpp
System.Bluetooth TBluetoothGattServer

Description

Adds the specified service to your GATT server.

AddService returns False if it cannot add the specified service to the list of services.

Once the specified service is added to your server, the OnServiceAdded event occurs.

Use the ShouldAdvertise parameter to indicate whether you want to include the specified service in the list of services that your GATT server advertises (True) or not (False).

The UUID of the specified service must not be the same as the UUID of any of the existing services. Otherwise, AddService raises an EBluetoothServiceException exception with the following message:

Service <UUID> is already added to this server

See Also