dlt.onBLECharacteristicValueChange(function listener)
Introduction
Add a listener for characteristic value changes.
Usage Limitations
You must register this listener before calling dlt.notifyBLECharacteristicValueChange.
Parameters
function listener
The listener function for the Bluetooth adapter state change event.
Parameters
Object res
Property | Type | Description |
---|---|---|
serviceUUID | string | Service UUID |
characteristicUUID | string | Characteristic UUID |
value | string | Characteristic value |
Sample Code
dlt.onBLECharacteristicValueChange(function (res) {
console.log(res);
});
In the sample code provided, dlt.onBLECharacteristicValueChange
is used to add a listener for characteristic value changes. When the characteristic value changes, the provided listener function is called, and it logs the received data to the console.