Logo Logo en
  • iRidi Pro
    Основные компоненты
    • Приложение i3 Pro
    • iRidi Pro Server
    • iRidi Studio
    • iRidium studio v. 1.3.8 (устаревшая версия)
    Java Script в iRidi
    • Руководство
    • Справочник
    • Примеры
    • JS драйвера
    другие
    • Личный Кабинет
    • iRidium Cloud
    • iRidium Transfer
    • Push-уведомления
    • Лучшая практика
    Лицензирование
    • Лицензирование и передача проекта
    • Оффлайн-лицензирование
    • Активация iRidi Pro Server
  • Продукты
    i3 lite
    • Приложение i3 lite
    • Регистрация и лицензирование
    • Сервер
    • Модули
    KNX Home Server
    • Приложение i3 KNX
    • KNX Home Server
    BUS77 HOME SERVER
    • Приложения Bus77 Home и Bus77 Lite
    • Bus77 Home Server
    Решения
    • BYOD - решение для гостиниц
    • Портал жителя - решение для МКД
    iRidi SCADA
    • iRidi SCADA
  • Bus77
    НАСТРОЙКА BUS77
    • Основы Bus77
    • Приложения Bus77 Home и Bus77 Lite
    • Работа с драйвером Bus77 в iRidi Studio
    • Настройка шины Bus77 в iRidi Studio
    ПРОТОКОЛ BUS77
    • Характеристики CAN (Bus77)
    • Описание протокола
    • Исходники на GitHub
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
  • Поддерживаемое оборудование
    Драйверы
    • Список драйверов
    • ProAV драйвера
    • AV & Custom Systems
    • JS драйвера
    • Сторонние драйвера и фриланс
    Протоколы и интерфейсы
    • Голосовое управление
    • 1-Wire
    • BACnet IP
    • Bus77
    • KNX
    • KNX IP BAOS
    • Weinzierl kBerry
    • Microsoft Exchange
    • Modbus
    • MQTT
    • NFC
    • ODBC
    • Onvif
    • SIP
    • SNMP
    • Wake On Lan
    • Z-Wave
    • ZigBee
    Производители
    • AMX
    • AVCiT
    • Beckhoff ADS
    • Biamp Tesira
    • Bluesound
    • Casambi
    • BSS Harman
    • Clipsal
    • ControlArt 7Port
    • Crestron
    • DigiBird
    • Domintell
    • Duotecno
    • EIDE
    • EPSNET
    • Global Cache
    • HDL Buspro
    • Helvar
    • IEAST
    • INELS BUS
    • INELS Wireless
    • Intesis
    • Kleger
    • Kramer VIA
    • Kramer 3000
    • Larnitech
    • Legrand Netatmo
    • LG TV
    • Lutron
    • Lutron Homeworks QS
    • MyHome
    • Nest
    • Novastar
    • Panasоnic PTZ
    • Philips Dynalite
    • PJLink
    • Satel
    • SamsungTV
    • Sonos
    • Somfy
    • SpinetiX
    • Televic Conference
    • TIS
    • Tion
    • URRI
    • Velbus
    • Velocio
    • Vinteo
    • WyreStorm
    • WiiM
    • Xicato
    • Yamaha
    • ZONT
    • Z-Wave.me
    Протестированное оборудование
    • Панель HDL S57
    • Панель HDL S10
    • SIP-домофон
    • Akuvox
    • Arlight
    • Divus
    • QBic TD-1050 PRO
    • QBic TD-1060 Slim
    • QBic TD-1070
    • Sigur
    • Uni-Ubi
    • Velocio
  • Оборудование iRidi

    Серверы
    • HS Сервер
    • ProAV Control Processor Basic
    • ProAV Control Processor Advanced
    • Спецификация контроллеров UMC
    • Настройка контроллера UMC C2
    • Настройка контроллера UMC C3
    • Настройка контроллера HDL IntelliCenter 2 (UMC C4)
    Модули расширения
    • I-PX-RS1
    • I-PX-RS4
    • I-PX-IR3
    KNX
    • KNX Home Server
    • KNX IP Interface
    Панели управления
    • iRidium Panel 7
    • Touch Panel P3
    • Touch Panel P6
    • Touch Panel P8
    • Touch Panel P10
    • Tabletop Touch Panel 10
    • AV Remote Control
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
    • Differences
