Материал из Module developer
Перейти к: навигация, поиск

Device.SetCharacteristicNotification

to set up receipt of notifications about value changes of the characteristic

Syntax

IR.CreateDevice(IR.DEVICE_BLE_DEVICE).SetCharacteristicNotification(in_ble_cha, in_bool)

input sample description
ID IR.DEVICE_BLE_DEVICE type: Number
the identifier of the BLE scanner
in_ble_cha type: Object
the characteristic object
in_bool true type: Boolean
the subscription flag
output

-


Example:

var device = IR.CreateDevice(IR.DEVICE_BLE_DEVICE);
device.SetCharacteristicNotification(in_ble_cha, in_bool);

It is required to have the characteristic object, it is available only after discovering IR.EVENT_SERVICES_DISCOVERED, the characteristic is required to have properties CharacteristicPropertyRead и CharacteristicPropertyNotify.
It activates the event: IR.EVENT_CHARACTERISTIC_CHANGED – the characteristic is changed.