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

IR.EVENT_CHARACTERISTIC_READ

the identifier of the event that the characteristic was read

Syntax

IR.AddListener(IR.EVENT_CHARACTERISTIC_READ, 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
in_status 0 type: Number
0 - successful (another code - error code)


Example:

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