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

IR.EVENT_CHARACTERISTIC_CHANGED

the identifier of the event that the characteristic was changed (on iOS reading and change are the same thing)

Syntax

IR.AddListener(IR.EVENT_CHARACTERISTIC_CHANGED, driver, function, [pointer]);

input sample description
driver IR.CreateDevice(IR.DEVICE_BLE_DEVICE) type: object
the reference to the driver
function function() {} type: function
the unnamed function or reference to the function
pointer - type: object
the pointer to the object which serves the function (optional)
output
in_ServiceUuid type: String
the service identifier
in_CharacteristicUuid type: String
the identifier of the characteristic
in_data type: Data
the array of bytes - the value of the characteristic


Example:

var device = IR.CreateDevice(IR.DEVICE_BLE_DEVICE)
IR.AddListener(IR.EVENT_CHARACTERISTIC_CHANGED, device, function(in_ServiceUuid, in_CharacteristicUuid, in_data){
IR.Log(in_ServiceUuid + " " + in_CharacteristicUuid + " " + in_data);
})