iRidium Script: Interfaces
-
Upload
iridiummobile365 -
Category
Internet
-
view
130 -
download
0
Transcript of iRidium Script: Interfaces
JavaScriptEnhanced capabilities of control
interfaces
Markov Ilya2016
Webinar
JS
GUI
Tokens
Drivers
Sounds
Interface Listener Actions
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
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.
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
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
Таймеры в 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
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
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
Function to Write Data in Console
IR.Log('text');IR.Log(Variable);
text – stringVariable – some variable
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.
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
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
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
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
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
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
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
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
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
IR.GetState(№ state)
This function is used to refer to the item state
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
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
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
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
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");
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
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");
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();
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
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; } });