Skip to main content

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.

AddSysTokenToItem.png 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.

Tokens_1.png

  • 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))

InputValueDescription
pathTokenstype: 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)
nameUpdatetype: String
variable name
value100type: 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

Tip
  • 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)")

InputValueDescription
pathTokenstype: 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
nameUpdatetype: String
variable name
Output
Valuetruetype: 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

Tip

Alias for Project Token: IR.GetVariable("Global.name")

IR.SaveConfig​

Enables scripted token saving when the project shuts down.

Syntax

IR.SaveConfig()

InputValueDescription
Output
successtruetype: 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()

InputValueDescription
Output
successtruetype: boolean
true

Example

IR.AddListener(IR.EVENT_START, 0, function () {
IR.ClearProjectTokens();
});

Notes

Tip

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​

  1. 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
  1. Full-screen mode IR.GetVariable("System.Display.FullScreen")

  2. Display height IR.GetVariable("System.Display.Height")

  3. Display width IR.GetVariable("System.Display.Width")

  4. 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​

  1. Seconds IR.GetVariable("System.Time.Seconds")
  2. Minutes IR.GetVariable("System.Time.Minutes")
  3. Hours IR.GetVariable("System.Time.Hour")
  4. Time in 24-hour format IR.GetVariable("System.Time.24")
  5. Time in 12-hour format IR.GetVariable("System.Time.12_AM_PM")
  6. Time in the operating system's format IR.GetVariable("System.Time.Standart")

Server project tokens

  1. Sunrise time in 24-hour format IR.GetVariable("System.Time.SunRise")

  2. Sunset time in 24-hour format IR.GetVariable("System.Time.SunSet")

Date​

  1. Day of the year IR.GetVariable("System.Date.DayOfYear")
  2. Year IR.GetVariable("System.Date.Year")
  3. Weekday (0 - Sunday ... 6 - Saturday) IR.GetVariable("System.Date.DayOfWeek")
  4. Month IR.GetVariable("System.Date.Month")
  5. Day of the month IR.GetVariable("System.Date.Day")
  6. Date in YYYY_MM_DD format IR.GetVariable("System.Date.YYYY_MM_DD")
  7. Date in DD_MONTH_YYYY format IR.GetVariable("System.Date.DD_MONTH_YYYY")
  8. Date in MONTH_DD_YYYY format IR.GetVariable("System.Date.MONTH_DD_YYYY")
  9. Date in DD_MM_YYYY format IR.GetVariable("System.Date.DD_MM_YYYY")
  10. Date in MM_DD_YYYY format IR.GetVariable("System.Date.MM_DD_YYYY")
  11. Date in DD_MM format IR.GetVariable("System.Date.DD_MM")
  12. Date in MM_DD format IR.GetVariable("System.Date.MM_DD")
  13. Weekday IR.GetVariable("System.Date.Weekday")

GPS coordinates​

  1. Course IR.GetVariable("System.Location.Course")
  2. Speed IR.GetVariable("System.Location.Speed")
  3. Altitude IR.GetVariable("System.Location.Altitude")
  4. Longitude IR.GetVariable("System.Location.Longitude")
  5. Latitude IR.GetVariable("System.Location.Latitude")
  • Supported only on iOS and Android.

Compass​

  1. Reading accuracy (degree of magnetization) IR.GetVariable("System.Magnetic.Accuarcy")
  2. True north IR.GetVariable("System.Magnetic.True")
  3. Magnetic north IR.GetVariable("System.Magnetic.Heading")
  4. Z coordinate IR.GetVariable("System.Magnetic.Z")
  5. Y coordinate IR.GetVariable("System.Magnetic.Y")
  6. X coordinate IR.GetVariable("System.Magnetic.X")
  • Supported only on iOS and Android.

Accelerometer​

  1. Shake IR.GetVariable("System.Accelerometer.Shake")
  2. Z coordinate IR.GetVariable("System.Accelerometer.Z")
  3. Y coordinate IR.GetVariable("System.Accelerometer.Y")
  4. X coordinate IR.GetVariable("System.Accelerometer.X")
  • Supported only on iOS and Android.

Gyroscope​

  1. Z coordinate IR.GetVariable("System.Gyroscope.Z")
  2. Y coordinate IR.GetVariable("System.Gyroscope.Y")
  3. X coordinate IR.GetVariable("System.Gyroscope.X")
  • Supported only on iOS and Android.

Network connections​

  1. 3G/4G connection status IR.GetVariable("System.Net.Cell")
  • true - connected
  • false - disconnected
  1. Wi-Fi connection status IR.GetVariable("System.Net.WiFi")
  • true - connected
  • false - disconnected
  1. Wi-Fi network identifier IR.GetVariable("System.Net.SSID")
  • Wi-Fi network name

Battery​

  1. Charge level IR.GetVariable("System.Battery.Level")
  2. Battery status IR.GetVariable("System.Battery.Status")
  • 1 - not charging
  • 2 - charging
  • 3 - fully charged (iOS)

Volume​

  1. Volume value IR.GetVariable("System.Sound.Volume")
  2. Silent mode IR.GetVariable("System.Sound.Mute")

Proximity sensor​

  1. Sensor value IR.GetVariable("System.Proximity")
  • false - sensor inactive
  • true - sensor triggered

Operating-system name​

  1. 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​

  1. 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​

  1. Network name of the control panel running iRidi IR.GetVariable("System.Device.Name");
Important

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.

Note
  • 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
});