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.

Properties

characteristics

characteristics: Array.<BleCharacteristic>

Type

id

id: string

Id of the service assigned by Homey

Type

  • string

name

name: string

The name of the service

Type

  • string

type

type: string

The type of the service

Type

  • string

uuid

uuid: string

Uuid of the service

Type

  • string

Methods

discoverCharacteristics

(async) discoverCharacteristics(characteristicsFilteropt): Promise.<Array.<BleCharacteristic>>

Discover characteristics of this service

Parameters

Name Type Description
characteristicsFilter
Array.<string> <optional>

List of characteristicUuids to search for

Returns

Promise.<Array.<BleCharacteristic>>

discoverIncludedServices

(async) discoverIncludedServices(includedServicesFilteropt): Promise.<void>

Discovers included service uuids

Parameters

Name Type Description
includedServicesFilter
Array.<string> <optional>

Array of included service uuids to search for

Returns

Promise.<void>

getCharacteristic

(async) getCharacteristic(uuid): Promise.<BleCharacteristic>

gets a characteristic for given characteristicUuid

Parameters

Name Type Description
uuid
string

The characteristicUuid to get

Returns

Promise.<BleCharacteristic>

read

(async) read(characteristicUuid): Promise.<Buffer>

Shorthand to read a characteristic for given characteristicUuid

Parameters

Name Type Description
characteristicUuid
string

The uuid of the characteristic that needs to be read

Returns

Promise.<Buffer>

write

(async) write(characteristicUuid, data): Promise.<Buffer>

Shorthand to write to a characteristic for given characteristicUuid

Parameters

Name Type Description
characteristicUuid
string

The uuid of the characteristic that needs to be written to

data
Buffer

The data that needs to be written

Returns

Promise.<Buffer>