This page is a
translated version of the page
Tokens API and the translation is 100% complete.
API iRidium. Controlling tags
methods for reading and writing any tags of different objects in iRidium projects: System Tokens, Project Tokens, Driver Tokens, Driver Feedbacks, GUI Properties
With the help of the IR.SetVariable and IR.GetVariable methods you can refer to properties of any entity of iRidium projects: System Tokens, Project Tokens, Driver Tokens, Driver Feedbacks, a graphic interface item.
To refer to a tag you are required to indicate its full name in the request:
System Tokens
IR.GetVariable("System.name")
- system variables. They store values of control panel properties: time, date, GPS coordinates, etc.
Tokens can be assigned to graphic items and the items will output information received from the system. Token values can be sent to scripts.
The majority of system tokens is available for reading only: see the list, but some can be written: see the list
Project Tokens
IR.GetVariable("Tokens.name")
- user variables. They store data which are available for reading and writing. Data can be written in tokens or read by a graphic item or script.
- Variables are stored in Project Device Panel
- You can write a number or string (DEC or ASCII) in variables.
- They can be created, deleted, copied, sorted and grouped in folders.
- Data in variables can be saved (or not saved) after closing of the application.
- Data can be writen in variables with the help of commands from items or from iRidium Script
Driver Tokens
IR.GetVariable("Drivers.Driver name.Online")
- the driver state, available for reading only, see the list
Driver Feedbacks
IR.GetVariable("Drivers.Driver name.Channel name")
- the feedback channel state of the driver, the channel name is displayed in the Feedbacks list. It can be read and written
Page or item property
IR.GetVariable("UI.Page 1.Item 1.Text")
- properties of pages, popups or graphic items. They can be read and written
Server tag in iRidum Server
IR.GetVariable("Server.Tags.Virtual Tag 1")
/ IR.GetVariable("Server.Tags.Driver.Tag 1")
- in the project iRidium Server you can refer to user variables and feedack channels of drivers created on the server.
IR.SetVariable
to write values in System Token
Syntax
IR.SetVariable("path.name", value)
path
|
Tokens
|
type: String indicates the path to the variable and its type:
- System - System Tokens
- Tokens - Project Tokens
- Drivers.<driver name> - Driver Tokens, Driver Feedbacks
- UI.<page name> - Page (Popup) tags
- UI.<page name>.<item name> - Item tags
- Server.Tags - the server varible (Virtual Tags, Driver Tags)
|
name
|
Update
|
type: String variable name
|
value
|
100
|
type: string, number values for writing
|
-
Sample
IR.AddListener(IR.EVENT_START, 0, function()
{
// System Tokens
IR.SetVariable("System.Update", false);
// Project Tokens
IR.SetVariable("Tokens.My Var", 100);
IR.SetVariable("Tokens.Str 1", "data string");
// Driver Tokens
IR.SetVariable("Drivers.AV & Custom Systems (TCP).Feedback 1", "string to display");
IR.SetVariable("Drivers.AV & Custom HTTP Network.AV & Custom Systems:AV Control Feedback", 0)
// GUI Tags
IR.SetVariable("UI.Page 1.Text", "Hello World!");
IR.SetVariable("UI.Page 1.Item 1.Value", 100);
// Server Tags (in iRidium Server only)
IR.SetVariable("Server.Tags.Virtual 1", 0);
IR.SetVariable("Server.Tags.AV & Custom Systems (TCP).Feedback 1", 100);
});
alias for Project Token: IR.SetVariable("Global.name", value)
activation of the IR.SetVariable method for Project Token will create a user variable with the indicated name if it was not created before
when you call the variable with some name and this name hasn't been used before you call it, the variable will be created by IR.SetVariable
you can't use this method for sending data from panel to server via Feedback
IR.GetVariable
request the variable state
Syntax
IR.GetVariable("path.name")
path
|
Tokens
|
type: String indicated the path to the variable and its type:
- System - System Tokens
- Tokens - Project Tokens
- Drivers.<driver name> - Driver Tokens
- UI.<page name> - Page (Popup) tags
- UI.<page name>.<item name> - Item tags
|
name
|
Update
|
type: String variable name
|
value
|
true
|
type: string, number variable value
|
Sample
IR.AddListener(IR.EVENT_START, 0, function()
{
// System Tokens
var tag1 = IR.GetVariable("System.Update");
// Project Tokens
var tag2 = IR.GetVariable("Tokens.My Var 1");
// Driver Tokens
var tag3 = IR.GetVariable("Drivers.AV & Custom Systems (TCP).Online");
var tag4 = IR.GetVariable("Drivers.AV & Custom Systems (TCP).Channel 1");
var tag5 = IR.GetVariable("Drivers.AV & Custom HTTP Network.AV & Custom Systems:AV Control Feedback");
// GUI Tags
var tag6 = IR.GetVariable("UI.Page 1.Text");
var tag7 = IR.GetVariable("UI.Page 1.Item 1.Value");
// Server Tags (in iRidium Server only)
var tag8 = IR.GetVariable("Server.Tags.Virtual 1");
var tag9 = IR.GetVariable("Server.Tags.AV & Custom Systems (TCP).Feedback 1");
});
alias for Project Token: IR.GetVariable("Global.name")
IR.SaveConfig
It enables saving a token by means of a script when a project is turned off.
Syntax
IR.SaveConfig()
success
|
true
|
type: boolean false/true
|
Sample
IR.AddListener(IR.EVENT_START,0,function()
{
IR.SetInterval(10000, save); // The "save" function is launched every 10 seconds
})
function add() { //Function to activate writing to a token
var val = IR.GetVariable("Global.test");
val++;
IR.SetVariable("Global.test", val);
IR.SetVariable("Global.test1", val);
IR.SetVariable("Global.test2", val);
IR.SetVariable("Global.test3", val);
IR.SetVariable("Global.test4", val);
}
function save(){ //It enables saving tokens
IR.SaveConfig();
}
IR.ClearProjectTokens
It resets values of project tokens to default ones.
Syntax
IR.ClearProjectTokens()
success
|
true
|
type: boolean true
|
Sample
IR.AddListener(IR.EVENT_START, 0, function () {
IR.ClearProjectTokens();
});
If a token has no default value, it is not cleared.
System Tokens: reading and writing
System tokens are available for reading (some of them for writing) on control panels only. iRidium Server does not provide a possibility to get the system state with the help of tokens.
The list of system variables available for reading and writing:
Project update mode
IR.SetVariable("System.Update", true);
IR.GetVariable("System.Update");
- false - project update if off
- true - project update if on
Device display
display brightness (available to control on iOS and Android only):
IR.SetVariable("System.Display.Bright", 80);
IR.GetVariable("System.Display.Bright");
- 0...100 - display brightness in percentage terms
full-screen mode
IR.GetVariable("System.Display.FullScreen")
display height
IR.GetVariable("System.Display.Height")
display width
IR.GetVariable("System.Display.Width")
display orientation
IR.GetVariable("System.ViewOrientation")
- 1 - vertical, the Home button is up
- 2 - vertical, the Home button is down
- 3 - horizontal, the Home button is to the left (by default)
- 4 - horizontal, the Home button is to the right
Vibration
to activate short vibration (it activates the vibro-motor for a while), for iOS and Android only
IR.SetVariable("System.Vibro", 1.5);
- 1.5 - duration of short vibration in seconds (for Android OS); in iOS duration of vibration is not adjusted, set the 1 value always.
Screensaver
control demosnstration of screensaver on all the OS
// set
IR.SetVariable("System.Screensaver.Show", 1) // 1 - show, 0 - hide
// get
IR.GetVariable("System.Screensaver.Show") // 1 - showed, 0 - hided
You can show screensaver only if "Screensaver.Enable" not a zero
- 0 -hide screensaver
- 1 - show screensaver, available only when scrrensaver interval not a zero
// set
IR.SetVariable("System.Screensaver.Enable", 0) // disable screensaver
IR.SetVariable("System.Screensaver.Enable", 10000) // enable screensaver with interval of 10000 ms
// get
IR.GetVariable("System.Screensaver.Enable") // interval of scrrensaver in ms, 0 when disabled
Screensaver can be turned on with Delay > 0. When you set the delay to 0, it turns the screensaver off
- 0 - remove the delay. Screensaver turns off
- 10000 - turn on screensaver with Delay (ms)
System Tokens: reading only
System tokens are available for reading (some of them for writing) on control panels only. iRidium Server does not provide a possibility to get the system state with the help of tokens.
The list of system variables available for reading only:
Time
seconds
IR.GetVariable("System.Time.Seconds")
minutes
IR.GetVariable("System.Time.Minutes")
hours
IR.GetVariable("System.Time.Hour")
time in the 24-hour format
IR.GetVariable("System.Time.24")
time in the 12-hour format
IR.GetVariable("System.Time.12_AM_PM")
time in the format set for OS
IR.GetVariable("System.Time.Standart")
Date
day of year
IR.GetVariable("System.Date.DayOfYear")
year
IR.GetVariable("System.Date.Year")
day of week (0 - sunday, ... , 6 - saturday)
IR.GetVariable("System.Date.DayOfWeek")
month
IR.GetVariable("System.Date.Month")
day of month
IR.GetVariable("System.Date.Day")
date in the format YYYY_ММ_DD
IR.GetVariable("System.Date.YYYY_MM_DD")
date in the format DD_MONTH_YYYY
IR.GetVariable("System.Date.DD_MONTH_YYYY"")
date in the format MONTH_DD_YYYY
IR.GetVariable("System.Date.MONTH_DD_YYYY")
date in the format DD_ММ_YYYY
IR.GetVariable("System.Date.DD_MM_YYYY")
date in the format ММ_DD_YYYY
IR.GetVariable("System.Date.MM_DD_YYYY")
datу in the format DD_ММ
IR.GetVariable("System.Date.DD_MM")
date in the format ММ_DD
IR.GetVariable("System.Date.MM_DD")
week day
IR.GetVariable("System.Date.Weekday")
GPS coordinates
course
IR.GetVariable("System.Location.Course")
speed
IR.GetVariable("System.Location.Speed")
altitude
IR.GetVariable("System.Location.Altitude")
longitude
IR.GetVariable("System.Location.Longitude")
latitude
IR.GetVariable("System.Location.Latitude")
Supported on iOS and Android only.
Compass
readability (degree of magnetization)
IR.GetVariable("System.Magnetic.Accuarcy")
geographic north
IR.GetVariable("System.Magnetic.True")
magnetic north
IR.GetVariable("System.Magnetic.Heading")
Z coordinates
IR.GetVariable("System.Magnetic.Z")
Y coordinates
IR.GetVariable("System.Magnetic.Y")
X coordinates
IR.GetVariable("System.Magnetic.X")
Supported on iOS and Android only.
Accelerometer
shaking
IR.GetVariable("System.Accelerometer.Shake")
Z coordinate
IR.GetVariable("System.Accelerometer.Z")
Y coordinate
IR.GetVariable("System.Accelerometer.Y")
X coordinate
IR.GetVariable("System.Accelerometer.X")
Supported on iOS and Android only.
Gyroscope
Z coordinate
IR.GetVariable("System.Gyroscope.Z")
Y coordinate
IR.GetVariable("System.Gyroscope.Y")
X coordinate
IR.GetVariable("System.Gyroscope.X")
Supported on iOS and Android only.
Network connections
status of connection to 3G/4G networks
IR.GetVariable("System.Net.Cell")
- true - there is connection
- false - there is no connection
status of connection to the Wi-Fi network
IR.GetVariable("System.Net.WiFi")
- true - there is connection
- false - there is no connection
identifier of Wi-Fi network
IR.GetVariable("System.Net.SSID")
- the name of the WIFi network
Battery
Power level
IR.GetVariable("System.Battery.Level")
Battery Status
IR.GetVariable("System.Battery.Status")
- 1 - is not rechaging
- 2 - is recharging
- 3 - maximum charge (for iOS)
Volume
volume value
IR.GetVariable("System.Sound.Volume")
mute mode
IR.GetVariable("System.Sound.Mute")
Proximity sensor
IR.GetVariable("System.Proximity")
- false - the sensor is not activated
- true - the sensor is activated
OS name
returns the name of OS where iRidium is running
IR.GetVariable("System.OS.Name");
- Microsoft windows
- Microsoft windows CE
- Apple OSX
- Apple iOS
- Android
Control panel type
identifier of the OS version where iRidium is running
IR.GetVariable("System.OS.Device");
- when launching on Windows OS
- 1 - Windows OS x86 32 / 64 bit
- when launching on Mac OS X
- 1 - Mac OS X PPC
- 2 - Mac OS X X86 32 bit
- 3 - Mac OS X X86 64 bit
- when launching on Android
- 1 - smart phone
- 2 - tablet
OS version
* under development *
IR.GetVariable("System.OS.Version");
Control panel name
network name of the control panel where iRidium is running
IR.GetVariable("System.Device.Name");
Control panel orientation
IR.GetVariable("System.Orientation");
- 1 - vertical, the Home/Menu button is in the bottom of the screen
- 2 - vertical, the Home/Menu button is on the top of the screen
- 3 - horizontal, the Home/Menu button is to the right of the screen
- 4 - horizontal, the Home/Menu button is to the left of the screen
- 5 - horizontal, the screen is up
- 6 - horizontal, the screen is down
- 0 - in the process of orientation change
Driver Tokens
Driver variables are available for reading only. The set of variables is the same for any driver.
IR.AddListener(IR.EVENT_START, 0, function()
{
// Driver Tokens
var tag1 = IR.GetVariable("Drivers.AV & Custom Systems.Online"); // Online..Offline = 1..0
var tag2 = IR.GetVariable("Drivers.AV & Custom Systems.Status"); // Offline..Connecting..Online..Waiting = 0..1..2..3
var tag3 = IR.GetVariable("Drivers.AV & Custom Systems.Host"); // domain name of remote equipment
var tag4 = IR.GetVariable("Drivers.AV & Custom Systems.HostPort"); // port of remote device
var tag5 = IR.GetVariable("Drivers.AV & Custom Systems.IP"); // IP address of Control Panel
var tag6 = IR.GetVariable("Drivers.AV & Custom Systems.HostIP"); // IP address of remote equipment
var tag7 = IR.GetVariable("Drivers.AV & Custom Systems.Port"); // local port on Control Panel
});