error = characteristic:setNotify(doEnable)
Enables or disables continuous notification mode for the value of the characteristic, provided the characteristic of the device supports this feature. If true is passed, notifications get enabled, whereas false will stop notifications. The notification period, changeability of the notification period and the method of changing the notification period is Bluetooth ® LE device specific. The peripheral needs to be connected so that a call to setNotify can have an effect. If a listener callback is provided with setValueUpdateListener for this characteristic (see subsection 20.5.2 ) it will be called when a new value can be retrieved via getValue(). There is no guarantee that for every single response from the device a dedicated call of the callback will happen. The system may decide to combine multiple as well as completions of read requests into a single call of the callback.
Parameter |
Type |
Description |
---|---|---|
doEnable | in boolean | true will enable notifications, otherwise false will stop notifications |
error |
out string (optional) |
If successful nil is returned, an error message otherwise |
Introduced in platform.apiLevel = '2.5'