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

SubDevice.AddDataRequestHandler

Add a subdevice request

Синтаксис

SubDevice.AddDataRequestHandler(Name, Type, Callback)

Название Пример Описание
Name "Image" type: String
request name
Type type: Number
request type:
  • IR.SUB_DEVICE_REQUEST_DINAMIC_IMAGE - Returns an image object
  • IR.SUB_DEVICE_REQUEST_SCANNER_INFO - Returns all information about modules installed with the help of a scanner
Callback type: Function
Function that is being executed
На выходе
Boolean type: Boolean
Success rate


Пример

var l_oDevice = module.GetDevice("MyDevice"); //Getting a device
var l_oSubDevice = module.AddSubDevice("SubDevice 1", l_oDevice); //creating a subdevice 
l_oSubDevice.AddDataRequestHandler("Image", IR.SUB_DEVICE_REQUEST_DINAMIC_IMAGE, function(){
	IR.Log("Hello, world!");	
});