Table of Contents

Class BluetoothLEServer

Namespace
nanoFramework.Device.Bluetooth
Assembly
nanoFramework.Device.Bluetooth.dll

Represents a Bluetooth LE Server.

public class BluetoothLEServer : IDisposable
Inheritance
BluetoothLEServer
Implements
Inherited Members
Extension Methods

Properties

Appearance

Appearance value of the device set in the Generic Access service and also the advertisment if enabled. The appearance is a 16 bit value comprising of bits 6 to 15 the device category and bits 0 to 5 the sub-categoty. See Bluetooth assigned numbers document section "Appearance Sub­category values" for values. For example a "IOT Gateway" has a value of 0x008D. The Appearance value defaults to 0, a Generic Unknown device.

public ushort Appearance { get; set; }

Property Value

ushort

DeviceName

Server device name, defaults to 'nanoFramework'. Set in the Generic Access service.

public string DeviceName { get; set; }

Property Value

string

Instance

Returns BluetoothLEServer singleton instance.

public static BluetoothLEServer Instance { get; }

Property Value

BluetoothLEServer

Pairing

Return Pairing object for handling Pairing.

public DevicePairing Pairing { get; }

Property Value

DevicePairing

Services

Gets an array of all associated service providers for this Bluetooth LE Server.

public GattServiceProvider[] Services { get; }

Property Value

GattServiceProvider[]

Remarks

The primary service will be index 0 followed by the Device Information at index 1. Any other Services added to server will follow these in the order they were created.

Session

Get GattSession associated with this server.

public GattSession Session { get; }

Property Value

GattSession

Methods

Dispose()

Dispose BluetoothLESever.
Remove all managed objects used by BluetoothLESever.

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Finalize()

Finalizer

protected override void Finalize()

GetServiceByUUID(Guid)

Returns service provider with specified UUID.

public GattServiceProvider GetServiceByUUID(Guid serviceUuid)

Parameters

serviceUuid Guid

UUID of the service to get.

Returns

GattServiceProvider

The service with the UUID.

Start()

Starts Bluetooth stack for server mode.

public void Start()

Exceptions

InvalidOperationException

If already running or in Client mode.

Stop()

Stops Bluetooth server mode. This stops the bluetooth stack but doesn't remove the current Services managed objects. To remove these dispose the BluetoothLEServer instance.

public void Stop()