iRidi API. Tag management
Methods for reading and writing tags of different iRidi project objects: System Tokens, Project Tokens, Driver Tokens, Driver Feedbacks, GUI Properties
IR.SetVariable and IR.GetVariable access properties of any iRidi project entity: system variables (System Tokens), user variables (Project Tokens), driver tags (Driver Tokens, Driver Feedbacks), and graphic interface items.
To access a tag, specify its full name in the request:
System Tokens
IR.GetVariable("System.name") - system variables storing control-panel parameters such as time, date, and GPS coordinates.
Bind a token to a graphic item to display system information on the item. Token values can also be passed to scripts.
Most system tokens are read-only: see the list, but some can also be written: see the list
Project Tokens
IR.GetVariable("Tokens.name") - user variables storing data available for reading and writing. A graphic item or script can write or read token data.
- Variables are stored in Project Device Panel
- A variable can store a number or string (DEC or ASCII).
- Create, delete, copy, sort, and group them into folders.
- Variable data can either be retained or discarded when the iRidi application closes.
- Write a variable through an item command or iRidi Script
Driver Tokens
IR.GetVariable("Drivers.Driver name.Online") - read-only driver state; see the list
Driver Feedbacks
IR.GetVariable("Drivers.Driver name.Channel name") - driver feedback-channel state; the channel name appears in Feedbacks. Supports reading and writing
Page or item property
IR.GetVariable("UI.Page 1.Item 1.Text") - property of a page, popup, or graphic item. Supports reading and writing
Server tags in iRidum Server
IR.GetVariable("Server.Tags.Virtual Tag 1") / IR.GetVariable("Server.Tags.Driver.Tag 1") - accesses user variables and driver feedback channels created on the server from an iRidi Server project.
IR.SetVariable
Write a value to a System Token variable
Syntax
IR.SetVariable("[path](#irsetvariable).[name](#irsetvariable)", [value](#irsetvariable))
| Input | Value | Description |
|---|---|---|
| path | Tokens | type: String specifies the variable path and 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 - server variable (Virtual Tags, Driver Tags) |
| name | Update | type: String variable name |
| value | 100 | type: string value to write, number |
| Output | ||
|---|---|---|
| - |
Example
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", "My string");
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 iRidi Server only)
IR.SetVariable("Server.Tags.Virtual 1", 0);
IR.SetVariable("Server.Tags.AV & Custom Systems (TCP).Feedback 1", 100);
});
Notes
- Alias for Project Token:
IR.SetVariable("Global.name", value) - Calling IR.SetVariable for a Project Token creates a user variable with the specified name if it does not already exist
- This method cannot send data from a panel to the server through Feedback
IR.GetVariable
Query a variable's state
Syntax
IR.GetVariable("[path](#irgetvariable).[name](#irgetvariable)")
| Input | Value | Description |
|---|---|---|
| path | Tokens | type: String specifies the variable path and 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 |
| name | Update | type: String variable name |
| Output | ||
|---|---|---|
| Value | true | type: string, number variable value |
Example
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 iRidi Server only)
var tag8 = IR.GetVariable("Server.Tags.Virtual 1");
var tag9 = IR.GetVariable("Server.Tags.AV & Custom Systems (TCP).Feedback 1");
});
Notes
Alias for Project Token: IR.GetVariable("Global.name")
IR.SaveConfig
Enables scripted token saving when the project shuts down.
Syntax
IR.SaveConfig()
| Input | Value | Description |
|---|---|---|
| Output | ||
|---|---|---|
| success | true | type: boolean true |
Example
IR.AddListener(IR.EVENT_START,0,function()
{
IR.SetInterval(10000, save); //Каждые 10 секунд запускается функция "save".
})
function add() { //Функция для активации записи в токен.
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(){ //Включает сохранение токенов.
IR.SaveConfig();
}
IR.ClearProjectTokens
Resets project token values to their defaults.
Syntax
IR.ClearProjectTokens()
| Input | Value | Description |
|---|---|---|
| Output | ||
|---|---|---|
| success | true | type: boolean true |
Example
IR.AddListener(IR.EVENT_START, 0, function () {
IR.ClearProjectTokens();
});
Notes
A token without a default value is not cleared.
System Tokens: reading and writing
System variables can be read, and some written, only on control panels. iRidi Server cannot provide system state through tokens.
System variables available for reading and writing:
Project update mode
IR.SetVariable("System.Update", true);
IR.GetVariable("System.Update");
- false - project updates disabled
- true - project updates enabled
Device display
- Display brightness (tag control available only on iOS and Android):
IR.SetVariable("System.Display.Bright", 80);
IR.GetVariable("System.Display.Bright")
- 0...100 - display brightness percentage
-
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 - portrait, Home button at the top
- 2 - portrait, Home button at the bottom
- 3 - landscape, Home button on the left (default)
- 4 - landscape, Home button on the right
Vibration
Short vibration (briefly activates the vibration motor), only on iOS and Android IR.SetVariable("System.Vibro", 1.5);
- 1.5 - short-vibration duration in seconds (Android); on iOS, duration cannot be adjusted, so always set 1.
Screensaver
Control screensaver display on all operating systems
// set
IR.SetVariable("System.Screensaver.Show", 1) // 1 - show, 0 - hide
// get
IR.GetVariable("System.Screensaver.Show") // 1 - showed, 0 - hided
The screensaver can be shown only if Screensaver.Enable is not zero
- 0 - close the screensaver
- 1 - show the screensaver; available only if the activation delay is not 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
The screensaver can be enabled if the delay > 0. Setting zero delay disables it
- 0 - remove the activation delay, disabling the screensaver
- 10000 - enable the screensaver with the specified delay (ms)
System Tokens: read-only
System variables can be read, and some written, only on control panels. iRidi Server cannot provide system state through tokens.
Read-only system variables:
Time
- Seconds
IR.GetVariable("System.Time.Seconds") - Minutes
IR.GetVariable("System.Time.Minutes") - Hours
IR.GetVariable("System.Time.Hour") - Time in 24-hour format
IR.GetVariable("System.Time.24") - Time in 12-hour format
IR.GetVariable("System.Time.12_AM_PM") - Time in the operating system's format
IR.GetVariable("System.Time.Standart")
Server project tokens
-
Sunrise time in 24-hour format
IR.GetVariable("System.Time.SunRise") -
Sunset time in 24-hour format
IR.GetVariable("System.Time.SunSet")
Date
- Day of the year
IR.GetVariable("System.Date.DayOfYear") - Year
IR.GetVariable("System.Date.Year") - Weekday (0 - Sunday ... 6 - Saturday)
IR.GetVariable("System.Date.DayOfWeek") - Month
IR.GetVariable("System.Date.Month") - Day of the month
IR.GetVariable("System.Date.Day") - Date in YYYY_MM_DD format
IR.GetVariable("System.Date.YYYY_MM_DD") - Date in DD_MONTH_YYYY format
IR.GetVariable("System.Date.DD_MONTH_YYYY") - Date in MONTH_DD_YYYY format
IR.GetVariable("System.Date.MONTH_DD_YYYY") - Date in DD_MM_YYYY format
IR.GetVariable("System.Date.DD_MM_YYYY") - Date in MM_DD_YYYY format
IR.GetVariable("System.Date.MM_DD_YYYY") - Date in DD_MM format
IR.GetVariable("System.Date.DD_MM") - Date in MM_DD format
IR.GetVariable("System.Date.MM_DD") - Weekday
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 only on iOS and Android.
Compass
- Reading accuracy (degree of magnetization)
IR.GetVariable("System.Magnetic.Accuarcy") - True north
IR.GetVariable("System.Magnetic.True") - Magnetic north
IR.GetVariable("System.Magnetic.Heading") - Z coordinate
IR.GetVariable("System.Magnetic.Z") - Y coordinate
IR.GetVariable("System.Magnetic.Y") - X coordinate
IR.GetVariable("System.Magnetic.X")
- Supported only on iOS and Android.
Accelerometer
- Shake
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 only on iOS and Android.
Gyroscope
- Z coordinate
IR.GetVariable("System.Gyroscope.Z") - Y coordinate
IR.GetVariable("System.Gyroscope.Y") - X coordinate
IR.GetVariable("System.Gyroscope.X")
- Supported only on iOS and Android.
Network connections
- 3G/4G connection status
IR.GetVariable("System.Net.Cell")
- true - connected
- false - disconnected
- Wi-Fi connection status
IR.GetVariable("System.Net.WiFi")
- true - connected
- false - disconnected
- Wi-Fi network identifier
IR.GetVariable("System.Net.SSID")
- Wi-Fi network name
Battery
- Charge level
IR.GetVariable("System.Battery.Level") - Battery status
IR.GetVariable("System.Battery.Status")
- 1 - not charging
- 2 - charging
- 3 - fully charged (iOS)
Volume
- Volume value
IR.GetVariable("System.Sound.Volume") - Silent mode
IR.GetVariable("System.Sound.Mute")
Proximity sensor
- Sensor value
IR.GetVariable("System.Proximity")
- false - sensor inactive
- true - sensor triggered
Operating-system name
- OS name
IR.GetVariable("System.OS.Name");
- Microsoft windows
- Microsoft windows CE
- Apple OSX
- Apple iOS
- Android
Performance metrics
CPU - processor utilization percentage
IR.GetVariable("System.Performance metrics.CPU")
Garbage Collector Rate - number of garbage-collector runs in the past 24 hours
IR.GetVariable("System.Performance metrics.GCrate")
Garbage Collector Time - garbage-collector execution time
IR.GetVariable("System.Performance metrics.GCtime")
License - license status
IR.GetVariable("System.Performance metrics.Licence")
- 0 - No License Found
- 1 - Commercial
- 2 - Trial
- 3 - Test mode
- 4 - Offline
- 5 - License is expired
RAM - memory utilization percentage
IR.GetVariable("System.Performance metrics.RAM")
Storage - disk-space utilization percentage
IR.GetVariable("System.Performance metrics.Storage")
Server project token
Clients Count - number of connected panels (online)
IR.GetVariable("System.Performance metrics.ClientsCount")
Control panel type
- Identifier of the OS version running iRidi
IR.GetVariable("System.OS.Device");
-
When running on Windows
- 1 - Windows x86 32 / 64 bit
-
When running on Mac OS X
- 1 - Mac OS X PPC
- 2 - Mac OS X X86 32 bit
- 3 - Mac OS X X86 64 bit
-
When running on iOS
- 1 - iPhone
- 2 - iPad
-
When running on Android
- 1 - smartphone
- 2 - tablet
Operating-system version
under development
IR.GetVariable("System.OS.Version");
Control panel name
- Network name of the control panel running iRidi
IR.GetVariable("System.Device.Name");
Starting with iOS 18, Apple tightened access requirements for the user-defined device name. Our application does not meet the new criteria, so this token may return incorrect data or empty values on iOS 18+ devices.
- To change the device name in Android system settings, open the system section, then the phone-information section and the device-name setting.
- Correct operation of Device.Name is guaranteed only on iRidi Touch Panel devices. Behavior on third-party Android devices may vary with firmware version and manufacturer.
Control panel orientation
IR.GetVariable("System.Orientation");
- 1 - portrait, Home/Menu button at the bottom
- 2 - portrait, Home/Menu button at the top
- 3 - landscape, Home/Menu button on the right
- 4 - landscape, Home/Menu button on the left
- 5 - horizontal, screen facing up
- 6 - horizontal, screen facing down
- 0 - orientation changing
Driver Tokens
Driver variables are read-only. The set of variables is the same for every 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
});