BleService

This class is a representation of a BLE Advertisement for a BlePeripheral in Homey. This class must not be initiated by the developer, but retrieved by calling BlePeripheral#discoverServices or BlePeripheral#getService.

Table of Contents

Constructor

new Homey.BleService()

Properties:
Name Type Description
id string

Id of the service assigned by Homey

uuid string

Uuid of the service

peripheral BlePeripheral

The peripheral object that is the owner of this service

name string

The name of the service

type string

The type of the service

Methods

discoverCharacteristics(characteristicsopt, callbackopt) → {Promise}

Discover characteristics of this service

Parameters:
Name Type Attributes Description
characteristics Array.<string> <optional>

List of characteristicUuids to search for

callback function <optional>
Name Type Description
err Error
characteristics Array.<BleCharacteristic>
Returns:
Type:
Promise

discoverIncludedServices(includedServicesopt, callbackopt) → {Promise}

Discovers included service uuids

Parameters:
Name Type Attributes Description
includedServices Array.<string> <optional>

Array of included service uuids to search for

callback function <optional>
Name Type Description
err Error
includedServiceUuids Array.<string>
Returns:
Type:
Promise

(async) getCharacteristic(uuid, callbackopt) → {Promise}

gets a characteristic for given characteristicUuid

Parameters:
Name Type Attributes Description
uuid string

The characteristicUuid to get

callback function <optional>
Name Type Description
err Error
characteristic BleCharacteristic
Returns:
Type:
Promise

getInfoString(ic, callbackopt) → {Promise}

Get all available information of this service as a printable string

Parameters:
Name Type Attributes Description
ic number

Indent count

callback function <optional>
Name Type Description
err Error

Will always be null

infoString string

the info string

Returns:
Type:
Promise

read(characteristicUuid, callbackopt) → {Promise}

Shorthand to read a characteristic for given characteristicUuid

Parameters:
Name Type Attributes Description
characteristicUuid string

The uuid of the characteristic that needs to be read

callback function <optional>
Name Type Description
err Error
result Buffer
Returns:
Type:
Promise

readAll(argumentsArray, callbackopt) → {Promise}

Shorthand to read multiple characteristicUuid values

Parameters:
Name Type Attributes Description
argumentsArray Array.<Array.<string>>

Two dimensional array with [characteristicUuid] entries

callback function <optional>
Name Type Description
err Error
results Array.<Buffer>
Returns:
Type:
Promise

write(characteristicUuid, data, callbackopt) → {Promise}

Shorthand to write to a characteristic for given characteristicUuid

Parameters:
Name Type Attributes Description
characteristicUuid string

The uuid of the characteristic that needs to be written to

data Buffer

The data that needs to be written

callback function <optional>
Name Type Description
err Error
result Buffer
Returns:
Type:
Promise

writeAll(argumentsArray, callbackopt) → {Promise}

Shorthand to write to multiple characteristicUuids

Parameters:
Name Type Attributes Description
argumentsArray Array.<Array.<string>>

Two dimensional array with [characteristicUuid, data] tuples

callback function <optional>
Name Type Description
err Error
results Array.<Buffer>
Returns:
Type:
Promise