Version: Smart Feature Phone 2.5

BluetoothDevice.onattributechanged

Description#

A handler to trigger when on of the remote device's properties has changed. Note access to the changed property in this event handler would get the updated value.

Paramter#

  • aAttributeEvent
    The event is a BluetoothAttributeEvent with property attrs that contains changed BluetoothDeviceAttributes.

Sample#

device.onattributechanged = function onDeviceAttributeChanged(evt) {
for (var i in evt.attrs) {
switch (evt.attrs[i]) {
case 'name':
console.log("device name changed to", device.name);
break;
case 'paired':
console.log("device paired changed to", device.paired);
break;
default:
break;
}
}
}