CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Jun 24, 2017 12:58 pm

All times are UTC+01:00




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

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


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

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 227
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.


Top
   
PostPosted: Fri Nov 11, 2016 11:54 am 
Offline

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


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

Joined: Tue Jun 06, 2006 9:03 am
Posts: 399
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.

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



Code:
// Iterate over all currently active visualization clients
VisuElems.g_ClientManager.BeginIteration();
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] = '127.0.0.1' THEN
                                                               VisuElems.g_VisuManager.SetMainVisu(pClient, 'MainVisu');       
                                               END_IF
                               END_IF
                               _asPreviousUserName[pClient^.GlobalData.GlobalClientID] := pClient^.GlobalData.CurrentUserName;
                END_IF
END_WHILE


Top
   
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