iridium script: interfaces
TRANSCRIPT
![Page 1: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/1.jpg)
JavaScriptEnhanced capabilities of control
interfaces
Markov Ilya2016
Webinar
![Page 2: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/2.jpg)
JS
GUI
Tokens
Drivers
Sounds
![Page 3: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/3.jpg)
Interface Listener Actions
![Page 4: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/4.jpg)
![Page 5: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/5.jpg)
![Page 6: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/6.jpg)
![Page 7: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/7.jpg)
IR.AddListener(Event_Type, Reference_to_Item, function(Input_Parameters){ Body of Listener});
Event_Type - the event at which the function is performed
Reference_to_Item - the reference of the item the function is assigned to
Input_Parameters - parameters giving information to the functionBody of Listerner – instructions that are done when a listener is activated
![Page 8: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/8.jpg)
Types of events for system listeners• IR.EVENT_START – Event is activated at the application launch.
• IR.EVENT_WORK – Event is activated when the application is running.
• IR.EVENT_EXIT – Event is activated when exiting the application.
• IR.EVENT_ORIENTATION – Event is activated when changing the device orientation.
• IR.EVENT_KEYBOARD_SHOW – Event is activated when opening a keyboard.
![Page 9: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/9.jpg)
IR.AddListener(Event_Type, Reference_to_Item, function(Input_Parameters){ Body of Listener});
Event_Type - the event at which the function is performed
Reference_to_Item - the reference of the item the function is assigned to
Input_Parameters - parameters giving information to the function
Body of Listener – instructions that are done when a listener is activated
![Page 10: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/10.jpg)
IR.AddListener(Event_Type, Reference_to_Item, function (Input_Parameters){ Body of Listener});
Event_Type - the event at which the function is performed
Reference_to_Item - the reference of the item the function is assigned to
Input_Parameters - parameters giving information to the function
Body of Listener – instructions that are done when a listener is activated
![Page 11: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/11.jpg)
![Page 12: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/12.jpg)
Таймеры в iRidumScript.
IR.SetTimeout(time, Name_Function); - This function is used for run a function when the time delay
time - time delay, msName_Function - name of the function that contains the command
IR.SetInterval(time, Name_Function); - This function is used to cycle with a given recurrence interval
time - time delay, msName_Function - name of the function that contains the command
![Page 13: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/13.jpg)
Delete timer
IR.ClearInterval(id); - This function is used for stopping and deleting delay the SetTimeout and SetInterval functions from the random access memory.
id - identifier of the SetTimeout or SetInterval function
![Page 14: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/14.jpg)
IR.RemoveListener(Event_Type, Reference_to_Item, Function_Name)
Event_Type - the event at which the function is performed
Reference_to_Item - the reference of the item the function is assigned to
Function_Name - the name of a function that contains a list of instructions
![Page 15: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/15.jpg)
Function to Write Data in Console
IR.Log('text');IR.Log(Variable);
text – stringVariable – some variable
![Page 16: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/16.jpg)
IR.Exit(); - This function closes the app
IR.Execute('text'); - This function is used to start other programs
IR.ShowKeyboard(value); - This function is used to show a keyboard.
![Page 17: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/17.jpg)
GUI API
GUI API is a set of functions for working with graphic items in a project.
These functions let you:Create graphic itemsDelete graphic itemsRefer to items and change their properties Create listeners assigned to graphical items Open and close pages and popups
![Page 18: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/18.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used to create items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 19: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/19.jpg)
The type of items determines what the created item will look like, that is, defines a set of properties.
Types of items:• Page - IR.ITEM_PAGE• Popup - IR.ITEM_POPUP• Button - IR.ITEM_BUTTON• Trigger button - IR.ITEM_TRIGGER_BUTTON• Multistate button - IR.ITEM_MUTI_STATE_BUTTON• Up/Down button - IR.ITEM_UPDOWN_BUTTON• Level - IR.ITEM_LEVEL• Multistate level - IR.ITEM_MUTI_STATE_LEVEL• EditBox - IR.ITEM_EDIT_BOX• Virtual Key - IR.ITEM_VIRTUAL_KEY_BUTTON• Joystick - IR.ITEM_JOYSTICK
![Page 20: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/20.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used for creating items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 21: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/21.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used for creating items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 22: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/22.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used for creating items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 23: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/23.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used for creating items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 24: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/24.jpg)
IR.CreateItem(Item_Type, Item_Name, Coordinate_X, Coordinate_Y, Item_Width, Item_Height);
This function is used for creating items
Item_Type- indicate the type of the created item;Item_Name - give the name to the item;Coordinate_X, Coordinate_Y - initial position of the item in the working area;Item_Width, Item_Height - width and height of the created item
![Page 25: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/25.jpg)
IR.GetItem("Page_of_Item_Location").GetItem("Item_Name")
This function is used to get the item identifier.
Page_of_Item_Location - the page with the itemItem_Name - the name of the item being changed
![Page 26: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/26.jpg)
IR.GetState(№ state)
This function is used to refer to the item state
![Page 27: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/27.jpg)
IR.DeleteItem(Item_ID);
This function delete graphic items.
Item_ID – reference to the item via GetItem or a variable, that stores the item ID
![Page 28: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/28.jpg)
Functions to work with pages and popups
• IR.PagesCount – the function is used to count pages in a project• IR.PopupsCount – the function is used to count popups in a project• IR.CurrentPage – the function is used to get a link to the page
opened at the moment• IR.ShowPopup – the function is used to open a popup• IR.ShowPage – the function is used to open a page• IR.HidePage – the function is used to close a page• IR.HideAllPopups – the fucntion is used close all popups• IR.HidePopup – the function is used to close a popup
![Page 29: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/29.jpg)
Events for GUI Listeners
IR.EVENT_ITEM_PRESS – The listener is activated when an item is pressed
IR.EVENT_ITEM_RELEASE – The listener is activated when an item is released
IR.EVENT_ITEM_CHANGE – The listener is activated when EditBox item is changed
IR.EVENT_MOUSE_DOWN – The listener is activated when an item is clicked on with a mouse and the mouse is moved down
IR.EVENT_MOUSE_UP– The listener is activated when an item is clicked on with a mouse and the mouse is moved up
IR.EVENT_MOUSE_MOVE – The listener is activated when an item is clicked on with a mouse and the mouse is moved
![Page 30: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/30.jpg)
Events for GUI API Listeners
IR.EVENT_TOUCH_DOWN – the listener is activated when an item is pressed with a finger and the finger moves downIR.EVENT_TOUCH_UP – the listener is activated when an item is pressed with a finger and the finger moves down upIR.EVENT_TOUCH_MOVE– the listener is activated when an item is pressed with a finger and the finger movesIR.EVENT_ITEM_SHOW– the listener is activated when a page or a popup opens
IR.EVENT_ITEM_HIDE– the listener is activated when a page or a popup closes
New is 3.0IR.EVENT_ITEM_END_HOLD - the listener is activated at the end of holding a graphical item (when releasing after HOLD event)IR.EVENT_ITEM_LOST_FOCUS - the listener is activated when any item is released (togetether with Release or End Of Hold). The event shows lost of focus by an item
![Page 31: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/31.jpg)
New in 3.0
Work with clipboard is now possible• IR.PasteFromClipboard• IR.GetClipboard• IR.ShowPasteHelper• IR.CopyToClipboard
Cloning appeared• IR.GetItem("Page 2").GetItem("Item 1").CloneItem("Item 2");
![Page 32: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/32.jpg)
New in 3.0
Local notifications IR.SendNotificationLocal notification can be sent to the same iOS device where i3 pro is launches (does not work on other OS)
SyntaxIR.SendNotification(text, delay, sound_id, badge_increment_num, id)
Text – text of notificationDelay - (sec) delay in notification appearancesound_id - id of the sound of the notification:• 0 – no sound• 1 – standard iOS notification sound• 2 - standard iOS ringtonebadge_increment_num – how to increase the number of notifications over the app iconId – unique identifier of the notification
IR.ClearNotification – clearing notification from the app
![Page 33: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/33.jpg)
New in 3.0
Global listener and subscription to any tagsIn iRidium 3.0 you can subscribe to changes of ANY tag, both driver feedback or EditBox text.
//Set global listenerIR.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");
![Page 34: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/34.jpg)
Sound API
• IR.PlaySound('File_Name',Slot_Number,Volume);
• File_Name - the name of sound file• Slot_Number - The number of slot• Volume - Volume level
• IR.StopSound('File_Name');
• File_Name - the name of sound file
• IR.StopSlot('Slot_Number');
• Slot_Number - The number of slot
• IR.StopAllSounds();
![Page 35: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/35.jpg)
Gestures API
IR.AddRecognizer(Gesture_Type); IR.RemoveRecognizer(Gesture_Type);
Event: IR.EVENT_GESTURE_BEGIN
Types of gestures:IR.GESTURE_SWIPE_LEFT - gesture to the leftIR.GESTURE_SWIPE_RIGHT - gesture to the rightIR.GESTURE_SWIPE_UP - gesture up IR.GESTURE_SWIPE_DOWN - gesture downIR.GESTURE_PINCH_IN - clenchIR.GESTURE_PINCH_OUT - unclenchIR.GESTURE_LONG_PRESS - long pressIR.GESTURE_DOUBLE_TAP - doble tap
![Page 36: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/36.jpg)
Event - IR.EVENT_GESTURE_BEGIN
IR.AddListener(IR.EVENT_GESTURE_BEGIN, IR.CurrentPage, function(gesture, x, y) { // Construction of the choice switch(gesture) { case IR.GESTURE_SWIPE_LEFT: button.Text = "Left"; // if a gesture to the left starts, the text to “Left” appears break; case IR.GESTURE_SWIPE_RIGHT: button.Text = "Right"; // if a gesture to the right starts, the text to “Right” appears break; case IR.GESTURE_SWIPE_UP: button.Text = "Up"; // if a gesture up starts, the text to “Up” appears break; case IR.GESTURE_SWIPE_DOWN: button.Text = "Down"; // if a gesture down starts, the text to “Down” appears break; } });
![Page 37: iRidium Script: Interfaces](https://reader031.vdocuments.net/reader031/viewer/2022020119/5877213b1a28ab4c1d8b79ff/html5/thumbnails/37.jpg)