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

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

    • 1 API iRidium. System
    • 2 Methods
      • 2.1 IR.ShowSystemMenu
      • 2.2 IR.SetEnableSystemMenu
      • 2.3 IR.GetEnableSystemMenu
      • 2.4 IR.SetEnableProjectMenu
      • 2.5 IR.GetEnableProjectMenu
      • 2.6 IR.ShowSettingsMenu
      • 2.7 IR.SetFullScreen
      • 2.8 IR.IsFullScreen
      • 2.9 IR.HWID
      • 2.10 IR.Exit
      • 2.11 IR.ShowKeyboard
      • 2.12 IR.Execute
      • 2.13 IR.GetSystemInfo
      • 2.14 IR.GetCurrentWlanInfo
      • 2.15 IR.GetCurrentLocalIPInfo
      • 2.16 IR.SetStatusAutoUpdateProject
      • 2.17 IR.Log
      • 2.18 IR.SetInterval
      • 2.19 IR.SetTimeout
      • 2.20 IR.ClearInterval
      • 2.21 IR.AddListener
      • 2.22 IR.RemoveListener
      • 2.23 IR.SetGlobalListener
      • 2.24 IR.SubscribeTagChange
      • 2.25 IR.UnsubscribeTagChange
      • 2.26 IR.CopyToClipboard
      • 2.27 IR.PasteFromClipboard
      • 2.28 IR.GetClipboard
      • 2.29 IR.ShowPasteHelper
      • 2.30 IR.GetDesignsCount
      • 2.31 IR.DesignSwitch
      • 2.32 IR.AndroidSendIR
      • 2.33 IR.CalculateCRC
      • 2.34 IR.CalculateHash
      • 2.35 IR.UrlDecode
      • 2.36 IR.HtmlDecode
      • 2.37 IR.Base64Encode
      • 2.38 IR.Base64Decode
      • 2.39 IR.IsModuleLicensed
      • 2.40 IR.ValidatePassword()
      • 2.41 IR.TouchIDStart()
      • 2.42 IR.BiometricAuthStart()
      • 2.43 IR.OpenPhotoGallery()
      • 2.44 IR.OpenPhotoCamera()
      • 2.45 IR.UploadFile()
      • 2.46 IR.EnableProximity()
      • 2.47 IR.OnTop()
      • 2.48 Popen
      • 2.49 iDate (object)
      • 2.50 JSON
        • 2.50.1 JSON.Stringify
        • 2.50.2 JSON.Parse
      • 2.51 XML
        • 2.51.1 new XML
        • 2.51.2 .toXMLString
      • 2.52 IR.SetPanelBacklight()
    • 3 Events
      • 3.1 IR.EVENT_START
      • 3.2 IR.EVENT_WORK
      • 3.3 IR.EVENT_EXIT
      • 3.4 IR.EVENT_GLOBAL_TAG_CHANGE
      • 3.5 IR.EVENT_ORIENTATION
      • 3.6 IR.EVENT_KEYBOARD_SHOW
      • 3.7 IR.EVENT_RECEIVE_SCHEME
      • 3.8 IR.ANDROID_BACK_PRESS
      • 3.9 IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY
      • 3.10 IR.EVENT_RECEIVE_PHOTO_FROM_CAMERA
      • 3.11 IR.EVENT_LICENCE_ACCEPT
    • 4 Not supported
      • 4.1 IR.DownLoadProject
      • 4.2 IR.SendNotification
      • 4.3 IR.ClearNotification
      • 4.4 IR.EVENT_RECEIVE_NOTIFY
      • 4.5 IR.EVENT_APP_ENTER_BACKGROUND
      • 4.6 IR.EVENT_APP_ENTER_FOREGROUND
      • 4.7 IR.EVENT_APP_WILL_TERMINATE

    API iRidium. System

    functions, methods, properties of objects used for work with the application in the context of its launch, execution, closing and changes by the OS

    IR object - it is a global object containing all functions and constants of iRidium API. Methods of IR objects for controlling system events of the iRidium application.

    Methods

    IR.ShowSystemMenu

    To open the system menu. After executing the system menu will be open.

    Syntax

    IR.ShowSystemMenu();

    input value description

    -

    output

    -


    Sample

    function ShowMenu () {
        IR.ShowSystemMenu();
    };





    IR.SetEnableSystemMenu

    Allow / ban opening the system menu

    Syntax

    IR.SetEnableSystemMenu();

    input value description
    mode true type: boolean
    • true - allow opening the system menu.
    • false - ban opening the system menu.
    output

    -


    Sample

    function SystemMenu()
    {
    IR.SetEnableSystemMenu(true);
    }





    IR.GetEnableSystemMenu

    It checks the capability to open the system menu.

    Syntax

    IR.GetEnableSystemMenu();

    input value description

    -

    output
    mode true type: boolean
    • true - permission to open the system menu.
    • false - ban to open the system menu.


    Sample

    IR.Log(IR.GetEnableSystemMenu());





    IR.SetEnableProjectMenu

    Allow / ban opening i3 pro project menu.

    Syntax

    IR.SetEnableProjectMenu();

    input value description

    -

    output
    mode true type: boolean
    • true - allow opening i3 pro project menu.
    • false - ban opening i3 pro project menu.


    Sample

    function ProjectMenu()
    {
    IR.SetEnableProjectMenu(true);
    }





    IR.GetEnableProjectMenu

    It checks the capability to open i3 pro project menu

    Syntax

    IR.GetEnableSystemMenu();

    input value description
    mode true type: boolean
    • true - permission to open i3 pro project menu.
    • false - ban to open i3 pro project menu.
    output

    -


    Sample

    IR.Log(IR.GetEnableProjectMenu());





    IR.ShowSettingsMenu

    Open the projects menu of i3 pro on the specified tab: Cloud or Local

    Syntax

    IR.ShowSettingsMenu();

    input value description

    -

    output

    -


    Sample

    function ShowMenu () {
        IR.ShowSettingsMenu();
    };





    IR.SetFullScreen

    Set app in fullscreen mode

    Syntax

    IR.SetFullScreen(mode);

    input value description
    mode true type: boolean
    turn on\turn off fullscreen mode
    • true - fullscreen mode
    • false - window mode
    output

    -


    Sample

         IR.SetFullScreen(true);

    method works only on windows


    IR.IsFullScreen

    Check fullscreen mode

    Syntax

    IR.IsFullScreen;

    input value description


    output
    mode true type: boolean
    • true - fullscreen mode is on
    • false - fullscreen mode is off


    Sample

       IR.Log(IR.IsFullScreen);

    method works only on windows



    IR.HWID

    the property of IR objects, it stores HWID of the control panel where the i3 pro is running.

    Syntax

    IR.HWID

    input value description

    -

    output
    hwid ff2c...1958 type: string
    conrol panel HWID


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
        IR.Log("Panel HWID: "+IR.HWID); // Panel HWID: ff2c589a2879c0fe1158697d5d4c1958
    });

    to get a symbol from HWID use the function charAt(symbol). The numeration of symbols starts with zero:

    IR.Log(IR.HWID.charAt(0));




    IR.Exit

    to close the application. It is available for Android and Windows only

    Syntax

    IR.Exit();

    input value description

    -

    output

    -


    Sample

    function CloseApp () {
        IR.Exit();
    };

    it is available for Android and Windows only


    IR.ShowKeyboard

    to show the system keyboard of iOS or Android devices

    Syntax

    IR.ShowKeyboard(type, ok_text, color, capitalization)

    input value description
    type 1 type: Number
    keyboard type that can also hide the keyboard (with 0 value):
    • works with iOS and Android:
      • 0 - Hide
      • 1 - Regular
      • 2 - URL address
      • 3 - Numeric
      • 4 - Phone number
      • 5 - E-mail address
      • 6 - Decimal
      • 7 - Text
      • 8 - Twitter
      • 9 - Web search
      • 10 - Numeric
      • 11 - Password
    • works only with Android:
      • 12 - Date and Time
      • 13 - Date
      • 14 - Time
      • 15 - Numeric signed
      • 16 - Numeric password
      • 17 - Text characters
      • 18 - Text sentences
      • 19 - Text words
      • 20 - Text ime multi line
      • 21 - Text multi line
      • 22 - Text suggestions
      • 23 - Text email subject
      • 24 - Text filter
      • 25 - Text long message
      • 26 - Text password
      • 27 - Text phonetic
      • 28 - Text postal address
      • 29 - Text short message
      • 30 - Text visible password
      • 31 - Text web email address
      • 32 - Text web password
      • 33 - Smart
      • 34 - Voice
    ok_text 0 type: Number
    text on "return" button:
    • 1 - default
    • 2 - go
    • 3 - google
    • 4 - join
    • 5 - next
    • 6 - route
    • 7 - search
    • 8 - send
    • 9 - yahoo
    • 10 - done
    • 11 - call
    • 12 - continue
    color 0 type: Number
    keyboard color
    • 1 - auto
    • 2 - dark
    • 3 - lite
    capitalization 0 type: Number
    auto-capitalization of text
    • 1 - none
    • 2 - words
    • 3 - sentences
    • 4 - all symbols
    output

    -


    Sample

    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 1"), function()
    {
      IR.ShowKeyboard(1); // regular
      IR.ShowKeyboard(1, 1, 1, 1); // regular, default, default, no capitalization
    });

    For iOS - use the command IR.ShowKeyboard(0) to hide the keyboard. It will not work on Android.
    To open the keyboard, all other keyboards have to be closed. If a keyboard (for example, a numeric one) is already opened, the command for opening the alphabet keyboard will not work.
    To open a keyboard on Windows, use the command IR.Execute("osk").


    IR.Execute

    to execute a random URL scheme (a command to the OS) supported by the device. Such commands include: opening hyperlinks in the browser, sending SMS, making calls by the phone number, writing e-mails, launching applications by their names, запустить Launching applications by the indicated path, etc.

    Syntax

    IR.Execute(scheme)

    input value description
    scheme http://iridiummobile.net type: string
    the command to be executed
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function() {
        IR.Execute('http://iridiummobile.net');
    });

    examples of URL schemes

     // All
    	IR.Execute("http://iridiummobile.net"); // open link
    	IR.Execute("mailto:support@iridiummobile.ru"); // send email
    // Windows	
    	IR.Execute("cmd"); // command string
            IR.Execute("ping","-t ya.ru"); //launch ping with link
    	IR.Execute("calc"); // calculator
    	IR.Execute("c:\\Program Files\\iRidium\\iRidium.exe"); // launch app
    // iOS, Android
    	IR.Execute("music:"); // open Music
    	IR.Execute("videos:"); // open Videos
    	IR.Execute("ibooks://"); // open iBooks
    	IR.Execute("fb://feed"); //open Facebook
    	IR.Execute("twitter://"); // open Twitter
    // iPhone, Android smartphone
    	IR.Execute("tel://+1234567890"); // call to
    	IR.Execute("sms://+1234567890"); // send SMS


    Windows: to launch an application on Windows - each slash in the path to the file must be substituted by the double back slash mark


    IR.GetSystemInfo

    to get information about the application memory and cache

    Syntax

    IR.GetSystemInfo("GC_MEMORY_INFO").property

    input value description
    property UsedMemory type: object
    the property to return:
    • .UsedMemory
    • .TotalMemory
    • .ChunkHeaps
    • .ChunkCache
    • .MemoryHeaps
    • .MemoryBusyBlocks
    • .MemoryFreeBlocks
    output
    property type: string
    the value in the property


    Sample

    IR.AddListener(IR.EVENT_START,0,function() {
        IR.Log(IR.GetSystemInfo("GC_MEMORY_INFO").UsedMemory);
    });





    IR.GetCurrentWlanInfo

    to get information about the wireless network to which the control panel is connected. The list of networks in united in an array. Each network is an array element with fixed list of properties.

    Syntax

    IR.GetCurrentWlanInfo()[element].property

    input value description
    element 0...n type: number
    the number of the array element corresponding to the sequence number of the network connection
    property Name type: object
    the property to return:
    • .Name - the type of the network connection
    • .SSID - the network name
    output
    property type: string
    the value in the property


    Sample

    IR.Log(IR.GetCurrentWlanInfo()[0].SSID)
    IR.AddListener(IR.EVENT_START,0,function()
    {
       var l_aWlanInfo = IR.GetCurrentWlanInfo();
       if (l_aWlanInfo.length) {
    	   IR.Log("Name = " + l_aWlanInfo[0].Name);
    	   IR.Log("SSID = " + l_aWlanInfo[0]['SSID']);
       } else {
          IR.Log("There is no network connections found");
       }
    });

    Check the length of the array to make sure there is at least one network


    IR.GetCurrentLocalIPInfo

    to get network settings of the control panel with running i3 pro
    This method can't get the MAC address of the network interface on iOS 7 and later.

    Syntax

    IR.GetCurrentLocalIPInfo()[element].property

    input value description
    element 0...n type: number
    the number of the array element corresponding to the sequence number of the network connection
    property Name type: object
    the property to return:
    • .Name - the name of the network connection
    • .IP - IP-address of a control panel
    • .Mask - the subnet mask
    • .MAC - the MAC address
    output
    property type: string
    the value in the property


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {      
       var l_aIPInfo = IR.GetCurrentLocalIPInfo();
       IR.Log("Name = " + l_aIPInfo[0].Name);
       IR.Log("IP = " + l_aIPInfo[0].IP);
       IR.Log("Mask = " + l_aIPInfo[0].Mask);
       IR.Log("MAC = " + l_aIPInfo[0].MAC);
    });

    Starting with Android 11 version and later the MAC address is not available.


    IR.SetStatusAutoUpdateProject

    Turn on / off project auto update.

    Синтаксис

    IR.SetStatusAutoUpdateProjects(mode);

    на входе значение описание
    mode true type: boolean
    turn on/off auto update:
    • true - turn on project auto update;
    • false - turn off project auto update.
    на выходе

    -


    Пример

    function AutoUpdate() 
    {
        IR.SetStatusAutoUpdateProjects(true);
    };





    IR.Log

    t output data in the debug console of the i3 pro application (the console is opened in Windows through F4)

    Syntax

    IR.Log(data);

    input value description
    data type: object, string, number, array
    the data for output in the log
    output
    data type: string
    the string data in the application log


    Sample

    IR.AddListener(IR.EVENT_START,0,function() {
        IR.Log("Hello World!");
    });

    the data sent to the console are converted into a string
    In Windows 7, the maximum size of a single string output to the console is 30 KB.


    IR.SetInterval

    to repeat action in a cycle with the preset interval (ms)

    Syntax

    IR.SetInterval(time, action)

    input value description
    time 500 type: number
    (ms) the interval of executing the function
    action function() { } type: number
    the unnamed function or the name of the function which contains the list of actions for executing them in a cycle
    output

    -


    Sample

    function actions() 
    {
      IR.Log("do action");
    }
    IR.SetInterval (2000, actions);
    IR.SetInterval (2000, function() 
    {
      IR.Log("do action");
    });
    var Inv = IR.SetInterval (2000, function() 
    {
      IR.Log("do action");
    }); 
    IR.ClearInterval(Inv);

    IR.SetInterval will work until the project is closed, if you do not stop it with the help of IR.ClearInterval
    The interval can be stopped only by referring to it by the variable name. Make sure you assign the name to the variable when you create the interval
    In the interval you cannot start functions with parameters
    JavaScript works in one stream in iRidium. It means all functions in it are executed sequentially. For the IR.SetInterval function it means that each cycle of script execution can take different time. It leads to errors of interval execution which depend on the number and type of executed operations. The system compensates the errors automatically for accuracy in big time periods (to avoid accumulation of temporary errors). That is why the intervals can differ by dozens or hundreds milliseconds upward or downward. Keep this in mind when creating commands for which the minimal interval is critical - set up the bigger interval value or use the function IR.SetTimeout which does not use the compensation mechanism.


    IR.SetTimeout

    to perform the function after the preset timeout (ms)

    Syntax

    IR.SetTimeout(time, action)

    input value description
    time 500 type: number
    (ms) the delay of function execution
    action function() { } type: number
    the unnamed function or the name of the function which stores the list of actions for execution with the delay
    output

    -


    Sample

    function actions() 
    {
      IR.Log("do action");
    }
    IR.SetTimeout(2000, actions);
    IR.SetTimeout(2000, function() 
    {
      IR.Log("do action");
    });
    var Tmr = IR.SetTimeout(2000, function() 
    {
      IR.Log("do action");
    }); 
    IR.ClearInterval(Tmr);

    IR.SetTimeout can be stopped with the help of IR.ClearInterval (there is no separate function IR.ClearTimeout).
    The timer can be stopped only when you refer to it by the variable name. That is why do not forget to assign the name to the variable when creating the timeout
    You cannot send functions with parameters to the timer


    IR.ClearInterval

    to delete the timers IR.SetInterval and IR.SetTimeout by their identifiers. To get the identifier, save it in the variable. It is possible only when you create the timer.

    Syntax

    IR.ClearInterval(timer_id)

    input value description
    timer_id var timer type: object
    the identifier of the timer you want to delete
    output

    -


    Sample

    var id = IR.SetTimeout (10000, function ()
    {
            IR.Log("do something");
    }); 
    IR.SetTimeout(5000, function ()  // stop after 5000 ms
    {
            IR.ClearInterval(id);
    });

    it is used to delete IR.SetInterval and IR.SetTimeout
    you can get the identifier used at deletion only when you create the timer


    IR.AddListener

    to create a listener - a function which is executed in case of activation of the indicated event. The event - a process forwarded in scripts with the identifier for monitoring. The list of event is available in the handbook.

    Syntax

    IR.AddListener(event, input, function, [pointer]);

    input value description
    event type: object
    the identifier of the event monitored by the listener
    input type: object
    the input parameter required to create the listener. If there is no such parameter, indicate 0
    function function() {} type: function
    the unnamed function or reference to the function where action are executed
    pointer type: object
    the pointer to the object which serves the function (optional)
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
        IR.Log("app started");
    });
    IR.AddListener(IR.EVENT_ITEM_PRESS,IR.GetItem("Page 1").GetItem("Item 61"),function()
    {
       IR.Log("button 61 pressed");  
    });


    Example 2:

    for(var i = 0; i < IR.GetItem("Page 1").ItemsCount; i++){
       // call the listener and add the pointer
       IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem(i),  press,  IR.GetPage("Page 1").GetItem(i) );
    } 
    function press(){
       //output the name of the activated button in the log using 'this' as a reference to the object
     
       IR.Log(this.Name);
    }

    You can read about execution of scripts with the help of listeners in the guide


    IR.RemoveListener

    to remove the listener created with the help of IR.AddListener. The function has to receive the same parameters which were indicated at creation of the listener.

    Syntax

    IR.RemoveListener(event, input, function, [pointer]);

    input value description
    event type: object
    the identifier of the event monitored by the listener
    input type: object
    the input parameter required to create the listener. If there is no such parameter, indicate 0
    function function() {} type: function
    the named function or reference to the function where action are executed
    pointer type: object
    the pointer to the object which serves the function (optional)
    output

    -


    Sample

    function pressed () 
    {
        IR.Log("action");
    }
    // add listener
    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 61"), pressed); 
    // remove listener
    IR.RemoveListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 61"), pressed);
    var l_pressed;
    // add listener
    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 61"), l_pressed =  function () 
    {
        IR.Log("action");
    });
    // remove listener
    IR.RemoveListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Item 61"), l_pressed);





    IR.SetGlobalListener

    to create the global listener - the function which is executed in case of activation of the indicated event. It can operate only with two events: IR.EVENT_GLOBAL_TAG_CHANGE (it is activated when changing any tag in iRidium).

    Unlike IR.AddListener, the global listener can be called only once. When calling the listener again, only the last listener created by the interpreter at script launch will work.

    For the listener to work at tag changes in the iRidium project, you need to subscribe to the changes with the help of the method IR.SubscribeTagChange

    Syntax

    IR.SetGlobalListener(event, function, [pointer]);

    input value description
    event IR.EVENT_GLOBAL_TAG_CHANGE type: object
    the identifier of the event which is monitored by the global listener:
    • IR.EVENT_GLOBAL_TAG_CHANGE - it is activated at change of any tag in iRidium
    function function(name, value) {} type: function
    the unnamed function or reference to the called function inside which actions are executed. The function received the name of the tag for which there is a subscription and the changed value
    pointer type: object
    the pointer to the object which serves the function (optional)
    output

    -


    Sample

    // Set global listener
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
         IR.Log("Active Global Listener: " + name + "\tValue: " + value);
    });
    // Subscribe 
    IR.SubscribeTagChange("Drivers.KNX.Online");       // driver token
    IR.SubscribeTagChange("Drivers.KNX.Address 1");       // driver feedback
    IR.SubscribeTagChange("Global.Token 1");           // project token
    IR.SubscribeTagChange("UI.Page 1.Item 1.Text");    // item property
    IR.SubscribeTagChange("System.Time.Hour");         // system time, hours
    IR.SubscribeTagChange("System.Time.Minutes");      // system time, minutes
    // resend the data from KNX Address 1 to Address 2 on change (for iRidium Server)
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
       if (name == "Server.Channels.KNX.Address 1")
          IR.SetVariable("Server.Channels.KNX.Address 2", value);
    });
    IR.SubscribeTagChange("Server.Channels.KNX.Address 1");

    the listener will get the full name of the tag to which you subscribed (name)
    The global listener can be created only once - only the listener created last will work
    The listener reacts on tag changes only when it is subscribed to this tag with the method IR.SubscribeTagChange
    The listener reacts only on tag changes (it will not work if the received value equals to the current one)
    The maximum number of subscriptions to the global listener is almost not limited (it is about a million)
    Unsubscribe from the tag: IR.UnsubscribeTagChange


    IR.SubscribeTagChange

    to subscribe to the tag changes in iRidium via the global listener to the event IR.EVENT_GLOBAL_TAG_CHANGE. The tags the listener is subscribed to return their value at each change.

    Syntax

    IR.SubscribeTagChange(name);

    input value description
    name "Drivers.AV (TCP).Feedback 1" type: string
    the full name of the tag on which you need to subscribe with the help of the global listener IR.EVENT_GLOBAL_TAG_CHANGE
    output

    -


    Sample

    //Set global listener
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
         IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
    });
    // Subscribe 
    IR.SubscribeTagChange("Drivers.KNX IP Router.Address 1"); 
    IR.SubscribeTagChange("Drivers.AV & Custom Systems (TCP).Online"); 
    IR.SubscribeTagChange("UI.Page 1.Item 1.Text"); 
    IR.SubscribeTagChange("System.Time.24");
    // resend the data from KNX Address 1 to Address 2 on change (for iRidium Server)
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
       if (name == "Server.Channels.KNX.Address 1")
          IR.SetVariable("Server.Channels.KNX.Address 2", value);
    });
    IR.SubscribeTagChange("Server.Channels.KNX.Address 1");

    You can unsubscribe from the tag with the help of the method IR.UnsubscribeTagChange


    IR.UnsubscribeTagChange

    to unsubscribe from the iRidium tag which changes are monitored by the global listener on the event IR.EVENT_GLOBAL_TAG_CHANGE. The subscription to the tag is performed with the help of the method IR.SubscribeTagChange

    Syntax

    IR.UnsubscribeTagChange(name);

    input value description
    name "Drivers.AV (TCP).Feedback 1" type: string
    the full name of the tag from which you need to unsubscribe
    output

    -


    Sample

    //Set global listener
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value) 
    {
         IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
    });
    // Subscribe
    IR.SubscribeTagChange("UI.Page 1.Item 1.Text"); 
    // Unsubscribe
    IR.UnsubscribeTagChange("UI.Page 1.Item 1.Text");

    You can subscribe to the tag with the help of the method IR.SubscribeTagChange


    IR.CopyToClipboard

    to copy the string in the exchange buffer of the iOS, Android, Windows device

    Syntax

    IR.CopyToClipboard(text)

    input value description
    text 'data' type: string
    the string which have to be placed in the exchange buffer
    output

    -


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {    
       IR.CopyToClipboard(IR.GetVariable("System.Device.Name") + " HWID: " + IR.HWID);
    });





    IR.PasteFromClipboard

    Paste the text from clipboard to an active EditBox Item. Only the Text will be pasted (not an images or other data). Cursor will be positioned after the text

    Синтаксис

    IR.PasteFromClipboard()

    на входе значение описание

    -

    на выходе

    -


    Пример

    IR.AddListener(IR.EVENT_ITEM_PRESS, IR.GetItem("Page 1").GetItem("Paste Button"),function()
    {
       IR.PasteFromClipboard();  
    });

    how to use: create the item "Paste text" beside of EditBox Item


    IR.GetClipboard

    Receive the text from clipboard

    Syntax

    IR.GetClipboard()

    input value description

    -

    output

    -


    Sample

    var clipboard = IR.GetClipboard();

    how to use: send the text from clipboard to JS


    IR.ShowPasteHelper

    This method shows the native Paste dialog above the EditBox item. This dialog includes the text "Paste" and performs the action IR.PasteFromClipboard();. when you press on it. If you press on any other item it will close this dialog

    Syntax

    IR.ShowPasteHelper()

    input value description

    -

    output

    -


    Sample

    IR.AddListener(IR.EVENT_ITEM_HOLD, IR.GetItem("Page 1").GetItem("EditBox"),function()
    {
       IR.ShowPasteHelper();  
    });

    How it works on Editbox Item:

    • Windows:
      • When you press CTRL+V, the metod IR.PasteFromClipboard(); occures if the clipboard is not empty and it is the Text there
      • If you press on EditBox with rhe right mouse button, you'll see the standard Paste dialog
      • cursor will be positioned in the end of pasted string
    • iOS, Android:
      • When you hold the EditBox 1 second, IR.ShowPasteHelper(); occures
      • cursor will be positioned in the end of pasted string




    IR.GetDesignsCount

    to count the number of visualization projects in the application memory.

    Syntax

    IR.GetDesignsCount();

    input value description

    -

    output
    number 1 type: number
    the number of projects uploaded in the memory of the control panel


    Sample

    IR.AddListener(IR.EVENT_START, 0, function() {
       var l_iCount = IR.GetDesignsCount();
       IR.Log("Designs Count = " + l_iCount);
       IR.Log("Current Project: " + IR.ProjectName);
     
       for(var i = 0; i < l_iCount; i++) {
          var l_sName = IR.GetDesignByIndex(i);
          IR.Log("Design(" + i + "): " + l_sName.Name);
       }
    });

    An additional functions:

    • IR.ProjectName - the property of IR object that stores the name of project opened in i3 pro
    • IR.GetDesignByIndex(i) - get the link to the project as an object by calling it by the index of project position in the list of downloaded projects




    IR.DesignSwitch

    switches between visualization projects in the panel memory

    Syntax

    IR.DesignSwitch(name,[id]);

    input value description
    name "Welcome" type: string
    project name on the panel or in the cloud where to switch
    id 116897 type: number
    project ID in the cloud where to switch (optional, obligatory for projects in the cloud)
    output

    -


    Sample

    var ID;
    IR.AddListener(IR.EVENT_START, 0, function() {
     
        var l_iCount = IR.GetDesignsCount();
        IR.Log("Designs Count = " + l_iCount);
        IR.Log("Current Project: " + IR.ProjectName);
        for(var i = 0; i < l_iCount; i++) {
            var l_sName = IR.GetDesignByIndex(i);
            IR.Log("Design(" + i + "): " + l_sName.OriginalName + ", ID "+l_sName.CloudID);
            if (l_sName.OriginalName == "ProjectName") //project name
                ID = l_sName.CloudID      
        }
    });
    function switch_to() {
        //IR.DesignSwitch("Welcome"); // local project name .irpz you want to switch to
        IR.DesignSwitch("ProjectName", ID); // project name and id in Iridium Cloud you want to switch to
        IR.Log("test");
    }

    The example contains switching to the app start page (Welcome.irpz project). The following things are used additionally :

    • IR.GetDesignsCount() - get the number of projects uploaed to i3 pro
    • IR.ProjectName - property of IR object that stores the name of the project that is open now in i3 pro
    • IR.GetDesignByIndex(i) - get a link to projectm as an object by addressing it the index in the list of uploaded projects
    • IR.GetDesignByIndex().OriginalName - original project name that a project has on a panel and in the cloud
    • IR.GetDesignByIndex().CloudID - unique ID of a project in the cloud




    Example: DesignSwitch

    IR.AndroidSendIR

    to send IR command through built-in IR emitter of Android device (IRDA)

    Syntax

    IR.AndroidSendIR(frequency, command);

    input value description
    frequency 38000 type: number
    (Hz) the frequency of the IR command send
    command [67,67,44,...,55,53,13] type: array
    IR command as an array that includes pulses and a pause of IR signal
    output

    -


    Sample

    IR.AndroidSendIR(38000, [67,67,67,67,67,66,67,67,67,67,67,67,66,67,66,66,66,66,66,66,44,50,49,44,55,53,54,13]);

    if you have a command in HEX format, you can transform it into a format for sending via the program iConvert from Global Cache


    IR.CalculateCRC

    Calculate Cyclic Redundancy Check (CRC) with CRC8, CRC16 or CRC32 algorithm

    Syntax

    IR.CalculateCRC(algorithm, string);

    input value description
    algorithm IR.CRC_16 type: object
    CRC algorithm:
    • IR.CRC_8
    • IR.CRC_16
    • IR.CRC_32
    string "Test" type: string
    string for which you want to calculate CRC
    output
    CRC 7205 type: number
    CRC calculating result


    Sample

    var crc8 = IR.CalculateCRC(IR.CRC_8,  "Test");
    var crc16 = IR.CalculateCRC(IR.CRC_16, "Test");
    var crc32 = IR.CalculateCRC(IR.CRC_32, "Test");
     
    IR.Log(crc8) // 207
    IR.Log(crc16) // 7205
    IR.Log(crc32) // 2018365746





    IR.CalculateHash

    Calculate the hash-sum with MD5, SHA1, SHA256, SHA384 or SHA512 algorithm

    IR.CalculateCRC(algorithm, string, type, key);

    on input value description
    algorithm IR.HASH_MD5 type: object
    an algorithm to calculate a hash-sum

    (only algorithm and string parameters are used):
    IR.HASH_MD5,
    IR.HASH_SHA1,
    IR.HASH_SHA256,
    IR.HASH_SHA384,
    IR.HASH_SHA512.

    (all 4 parameters are used):
    IR.HASH_HMACSHA1,
    IR.HASH_HMACSHA256,
    IR.HASH_HMACSHA384,
    IR.HASH_HMACSHA512,
    IR.HASH_HMACMD5

    string "Test" type: string
    a string for which a hash-sum must be calculated
    type 0 type: number
    a format to display data:
    0 - a string,
    1 - a byte array.
    key "6af02e...286d2" type: string
    data encryption key.
    on input value description
    hash 0cbc66...5a615b type: number
    the result of calculating a hash-sum


    An example for the following algorithms MD5, SHA1, SHA256, SHA384, SHA512:

    var hashMD5 = IR.CalculateHash(IR.HASH_MD5, "Test");
    var hashSHA1 = IR.CalculateHash(IR.HASH_SHA1, "Test");
    var hashSHA256 = IR.CalculateHash(IR.HASH_SHA256, "Test");
    var hashSHA384 = IR.CalculateHash(IR.HASH_SHA384, "Test");
    var hashSHA512 = IR.CalculateHash(IR.HASH_SHA512, "Test");
     
    IR.Log(hashMD5);     // 0cbc6611f5540bd0809a388dc95a615b
    IR.Log(hashSHA1);    // 640ab2bae07bedc4c163f679a746f7ab7fb5d1fa
    IR.Log(hashSHA256);  // 532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25
    IR.Log(hashSHA384);  // 7b8f4654076b80eb963911f19cfad1aaf4285ed48e826f6cde1b01a79aa73fadb5446e667fc4f90417782c91270540f3
    IR.Log(hashSHA512);  // c6ee9e33cf5c6715a1d148fd73f7318884b41adcb916021e2bc0e800a5c5dd97f5142178f6ae88c8fdd98e1afb0ce4c8d2c54b5f37b30b7da1997bb33b0b8a31


    An example for the following algorithms HMACSHA1, HMACSHA256, HMACSHA384, HMACSHA512, HMACMD5:

    var textData = 'iRidi';
    var secretKey = '9212a1010dde4d4fbcb0';
    var HASH_HMACSHA256 = IR.CalculateHash(IR.HASH_HMACSHA256, textData, 1, secretKey);
    var HASH_HMACSHA = IR.CalculateHash(IR.HASH_HMACSHA1, textData, 1, secretKey);
    var HASH_HMACSHA384 = IR.CalculateHash(IR.HASH_HMACSHA384, textData, 1, secretKey);
    var HASH_HMACSHA512 = IR.CalculateHash(IR.HASH_HMACSHA512, textData, 1, secretKey);
    var HASH_HMACMD5 = IR.CalculateHash(IR.HASH_HMACMD5, textData, 1, secretKey);
     
    IR.Log(HASH_HMACSHA256); // 14,70,95,95,20,12,211,73,234,5,235,195,81,174,41,46,156,92,193,71,9,81,240,87,16,228,88,130,224,193,151,95
    IR.Log(HASH_HMACSHA);    // 244,101,165,67,222,85,108,145,20,89,16,231,57,40,39,48,136,49,151,163
    IR.Log(HASH_HMACSHA384); // 92,90,124,178,158,199,230,160,28,34,156,136,1,248,177,174,191,32,82,108,124,107,203,61,203,204,14,141,143,132,175,104,20,46,227,3,100,3,30,66,110,240,4,194,120,85,187,66
    IR.Log(HASH_HMACSHA512); // 106,247,151,52,13,155,173,249,228,182,129,10,4,56,118,233,176,26,104,200,65,250,133,35,229,1,201,249,143,8,125,234,72,16,202,211,119,121,28,173,3,23,206,137,69,159,196,221,53,90,43,222,142,20,254,56,210,122,152,229,132,150,189,25
    IR.Log(HASH_HMACMD5);    // 253,150,247,65,231,140,184,168,151,164,208,197,253,148,230,104


    IR.UrlDecode

    change the UTF-8 sequences to the related symbols (decode UTF-8 sequence)

    Syntax

    IR.UrlDecode(url);

    input value description
    url 'http://www.google.com/search?&q=%D0%BE%D0%BA' type: string
    UTF-8 string, usually the link that should be decoded
    output
    url http://www.google.com/search?&q=ок type: string
    result


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
       var utf8_encode = encodeURI('http://www.google.com/search?&q=ок');
       IR.Log(utf8_encode); // http://www.google.com/search?&q=%D0%BE%D0%BA
     
       var decode = IR.UrlDecode(utf8_encode);
       IR.Log(decode);	// http://www.google.com/search?&q=ок
    });





    IR.HtmlDecode

    decode symbols (mnemonic references) in HTML structure

    Syntax

    IR.HtmlDecode(text)

    input value description
    text
    "&gt;"
    type: string
    source text
    output
    text > type: string
    decoded text


    Sample

    IR.AddListener(IR.EVENT_START, 0, function() {  
        var data = IR.HtmlDecode("&gt;");
        IR.Log(data); // >
    });

    The function does not decode all standard mnemonics. The full list of mnemonics that can be decoded is here:

    &lt; &gt; &quot; &amp; &nbsp; &iexcl; &cent; &pound; &curren; &yen; &brvbar; &sect; &uml;
    &copy; &ordf; &laquo; &raquo; &not; &shy; &reg; &macr; &deg; &plusmn; &sup2; &sup3;
    &acute; &micro; &para; &middot; &cedil; &sup1; &ordm; &frac14; &frac12; &frac34;
    &iquest; &Agrave; &Aacute; &Acirc; &Atilde; &Auml; &Aring; &AElig;
    &Ccedil; &Egrave; &Eacute; &Ecirc; &Euml; &Igrave; &Iacute; &Icirc; &Iuml; &ETH; &Ntilde;
    &Ograve; &Oacute; &Ocirc; &Otilde; &Ouml; &times; &Oslash; &Ugrave; &Uacute; &Ucirc; &Uuml;
    &Yacute; &THORN; &szlig; &agrave; &aacute; &acirc; &atilde; &auml; &aring; &aelig; &ccedil;
    &egrave; &eacute; &ecirc; &euml; &igrave; &iacute; &icirc; &iuml;
    &eth; &ntilde; &ograve; &oacute; &ocirc; &otilde; &ouml; &divide;
    &oslash; &ugrave; &uacute; &ucirc; &uuml; &yacute; &thorn; &yuml;
    &apos; &OElig; &oelig; &Scaron; &scaron; &Yuml; &circ; &tilde;
    &ndash; &mdash; &lsquo; &rsquo; &sbquo; &ldquo; &rdquo; &bdquo;
    &dagger; &Dagger; &permil; &lsaquo; &rsaquo; &euro;




    IR.Base64Encode

    encode a string / an array in the Base64 format

    Syntax

    IR.Base64Encode(data, data_type)

    input value description
    data "Hello" type: string / array
    initial data.
    data_type 0 / 1 type: number
    type of data:
    0 - a string,
    1 - an array.
    output
    code "SGVsbG8=" type: string
    Base64 encoded text


    Sample

    //Example 1:
    IR.Log(IR.Base64Encode([0x48, 0x65, 0x6c, 0x6c, 0x6f], 1)); // encode a data array
     
    //Example 2:
    IR.Log(IR.Base64Encode("Hello", 0)); // encode a string
     
    //Пример 3:
    IR.Log(IR.Base64Encode("Hello")); // encode a string (an out-of-date method)





    IR.Base64Decode

    decode a string / an array in the Base64 format

    Syntax

    IR.Base64Decode(code, data_type)

    input value description
    code "SGVsbG8=" type: string
    Base64 encoded text
    data_type 0 / 1 type: number
    type of data:
    0 - a string,
    1 - an array.
    output
    data "Hello" type: string / array
    initial text / data array


    Sample

    //Example 1:
    IR.Log(IR.Base64Decode("SGVsbG8=", 1)); // decode an array
     
    //Example 2:
    IR.Log(IR.Base64Decode("SGVsbG8=", 0)); // encode a string
     
    //Example 3:
    IR.Log(IR.Base64Decode("SGVsbG8=")); //  decode a string (an out-of-date method)





    IR.IsModuleLicensed

    the method applicable for commercialization of unique scripts. It allows you to find out if an iRidium license has some particular "product". The products that this method allows you to check are included in iRidium mobile commercial licenses after agreement with the developer. The principle of use:

    1. Create a script that you want to encrypt and distribute on a commercial basis
    2. Contact iRidium mobile team to get the unique ID for your product (script)
    3. Add ID checking with the method IR.IsModuleLicensed(id)in the script so the script would not work until the project receives the license
    4. Protect the script file with a password to distribute the file to other users
    5. Contact the iRidium mobile team to arrange the inclusion of your product ID in commercial licenses

    Syntax

    IR.IsModuleLicensed(id)

    input value description
    id 57599 type: number
    the unique product ID provided to the developer by iRidium mobile is stored in the license
    output
    success true type: boolean
    the result of the checking:
    • true - if the product is included in the license
    • false - if it is not


    Sample

    function RunProtectedModule  () {
        // protected content
    }
     
    // unique module ID  = 65537;
    if (IR.IsModuleLicensed(65537)) RunProtectedModule ();

    Trial licenses and the test mode always return "true" on ID checking. It is due to the principle of free use of iRidium products in the testing mode.

    Для драйвера AV & Custom Systems ID = 6, для AV & Custom HTTP ID = 14.

    IR.ValidatePassword()

    This method allows to use the standard "4-layer passwords system" of project. The method can be used to create your own Password request window or request password by any event. The method compares any string with the system password preset in the project. It allows to use the same list of passwords in standard functions and JS and also makes you able to change passwords when project works.

    Syntax

    IR.ValidatePassword(pwd_number, check_string)

    input value description
    pwd_number 1 type: number
    1...4 - the number of password that you want to compare with some string (the password strings configured in project properties)
    check_string "password" type: string
    the password strings that will be compared with some system password from project properties
    output
    result true type: boolean
    the result of the validation, true if the password is correct, false if it is not correct


    Sample

    var editbox = IR.GetItem("Page 1").GetItem("Item 1"); // editbox item on page
     
    IR.AddListener(IR.EVENT_ITEM_CHANGE, editbox, function (action, key) // listen to changes in Editbox
    {    
        if (action == 2) { // when press Enter in Editbox item
            var confirm = IR.ValidatePassword(1, editbox.Text) // check the password from Editbox
                if (confirm) {
                    IR.Log("Access confirmed!");
                    // any action have to be activated by correct password
                } else {
                    IR.Log("Access denied!");
                }
            }
    });

    if in the project settings the password is not specified, the method will always return true


    IR.TouchIDStart()

    The method calls a system function, requesting a user's finger print.

    The method works only on devices based on iOS 11 and later, Android and on devices with a fingerprint scanner.

    System menu, requesting a finger print is displayed on iOS devices. System menu is not displayed in Android OS, the system function works in the background mode.

    Syntax

    IR.TouchIDStart(function(status){}, {}, reason)

    input value description
    reason "Place your finger on the
    fingerprint scanner to authorize."
    type: string
    a text, displayed to a user in the system menu, explaining the reason for requesting a fingerprint. Only for iOS. In case with Android OS the text is not displayed, any string can be sent, for example, an empty one.
    output
    status true type: boolean
    the result of scanning a fingerprint:
    true - successful,
    false - scanning is canceled
    function(){} - type: function
    a function, processing the result of scanning a fingerprint


    Sample

    var button = IR.GetPage("Page 1").GetItem("Button");    
    var result = IR.GetPage("Page 1").GetItem("Result");
     
    IR.AddListener(IR.EVENT_ITEM_RELEASE, button, function() {
      IR.TouchIDStart(function(status) {
        IR.Log("STATUS: " + status);
        result.Value = status;  
      }, {}, "reason");
    });

    When the TouchID system menu is open on iOS devices, i3 pro app is minimized and it does not work.

    If a fingerprint is not recognized, a user is asked to enter a password to enter the operation system. When the correct password is entered the processing function gets the true value.

    download:
    • example of project with TouchID




    IR.BiometricAuthStart()

    The method calls a system function, requesting a user's finger print or face.

    The method works only on devices based on iOS 11 and later, Android and on devices with a fingerprint or face scanner.

    The first time you use facial recognition in i3 pro app, give the app access to Face ID. Otherwise the function will not work.

    Syntax

    IR.BiometricAuthStart( function(status) {} , {}, reason)

    input value description
    reason "Place your finger on the
    fingerprint scanner to authorize."
    type: string
    a text, displayed to a user in the system menu, explaining the reason for requesting a fingerprint or face. Only for iOS. In case with Android OS the text is not displayed, any string can be sent, for example, an empty one.
    output
    status true type: boolean
    biometric scan result:
    true - successful,
    false - scanning is canceled.
    function(){} - type: function
    a function, processing the result of scanning a fingerprint


    Sample

    var button = IR.GetPage("Page 1").GetItem("Item 1");
     
    IR.AddListener(IR.EVENT_ITEM_RELEASE, button, function() 
    {
      IR.BiometricAuthStart(function(status) {
        if(status)
            IR.ShowPopup("Popup 1");  //action, when status is true
      },{}, "For opening popup");
    });

    When the system menu is open on iOS devices, i3 pro app is minimized and it does not work.

    In the case of an error (no face id or ios does not support face id, etc), a user is asked to enter a password to enter the operation system. When the correct password is entered the processing function gets the true value.

    download::
    • example of project with BiometricAuthStart





    IR.OpenPhotoGallery()

    it launches a system function to select a image file. The result of the method work is the name of a selected file and a file path to it that is sent to a listener by the following event IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY.


    The method works on Windows, iOS and Android panels. The server is not supported.

    Syntax

    var result = IR.OpenPhotoGallery();

    input value description


    output
    result true type: boolean
    the result:
    true - the method is supported by the operation system,
    false - the method is not supported.


    Sample

    if (IR.OpenPhotoGallery()) {
       IR.AddListener(IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY, 0, function(filename, filepath) {
          IR.Log("Photo selected.\n Filename: " + filename + "\n Filepath: " + filepath);
       })
    };





    Example: PhotoGallery.irpz

    IR.OpenPhotoCamera()

    The method calls a system camera to take a picture and then send if to iRidium. To get the photo use the following listener IR.EVENT_RECEIVE_PHOTO_FROM_CAMERA.

    Syntax

    IR.OpenPhotoCamera();

    input value description


    output
    result true type: boolean
    the result:
    true - the method is supported by the operation system,
    false - the method is not supported.


    Sample

    IR.AddListener(IR.EVENT_ITEM_RELEASE,IR.GetPage("Page 1").GetItem("Item 2"),function()
    {
        IR.OpenPhotoCamera();
    })

    The method works on iOS and Android panels


    IR.UploadFile()

    The method downloads files via HTTP protocol.

    The method work both in panel and server projects.

    Syntax

    var uploadResult = IR.UploadFile({
          Host: host,
          Port: port,
          SSL: ssl,
          UrlPath: urlpath,
          FilePath: filepath,
          Disposition: disposition,
          Headers: headers,
          Params: params,
          <other>,
          Callback: function(resultObj){}
    })

    input value description
    Host "192.168.1.2" type: string
    IP address of an addressee (who receives a file)
    Port 8457 type: number
    port of an addressee
    SSL IR.SSL_CONTEXT_
    _TYPE_NONE
    type: number
    type of encrypting:
    IR.SSL_CONTEXT_TYPE_NONE - no encrypting
    IR.SSL_CONTEXT_TYPE_TLS_V12 - TLS v1.2
    IR.SSL_CONTEXT_TYPE_SSL_V23 - SSL v2.3
    IR.SSL_CONTEXT_TYPE_SSL_V30 - SSL v3.0
    UrlPath "/bin" type: string
    URL path of an addressee
    FilePath "C:/images/face01.jpg" type: string
    file path and file name for uploading
    Disposition "image" type: string
    type of attachment (defines the HTTP heading - Content-Disposition)
    Headers {Connection: Keep-Alive,
    Content-Length: 100,
    Accept: */*}
    type: object
    object - headers for POST request
    Params {param1: value1,
    param2: value2}
    type: object
    object - parameters for POST request
    <other> - type: -
    other parameters, that are applied to AV & Custom Systems (HTTP) driver
    function function(resultObj){} type: function
    an unnamed function or a link to a named function, inside which an action is done
    output
    uploadResult true type: boolean
    the results of an attempt to upload a file:
    false - error, a file is not uploaded ,
    true - success, upload began
    resultObj - type: object
    object containing the results of uploading a file
    resultObj.State IR.UPLOADER_MANAGER_
    _NOTIFY_STEP
    type: number
    the current state of file upload:
    IR.UPLOADER_MANAGER_NOTIFY_START - beginning
    IR.UPLOADER_MANAGER_NOTIFY_STEP - upload in progress, the returned function is called every second
    IR.UPLOADER_MANAGER_NOTIFY_END - end
    IR.UPLOADER_MANAGER_NOTIFY_ERROR - error
    resultObj.Size 10000 type: number
    the current uploaded file size in bytes. At the beginning of upload resultObj.Size is equal to the size of the whole file.
    resultObj.Answer "{Status: 0}" type: string
    contents of an answer to HTTP request received from an addressee when a file is uploaded.


    Sample

    IR.UploadFile({
       Host: "192.168.0.21",
       Port: 8587,
       SSL: IR.SSL_CONTEXT_TYPE_NONE,
       UrlPath: "/api/upload/plain",
       FilePath: "C:/image.png",
       Disposition: "image",
       Headers: {
          "Cache-Control": "no-cache",
          "Pragma": "no-cache",
          "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
          "Accept-Language": "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7",
          "Accept-Encoding": "gzip, deflate, br"
       },
       Callback: function(obj) {
          switch(obj.State) {
             case IR.UPLOADER_MANAGER_NOTIFY_START:
                IR.Log("UPLOADER_MANAGER_NOTIFY_START: " + obj.Size + " bytes to load");
                break;
             case IR.UPLOADER_MANAGER_NOTIFY_STEP:
                IR.Log("UPLOADER_MANAGER_NOTIFY_STEP: " + obj.Size + " bytes loaded");
                break;
             case IR.UPLOADER_MANAGER_NOTIFY_END:
                IR.Log("UPLOADER_MANAGER_NOTIFY_END");
                var data = JSON.Parse(obj.Answer);
                IR.Log("Answer Status: " + data.Status);  
                break;
             case IR.UPLOADER_MANAGER_NOTIFY_ERROR:
                IR.Log("UPLOADER_MANAGER_NOTIFY_ERROR");
                break;
          }
       }
    });





    IR.EnableProximity()

    The method activates monitoring a proximity sensor of a device.

    Syntax

    var result = IR.EnableProximity();

    input value description


    output
    result true type: boolean
    the result:
    true - the method is supported by the operation system,
    false - the method is not supported.


    Sample

    {
        IR.EnableProximity(this.Value == 1);
    }





    IR.OnTop()

    The method displays a popup above other popups in the system along the Z axis.

    Syntax

    IR.OnTop();

    input value description


    output
    succes true type: boolean
    true


    Sample

    IR.TimeOut(5000, function() {
    IR.OnTop();
    });

    It works only on Windows platform.


    Popen

    Popen - a process enabling iRidium Server to execute a command in the Windows and Linux command string. Popen does not work in the i3 pro client application. Executing of Popen opens the file directory of the process and allows you to sent information about command work in the indicated instance of the listener function. In order to execute several commands and distinguish information about their work, create Popen instances.

    Syntax

    var cmd_process = new Popen (command, function);

    input value description
    command 'ping 192.168.0.1' type: string
    the command for execution in the command string (cmd.exe)
    function cmd_result type: function
    the instance of the listener function where the results of command execution will be sent
    output
    line .onRecieve type: string
    the data generated by the command during execution. The .OnReceive event is activated in the context of Popen and receives the line string as an input parameter. The string can be output in the log or written in the iRidium Server variable
    result .onEnd type: number
    the code generated by the command at its finishing. The .onEnd event is activated in the context of Popen and result is received as an input parameter. You can output the code in the log or write in the iRidium Server variable:
    • 0 - the command is successfully finished
    • 259 and other numbers - errors. Error codes will be generated at execution of the .Stop() method - premature command finishing and in case of a negative result (for example, when the IP-address is unavailable for the ping command)
    .Stop() .Stop() type: method
    the command of forced finish of the Popen process. You do not need to finish the process if the .onEnd event is activated. But you are required to finish it when the command does not finish (for example, as continuous ping)


    Sample

    function Listener (cmd)
    {
       this.onRecieve = function(line)
       {
          IR.Log(line); 
       }
     
       this.onEnd = function(result)
       {
          IR.Log('Command: '+ cmd + " Result: " + result);
       }   
    }
     
    function stop()
    {
      cmd_process.Stop();
    }
     
    var cmd_result    =  new Listener ('ping 192.168.0.1');
    var cmd_process   =  new Popen ('ping 192.168.0.1', cmd_result);

    To finish the process use the Stop() method. Command which do not finish by themselves must be stopped as each of them uses OS resources and affects speed of operation

    Popen works only in iRidium Server on Windows and Linux. It does not work in i3 pro


    iDate (object)

    iDate - это представление даты в виде 64 битного числа с плавающей запятой. Может оперировать датами и временем в диапазоне от 1 января 100 года до 31 декабря 9999 года.

    Целая часть означает количество дней с 30 декабря 1899 года, т.е. число 2 будет означать 1 января 1900 года. Чтобы указать даты до 30 декабря 1899 года, используйте отрицательное число, например -1 будет обозначать 29 января 1899 года.

    Дробная часть определяет время. Чтобы увеличить время на 1 час нужно прибавить 1/24, чтобы прибавить 1 минуту: 1/1440. Недостатком объекта является низкая точность при работе с миллисекундами, погрешность составляет +/-150 миллисекунд.


    iDate без аргументов

    При создании без аргументов, создается объект, который инициализируемый текущей датой и временем.

    var date = new iDate();
    IR.Log("Date " + date.year + "." + date.month + "." + date.day);
    IR.Log("Time " + date.hours + ":" + date.minutes + ":" + date.seconds + "." + date.ms);
    IR.Log("Value " + date.value);
    /*
       result:
       Date 2014.11.29
       Time 20:49:20.778
       Value 41972.86760159722
    */


    iDate c 1 аргументом

    Аргументом является value - число с плавающей запятой, обозначающее совмещенное представление даты и времени.

    При создании объекта число с плавающей запятой преобразовывается в объект, из которого, в свою очередь, можно получить дату и время.

    // создадим объект iDate, передав ему целое положительное число.
    var d1 = new iDate(16384);
    IR.Log("Date 1 " + d1.year + "." + d1.month + "." + d1.date);
    IR.Log("Time 1 " + d1.hours + ":" + d1.minutes + ":" + d1.seconds + "." + d1.ms);
    IR.Log("Value 1" + d1.value);
    /* 
       result:
       Date 1 1944.11.8
       Time 1 0:0:0.0
       Value 1 16384
    */
    // создадим объект iDate, передав ему целое отрицательное число.
    var d2 = new iDate(-16384);
    IR.Log("Date 2" + d2.year + "." + d2.month + "." + d2.date);
    IR.Log("Time 2" + d2.hours + ":" + d2.minutes + ":" + d2.seconds + "." + d2.ms);
    IR.Log("Value 2" + d2.value);
    /* 
       result:
       Date 2 1855.2.20
       Time 2 0:0:0.0
       Value 2 -16384
    */


    iDate более чем с 1 аргументом

    Аргументы:

    • year - год
    • month - месяц
    • date - день
    • hours - часы
    • minutes - минуты
    • seconds - секунды
    • ms - миллисекунды


    При создании объекта происходит раздельное заполнение года, месяца, даты, часов, минут, секунд и миллисекунд. Если заполнены не все параметры, оставшиеся заполняются текущим значением.

    // создание  объекта iDate, с текущими значениями даты и времени.
    var cur = new iDate();
    IR.Log("Cur Date " + cur.year + "." + cur.month + "." + cur.date);
    IR.Log("Cur Time " + cur.hours + ":" + cur.minutes + ":" + cur.seconds + "." + cur.ms);
    IR.Log("Cur Value" + cur.value);
    /* 
       result:
       Cur Date 2014.11.29
       Cur Time 21:6:45.128
       Cur Value41972.879688981484
    */
    // создание  объекта iDate, с указанием года, месяца и числа
    var date2 = new iDate(1999, 1, 21);
    IR.Log("Date 2 " + date2.year + "." + date2.month + "." + date2.date);
    IR.Log("Time 2 " + date2.hours + ":" + date2.minutes + ":" + date2.seconds + "." + date2.ms);
    IR.Log("Value 2 " + date2.value);
    /* 
       result:
       Date 2 1999.1.21
       Time 2 21:6:45.133
       Value 2 36181.87968903935
    */
    // создание объекта iDate, с указанием года, месяца, числа, часа и минуты
    var date4 = new iDate(1999, 1, 21, 4, 16);
    IR.Log("Date 4 " + date4.year + "." + date4.month + "." + date4.date);
    IR.Log("Time 4 " + date4.hours + ":" + date4.minutes + ":" + date4.seconds + "." + date4.ms);
    IR.Log("Value 4 " + date4.value);
    /* 
       result:
       Date 4 1999.1.21
       Time 4 4:16:45.138
       Value 4 36181.17830020833
    */
    // создание  объекта iDate, с указанием года, месяца, числа, часа, минуты, секунды и миллисекунды
    var date6 = new iDate(1999, 1, 21, 4, 16, 12, 400);
    IR.Log("Date 6 " + date6.year + "." + date6.month + "." + date6.date);
    IR.Log("Time 6 " + date6.hours + ":" + date6.minutes + ":" + date6.seconds + "." + date6.ms);
    IR.Log("Value 6 " + date6.value);
    /* 
       result:
       Date 6 1999.1.21
       Time 6 4:16:12.400
       Value 6 36181.177921296294
    */

    Для класса iDate добавлены методы toTimeString() и toDateString(), которые повторяют поведение одноименных методов класса Date. Вывод при использовании этих методов учитывает локальное (системное) время сервера.

    Пример:

    IR.AddListener(IR.EVENT_START, 0, function()
    {
        function getTime()
        {
            var currentDate = new iDate();         // Создадим экземпляр класса iDate
            var time = currentDate.ToTimeString(); // Преобразуем iDate к строке вида - HH:MM:SS
            var date = currentDate.ToDateString(); // Преобразуем iDate к строке вида - Day, DD Mon YEAR 
            IR.Log("iDate: " + time + " " + date); // Выведем результат
     
            IR.SetTimeout(2000, getTime);
        }
     
        IR.SetTimeout(2000, getTime);
    });

    На выходе:

    …INFO SCRIPT  iDate: 16:30:28 Thu, 4 Jul

    JSON

    JSON.Stringify

    convert JSON object into a string

    Syntax

    JSON.Stringify(object, bool)

    input value description
    object type: object
    JSON object
    output
    mode true type: boolean
    * true - show objeсt clones.
    • false - do not show object clones (by default it is false).
    text type: string
    JSON object converted into a string


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
       var object = {"Room" : [{"Floor" : "Ground", "Name" : "Kitchen"}]}
       var string = JSON.Stringify(object);
       IR.Log(string) // {"Room":[{"Floor":"Ground", "Name":"Kitchen"}]}
    });





    JSON.Parse

    convert a string into a JSON object

    Syntax

    JSON.Parse(text)

    input value description
    text type: string
    string
    output
    object type: object
    JSON object


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
       var string = '{"Room":[{"Floor":"Ground", "Name":"Kitchen"}]}'
       var object = JSON.Parse(string);
       IR.Log(object) // [object Object]
    });





    XML

    new XML

    create XML object

    Syntax

    new XML(text)

    input value description
    text type: string
    string with XML message
    output
    object type: object
    XML object


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
       var xml_string = '<file id="123" quote="true"><name>project 1</name><version>v 1.0</version></file><Panel>"panel #1"</Panel><Panel>"panel #2"</Panel>'
       var xml_object = new XML(xml_string); // create XML object
     
       var name = xml_object.file["name"];
       var attrib_id = xml_object.file["@id"];
       var attrib_quote = xml_object.file["@quote"];	
       var version = xml_object.file.version;	
       var panel1 = xml_object.Panel[0];
       var panel2 = xml_object.Panel[1];	
     
       IR.Log(name+" "+version+" "+panel1+" "+panel2); // project 1 v 1.0 "panel #1" "panel #2"
       IR.Log(attrib_id); //view attribute "id"
       IR.Log(attrib_quote); //view attribute "quote"
    });





    .toXMLString

    convert XML object into the string

    Syntax

    string.toXMLString()

    input value description
    object type: object
    XML object
    output
    string type: string
    string


    Sample

    IR.AddListener(IR.EVENT_START,0,function()
    {
       var xml_string = '<file><name>project 1</name><version>v 1.0</version></file><Panel>panel #1</Panel><Panel>"panel #2"</Panel>'   
     
       var xml_object = new XML(xml_string);
       var xml_string_from_object = xml_object.toXMLString()  // XML object to XML string
     
       IR.Log(xml_string_from_object);
    });






    IR.SetPanelBacklight()

    Control of side lighting on iRidium Panel 7.

    Syntax

    IR.SetPanelBacklight(imax, brightness, color)

    On input Value Description
    imax 1 - 4 type: Number
    brightness 0 - 255 type: Number
    brightness of lighting
    color 0 - turned off,
    1 - blue,
    2 - green,
    3 - light blue,
    4 - red,
    5 - violet,
    6 - yellow,
    7 - white.
    type: Number
    the color of lighting.

    Create a new script in a project and add to it an example to turn on side lighting

    //example to turn on side lighting of green color:
    IR.AddListener(IR.EVENT_ITEM_RELEASE, IR.GetPage("Page 1").GetItem("Item 1"), function()
    {
       IR.SetPanelBacklight(4, 255, 2);
       //IR.GetPage("Page 1").GetItem("color_Light").GetState(0).FillColor = 0x0000ffff;
       IR.Log("green");
    });


    Example: iRidium Panel 7



    Events

    IR.EVENT_START

    the identifier of the event which is activated at the i3 pro application launch

    Syntax

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

    input value description
    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_START, 0, function ()
    {
        IR.Log("app started"); // action
    });





    IR.EVENT_WORK

    the identifier of the event which is activated at each clock cycle of processor when the app works

    Syntax

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

    input value description
    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

    // IS NOT RECOMMENDED FOR REAL TASKS! 
    IR.AddListener(IR.EVENT_WORK, 0, function ()
    {
        IR.Log("app works"); // action
    });

    This event IS NOT recommended for using in real JS tasks, because of not the optimal use of resources. Please use IR.SetInterval() or the listeners of tag changes.


    IR.EVENT_EXIT

    the identifier of the event which is activated at closing of the i3 pro application. It is activated when receiving the command to close the application.

    Syntax

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

    input value description
    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_EXIT, 0, function ()
    {
        IR.Log("app closed"); // action
    });

    The event will not be activated at emergency closing of the application


    Work with IR.Execute() and work with drivers are not suported.

    IR.EVENT_GLOBAL_TAG_CHANGE

    the identifier of the event which is activated at change of any tag in iRidium. Tags are any properties of interface items or drivers which can be requested. For the system to register tag changes, you need to subscribe to it with the help of the method IR.SubscribeTagChange

    Syntax

    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function() {}, [pointer]); IR.SubscribeTagChange(tag);

    input value description
    function function() {} type: function
    the unnamed function or reference to the function
    tag "Drivers.AV (TCP).Online" type: string
    the full name of the tag to which you want to subscribe with the help of the method IR.SubscribeTagChange. Without the subscription tag changes will not be displayed in the system
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output

    -


    Sample

    //Set global listener
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
         IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
    });
    // Subscribe 
    IR.SubscribeTagChange("Drivers.KNX IP Router.Address 1"); 
    IR.SubscribeTagChange("Drivers.AV & Custom Systems (TCP).Online"); 
    IR.SubscribeTagChange("UI.Page 1.Item 1.Text"); 
    IR.SubscribeTagChange("System.Time.24");
    // Unsubscribe
    IR.UnsubscribeTagChange("UI.Page 1.Item 1.Text");
    // resend the data from KNX Address 1 to Address 2 on change (for iRidium Server)
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
    {
       if (name == "Server.Channels.KNX.Address 1")
          IR.SetVariable("Server.Channels.KNX.Address 2", value);
    });
    IR.SubscribeTagChange("Server.Channels.KNX.Address 1");

    The global listener can be created only once - only the listener created last will work
    To activate the listener: IR.SetGlobalListener
    The listener reacts on tag changes only when it is subscribed to this tag with the method IR.SubscribeTagChange
    The listener reacts only on tag changes (it will not work if the received value equals to the current one)
    Unsubscribe from the tag: IR.UnsubscribeTagChange


    IR.EVENT_ORIENTATION

    the identifier of the event which will be activated at turn of the control panel with an accelerometer. The work of the event can be emulated on Windows by clicking F5

    Syntax

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

    input value description
    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
    orientation_id 1 type: number
    the number of the new device:
    • 1 - vertical, the Home button is down, the constant: IR.ORIENTATION_PORTRAIT
    • 2 - vertical, the Home button is up, the constant: IR.ORIENTATION_PORTRAIT_UPSIDE_DOWN
    • 3 - horizontal, the Home button is to the right, the constant: IR.ORIENTATION_LANDSCAPE_LEFT
    • 4 - horizontal, the Home button is to the left, the constant: IR.ORIENTATION_LANDSCAPE_RIGHT


    Sample

    IR.AddListener(IR.EVENT_ORIENTATION, 0, Message);
    function Message(orientation)
    {
    IR.Log("new orientation id: " + orientation);
    switch (orientation) {
          case IR.ORIENTATION_PORTRAIT:
          IR.Log("Vertical")
          break;
          case IR.ORIENTATION_PORTRAIT_UPSIDE_DOWN:
          IR.Log("Upside down")
          break;
          case IR.ORIENTATION_LANDSCAPE_LEFT:
          IR.Log("Turned to the left");
          break;
          case IR.ORIENTATION_LANDSCAPE_RIGHT:
          IR.Log("Turned to the right");
          break;
       }
    }

    the initial orientation value will be received at the application launch
    you can emulate the turn on Windows by clicking F5


    IR.EVENT_KEYBOARD_SHOW

    the identifier of the event which is activated at opening a keyboard on the iOS or Android device

    Syntax

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

    input value description
    function function(id){} type: function
    the unnamed function or request to the function
    pointer - type: object
    the pointer to the object which serves the function (optional)
    output
    id true type: boolean
    result: true - keyboard is opened, false - keyboard is closed


    Sample

    IR.AddListener(IR.EVENT_KEYBOARD_SHOW, 0, function(id)
    {
       if (id)
          {
             IR.Log("keyboard showed");
          }
       else
          {
             IR.Log("keyboard hidden");
          } 
    });





    IR.EVENT_RECEIVE_SCHEME

    the identifier of the event which is activated when the i3 pro application on the iOS or Android device is started with the help of the URL scheme from the browser, mail agent or another application. The URL scheme for starting i3 pro looks as follows:
    iridium://script?data1&data2
    data1&data2 - the string with data which will be sent to the script , to the query parameter

    Syntax

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

    input value description
    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
    query - type: string
    the data string sent in URL
    source - type: string
    the application which called URL схему


    Sample

    // called URL scheme: iridium://script?Page1
    IR.AddListener(IR.EVENT_RECEIVE_SCHEME,0,function(query, source) 
    {
       if (query == "Page1")
          IR.ShowPage("Page 1");
    });





    IR.ANDROID_BACK_PRESS

    the identifier of the event which is activated by press on Back button of android device (it could be hardware or software Back button).If you are subscribed for the event, the Back button perform only an actions, programmed in on the entrance function of the listener. If you are not subscribed, click on the Back button will minimize the app

    Syntax

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

    input value description
    function function() {} type: function
    the unnamed function or reference to the function
    output

    -


    Sample

    var back_subscribe = function () 
    {
       IR.Log("Back button pressed!");
    }
    IR.AddListener(IR.ANDROID_BACK_PRESS, 0, back_subscribe);
     
    // to unsunscribe you can call the function back_unsubscribe (); in any moment
    function back_unsubscribe () 
    {
       IR.RemoveListener(IR.ANDROID_BACK_PRESS, 0, back_subscribe);
    }

    If you are subscribed for the event, the Back button perform only an actions, programmed in on the entrance function of the listener. If you are not subscribed, click on the Back button will minimize the app


    IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY

    an event called when an image is selected from the gallery initiated by the method IR.OpenPhotoGallery().

    Syntax

    IR.AddListener(IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY, 0, function(filename, filepath) { }, [pointer]);

    input value description
    function function() {} type: function
    the unnamed function or reference to the function
    output
    filename "flower.png" type: string
    name of the image file
    filepath "D:/collection/flower.png" type: string
    file path and the name of a file image
    pointer - type: pointer
    pointer to the listener context (optional)


    Sample

    if (IR.OpenPhotoGallery()) {
       IR.AddListener(IR.EVENT_RECEIVE_PHOTO_FROM_GALLERY, 0, function(filename, filepath) {
          IR.Log("Photo selected.\n Filename: " + filename + "\n Filepath: " + filepath);
       }
    });





    Example: PhotoGallery.irpz


    IR.EVENT_RECEIVE_PHOTO_FROM_CAMERA

    an event that is called when a photo from the camera is received, and the photo is initiated by the following method IR.OpenPhotoCamera().

    Syntax

    IR.AddListener(IR.EVENT_RECEIVE_PHOTO_FROM_CAMERA, 0, function(filename, filepath) { }, [pointer]);

    input value description
    function function() {} type: function
    an unnamed function or a function call
    output
    filename "flower.png" type: string
    name of the image file
    filepath "D:/collection/flower.png" type: string
    file path and the name of tha image file
    pointer - type: pointer
    pointer to the context of a listener (optional)


    Sample

    if (IR.OpenPhotoCamera()) {
       IR.AddListener(IR.EVENT_RECEIVE_PHOTO_FROM_CAMERA, 0, function(filename, filepath) {
          IR.Log("Photo selected.\n Filename: " + filename + "\n Filepath: " + filepath);
       }
    });





    IR.EVENT_LICENCE_ACCEPT

    A listener is activated when a license for i3 pro or iRidium server is received.

    Syntax

    IR.AddListener(IR.EVENT_LICENCE_ACCEPT, 0, function);

    input value description
    function function() {} type: function
    unnamed function or function call
    output


    Sample

     





    Not supported

    The list of methods and events below is not supported in iRidium v3

    IR.DownLoadProject

    to download the project available by the HTTP link to the control panel. When downloading the project, it can be given a unique name for working in the Multi-design mode.

    Syntax

    IR.DownLoadProject({type: protocol, host: host, path: path, multiproject: mode, name: name});

    input value description
    protocol 'https' type: string
    the protocol type: http or https
    host 'drive.google.com' type: string
    the IP-address or domain name of the resource
    path '/folder/file.irpz' type: string
    the path to the project file
    mode 0 type: number
    the Multi-design mode, 0 - off, 1 - on
    name 'Main' type: string
    the project name, Main - the default interface
    output
    object [Object DevicePrototype] type: object
    the reference to the iRidium HTTP Updater driver which starts project update


    Sample

    IR.AddListener(IR.EVENT_START, 0, function()
    {    
       IR.DownLoadProject({
    				type: 'https', 
    				host: 'drive.google.com', 
    				path: '/uc?export=view&id=0B2nsHBulOZWTR2tUaW85Vlo1Yzg', 
    				multiproject: 0, 
    				name: 'Main' 
       });
    });
    // regular expression returns the parsed link to Project
    function parse_url(url) 
    {
        var pattern = RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
        var matches =  url.match(pattern);
        return {
            scheme: matches[2],
            authority: matches[4],
            path: matches[5],
            query: matches[7],
            fragment: matches[9]
        };
    }
    // start the uroject uploading
    function HTTPUpdate(url)
    {
       var parsed_url = parse_url(url);
       var downloader = IR.DownLoadProject({
                    type:parsed_url.scheme,
                    host:parsed_url.authority,
                    path:parsed_url.path + '?' + parsed_url.query,
                    multiproject: 1,
                    name: "TestNew"
                        });
    }
    // call the uploading function and send the URL for parsing
    function Update_new()
    {
             HTTPUpdate('https://drive.google.com/uc?export=view&id=0B2nsHBulOZWTR2tUaW85Vlo1Yzg');
    }

    the project name is set up in the name property: the file system received the new name at project upload, creates a file with the new name and writes data in this file. If the Multi-design mode is on, the project with the new name will be added to the current one and not substitute it.


    IR.SendNotification

    to send the local notification to the iOS device with running i3 pro (it does not work on other OS)

    Syntax

    IR.SendNotification(text, delay, sound_id, badge_increment_num, id)

    input value description
    text "event N" type: string
    текст уведомления
    delay 0 type: number
    (s) the delay of notification sending
    sound_id 1 type: number
    the identifier of the sound which will be used for the notification:
    • 0 - without any sound
    • 1 - the standard sound of iOS notifications
    • 2 - the standard iOS ringtone
    badge_increment_num 1 type: number
    by what number the number of received notifications has to be increased on the application icon
    id "None" type: string
    the unique notification identifier
    output

    -


    Sample

    IR.AddListener(IR.EVENT_APP_ENTER_BACKGROUND, 0, function()
    {  
          IR.SendNotification("iRidium minimized", 0, 1, 1, "None");
    });

    it works only on iOS, it is not a push-notification


    IR.ClearNotification

    to clear the list of local notifications generated by i3 pro on the iOS device

    Syntax

    IR.ClearNotification()

    input value description

    -

    output

    -


    Sample

    IR.AddListener(IR.EVENT_APP_ENTER_FOREGROUND, 0, function()
    {  
          IR.ClearNotification();
    });

    it works only on iOS


    IR.EVENT_RECEIVE_NOTIFY

    the identifier of the event which is activated when the application receives a local notification

    Syntax

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

    input value description
    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
    text - type: string
    the notification text
    id - type: string
    the text identifier of the notification


    Sample

    IR.AddListener(IR.EVENT_RECEIVE_NOTIFY, 0, notify)
    function notify (text, id) 
    {
       switch (id) 
       {
          case "Notify 1": // notification ID
          IR.ShowPopup("Popup 1");
          IR.GetItem("Popup 1").GetItem("Item 1").Text = text; // notification text
          break;
          case "Notify 2":
          IR.ShowPopup("Popup 2");
          IR.GetItem("Popup 2").GetItem("Item 1").Text = text;
          break;
       }
    }





    IR.EVENT_APP_ENTER_BACKGROUND

    the identifier of the event which is activated at minimizing and closing of the application on the iOS or Android device

    Syntax

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

    input value description
    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_APP_ENTER_BACKGROUND, 0, function()
    {
       IR.Log("app minimized"); 
    });

    the event will not be activated at emergency closing (crash) of the application


    IR.EVENT_APP_ENTER_FOREGROUND

    the identifier of the event which is activated at maximizing of the application on the iOS or Android device

    Syntax

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

    input value description
    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_APP_ENTER_FOREGROUND, 0, function()
    {
       IR.Log("app maximized"); 
    });

    the event will not be activated at the application launch


    IR.EVENT_APP_WILL_TERMINATE

    the identifier of the event which is activated right before the application on the iOS or Android device will be closed.

    Syntax

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

    input value description
    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_APP_WILL_TERMINATE, 0, function()
    {
       IR.Log("app will be closed right now"); 
    });

    the event will not be activated at the emergency closing of the application

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