1.4.2 - Bugfix for enableNotification on Android
This version of the plugin contains an update that fixes a bug in enableNotification. The options parameter did not work as expected.
It now works to set the last options parameter as follows; setting writeConfigDescriptor: false will turn off automatic writing of the config descriptor:
evothings.ble.enableNotification(
deviceHandle,
characteristic.handle,
function(data)
{
console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
},
function(errorCode)
{
console.log('BLE enableNotification error: ' + errorCode);
},
{ writeConfigDescriptor: false });
This also works for disableNotification:
evothings.ble.disableNotification(
deviceHandle,
characteristic.handle,
function()
{
console.log('BLE characteristic notification disabled');
},
function(errorCode)
{
console.log('BLE disableNotification error: ' + errorCode);
},
{ writeConfigDescriptor: false });
Disabling automatic writing of the notification/indication config descriptor can be useful if the application has special requirements.
Setting writeConfigDescriptor: true turns on automatic writing of the config descriptor. This is the default if you leave out the options parameter, like this:
evothings.ble.enableNotification(
deviceHandle,
characteristic.handle,
function(data)
{
console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
},
function(errorCode)
{
console.log('BLE enableNotification error: ' + errorCode);
});
This should work for most applications.
The high-level EasyBLE library also has support for specifying the options parameter in function enableServiceNotification(). This library is available here:
https://github.com/evothings/evothings-libraries/blob/master/libs/evothings/easyble/easyble.dist.js