CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Nov 23, 2017 6:14 am

All times are UTC+01:00

Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Aug 31, 2016 12:51 pm 

Joined: Mon Feb 16, 2015 1:56 pm
Posts: 9
Is it possible to show different start visu for different clients according to their IP?

PostPosted: Fri Nov 11, 2016 5:14 am 
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 257
I had a system that had two different screens - similar problem: same screens but some parts were read only on the remote monitors. My best solution was to define a variable that is only used by the visu. You set it on the visu screen at first run (setup screen). Make the variable persistent retain and it will live even after power cycle. Maybe that helps you.

Scott Cunningham
KEB America, Inc.

PostPosted: Fri Nov 11, 2016 11:54 am 

Joined: Thu Jun 09, 2016 5:32 am
Posts: 38
Location: memmingen,germany
write small logic in the plc to which Screen to be active depends on Ip .

PostPosted: Tue May 16, 2017 12:02 pm 
Frequent User
Frequent User
User avatar

Joined: Tue Jun 06, 2006 9:03 am
Posts: 403
You can iterate over all connected clients.
From each client you can get data (including asking it's IP address).
Then you can set the required visualization of this client.

Please note that currently you cannot read the current page. According to 3S-Smart Software Solutions with SP11 a new user friendlier library will be released which can do the same as below including reading the actual visualization the client is on.

Below the example code which I used to changed to a certain visualization when a user logged out at a specific client (local client). In this case I remembered who was already logged on. In your case you could use another array to detect if this is a new client. If yes, then set the start visualization.

                pClient : POINTER TO VisuElems.VisuStructClientData;
                _VisuFbClientTagDataHelper                    : VisuElems.VisuFbClientTagDataHelper;
                _asIP: ARRAY[0..5] OF STRING;
                _asPreviousUserName : ARRAY[0..5] OF WSTRING;

// Iterate over all currently active visualization clients
WHILE (pClient := VisuElems.g_ClientManager.GetNextClient()) <> 0 DO
                // Switch the visu of a webclient only if it is a specific client where the admin user is logged out. In this case the current user is empty and the previous was Admin.
                IF pClient^.GlobalData.ClientType = VisuElems.Visu_ClientType.WebVisualization THEN
                               _VisuFbClientTagDataHelper(pClientData := pClient);
                               IF _VisuFbClientTagDataHelper.xIPv4Valid THEN
                                               _asIP[pClient^.GlobalData.GlobalClientID] := _VisuFbClientTagDataHelper.stIPv4;
                                               IF pClient^.GlobalData.CurrentUserName = "" AND _asPreviousUserName[pClient^.GlobalData.GlobalClientID] = "Admin" AND _asIP[pClient^.GlobalData.GlobalClientID] = '' THEN
                                                               VisuElems.g_VisuManager.SetMainVisu(pClient, 'MainVisu');       
                               _asPreviousUserName[pClient^.GlobalData.GlobalClientID] := pClient^.GlobalData.CurrentUserName;

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited