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

Methods

(async) discoverCharacteristics(characteristicsFilteropt) → {Promise.<Array.<BleCharacteristic>>}

Discover characteristics of this service

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

List of characteristicUuids to search for

Returns:
Type:
Promise.<Array.<BleCharacteristic>>

(async) discoverIncludedServices(includedServicesFilteropt) → {Promise.<void>}

Discovers included service uuids

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

Array of included service uuids to search for

Returns:
Type:
Promise.<void>

(async) getCharacteristic(uuid) → {Promise.<BleCharacteristic>}

gets a characteristic for given characteristicUuid

Parameters:
Name Type Description
uuid string

The characteristicUuid to get

Returns:
Type:
Promise.<BleCharacteristic>

(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:
Type:
Promise.<Buffer>

(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:
Type:
Promise.<Buffer>