iRidium mobile web-site
Содержание
    Инструменты‌
    • Сведения о странице
    • Постоянная ссылка
    • Версия для печати
    • Спецстраницы
    • Связанные правки
    • Ссылки сюда
    Login / Create Account
    Материал из for iRidium developers
    Перейти к: навигация, поиск
    Эта страница является переводом страницы Drivers API. Перевод выполнен на 100%.

    Other languages:
    English • ‎русский
  • Handbook
  • Drivers
  • Содержание

    • 1 API iRidium. Drivers
    • 2 Methods
      • 2.1 IR.CreateDevice
        • 2.1.1 AV & Custom Systems parameters
        • 2.1.2 Constants in Driver Settings
      • 2.2 IR.GetDevice
        • 2.2.1 .Connect
        • 2.2.2 .Disconnect
        • 2.2.3 .Send
        • 2.2.4 .SendEx
        • 2.2.5 .Set
        • 2.2.6 .SetFeedback
        • 2.2.7 .GetFeedback
        • 2.2.8 .SetParameters
        • 2.2.9 .GetCookies
        • 2.2.10 .SetCookie
        • 2.2.11 .GetLogin
        • 2.2.12 .GetPassword
        • 2.2.13 .AddChannel
        • 2.2.14 .AddTag
        • 2.2.15 .AddRelation
        • 2.2.16 .RemoveRelation
        • 2.2.17 .GetCommandsCount
        • 2.2.18 .GetCommandAtName
        • 2.2.19 .GetCommandAtPos
        • 2.2.20 .GetFeedbacksCount
        • 2.2.21 .GetFeedbackAtName
        • 2.2.22 .GetFeedbackAtPos
        • 2.2.23 .AddEndOfString
        • 2.2.24 .AddEndOfData
        • 2.2.25 .GetChannelURI
        • 2.2.26 Conversion of Data from the Data Field
      • 2.3 IR.GetDevices()
      • 2.4 IR.IsModuleLicensed
    • 3 Events
      • 3.1 IR.EVENT_ONLINE
      • 3.2 IR.EVENT_OFFLINE
      • 3.3 IR.EVENT_TAG_CHANGE
      • 3.4 IR.EVENT_RECEIVE_DATA
      • 3.5 IR.EVENT_RECEIVE_TEXT
      • 3.6 IR.EVENT_ERROR
      • 3.7 IR.EVENT_CHANNEL_SET
      • 3.8 IR.EVENT_TAG_UPDATE_START
      • 3.9 IR.EVENT_TAG_UPDATE_END
    • 4 UPnP
      • 4.1 .InvokeAction
      • 4.2 .Subscribe
      • 4.3 .Unsubscribe
      • 4.4 IR.EVENT_DEVICE_FOUND
      • 4.5 IR.EVENT_RECEIVE_EVENT
    • 5 Properties
      • 5.1 Driver Properties
        • 5.1.1 AMX
        • 5.1.2 AV & Custom Systems (UDP)
        • 5.1.3 AV & Custom Systems (HTTP)
        • 5.1.4 AV & Custom Systems (RS232)
        • 5.1.5 AV & Custom Systems (TCP Server)
        • 5.1.6 AV & Custom Systems (UDP Server)
        • 5.1.7 Clipsal
        • 5.1.8 Crestron
        • 5.1.9 DVR
        • 5.1.10 Domintell
        • 5.1.11 EPSNET
        • 5.1.12 Global Cache
        • 5.1.13 HDL-Buspro
        • 5.1.14 Helvar
        • 5.1.15 KNX
        • 5.1.16 KNX IP BAOS
        • 5.1.17 Modbus
        • 5.1.18 Modbus Serial
        • 5.1.19 SIP
        • 5.1.20 iRidium Server

    API iRidium. Drivers

    functions, methods and properties for work with equipment set up in the project: creation and control of drivers, sending commands, processing of the incoming data

    Methods


    IR object - it is a global object containing all iRidium API functions and constants. Methods of the IR object for drivers enable driver creation and reference to the driver in the iRidium project. Many methods are applied to the reference to the existing driver.

    You can enter manually a command, feedback, token or link to a driver or you can get them when you drag'n'drop the item to the JS editor (see the instruction).

    IR.CreateDevice

    to create a driver based on "AV & Custom Systems" in iRidium project
    Attention! The old syntax of this function supported by iRidium V3, but we do not recommend to use it

    Syntax

    IR.CreateDevice(type, name, {properties})

    input value description
    type IR.DEVICE_CUSTOM_TCP type: object
    the driver type
    name "AV Driver" type: string
    the unique driver name
    properties Host: "192.168.0.47", Port: 8080 type: string
    list of properties separated by commas
    output
    Object [object DevicePrototype] type: Object
    the reference to the driver


    Sample

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_TCP, "AV Device (TCP)",	
    			{Host: "192.168.0.47",
    			Port: 80,
    			SSL: false,
    			SendMode: IR.ALWAYS_CONNECTED,
    			ScriptMode: IR.DIRECT_AND_SCRIPT,
    			SendCommandAttempts: 0,
    			ConnectWaitTimeMax: 3000,
    			ReceiveWaitTimeMax: 5000,
    			Login: "admin",
    			Password: "admin"
    });
    IR.Log(driver); // [object DevicePrototype]

    the set of properties is different for different drivers
    if you delete some parameter from the list of properties when create the driver, this parameter uses default value
    a driver won't be created until the app is launched, that is, IR.EVENT_START happens.
    if you want to create the driver later than application starts (unless IR.EVENT_START event happens), you must call the method .Connect() to connect the driver to equipment. But when you create the driver at application start, the driver connects automatically. You can disconnect driver from equipment with .Disconnect() method.
    creating a driver takes time, that's why sending data via this driver is unavailable for several milliseconds; send data by IR.EVENT_ONLINE event.


    AV & Custom Systems parameters

    AV & Custom Systems (TCP):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_TCP, "AV Device (TCP)",	
    			{Host: "192.168.0.47",
    			Port: 80,
    			SSL: false,
    			SendMode: IR.ALWAYS_CONNECTED,
    			ScriptMode: IR.DIRECT_AND_SCRIPT,
    			SendCommandAttempts: 0,
    			ConnectWaitTimeMax: 3000,
    			ReceiveWaitTimeMax: 5000,
    			Login: "",
    			Password: "",
    			DisableQueue: false
    });

    AV & Custom Systems (UDP):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_UDP, "AV Device (UDP)",	
    			{Host: "192.168.0.47",
    			Port: 80,
    			LocalPort: 80,  // port on iRidium side for data receiving
    			Group: null,  // null - broadcast, "host" - multicast group
    			Multicast: false,  // false - broadcast, true - multicast (if multicast group added)
    			ScriptMode: IR.DIRECT_AND_SCRIPT
    });

    AV & Custom Systems (HTTP):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_HTTP_TCP, "AV Device (HTTP)",	
    			{Host: "192.168.0.47",
    			Port: 8080,
    			SSL: false,
    			Login: "",
    			Password: "",
    			DisableQueue: false,
    			SendCommandAttempts: 0,
    			ConnectWaitTimeMax: 3000,
    			ReceiveWaitTimeMax: 5000,
    			UserAgent: ""
    });

    AV & Custom Systems (RS232):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_SERIAL, "AV Device (RS232)",	
    			{PortName: "\\\\.\\COM1",      // double slash "\\" will be converted
                                               // to single slash "\". Result: "\\.\COM1"
    			BaudRate: 9600,
    			DataBits: 8,
    			Parity: 0,
    			StopBits: 0,
    			Use485: false  // works with RS485, not RS232
    });

    AV & Custom Systems (TCP Server):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_SERVER_TCP, "iRidium TCP Server",	
    			{Port: 2323,
    			MaxClients: 10  // maximum of clients connected at the same time
    });

    For creating SSL server your should use SetParameters method after creating driver

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_SERVER_TCP, "iRidium TCP Server",	
    			{Port: 2323,
    			MaxClients: 10  // maximum of clients connected at the same time
    });
    driver.SetParameters({SSL:3});

    SSL server will works only on iRidium Server

    AV & Custom Systems (UDP Server):

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_SERVER_UDP, "iRidium UDP Server",	
    			{Port: 2323,
    			MaxClients: 10,  // maximum of clients connected at the same time
    			ClientTimeOut: 100 // (ms) when the Client will be disconnected if it doesn't send data
    });

    Constants in Driver Settings


    Send Mode

    • IR.ALWAYS_CONNECTED = 0; - the driver is always connected, it can send and receive data.
    • IR.CONNECT_WHEN_SENDING = 1; - the driver connects at the moment of data sending and disconnects after that, it can only send data.



    Script Mode

    • IR.DIRECT_AND_SCRIPT = 0; // Commands can be sent via scripts and editor channels
    • IR.SCRIPT_ONLY = 1; // Commands can be sent via scripts only



    Background Mode

    • IR.BACKGROUND_OFF = 0; // The driver works only in the foreground mode
    • IR.BACKGROUND_ON = 1; // The driver worksboth in the foreground and background modes

    IR.GetDevice

    to get access to any driver in the iRidium project. It works for all drivers not only for the ones created with the help of IR.CreateDevice.

    Syntax

    IR.GetDevice(name)

    input value description
    name "Driver 1" type: string
    the driver name in the iRidium project
    output
    Object [object DevicePrototype] type: Object
    the reference to the driver


    Sample

    var myDriver = IR.GetDevice("AMX");
    var myDriver1 = IR.GetDevice("HDL-BUS Pro Network (UDP)");
    IR.Log(myDriver); // [object DevicePrototype]
    IR.Log(myDriver1); // [object DevicePrototype]

    HDL, Domintell: use the network name at reference - "HDL-BUS Pro Network (UDP)" / "Domintell Network (UDP)", not the name of a particular device in the network.

    Below you can see the methods which can be applied to the reference to the driver received with the help of IR.GetDevice.


    .Connect

    to establish connection with equipment

    Syntax

    IR.GetDevice(name).Connect()

    input value description
    name "Driver 1" type: string
    the driver name in the project iRidium
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("AV & Custom Systems (TCP)").Connect();

    after creation of the driver the connection is established automatically


    .Disconnect

    to disconnect from equipment

    Syntax

    IR.GetDevice(name).Disconnect()

    input value description
    name "Driver 1" type: string
    the driver name in the iRidium project
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("AV & Custom Systems (TCP)").Disconnect();





    .Send

    the method can be used only with AV & Custom Systems and Global Cache drivers. It enables sending of random data (string, number, array) to equipment

    Syntax

    IR.GetDevice(name).Send([data])
    IR.GetDevice(name).Send(array)
    IR.GetDevice("Global Cache").Send([data], transport)

    input value description
    name "Driver 1" type: string
    the driver name in the iRidium project
    data a, b, c type: string
    the list of variables or strings: instructions for sending
    array [a, b, c] type: array
    the array of variables or strings: instructions for sending
    transport 0 type: number
    the identifier of transport. With the Global Cache used to select the transport via which you need to send data:
    • 0 - port 4998 (IR commands, relays, sensors, system)
    • 1 - port 4999 (СОМ 1)
    • 2 - port 5000 (СОМ 2)


    Also used on iRidium Server and with Custom TCP Server driver. Allows to select the client - reseiver of message from Server. 0 - all the clients receive a message, 1..n (client ID ,received from IR.ACCEPT_CLIENT) - send to one client

    output
    successful or not type: Boolean
    successful


    Sample

    // AV & Custom Systems (TCP, UDP, RS232)
    IR.GetDevice("AV Device").Send(['instruction', '\r\n']);
    // AV & Custom Systems (HTTP)
    // <Type or request>,<URI>,<Data> devided by "," so u cannot use "," inside of <URI> and <Data>
    IR.GetDevice("AV Device").Send(['GET,URI']); // GET 
    IR.GetDevice("AV Device").Send(['POST,URI,Data']); // POST 
    IR.GetDevice("AV Device").Send(['PUT,URI,Data']); // PUT
    // Global Cache:
    // IR.GetDevice("Global Cache").Send(<DATA>, <TRANSPORT ID>)
    IR.GetDevice("Global Cache").Send(['setstate,1:1,1', '\r\n'], 0)
    // iRidium Server:
    // IR.GetServer().Send(<DATA>, <TRANSPORT ID>)
    IR.GetServer().Send(['command', '\r\n'], 1)

    HTTP: when sending HTTP command to the driver, first indicate the sending method: GET, POST, PUT, then after the comma indicate the command URI and Data for POST and PUT. Inside URI and Data do not use commas. If your protocol uses commas in HTTP commands, send them via AV & Custom Systems (TCP), forming entire requests.
    Global Cache: make sure to indicate the ID of the transport where data must be sent


    .SendEx

    {{API Function/en|description= the method can be used only with AV & Custom Systems (HTTP) drivers. It allows to send data arrays with indication of the parent object (execution context). Several events that send data about their work to functions can be added inside SendEx. The events allows to keep track of getting data from HTTP server and process different stages of working with the server. |constructor= IR.GetDevice(name).SendEx(params, context) |input=

    name "Driver 1" type: string
    the name of the driver in iRidium project
    params {a, b, c} type: object
    parameters to send
    context this type: object
    object (this) to call a function

    |output= - |JSsample=

    //Example 1:
     
    var context = {
       appleCount: 10,
       key: 777,
    }
     
    var params = { 
          Type: "POST",        															
          Url:  "/html/login",
          Data: ["Password=2007&name=authform&Login=admin"],
          Headers: {"Content-Type": "application/x-www-form-urlencoded"},       
          cbReceiveText:       function(text, code, headers)    {IR.Log("cbReceiveText "+text+code+headers); IR.Log(this.key)},
          cbReceiveData:       function(data, code, headers)    {IR.Log("cbReceiveData "+data+code+headers);},
          cbReceiveCode:       function(code)                   {IR.Log("cbReceiveCode "+code);},
          cbReceiveKey:        function(key,value)              {IR.Log("cbReceiveKey "+key+value);},
          cbReceiveStartBody:  function(stream)                 {IR.Log("cbReceiveStartBody "+stream);},
          cbReceivePartBody:   function(stream)                 {IR.Log("cbReceivePartBody "+stream);},
          cbReceiveEndBody:    function(size)                   {IR.Log("cbReceiveEndBody "+size);}, 
          cbTimeOut:           function()                       {IR.Log("cbTimeOut");},
          cbReceiveStream:     function(stream, code, headers)  {IR.Log("cbReceiveStream "+stream+code+headers);}   
       }
     
    IR.GetDevice("Server REST").SendEx(params, context)
     
    //Example 2:
     
    IR.GetDevice("Server REST").SendEx({ 
          Type: "GET",        															
          Url:  "/json/ok/server/channel",
          Headers: {"Cookie":"ir-session-id=o8lKdEvw2ZlU"},
          cbReceiveText:   function(text, code, headers)    {IR.Log("cbReceiveText "+text);}
       });

    Parameters to send are set with the following variables:

    Parameter Example Description
    Type "GET" / "POST" / "PUT" Type of request formation.
    Url "/html/login" A link to an object that is called.
    Data ["Password=2007&name=authform&Login=admin"] An additional parameter. It is available for POST and PUT requests.
    Header {"Cookie":"ir-session-id=o8lKdEvw2ZlU"} Creating standard and non-standard headers of HTTP-requests.
    cbReceiveData cbReceiveData: function(data, code, headers) { IR.Log("Getting data in the Data format: \n Code an answer from the server: " + code + "\n Data: "+ data); }, A function to process received data in the DATA format with the following parameters:
    data - data,
    code - an answer from the server,
    headers - headers.
    cbRecieveText cbReceiveText: function(text, code, headers) {IR.Log("Getting data in the Text format: \n Code an answer from the server: " +code + "\n Data: " + text + "\n Headers: " + headers);}, A function to process received data in the TEXT format with the following parameters:
    data - data,
    code - an answer from the server,
    headers - headers.
    cbRecieveKey cbReceiveKey: function(key, value) {IR.Log("Headers : "+ key + "\n Header value: "+ value);}, A function to process headers with the following parameters:
    key - header,
    value - header value.
    cbReceiveCode cbReceiveCode: function(code) {IR.Log("Code an answer from the server: "+code);}, A function of the server answer with the following parameter:
    code - an answer from the server.
    cbRecieveStartBody cbReceiveStartBody: function() {}, A function of the start of processing a stream.
    cbRecievePartBody cbReceivePartBody: function(stream) {IR.Log("Getting data in the ByteStream format (Data object): "+stream);}, A function of the "body" of processing and getting a stream.
    cbRecieveEndBody cbReceiveEndBody: function(size) {IR.Log("The size of a received strems (Stream): "+size);} , A function of the end of processing a stream.
    cbTimeOut cbTimeOut: function() {IR.Log("cbTimeOut: TimeOut")}, A processing function when the time to get an answer from the server is over.
    cbRecieveStream cbReceiveStream: function(stream, code, headers) { IR.Log("Getting data in the ByteStream format: \n Code an answer from the server: " +code + "\n Data object: " + stream); } A function to process streams.


    SendEx() method with the help of Headers: {} allows to create standard and non-standard headers of HTTP-requests. Below you can see several standard headers and their special features when working with the SendEx() method.

    Header Value by default or example Description Capability to set (redefine) a header in the Header field Method to set (redefine)
    Host 192.168.0.100:123 The domain name and the host port of a requested resource no In the Host and Port of AV & Custom Systems (HTTP) driver
    Connection Keep-Alive or close Method of HTTP-connection no It is defined by the value of the KeepAliveOut field, that is sent to SendEx() method: if KeepAliveOut = 0, the "Connection: close" header is sent; if KeepAliveOut > 0, the "Connection: Keep-Alive" header is sent
    Transfer-Encoding chunked Self-definition of the content length of a request no It is not set, see header Content-Length
    Content-Length 0 Content length of a request no It is not set, it is calculated automatically by the request content
    Authorization - Data for authorization no In the Login and Password parameters of the AV & Custom Systems (HTTP) driver. It is calculated automatically (Basic Authorization)
    Content-Type application/x-www-form-urlencoded Type of the request content yes -
    Accept */* A list of possible resource formats yes -
    User-Agent Iridium Server/x.x.x A list of names and versions of the client and its components with comments yes In the User-Agent parameter of the AV & Custom Systems (HTTP) driver.

    Below you can see an example of writing a Header block:

    IR.GetDevice("AV & Custom Systems (HTTP)").SendEx({ 
          Type: "GET",        															
          Url:  "/device/http",
          Headers: {
             "Content-Type": "application/json",
             "Accept": "application/xml",
             "User-Agent": "Project Server v2.0",
             "Accept-Language": "en",
             "Set-Cookie": "parameter=1",
          },
          KeepAliveOut: 0; // used for "Connection: close" header
          cbReceiveText:   function(text, code, headers)    {IR.Log("Header: "+headers);}
       });


    You can see how this method is realized in the driver in the attached project:

    Download:

    • Full test HTTP.irpz


    .Set

    to execute the native driver command preset in the command tree of the editor. When executing the command you send the value to it the same way it is done when you press on the button in the interface. It works for native drivers only. You can activate the command by its index (the sequence number in the tree, beginning with one) or name. If the command is not preset in the project tree, it cannot be executed.

    Syntax

    IR.GetDevice(driver).Set(command, value)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    command "Channel 1" type: string, number
    the command index or name, the sequence number in the tree, beginning with one
    value 100 type: string, number
    the number or string to be transferred to the command for sending to equipment
    output
    successful or not type: Boolean
    successful


    Sample

    //KNX. 1 - first Commands in project Tree; 100 - value to send, "Dimming" - command name
    IR.GetDevice("KNX Router (KNXnet/IP)").Set(1, 100);
    IR.GetDevice("KNX Router (KNXnet/IP)").Set("Dimming", 100);
    //Global Cahe. "Command 1" - name of command on GC output, "" - empty data
    IR.GetDevice("Global Cache").Set("Command 1", "")
    //HDL. "HDL-BUS Pro Network (UDP)" - name of network
    //"Dimmer" - name of Device in Network, "Channel 1" - name of Channel, 100 - value to send
    IR.GetDevice("HDL-BUS Pro Network (UDP)").Set("Dimmer:Channel 1", 100);
    //Domintell. "Domintell Network (UDP)" - name of network
    //"DDIM01" - name of Device in Network, "Channel 1" - name of Channel, 100 - value to send
    IR.GetDevice("Domintell Network (UDP)").Set("DDIM01:Channel 1", 100);
    //Set data to virtual tag in iRidium Server project
    IR.GetDevice("iRidium server").Set("Virtual 1", 100); 
    //Set data to channel in iRidium Server project
    IR.GetDevice("iRidium Server").Set("KNX Router.Address 1", 1);

    HDL, Domintell:use the network name "HDL-BUS Pro Network (UDP)" / "Domintell Network (UDP)" at reference, not the name of a particular network device.


    .SetFeedback

    to write the value in the driver feedback channel. The channel must be created in Project Device Panel in advance. It is used for displaying data received from equipment during work of scripts.

    Syntax

    IR.GetDevice(driver).SetFeedback(name, value)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    name "Channel 1" type: string
    the feedback channel name (Feedbacks)
    value "data" type: string, number
    the string or number to be written in the channel
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("MyDevice").SetFeedback("Value 1", 100);





    .GetFeedback

    to get the value from the driver feedback channel. The channel must be created in Project Device Panel in advance. It is used for getting access to the data written in the channel.

    Syntax

    IR.GetDevice(driver).GetFeedback(name)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    name "Channel 1" type: string
    the feedback channel name (Feedbacks)
    output
    value "data" type: string, number
    the string or number received from the feedback channel


    Sample

    IR.GetDevice("MyDevice").GetFeedback("Value 1"); // 100





    .SetParameters

    to change driver properties of connection to the controlled equipment. A typical example: switch between the local and Internet connections. It is possible to change only some properties.
    The new connection do not change the initial driver properties and are not saved at the application relaunch.
    Any TCP, UDP, HTTP driver always has a standard set of parameters: Host, Port, Login, Password (even if the driver does not use the login and password). There are also sets of unique parameters depending on the driver type.

    Syntax

    IR.GetDevice(driver).SetParameters(Host: host, Port: port, <other>);

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    host "192.168.0.100" type: string
    the IP-address or domain name for connection to equipment
    port 8080 type: number
    the connection port
    LogLevel 4 type: number
    Log level LogLevel
    other type: -
    other parameters typical for the driver. If the parameter is not indicated, the previous value of the default value will be saved
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("KNX").SetParameters({Host: "215.110.10.22", Port: 8080});

    The List of current settings of driver are available as driver Properties


    .GetCookies

    to get the Cookies array via the AV & Custom Systems (HTTP) driver

    Syntax

    IR.GetDevice(driver).GetCookies()

    input value description
    driver "Driver 1" type: string
    the name of the HTTP driver in the iRidium project
    output
    array type: array
    the Cookies array


    Sample

    var num = IR.GetDevice("MyDevice").GetCookies()





    .SetCookie

    to send Cookie together with the other header-information via the AV & Custom Systems (HTTP) driver

    Syntax

    IR.GetDevice(driver).SetCookie(key, value)

    input value description
    driver "Driver 1" type: string
    the name of the HTTP driver in the iRidium project
    key type: string
    the key
    value type: string
    the value
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("MyDevice").SetCookie("TestCookie", "value")





    .GetLogin

    to get the login of connection with any driver

    Syntax

    IR.GetDevice(driver).GetLogin()

    input value description
    driver "Driver 1" type: string
    the driver name
    output
    login 'admin' type: string
    the driver login


    Sample

    var login = IR.GetDevice("MyDevice").GetLogin()
    IR.Log(login) // admin





    .GetPassword

    to get the password of connection with any driver

    Syntax

    IR.GetDevice(driver).GetPassword()

    input value description
    driver "Driver 1" type: string
    the driver name
    output
    login 'admin' type: string
    the driver password


    Sample

    var pass = IR.GetDevice("MyDevice").GetPassword()
    IR.Log(pass) // password





    .AddChannel

    *the function is under development* to add a channel for the driver

    Syntax

    IR.GetDevice(driver).AddChannel(name, data)

    input value description
    driver "Driver 1" type: string
    the driver name
    name "Channel 1" type: string
    the command name
    data type: array
    the data array specific for each driver
    output

    -


    Sample

    /* under development */





    .AddTag

    *the function is under development* to add a feedback channel for the driver

    Syntax

    IR.GetDevice(driver).AddTag(name, data)

    input value description
    driver "Driver 1" type: string
    the driver name
    name "Channel 1" type: string
    the feedback channel name
    data type: array
    the data array specific for each driver
    output

    -


    Sample

    /* under development */





    .AddRelation

    add a relation between the interface objects and a drivers, variables and other objects.

    Studio2019 SeeRelationsSyntax.png

    Syntax

    IR.AddRelation(source, destination)

    input value description
    source "Drivers.iRidium Server.Tags.KNX.1/0/1" type: string
    the source of data
    destination "UI.Popup 1.Item 1.Value" type: string
    the recipient of data
    output

    -


    Sample

    var from = "Drivers.iRidium Server.Tags.KNX.1/0/1";
    var to = "UI.Popup 1.Item 1.Value";
    IR.AddRelation(from, to);






    .RemoveRelation

    to delete a Relation between interface objects and drivers / variables / other objects.

    Syntax

    IR.RemoveRelation(source, destination)

    input value description
    source "Drivers.iRidium Server.Tags.KNX.1/0/1" type: string
    data source
    destination "UI.Popup 1.Item 1.Value" type: string
    data recepient
    output

    -


    Sample

    var from = "Drivers.iRidium Server.Tags.KNX.1/0/1";
    var to = "UI.Popup 1.Item 1.Value";
    IR.RemoveRelation(from, to);






    .GetCommandsCount

    to get the number of commands set up in the AV & Custom System driver (HTTP, TCP, UDP, RS232)

    Syntax

    IR.GetDevice(driver).GetCommandsCount()

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    output
    CommandsCount 52 type: number
    the number of device commands


    Sample

    var num = IR.GetDevice("MyDevice").GetCommandsCount(); 
    IR.Log(num); // number of commands





    .GetCommandAtName

    to get data from the Data field of the command of the driver. The command is referred by its name.

    Syntax

    IR.GetDevice(driver).GetCommandAtName(name)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    name "Command 1" type: string
    the command name
    output
    object [object Object] type: object
    the reference to the driver command
    object.id 1 type: number
    the object property: the command identifier (beginning with 1)
    object.name Command 1 type: string
    the object property: the command name
    object.data 74,65,73,74 type: array
    the object property: the data from the Data field of the command presented as a byte array


    Sample

       var Command = IR.GetDevice("AV").GetCommandAtName("Command 1");
       IR.Log("id: " + Command.id + ", name: " + Command.name + ", data: " + Command.data);   
       // id: 1, name: Command 1, data: 74,65,73,74





    .GetCommandAtPos

    to get data from the Data field of the command of the AV & Custom System driver (HTTP, TCP, UDP, RS232). The command is referred by its sequence number, beginning with 0.

    Syntax

    IR.GetDevice(driver).GetCommandAtPos(position)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    position 0 type: number
    the command sequence number (beginning with 0)
    output
    object [object Object] type: object
    the reference to the driver command
    object.id 1 type: number
    the object property: the command identifier (beginning with 1)
    object.name Command 1 type: string
    the object property: the command name
    object.data 74,65,73,74 type: array
    the object property: the data from the Data field of the command presented as a byte array


    Sample

       var Command = IR.GetDevice("AV").GetCommandAtPos(0);
       IR.Log("id: " + Command.id + ", name: " + Command.name + ", data: " + Command.data);   
       // id: 1, name: Command 1, data: 74,65,73,74





    .GetFeedbacksCount

    to get the number of feedback channels set up in the AV & Custom System driver (HTTP, TCP, UDP, RS232)

    Syntax

    IR.GetDevice(driver).GetFeedbacksCount()

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    output
    FeedbacksCount 52 type: number
    the number of device channels


    Sample

    var num = IR.GetDevice("MyDevice").GetFeedbacksCount(); 
    IR.Log(num); // number of feedbacks





    .GetFeedbackAtName

    to get data from the Data field of the feedback channel of the driver. The feedback channel is referred by its name or identifier.

    Syntax

    IR.GetDevice(driver).GetFeedbackAtName(name/ID)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    name/ID "Feedback 1" type: string/number
    the channel name/identifier
    output
    object [object Object] type: object
    the reference to the object: the feedback channel
    object.id 1 type: number
    the object property: the channel identifier (beginning with 1)
    object.name Command 1 type: string
    the object property: the channel name
    object.data 74,65,73,74 type: array
    the object property: the data from the Data field of the channel presented as a byte array


    Sample

       var Feedback = IR.GetDevice("AV & Custom System (TCP)").GetFeedbackAtName("Feedback 1");
       IR.Log("id: " + Feedback.id + ", name: " + Feedback.name + ", data: " + Feedback.data);   
       // id: 1, name: Feedback 1, data: 74,65,73,74





    .GetFeedbackAtPos

    to get data from the Data field of the feedback channel of the AV & Custom System driver AV & Custom System (HTTP, TCP, UDP, RS232). The channel is referred to by its order number, beginning with 0.

    Syntax

    IR.GetDevice(driver).GetFeedbackAtPos(position)

    input value description
    driver "Driver 1" type: string
    the driver name in iRidium project
    position 0 type: number
    the channel order number (beginning with 0)
    output
    object [object Object] type: object
    the reference to the feedback channel
    object.id 1 type: number
    the object property: the channel identifier (beginning with 1)
    object.name Command 1 type: string
    the object property: the channel name
    object.data 74,65,73,74 type: array
    the object property: the data from the Data field of the channel presented as a byte array


    Sample

       var Feedback = IR.GetDevice("AV & Custom System (TCP)").GetFeedbackAtPos(0);
       IR.Log("id: " + Feedback.id + ", name: " + Feedback.name + ", data: " + Feedback.data);   
       // id: 1, name: Feedback 1, data: 74,65,73,74





    .AddEndOfString

    Method to indicate a string that is considered the end onf the message in a listener IR.EVENT_RECEIVE_TEXT. The method work only for AV & Custom System (TCP, UDP, RS232). When large messages are sent, devices split them into parts (packages) and IR.EVENT_RECEIVE_TEXT listener gets the message in parts (packages). With the help of this method script searches the indicated string in packages and combines all packets that come before it into a single message.

    The method does not work with HTTP driver. We recommend that you use .SendEx method for HTTP driver. It can gather data received in parts in a single message.

    Syntax

    IR.GetDevice(driver).AddEndOfString(string)

    input value description
    driver "Driver 1" type: string
    driver name in iRidium project
    string "happy" type: string
    string identifying the end of the message
    output
    object [object Object] type: object
    a link to a driver channel
    result true type: boolean
    the results of the method. If a string is indicated as an input parameter, the method returns "true". if any other type of data is indicated, false is returned


    Sample

       var driver = IR.GetDevice("TCP");
       IR.AddListener(IR.EVENT_START,0,function()
       {
          IR.Log(driver);
          driver.AddEndOfString("happy");	
       })





    .AddEndOfData

    Method to indicate the order of bytes that are considered the end of a message in a listener IR.EVENT_RECEIVE_DATA. The method works only for AV & Custom System (HTTP, TCP, UDP, RS232). When large messages are sent, devices split them into parts (packages) and IR.EVENT_RECEIVE_DATA listener gets the messaga in parts (packages). With the help of this method script searches the indicated string in packages and combines all packets that come before it into a single message

    Syntax

    IR.GetDevice(driver).AddEndOfData(data)

    input value description
    driver "Driver 1" type: string
    driver name in iRidium project
    data 0x0d,0x0a type: string
    order meaning the end of the message
    output
    object [object Object] type: object
    a link to a driver channel
    result true type: boolean
    the result of the method. If byte is indicated as an input parameter, the method returns "true", if any other type of data is indicated, "false" is returned


    Sample

       var driver = IR.GetDevice("TCP");
       IR.AddListener(IR.EVENT_START,0,function()
       {
          IR.Log(driver);
          driver.AddEndOfData([0x0d,0x0a]);
       })





    .GetChannelURI

    Method of address URI field in Custom AV HTTP driver from JS. It allows to ready the string from the URI field directly.

    Syntax

    IR.GetDevice("AV & Custom Systems (HTTP)").GetChannelUR("AV Control Command")

    input value description
    name "AV Control Command" type: string
    command name
    output
    URI in tag http://YourURI type: string
    string with URI


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {      
          var device = IR.GetDevice("AV & Custom Systems (HTTP)");
          var URI = device.GetChannelURI("AV Control Command");
                IR.Log("************ " + URI); 
    });





    Conversion of Data from the Data Field

    The methods described above return data from the Data field in the HEX format. To convert the data into ASCII strings, use the following instructions:

    // process an array of HEX bytes from Data field of Command or Feedback
    function HexArrayToAsciiString(in_aArray) 
    {
       // init string
       var l_sStr = '';
     
       // aray bypass
       for(var i = 0; i < in_aArray.length; i++)
          l_sStr += String.fromCharCode(parseInt(in_aArray[i], 16));
     
       // return string in ASCII format
       return l_sStr;
    }
    IR.AddListener(IR.EVENT_START, 0, function()  
    { 
        var l_pCommand =  IR.GetDevice("Driver").GetCommandAtName(1);
        IR.Log("data:" + HexArrayToAsciiString(l_pCommand.data)); // ASCII data
    });


    IR.GetDevices()

    get the array of all drivers in iRidium project

    Syntax

    IR.GetDevices();

    input value description


    output
    Object [object DevicePrototype] type: Object
    link to driver array


    Sample

    var devices = IR.GetDevices();
    var name_1 = devices[0].Name;
    var name_2 = devices[1].Name;
    IR.Log("First device: " + name_1);
    IR.Log("Second device: " + name_2);





    IR.IsModuleLicensed

    Driver verification for license
    Attention! In order for the function to work for your driver, you need to agree on the support of your driver with us. To make your driver with a list of supported, write to us at contact@iridiummobile.ru

    Syntax

    IR.IsModuleLicensed(ID)

    input value description
    ID 452 type: Number
    driver type, agreed with our company
    output
    Result true type: boolean
    true - the driver is licensed, false - the driver is not licensed


    Sample

    var hasLicense1= IR.IsModuleLicensed("6")   // AV & Custom Systems
    var hasLicense2= IR.IsModuleLicensed("14")   // AV & Custom HTTP





    Events


    An event - a process forwarded to scripts with an identifier for monitoring.

    A listener - it is a function which is executed if the event set for it is activated

    Add a listener using the method IR.AddListener

    IR.AddListener(event, input, action);
    • event - the identifier of the event monitored by the listener
    • input - the input parameter required for creating the listener. If there is not such parameter indicate 0
    • action - the unnamed function or the link to the named function in which the actions are performed



    Sample:

    // function inside of listener
    IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Driver"), function (name, value)
    {
        IR.Log("changes: "+name+" > "+value); // changes: Feedback 1 > 100
    });

    IR.EVENT_ONLINE

    the identifier of the event activated at connection with equipment

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") 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

    -


    Sample

    IR.AddListener(IR.EVENT_ONLINE, IR.GetDevice("Global Cache"), function() 
    {  
        IR.Log("Device online");
    });





    IR.EVENT_OFFLINE

    the identifier of the event activated at disconnection from equipment

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") 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

    -


    Sample

    IR.AddListener(IR.EVENT_OFFLINE, IR.GetDevice("Global Cache"), function() 
    {  
        IR.Log("Device offline");
    });





    IR.EVENT_TAG_CHANGE

    the identifier of the event activated at changing the status of the native driver feedback channel.

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    the reference to the driver
    function function(name, value) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    name "Feedback 1" type: string
    the name of the changed channel
    value 100 type: number
    the new value


    Sample

    // Subscribe to driver
    IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("KNX Router (KNXnet/IP)"), function(name, value) 
    {  
        IR.Log(name+": "+value); // Feedback 1: 100
    });
    // subscribe to iRidium Server variables (in Server project)
    IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetServer(), function(name, value) 
    {  
        IR.Log(name+": "+value);
    });

    For the AV & Custom Systems driver use IR.EVENT_RECEIVE_DATA or IR.EVENT_RECEIVE_TEXT to parse data of this driver
    HDL: instead of the driver name indicate the name of the HDL network, "HDL-BUS Pro Network (UDP)" by default. The changed channel value is returned as "device:channel"; device - the name of the executing HDL device, channel - the channel in the settings of this device.
    Domintell: nstead of the driver name indicate the name of the Domintell network, "Domintell Network (UDP)" by default. The changed channel value is returned as "device:channel"; device - the name of the executing Domintell device, channel - the channel in the settings of this device.
    IR.EVENT_TAG_CHANGE event appears:

    • every time when data are received (even if the value is not changed) in case of direct access to driver via IR.GetDevice(),
    • only when data are changes in case of indirect access via IR.GetServer().




    IR.EVENT_RECEIVE_DATA

    the identifier of the event activated when receiving data by the AV & Custom Systems driver. The data are output as an byte-array - array of characters in ASCII code. It works only with AV & Custom Systems drivers.

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    the reference to the driver
    function function(data) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    data type: array
    array of characters


    Sample

    IR.AddListener(IR.EVENT_RECEIVE_DATA, IR.GetDevice("AV & Custom Systems (TCP)"), function(data) 
    {  
        IR.Log(data);
    });

    it works only with AV & Custom Systems drivers.


    IR.EVENT_RECEIVE_TEXT

    the identifier of the event activated when receiving data by the AV & Custom Systems driver. The data are output in the string format. It works only with AV & Custom Systems drivers.

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    the reference to the driver
    function function(text) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    text type: string
    the received data in the string format


    Sample

    IR.AddListener(IR.EVENT_RECEIVE_TEXT, IR.GetDevice("AV & Custom Systems (TCP)"), function(text) 
    {  
        IR.Log(text);
    });

    it works only with AV & Custom Systems drivers.


    IR.EVENT_ERROR

    the identifier of the event activated when on send of HTTP command the resource is not available or resource is available but not responded within the set time. The event shows the result of the request as Error Code.

    Синтаксис

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

    на входе значение описание
    driver IR.GetDevice("AV & Custom Systems (HTTP)") type: object
    link to the driver object
    function function(transport_id, local_ip, local_port, host_ip, host_port, errorCode) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    на выходе
    transport_id 0 type: number
    the identifier of transport. 0 for any AV driver except Global Cache: 0 - IR, system, 1 - COM1, 2 - СОМ2
    local_ipt 192.168.0.100 type: string
    the local address of command sender
    local_port 80 type: number
    the local port of command sender
    host_ip 200.200.10.10 type: string
    the address of command receiver
    host_port 80 type: number
    the port of command receiver
    errorCode 1 type: number
    the error code:
    • 1 - the request wasn't sent (the resource is not available)
    • 2 - the resource is available, but the answer wasn't received in a time


    Пример

    var driver = IR.CreateDevice(IR.DEVICE_CUSTOM_HTTP_TCP, "AV Device (HTTP)", {
       Host: "ResourceUnavailable.net", Port: 80
    });
     
    driver.SendEx({ 
       Type: "GET",  Url:  "/request", Headers: {},
       cbReceiveText:   function(text, code, headers)    {IR.Log("cbReceiveText (code) = "+code);}
    });
     
    IR.AddListener(IR.EVENT_ERROR, driver, function(transport_id, local_ip, local_port, host_ip, host_port, errorCode) {
       IR.Log("IR.EVENT_ERROR (code) = "+errorCode);
    });

    работает только с AV & Custom Systems (HTTP)
    не сработает, если от ресурса пришел ответ, даже с ошибкой. Для обработки ошибок используйте SendEx


    IR.EVENT_CHANNEL_SET

    the identifier of the event activated at activation of the driver command

    Syntax

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

    input value description
    driver IR.GetDevice("AV") type: object
    the reference to the driver
    function function(name, value) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    name "Command 1" type: string
    the name of the command which was activated
    value 100 type: number
    the Value written in the command on Send
    value 100 type: number
    the data written in the Data property of the called command available only in AV drivers


    Sample

    IR.AddListener(IR.EVENT_CHANNEL_SET, IR.GetDevice("AV & Custom Systems (TCP)"), function(name, value, data) {  
       switch(name) {
          case "Volume": 
             if (data) IR.Log("Volume set: " + data + " " + value)
             else IR.Log("Volume set: " + value)
             break;
          case "Play":
             IR.Log("Play")
             break;
       }
    });

    this event works only with AV & Custom Systems and Global Cache drivers


    IR.EVENT_TAG_UPDATE_START

    A listener is activated at the start of the request of KNX bus

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    link to the driver
    function function(name, value) {} type: function
    an unnamed function or a function call
    pointer - type: object
    a pointer to an object that services a function (optional)
    output


    Sample

    IR.AddListener(IR.EVENT_TAG_UPDATE_START, IR.GetDevice("KNX Router (KNXnet/IP) / Serial (UMC) 1"), function () {IR.Log("EVENT_TAG_UPDATE_START")});





    IR.EVENT_TAG_UPDATE_END

    A listener is activated at the end of the request of KNX bus.

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    link to the driver
    function function(name, value) {} type: function
    an unnamed function or a function call
    pointer - type: object
    a pointer to an object that services a function (optional)
    output


    Sample

    IR.AddListener(IR.EVENT_TAG_UPDATE_END, IR.GetDevice("KNX Router (KNXnet/IP) / Serial (UMC) 1"), function () {IR.Log("EVENT_TAG_UPDATE_END")});





    UPnP

    .InvokeAction

    to send instructions to the device with UPnP support

    Syntax

    IR.GetDevice(driver).InvokeAction(action_name, service_type, [arguments, callback])

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    action_name "Play" type: string
    the command name
    service_type "service:AVTransport:1" type: string
    the used service
    arguments {InstanceID: 0, Speed: 1} type: string
    the list of command arguments
    callback type: object
    the callback function
    output
    successful or not type: Boolean
    successful


    Sample

    IR.GetDevice("Sonos").InvokeAction("Play", "service:AVTransport:1", {InstanceID: 0, Speed: 1});





    .Subscribe

    to subscribe to the event of the device with UPnP support

    Syntax

    IR.GetDevice(driver).Subscribe(service_type)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    service_type "urn:schemas-upnp-org:service:AVTransport:1" type: string
    the used service
    output
    true true type: Boolean
    successful


    Sample

    IR.GetDevice("Sonos").Subscribe("urn:schemas-upnp-org:service:AVTransport:1");





    .Unsubscribe

    to unsubscribe from the event of the device with UPnP support

    Syntax

    IR.GetDevice(driver).Unsubscribe(service_type)

    input value description
    driver "Driver 1" type: string
    the driver name in the iRidium project
    service_type "urn:schemas-upnp-org:service:AVTransport:1" type: string
    the used service
    output
    true true type: Boolean
    successful


    Sample

    IR.GetDevice("BAOS").Unsubscribe("urn:schemas-upnp-org:service:AVTransport:1");





    IR.EVENT_DEVICE_FOUND

    the identifier of the event activated at the event on the UPnP device

    Syntax

    IR.AddListener(IR.EVENT_DEVICE_FOUND, 0, function, [pointer]);

    input value description
    function function(name) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    name "Device" type: string
    the name of the found UPnP device


    Sample

    IR.AddListener(IR.EVENT_DEVICE_FOUND, 0, function(name) 
    {  
        IR.Log(name);
    });





    IR.EVENT_RECEIVE_EVENT

    the identifier of the event activated at receiving the event from the UPnP device

    Syntax

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

    input value description
    driver IR.GetDevice("MyDriver") type: object
    the reference to the UPnP driver
    function function(type, text) {} type: function
    the unnamed function or reference to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    type type: string
    the event type
    text type: string
    the message from the device


    Sample

    IR.AddListener(IR.EVENT_RECEIVE_EVENT, IR.GetDevice("MyDriver"), function(type, text) 
    {  
        IR.Log(text);
    });





    Properties

    Driver Properties

    Driver connection parameters are readable as properties of the Driver object. To change the connection settings, you need to use the .SetParameters.

    The basic driver properties in the iRidium project are the name and type. They can be requested from any driver. :

    driver.property

    property:

    Name Crestron 1 type: string
    the driver name
    Type Crestron (TCP) type: string
    the driver type. You can see the exact type name in the Driver Type property in the window of connection settings
    LogLevel Debug type: number
    logging level:
    0 - Emergency
    1 - Alert
    2 - Critical
    3 - Error
    4 - Warning
    5 - Notice
    6 - Info
    7 - Debug
    8 - Never
    var driver = IR.GetDevice("Crestron 1");
    IR.AddListener(IR.EVENT_START,0,function()
    {
         var properties  = driver.Name + " (" + driver.Type + ") created";
         IR.Log(properties); 
    });


    The remaining driver parameters are unique, and depend on the type of driver. The driver parameter names can be found in the system menu i3 pro or from the list:

    driver.property


    AMX

    Host 192.168.0.100 type: string
    the IP address or domain name
    Port 1319 type: number
    the connection port
    DeviceID 10001 type: number
    the unique identifier of the AMX panel
    Login admin type: string
    the login of the secure session
    Password admin type: string
    the password of the secure session


    AV & Custom Systems (UDP)

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 8080 type: number
    the connection port
    LocalPort 80 type: number
    the local port for data receipt (on the side of iRidium)
    Group null type: string
    null - broadcast, "host" - the multicast group
    Multicast false type: string
    false - broadcast, true - multicast (if the group is indicated)
    ScriptMode 0 type: number
    to send data directly to the driver and scripts (0) or to scripts only (1)


    AV & Custom Systems (HTTP)

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 8080 type: number
    the connection port
    SSL false type: number
    secure connection
    Login admin type: string
    the login of the secure session
    Password admin type: string
    the password of the secure session
    DisableQueue 0 type: number
    do not add commands to the queue if they couldn't be sent
    SendCommandAttempts 0 type: string
    the number of times to repeat the command if its sending failed (0 - do not repeat, single sending)
    ConnectWaitTimeMax 3000 type: number
    (ms) the time to wait for connection
    ReceiveWaitTimeMax 5000 type: number
    (ms) the time to wait for response
    UserAgent iRidium type: string
    how iRidium identifies itself to the HTTP server


    AV & Custom Systems (RS232)

    PortName \\.\COM1 type: string
    the name of the COM port
    BaudRate 19200 type: number
    the speed of data exchange
    DataBits 8 type: number
    the number of information bits in a frame
    Parity e type: string
    parity check
    StopBits 1 type: number
    the stop bit in a frame
    Use485 0 type: number
    to use the RS485 transport


    AV & Custom Systems (TCP Server)

    Port 8080 type: number
    the connection port
    MaxClients 10 type: number
    the maximum number of connected clients


    AV & Custom Systems (UDP Server)

    Port 8080 type: number
    the connection port
    MaxClients 10 type: number
    the maximum number of connected clients
    ClientTimeOut 100 type: number
    (ms) the client will be disconnected after the indicated time if it does not send data to the server


    Clipsal

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 20023 type: number
    the connection port
    Project PROJ type: string
    the name of the Toolkit project


    Crestron

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 41794 type: number
    the connection port
    NetID 3 type: number
    the IP ID (IP Net Address) of the panel from the project in SIMPL Windows
    TelnetPort 41795 type: number
    the Telnet connection port (system)
    TelnetSSL 1 type: number
    use of SSL connection
    TelnetLogin admin type: string
    the login for SSL
    TelnetPassword admin type: string
    the password for SSL


    DVR

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 8080 type: number
    the connection port
    Login admin type: string
    the login of the secure session
    Password admin type: string
    the password of the secure session


    Domintell

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 17481 type: number
    the connection port
    Password admin type: string
    the connection password
    PingTime 1000 type: number
    (ms) the frequency of data update


    EPSNET

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 61682 type: number
    the connection port
    UpdateTime 1000 type: number
    (ms) the frequency of data update
    DeviceAddress type: string
    it is not used by default


    Global Cache

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 4998 type: number
    the port for sending system commands - 4998
    IrConfirm 0 type: number
    to confirm delivery of IR commands
    SerialPort1 4999 type: number
    СОМ port 1 (serial 1), if there is one
    SerialPort2 5000 type: number
    СОМ port 2 (serial 2), if there is one
    SerialPort3 0 type: number
    reserved
    PingTime 0 type: number
    (ms) to check at regular intervals if there is connection with GC. 0 - no ping
    DisableQueue 0 type: number
    do not add commands to the queue if they couldn't be sent
    SendCommandAttempts 0 type: string
    the number of times to repeat the command if its sending failed (0 - do not repeat, single sending)
    ConnectWaitTimeMax 3000 type: number
    (ms) the time to wait for connection
    ReceiveWaitTimeMax 5000 type: number
    (ms) the time to wait for response


    HDL-Buspro

    Host 255.255.255.255 type: string
    the IP-address or domain name. In the local network - broadcast address 255.255.255.255
    Port 6000 type: number
    the connection port
    SendTimeOut 20 type: number
    (ms) the forced interval between commands
    ConnectMode 0 type: number
    0 - Local, 2 - Internet, 3 - Remote Server
    Login User type: string
    the login (for Internet and Remote Server)
    Password User type: string
    the password (for Internet and Remote Server)
    Project ir_proj type: string
    the project name (for Internet and Remote Server)
    ExtendedPort 6000 type: string
    the server port (for Remote Server)
    Group ir_group type: string
    the group (for Remote Server)
    // Local (ConnectMode=0)
    IR.GetDevice("HDL Buspro UDP").SetParameters({Host: "255.255.255.255", Port: 6000, 
    SendNeedConfirm: 0, SendTimeout: 20, ConnectMode: 0});
     
    // Internet (ConnectMode=1)
    IR.GetDevice("HDL Buspro UDP").SetParameters({Host: "215.110.10.10", Port: 6000, 
    Login: "User", Password: "User", SendNeedConfirm: 0, SendTimeout: 20, ConnectMode: 2, 
    Project: "ir_proj"});
     
    // HDL Remote Server (ConnectMode=2)
    IR.GetDevice("HDL Buspro UDP").SetParameters({Host: "215.110.10.10", Port: 9999, 
    Login: "User", Password: "User", SendNeedConfirm: 0, SendTimeout: 20, ConnectMode: 3, 
    ExtendedPort: 6000, Project: "ir_proj", Group: "ir_group"});


    Helvar

    Host 192.168.0.100 type: string
    the IP-address or domain name (none for Net Internal UDP)
    Port 50001 type: number
    the connection port


    KNX

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 3671 type: number
    the connection port
    ConnectionWaitTime 120000 type: number
    (ms) the waiting time at emergency disconnection: 60000 or 120000 ms (depends on the KNX interface)
    SendWaitTime 0 type: number
    (ms) the pause between command sending in the bus, it is used to decrease the load on the bus
    PingTime 60000 type: number
    (ms) the frequency of sending the Ping command to check connection with the router
    Nat 0 type: number
    the NAT mode (it has to be activated when you work via the Internet or with several network interfaces)


    KNX IP BAOS

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 12004 type: number
    the connection port
    UpdateTime 0 type: number
    (ms) the frequency of sending the Ping command to check connection with the router


    Modbus

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 502 type: number
    the connection port
    UpdateTime 1000 type: number
    (ms) the frequency of data update


    Modbus Serial

    Port 1 type: number
    the number of the СОМ port
    PortName \\.\COM1 type: string
    the name of the COM port
    BaudRate 19200 type: number
    the speed of data exchange
    DataBits 8 type: number
    the number of information bits in a frame
    Parity e type: string
    parity check
    StopBits 1 type: number
    the stop bit in a frame
    Use485 0 type: number
    to use the RS485 transport


    SIP

    Host 192.168.0.100 type: string
    the IP-address or domain name of the SIP server
    Port 502 type: number
    the port of connection to the SIP server
    CallerID Ben type: string
    the subscriber's alias
    ID Ben type: number, string
    the subscriber's number
    Password Pwd type: number, string
    the subscriber's
    FirstRTPPort 40000 type: number
    the first port of the RTP range
    LastRTPPort 41000 type: number
    the last range of the RTP range
    ToneDTMF 1 type: number
    to send DTMF tones
    ToneSIP 0 type: number
    to send SIP tones
    ExternalIP type: string
    the external subscriber's address
    PCMU 1 type: number
    to turn on/off the codec
    PCMA 1 type: number
    to turn on/off the codec
    GSM 1 type: number
    to turn on/off the codec
    H263 1 type: number
    to turn on/off the codec
    H263_1998 1 type: number
    to turn on/off the codec


    iRidium Server

    Host 192.168.0.100 type: string
    the IP-address or domain name
    Port 30464 type: number
    the connection port
    Login admin type: string
    the login of the secure session
    Password admin type: string
    the password of the secure session
    Источник — «https://dev.iridi.com/index.php?title=Drivers_API/en&oldid=138420»
    Категория:
    • Инструкции
    About us
    Company
    Team
    History
    Philosophy
    Rewards
    Partnership
    Our partner
    Partnership Programs
    Apply for partnership
    products
    iRidium pro
    iRidium lite
    iRidium gate
    iRidium server
    Loads
    iRidium pro
    iRidium lite
    Other version
    Marketing materials
    Support
    On-line courses/Video
    Recommended equipment
    Other version
    iRidium pro
    Documentation
    FAQ
    Forum
    iRidium lite
    Documentation
    Forum
    Projects
    Standart projects
    Smart buildings
    Smart house
    Special solution
    Find a dealer
    News
    Youtube
    Twitter
    VK
    Logo
    contact@iridi.com
    +7 (499) 322-73-29

    Privacy policy