Class: Toybox.BluetoothLowEnergy.Device

Overview

Represents a Bluetooth Low Energy Device that has been paired with the system.

This class cannot be instantiated, access to paired system devices is done through the use of BluetoothLowEnergy.getPairedDevices() or by calling BluetoothLowEnergy.pairDevice() after receiving a ScanResult for a device

Since:

API Level 3.1.0

Instance Method Summary collapse

Instance Method Details

getName() as Lang.String or Null

Retrieves the Name of the sensor according to the device name that is available in the GAP Service

Returns:

  • Lang.String

    the name of the device. null if the device is not connected or name has not been received yet.

Since:

API Level 3.1.0

getService(uuid as BluetoothLowEnergy.Uuid) as BluetoothLowEnergy.Service or Null

Retrieves the service with a specified UUID

If access to a specific service is required, use this function to directly access the service based on a UUID.

Parameters:

Returns:

  • BluetoothLowEnergy.Service

    The service represented by the UUID if the service exists or, null if the service does not exist or the UUID has not been registered

Since:

API Level 3.1.0

getServices() as BluetoothLowEnergy.Iterator

Retrieves an Iterator over the services provided by the device.

This will only provide Services that have been registered using BluetoothLowEnergy.registerProfile()

Returns:

Since:

API Level 3.1.0

isBonded() as Lang.Boolean

Gets the Bonded State of the Device

Supported Devices:

Returns:

  • Lang.Boolean

    true if the device is bonded false if the device is not bonded

Since:

API Level 4.2.5

isConnected() as Lang.Boolean

Gets the connected status of the device

Returns:

  • Lang.Boolean

    true if the sensor is connected false if sensor is disconnected

Since:

API Level 3.1.0

requestBond() as Void

Requests that a bond is formed with the Device

If the device is not currently bonded this will initiate the bonding procedure.

Once the operation is completed BleDelegate.onEncryptionStatus() will be called on the registered BleDelegate with the status of the operation

Supported Devices:

Since:

API Level 4.2.5

Throws:


Generated Apr 17, 2024 9:40:37 AM