Organizing shared data on the server
A common task is to control shared smart home or building equipment from multiple smartphones or tablets. A server provides 24/7 equipment control and stores information in a database.
Clients (smartphones and tablets) can share access to the same data on the server. Each client can change the shared data, and the changes must appear on the server and all other clients. Clients can lose their connection to the server; data cannot be kept current in this case, but it must update (synchronize) automatically on the client when the connection is restored.
Solution: In this case, one server project and one or more Panel Projects are developed. The server project is integrated into each Panel Project.
Example overview
The panel has two time entry fields, "HOURS" and "MINUTES". Pressing Enter sends the data to virtual channels in iRidi Server. The event then runs the virtual_to_virtual() script, which writes the received data to virtual tags. The time is displayed on every panel subscribed to these tags. The virtual tags are also stored in the server database.
-b0967105923078021414830ad6b0f8b8.png)
Each client (panel) can therefore change the time. All changes are stored in the database and displayed on every client's screen in real time.
Creating and configuring the server project
-
Create a server project.
-
Open the I/O tab and create the required number of virtual channels and virtual tags for shared data. Each channel must have a corresponding tag. Give each corresponding channel and tag pair the same name.
- Create a data gateway script.
function virtual_to_virtual(in_Type, in_Name, in_Value) {
IR.SetVariable("Server.Tags." + in_Name, in_Value);
return in_Value;
}
For details:Data gateway between a virtual channel and a tag.
- In the virtual channel properties, set Script Modifier to the gateway function virtual_to_virtual().
- Configure each virtual tag to meet the task requirements.
-
Access: Public
-
Persist: Yes
-
Store In DB: None / Signed 32bit / Float 64bit / String UTF-8
-
DB Save Strategy: Deadband / Interval
For details: Driver and server variables.
You can store tags in the database, but this is optional for shared data.
- Save the server project.
Creating and configuring Panel Projects
-
Create a Panel Project.
-
Add a driver for communication with iRidi Server, then specify the server project file (the server project must be open in iRidi Studio at this point).

- Select the server driver. The server-project synchronization button becomes available to retrieve the list of all virtual server tags. Click it.
For details: Visualizing iRidi Server control
- Set Save Value When Disconnected to the desired behavior of virtual tags on the panel when disconnected from the server:
- True - retain the last tag value,
- False - force the tag value to be empty.
- Add graphical items:
-
items for data entry, such as Edit Box,
-
items for data display, such as Label (Type: Button, Hit: PassThrough).
-a90d6715fe50f82b3de26ff0a14cdb85.png)
-
Drag virtual channels from the "iRidi Server" driver onto the graphical items used to change data. Link them to the Enter or Release event (depending on the graphical item type).
-
Drag virtual feedbacks from the "iRidi Server" driver onto the graphical items used to display data. Link them to write to the Text or Value properties (depending on the graphical item type).
-
Set the server IP address.

- Save the project.
You can create several Panel Projects or use the same project on different devices without conflicts.
Starting the projects
-
Start the projects on the devices in any order. You can use the i3 pro emulator and iRidi Server for Windows.
-
You can check how the displayed data behaves when a client disconnects from and reconnects to the server.
-
You can also try stopping the server (closing the server application), then starting it again to verify that shared data is retained (provided that Persist = Yes).
Synchronizing projects
It is recommended to finish developing the virtual channels and tags in the server project before using them in a Panel Project. However, you can change the server project while developing the Panel Project using the following features.
- Updating virtual channels and tags in a Panel Project (synchronizing server and Panel Projects)
If the set of virtual channels and tags in the server project changes during development, the changes do not appear automatically in the Panel Project even though the projects are integrated. To update the channel and tag list, select the server driver in the Panel Project. The server-project synchronization button becomes available. Click it to read the virtual channel and tag list from the server project again.
- Renaming channels and tags in the server project
You can freely rename virtual channels and tags in the server project. Synchronization updates the names while retaining all previously configured links on the panel side.
- Renaming the server project file
After renaming the server project file, open both projects in iRidi Studio, then update Source Project for the server driver in the Panel Project.
- Working separately with project files
Server and Panel Projects synchronize manually, so you can work on them separately. For example, two developers can work on the projects on different computers. The server project file is not required to run the Panel Project.