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

    Other languages:
    English • ‎русский

    Switching between projects

    Setting of automatic switching between projects in i3pro.

    documentation was last updated on 16.6.2023

    Automatic switching between projects allows to start another project by an event set earlier. The following can be used as an event: a user chooing a project himself from a list of projects downloaded on the panel, connection of a panel to a required Wi-Fi network or a panel getting coordinates set earlier.

    Switching between projects works only with projects that were downloaded from the cloud on a panel.

    Download an example
    • selection of a project from a list of projects downloaded on the panel;
    • switching between projects by the name of the Wi-Fi network.

    Setting Project Selection from List of Projects Downloaded on Panel

    1 Download a sample project.

    2 Merge the example with your project.

    DesignSwitch1.png


    The project will get an additional page with a List that will display all projects downloaded from the cloud on a panel. When an item of the list is pressed, you'll go to the selected project.

    To go to the initial project or to choosing another project, switching to projects from a list must be added to the additional project.

    DesignSwitch2.png


    An example of the script

    IR.AddListener(IR.EVENT_START, 0, function()  // Actions are performed at start
    {
        // getting the number of projects
        var l_iCount = IR.GetDesignsCount();
        //get a list
        var list = IR.GetItem("Page 1").GetItem("Item 1");
     
        // making a list of projects
        for(var i = 0; i < l_iCount; i++)
        {
            // get a link to the project
            var l_sName = IR.GetDesignByIndex(i);
            //сhecking that the project is downloaded from the cloud
            if(l_sName.CloudID > 0){
                // create a list item (ListItem)
                var item = list.AddItem("Popup 1", {
                    Name: {
                        Text: l_sName.OriginalName
                    }
                });
                //setting custom data to a list item
                item.SetData({name: l_sName.OriginalName, id: l_sName.CloudID})
                // execute a function when the button is released
                item.SetReleaseAction(function(in_item, in_subItem){
                    var name = in_item.Data.name;
                    var id = in_item.Data.id;
                    //switch to the selected project
                    IR.DesignSwitch(name, id);
                    IR.Log(name + "   " + id);
                });   
            }
        }
    });

    Used Methods:

    • IR.GetDesignsCount - counts the number of visualization projects in the app memory;
    • IR.GetDesignByIndex - ges a link to a project as an object by calling it by the index in the list of downloaded projects;
    • IR.DesignSwitch - switches between visualization projects in the panel memory.


    Setting Automatic Project Switch by Name of Wi-Fi Network

    1 Download a sample project.

    2 Merge the example with your project or copy the script from the example to you project.

    DesignSwitch1.png

    3 Open the script of the example and change the following:

    • the Project1 name with the name of a project that will be opned when a panel is connected to ssid1 Wi-Fi network;
    • the ssid1' name of Wi-Fi network with the name of Wi-Fi network connection to which will open Project1;
    • the Project2 name with the name of a project that will be opned when a panel is connected to ssid2 Wi-Fi network;
    • the ssid2 name of Wi-Fi network with the name of Wi-Fi network connection to which will open Project2;
    • the Project3' name with the name of a project that will be opned when a panel is connected to other Wi-Fi networks or mobile internet.


    This solution allows to switch automatically between automation projects (for example, several apartments and an country house can be united this way). The script can be modified, if it is required and additional variables with projects and the name of a Wi-Fi network can be added.

    To switch between projects, all united projects must contain this script, and the parameters must be identical.


    An example of the script

    (function(){
     
        /**
         * Auto project selector
         */
        function ProjectSelector(projects)
        {
            this.trigger = "System.Net.SSID";
            this.projects = projects;
     
            IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, this.select, this);
            IR.SubscribeTagChange(this.trigger);
            IR.AddListener(IR.EVENT_START, 0, this.analize, this);
        }
     
        /**
         * Select project by trigger
         */
        ProjectSelector.prototype.select = function()
        {
            var selectID = 0;
            var selectName = "";
            var ssid = IR.GetVariable(this.trigger);
            var unknownItem;
            for(var j = 0; j < this.projects.length; j++)
            {
                var item = this.projects[j];
                if(item.CloudID == 0)
                    IR.Log("ProjectSelector: " + item.projectName + " is not found");
     
                 if(item.ssid == undefined)
                     unknownItem = item;
     
                 if(item.ssid == ssid && item.CloudID)
                 {
                     selectID = item.CloudID;
                     selectName = item.projectName;
                     break;
                 }
            }   
     
            // не один проект не подошел
            if(selectID == 0 && unknownItem != undefined)
            {
                selectID = unknownItem.CloudID;
                selectName = unknownItem.projectName;
            }
     
            var currentProject = IR.GetCurrentDesign();
            if(currentProject)
            {
                if(selectID != currentProject.CloudID)
                {
                    IR.Log("ProjectSelector: " + selectName + " will be selected");
                    IR.DesignSwitch(selectName, selectID);
                }
                else
                    IR.Log("ProjectSelector: " + selectName + " selecte skipped, is already started");
            }
        }
     
        /**
         * Analize project names and find his clouds ids
         */
        ProjectSelector.prototype.analize = function()
        {
            var count = IR.GetDesignsCount();
            for(var i = 0; i < count; i++) 
            {
                var project = IR.GetDesignByIndex(i);
                for(var j = 0; j < this.projects.length; j++)
                {
                    var item = this.projects[j];
                    if(item.projectName == project.OriginalName)
                        item.CloudID = project.CloudID;
                }    
            }
     
            this.select();
        }
     
        /**
         * Make instance
         */
        new ProjectSelector([
            {
                ssid: "ssid1",
                projectName: "Project1",
            },
            {
                ssid: "ssid2",
                projectName: "Project2",
            },
            {
                /* unknown ssid */
                projectName: "Project3",
            }
        ]);
    })();

    Used Methods:

    • IR.GetDesignsCount - counts the number of visualization projects in the app memory;
    • IR.GetDesignByIndex - ges a link to a project as an object by calling it by the index in the list of downloaded projects;
    • IR.GetVariable - selection of a token to activate an event (the ID of a Wi-Fi network is used in this example ("System.Net.SSID"));
    • IR.DesignSwitch - switches between visualization projects in the panel memory.
    • IR.SetGlobalListener - creates a global listener;
    • IR.SubscribeTagChange - subscribes to a tag.
    Источник — «https://dev.iridi.com/index.php?title=DesignSwitch/en&oldid=131634»
    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