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
    Перейти к: навигация, поиск
    Эта страница является переводом страницы IRidium studio 2019 Custom Systems. Перевод выполнен на 100%.

  • iRidium studio 2019
  • Tools to create your own drivers
  • Содержание

    • 1 Tools to create your own drivers
      • 1.1 Selecting AV & Custom Systems Driver
      • 1.2 Connection Settings
        • 1.2.1 AV & Custom Systems, TCP
        • 1.2.2 AV & Custom Systems, UDP
        • 1.2.3 AV & Custom Systems, Serial (RS232)
        • 1.2.4 AV & Custom Systems (HTTP), HTTP
      • 1.3 Examples of Forming Commands
        • 1.3.1 Strings, simbols, numerals and their sequences for TCP, UDP, Serial
        • 1.3.2 GET, POST, PUT requests over HTTP
      • 1.4 Examples of Processing Incoming Data
      • 1.5 Example of TCP-server

    Tools to create your own drivers

    A group of "AV & Custom Systems" drivers allows to set connection with an external resource (TCP, UDP, HTTP, Serial), on the basis of which you can realize a protocol of data exchange that you did not find in the list of iRidium ready soluitons.

    A driver in iRidium realizes a protocol (rules) to exchange data with equipment on the basis of transport - a definite means to exchange data (TCP, UDP, HTTP, Serial).

    HowItWorksTCP.png

    But if your system does not have a realized protocol, you can create it yourself. To do it a driver is required that realizes only the transport part of the data exchange process, as for the protocol part (forming requests and processing answers), it is formed by you with the help of JavaScript.

    Several driver-transports can be created in iRidium pro. Let's have a close look at their features and use:

    Selecting AV & Custom Systems Driver

    Add AV & Custom Systems driver for your task:

    • TCP, UDP, Serial (RS232) to connect to a remote resource via TCP, UDP or RS232 protocol.:
      • "AV & Custom Systems" driver in i3 pro or iRidium server
      • Select in the "Protocol" parameter of the driver settings a type of transport: TCP, UDP or Serial (RS232)
    • HTTP to connect to c remote resource via HTTP, HTTPs protocol:
      • Драйвер "AV & Custom Systems (HTTP)" in i3 pro or iRidium server
    • TCP server to accept connections from remote resources via TCP protocol:
      • JavaScript realization of TCP server, a driver is not added to the device tree
    • General transport. For several logic devices to work via one TCP/UDP, using different data in the script and different address to commands and feedback channels
      • "AV & Custom TCP/UDP Network" driver in i3 pro or iRidium server
      • "AV & Custom HTTP Network" driver in i3 pro or iRidium server


    AVCS1.png

    Connection Settings

    When a driver is added, enter its connection parameters:

    AV & Custom Systems, TCP

    AV & Custom Systems driver, Protocol: TCP. Connection parameters:

    • Host - IP-адрес or domain name
    • Port - TCP connection port
    • Mode - connection mode:
      • Always Connected - it is always connected
      • Connect when Sending - it is connected only at the moment commands are sent. Feedback is not received in this mode, but commands can be sent without occupying connection al the time
    • SSL - turn on /off SSL encrypting
    • Script Mode - a mode of forwarding commands to script:
      • Direct and Script - send a command to equipment at once and copy it to the script
      • Script Only - send a command only to script (when a button is pressed, a command, assigned to it, is processed in iRidium script, and is not sent to equipment, as it usually happens)
    • Disable Queue - turn off a queue of commands in iRidium. The queue "stores" commands that were not sent for some reason and sends them when connection is restored
    • Send Command Attempts - the number of attempts to send a command from a queue that was not successfully sent for the first time. 0 - do not repeat sending
    • Wait for Connection (ms) – time to wait for connection (otherwise another connection attempt is made)
    • Wait for Data (ms) – time to wait for and answer from equipment (otherwise a command is repeated and connection is checked). Put 0, if you don't want your driver to disconnect from equipment, if there is no data exchange

    AV & Custom Systems, UDP

    AV & Custom Systems driver, Protocol: UDP. Conenction parameters:

    • Host - IP-address or domain name
    • Port - UDP connection port
    • Script Mode - mode to forward commands to script:
      • Direct and Script - send a command directly to equipment and copy it in the script
      • Script Only - send a command only to the script (when a button is pressed, a command, assigned to it, is processed in iRidium script and is not sent to equipment, as it usually happens)
    • Local Port - UDP port that is open on iRidium side: data from equipment come here. It can be different from a port open on the equipment side
    • Multicast - use a mode of multicast connection
      • Group - multicast group, for example, например 224.0.0.1

    AV & Custom Systems, Serial (RS232)

    AV & Custom Systems Driver, Protocol: Serial (RS232). Connection parameters:

    • Host - number of СОМ-port, to which a controlled device is connected. For example,: \\.\COM1
    • Baud Rate - speed of data exchange
    • Data Bits - number of data bits in a shot
    • Parity - parity control
    • Stop Bits - stop bit in a shot
    • Script Mode - mode to forward commands to script:
      • Direct and Script - send a command directly to equipment and copy it to script
      • Script Only - send a command only to script (when a button is pressed, a command, assigned to it, is processed in iRidium script, it is not sent to equipment, as it usually happens)

    AV & Custom Systems (HTTP), HTTP

    AV & Custom Systems driver (HTTP). Connection parameters:

    • Host - IP address or domain name
    • Port - TCP connectin port (usually 80)
    • Login, Password - login and password of protected connection
    • SSL - turn on/off SSL encrypting
    • User Agent - user name used by iRidium to address a remote system
    • Script Mode - mode to forward commands to script:
      • Direct and Script - send a command directly to equipment and copy it to script
      • Script Only - send a command only to script (when a button is pressed, a command, assigned to it, is processed in iRidium script, but is not sent to equipment, as it usually happens)
    • Disable Queue - turn off a queue of commands to iRidium. A queue "stores" commands, that were not sent for some reason,and sends them when connection is restored
    • Send Command Attempts - number of attempts to send a command from a queue that could not be sent once. 0 - do not repeat sending
    • Wait for Connection (ms) – time to wait for connection (otherwise another connection attempt is made)
    • Wait for Data (ms) – period of time to wait for an answer from equipment (otherwise a command is repeated and connection is checked). Enter 0, if you do not want a driver to disconnect from equipment when there is no data exchange

    Examples of Forming Commands

    Strings, simbols, numerals and their sequences for TCP, UDP, Serial

    To send equipment some data sequence via TCP, UDP, or via COM-port, it is required: to create a Command in "AV & Custom Systems" driver with a corresponding transport and enter data in the Data field of the created command.

    When a command with any value is called, entered data are sent to equipment

    During iRidium work the contents of a command written this way can't be changed (it's a constant). Variable values must be formed in script (see .Set и .Send methods).


    Rules to form data :

    • STRING use 'single quotes', use single quotes for several strigns and separate them with commas. See below CR or LF line break
    • Шестнадцатеричные (HEX) символы разделите запятыми, перед каждым символом поставьте значок $ или 0x (другие не поддерживаются)
    • Десятичные (DEC) числа разделите запятыми
    • В конце данных добавьте, согласно указаниям вашего API, один из символов конца строки (или оба символа):
      • ,13 - возврат каретки (CR, carriage return). Этот же символ в iRidium можно записать как ,$0D или ,0x0D
      • ,10 - подача строки (LF, line feed). Этот же символ в iRidium можно записать как ,$0A или ,0x0A
      • некоторые устройства принимают только CR, некоторые CR+LF, а некоторые и вовсе не нуждаются в указании на конец строки, но указание чаще требуется; опирайтесь на ваш API и не пренебрегайте этой надстройкой!


    Examples:

    • Sequence of hexadecimal simbols + end of line
      0x16,0x8A,0xFF,0x81,13 or
      0x16,0x8A,0xFF,0x81,0x0D
    • Sequence of decimal numbers + end of line
      01,255,255,15,13
    • Line + end of line
      'PWR 01',13
    • Mixed data + end of line
      0,255,'PWR 01',0x00,0xFF,13


    AVCS2.png

    How to understand that data are formed correctly:

    • The lower part of the window in the window mode of data review shows a command in the HEX format (as a driver sends it). If you see no simbols in the lower part of the window, or if the number of simbols above and below is evidently different, it means you made a mistake in forming data. Check commasm interted commas and HEX simbols.
    • If the first part of data is formed correctly, and the second is not, the second part is ignored,, that's why check that the number of simbols in the upper and lower part of the window is the same.


    GET, POST, PUT requests over HTTP

    To send HTTP-request to equipment create a Command in "AV & Custom Systems (HTTP)" driver and enter data in the URI field of a created command. POST and PUT requests allow to send additional data in the Data field.

    When a command with any value is called, you send a formed request to equipment

    During iRidium work the contents of a request written this way can't be changed (it's a constant). Variable values must be formed in script (see .SendEx method).


    Rules for GET-requests:

    A request consists of URI body - it's data written in the HTTP-request after IP-address or domain. Data must be copied to the URI field starting with / (slash) simbol without inverted commas:

    • example 1: http://iridi.com/support
      • /support - it's a body of a request that must be placed in the URI field.
      • iridi.com - send address is entered in the Host fiels of a driver settings
      • default port (80) is entered in driver settings
    • example 2: httр://192.168.0.100:81/do?cmd=ir_code=B748BF00
      • /do?cmd=ir_code=B748BF00 - it's a body of a request that must be placed in the URI field.
      • 192.168.0.100 - send address is entered in the Host fiels of a driver settings
      • 81 - port, entered in driver settigns
    • You can use .SendEx script method to form requests, data, headings and to process answers received to these requests


    AVCS3.png


    Rules of POST and PUT-requests:
    A request consists of a URI body - it's data written in HTTP-request after IP-address or a domain name, that are written in the Data fiels. URI is written without inverted commas, Data are writtem as a line array in inverted commas (see rules for TCP, UDP, Serial lines).

    Example:

    POST /YamahaRemoteControl/ctrl HTTP/1.1
     
    Accept: */*
    Referer: http://192.168.10.102/
    Content-Type: text/xml; charset=UTF-8
    Host: 192.168.10.100
    Content-Length: 105
    Cache-Control: no-cache
     
    <YAMAHA_AV cmd="PUT"><System><Power>Standby</Power></System></YAMAHA_AV>
    • /YamahaRemoteControl/ctrl - (without HTTP 1.1) it's the body of a request that must be placed in the URI field
    • '<YAMAHA_AV cmd="PUT"><System><Power>Standby</Power></System></YAMAHA_AV>' - these are additional data, that must be placed in inverted commas and placed in the Data field
    • The remaining data are headings that a driver forms automatically
    • You can use .SendEx script method to form requests, data, headings and to process answers received to these requests


    AVCS4.png

    Examples of Processing Incoming Data

    Incoming data are always processed in the script.

    You can subscribe to IR.EVENT_RECEIVE_TEXT or IR.EVENT_RECEIVE_DATA event with the help of any transport and process data received from a driver.

    In case withHTTP the most suitable method to process data is .SendEx – it allows to form and send a request, to wait for an answer and to process at once the answer that came to this very request. This way you will not have to identify what this or that answer refers to, in contrast to working with the event system of a driver.

    Example of TCP-server with processing incoming data.

    Example of using SendEx:

    function Login() {
       IR.GetDevice("Server REST").SendEx({ 
          Type: "POST",                                                                    
          Url:  "/html/login",
          Data: ["Password=2007&name=auth&Login=admin"],
          Headers: {"Content-Type": "application/x-www-form-urlencoded"}, 
     
          cbReceiveKey: function(key,value) 
          {             
             if (key == "set-cookie")
             {   
                cookie = value.match(/=.+;/);
                if (cookie) {
                    IR.Log("ir-session-id" + cookie);
                    Volume80();
                }
             }
          }
       });
    }
     
    function Volume80() {
       IR.GetDevice("Server REST").SendEx({ 
          Type: "GET",                                                                    
          Url:  "/json/ok/server/channel/set?name=Sender%20Hotel.FM%20Volume?value=80",
          Headers: {"Cookie":"ir-session-id" + cookie},
     
           cbReceiveText: function(text, code, headers) {
               IR.Log("cbReceiveText code: " + code); IR.Log("cbReceiveText text: " + text);
           }
       });
    }
     
    IR.AddListener(IR.EVENT_START, 0, function() {
        Login();
    });

    Example of TCP-server

    Example: TCP-server for i3 pro

    Источник — «https://dev.iridi.com/index.php?title=IRidium_studio_2019_Custom_Systems/en&oldid=106080»
    Категория:
    • Studio2019
    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