Class: Toybox.BluetoothLowEnergy.BleDelegate

Overview

Delegate Class for Bluetooth Low Energy Callbacks.

Applications must extend this Class and register an instance with the BLE Subsystem using BluetoothLowEnergy.setDelegate() to support asynchronous operations.

Since:

API Level 3.1.0

Instance Method Summary collapse

Instance Method Details

initialize()

Constructor

Since:

API Level 3.1.0

onCharacteristicChanged(characteristic as BluetoothLowEnergy.Characteristic, value as Lang.ByteArray) as Void

After enabling notifications or indications on a characteristic by enabling the appropriate bit of the CCCD of the characteristic this function will be called after every change to the characteristic.

Parameters:

Since:

API Level 3.1.0

onCharacteristicRead(characteristic as BluetoothLowEnergy.Characteristic, status as BluetoothLowEnergy.Status, value as Lang.ByteArray) as Void

After requesting a read operation on a characteristic using Characteristic.requestRead() this function will be called when the operation is completed.

Parameters:

  • characteristic(BluetoothLowEnergy.Characteristic)

    The characteristic that was read.

  • status(Lang.Number)

    A BluetoothLowEnergy.STATUS_* indicating the result of the operation

  • value(Lang.ByteArray)

    Characteristic value that was read. null if status is not STATUS_SUCCESS

Since:

API Level 3.1.0

onCharacteristicWrite(characteristic as BluetoothLowEnergy.Characteristic, status as BluetoothLowEnergy.Status) as Void

After requesting a write operation on a characteristic using Characteristic.requestWrite() this function will be called when the operation is completed.

Parameters:

Since:

API Level 3.1.0

onConnectedStateChanged(device as BluetoothLowEnergy.Device, state as BluetoothLowEnergy.ConnectionState) as Void

After pairing a device this will be called after the connection is made

Parameters:

  • device(Device)

    the device state that was changed

  • state(Lang.Number)

    A BluetoothLowEnergy.CONNECTION_STATE_* inicating the state of the connection

Since:

API Level 3.1.0

onDescriptorRead(descriptor as BluetoothLowEnergy.Descriptor, status as BluetoothLowEnergy.Status, value as Lang.ByteArray) as Void

After requesting a read operation on a descriptor using Descriptor.requestRead() this function will be called when the operation is completed.

Parameters:

  • descriptor(BluetoothLowEnergy.Descriptor)

    The descriptor that was read

  • status(Lang.Number)

    A BluetoothLowEnergy.STATUS_* indicating the result of the operation

  • value(Lang.ByteArray)

    Descriptor value that was read. null if status is not STATUS_SUCCESS

Since:

API Level 3.1.0

onDescriptorWrite(descriptor as BluetoothLowEnergy.Descriptor, status as BluetoothLowEnergy.Status) as Void

After requesting a write operation on a descriptor using Descriptor.requestWrite() this function will be called when the operation is completed.

Parameters:

Since:

API Level 3.1.0

onEncryptionStatus(device as BluetoothLowEnergy.Device, status as BluetoothLowEnergy.Status) as Void

After requesting a new bond or reconnecting to a device with a previously established bond, this function will be called with the current encryption status.

Parameters:

  • device(Device)

    the device state that was changed

  • status(Lang.Number)

    A BluetoothLowEnergy.STATUS_* indicating the status of the encryption operation.

Supported Devices:

Since:

API Level 4.2.5

onProfileRegister(uuid as BluetoothLowEnergy.Uuid, status as BluetoothLowEnergy.Status) as Void

After Registering a UUID this callback will notify of the result of the registration request

Parameters:

Since:

API Level 3.1.0

onScanResults(scanResults as BluetoothLowEnergy.Iterator) as Void

If a scan is running this will be called when new ScanResults are received

Parameters:

  • scanResults(BluetoothLowEnergy.Iterator)

    An iterator of BluetoothLowEnergy.ScanResult objects for all of the advertisements seen since the last call to this callback

Since:

API Level 3.1.0

onScanStateChange(scanState as BluetoothLowEnergy.ScanState, status as BluetoothLowEnergy.Status) as Void

When the state of scanning is modified the system will call this function with the new state and a status indicating the result of the last call to BluetoothLowEnergy.setScanState().

Parameters:

Since:

API Level 3.1.0


Generated Apr 17, 2024 9:40:37 AM