Properties
descriptors
descriptors: Array.<BleDescriptor>Type
- Array.<BleDescriptor>
id
id: stringId of the characteristic assigned by Homey
Type
- string
name
name: stringThe name of the characteristic
Type
- string
properties
properties: Array.<string>The properties of the characteristic
Type
- Array.<string>
type
type: stringThe type of the characteristic
Type
- string
uuid
uuid: stringUuid of the characteristic
Type
- string
value
value: Buffer|nullThe value of the characteristic. Note: this is set to the last result of $BleCharacteristic#read and is initially null
Type
- Buffer | null
Methods
discoverDescriptors
(async) discoverDescriptors(descriptorsFilteropt): Promise.<Array.<BleDescriptor>>Discovers descriptors for this characteristic
Parameters
Name | Type | Description |
---|---|---|
descriptorsFilter
|
Array.<string>
<optional> |
list of descriptorUuids to search for |
Throws
Will throw an error if peripheral is not connected
Returns
read
(async) read(): Promise.<Buffer>Read the value for this characteristic
Throws
Will throw an error if peripheral is not connected
Returns
subscribeToNotifications
(async) subscribeToNotifications(callback): Promise.<void>Subscribe to BLE notifications from the characteristic. The callback will be called with the data as buffer
Parameters
Name | Type | Description |
---|---|---|
callback
|
BleCharacteristic.NotificationCallback |
Throws
Will throw an error if peripheral is not connected
Returns
- resolves when the subscription is succesful
unsubscribeFromNotifications
(async) unsubscribeFromNotifications(): Promise.<void>Unsubscribes notifications from this characteristic.
Throws
Will throw an error if peripheral is not connected
Returns
- resolves when unsubscribe has performed successful and the callback has been removed.
write
(async) write(data): Promise.<Buffer>Write a value to this characteristic
Parameters
Name | Type | Description |
---|---|---|
data
|
Buffer | The data that should be written |
Throws
Will throw an error if peripheral is not connected
Returns
Type Definitions
NotificationCallback
NotificationCallback(data)Parameters
Name | Type | Description |
---|---|---|
data
|
Buffer | the received notification data |