IPWorks BLE 2020 ActiveX Edition

Questions / Feedback?

DiscoverServices Method

Used to discover services for the currently connected server.


bleclientcontrol.DiscoverServices ServiceUuids, IncludedByServiceId


This method is used to discover root services on the currently connected server when empty string is passed for the IncludedByServiceId parameter. Passing the Id of an already-discovered service instead will cause the control to discover services included by that service.

All discovered services, root or otherwise, are added to the Service* properties.

It is recommended that you pass a comma-separated list of service UUIDs for the ServiceUuids parameter in order to limit discovery to just the services that you are interested in. You may also pass the empty string to discover all of the server's services (or all of a service's included services), but doing so will result in much higher power consumption.

During the discovery process, the Discovered event will fire once for each service discovered. You may control whether it fires when a service is rediscovered by setting the IncludeRediscovered configuration setting.

Keep in mind that having any of the following configuration settings enabled when you call this method may cause additional, unwanted power consumption: AutoDiscoverCharacteristics, AutoDiscoverDescriptors, or AutoDiscoverIncludedServices.

Service Discovery

// Discovered event handler.
bleclient1.OnDiscovered += (s, e) => {
  Console.WriteLine("Service discovered:" +
    "\r\n\tService Id: " + e.ServiceId +
    // The discovered service's 128-bit UUID string, in the format
    "\r\n\tUUID: " + e.Uuid +
    // For standard services whose UUIDs are defined by the Bluetooth SIG,
    // the Description event parameter will contain the name of the service.
    "\r\n\tDescription: " + e.Description);

// Discover all root services.
bleclient1.DiscoverServices("", "");

// Discover all services included by a discovered service whose Id is "000100000000".
bleclient1.DiscoverServices("", "000100000000");

Filtered Service Discovery

// Discover specific root services. These three UUIDs will cause the Device Information,
// Luxometer, and Humidity services to be discovered on our CC2650STK TI SensorTag.
// (Since the latter two are non-standard, you have to use their full UUIDs.)
bleclient1.DiscoverServices("180A,F000AA70-0451-4000-B000-000000000000,F000AA20-0451-4000-B000-000000000000", "");

// Discover specific services included by a discovered service whose Id is "000100000000".
// (The TI SensorTag doesn't have any included services, this is just an example.)
bleclient1.DiscoverServices("FFFFFFFF-9000-4000-B000-000000000000", "000100000000")

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks BLE 2020 ActiveX Edition - Version 20.0 [Build 8162]