Hello.
Is it possible to show different start visu for different clients according to their IP?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-11-11
Originally created by: scott_cunningham
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2016-11-11
Originally created by: barkamharikrishna
write small logic in the plc to which Screen to be active depends on Ip .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
PROGRAMPLC_PRGVAR        pClient:POINTERTOVisuElems.VisuStructClientData;        _VisuFbClientTagDataHelper          :VisuElems.VisuFbClientTagDataHelper;        _asIP:ARRAY[0..5]OFSTRING;        _asPreviousUserName:ARRAY[0..5]OFWSTRING;END_VAR
//IterateoverallcurrentlyactivevisualizationclientsVisuElems.g_ClientManager.BeginIteration();WHILE(pClient :=VisuElems.g_ClientManager.GetNextClient())<>0DO
        //Switchthevisuofawebclientonlyifitisaspecificclientwheretheadminuserisloggedout. InthiscasethecurrentuserisemptyandthepreviouswasAdmin.
        IFpClient^.GlobalData.ClientType=VisuElems.Visu_ClientType.WebVisualizationTHEN
                _VisuFbClientTagDataHelper(pClientData :=pClient);
                IF_VisuFbClientTagDataHelper.xIPv4ValidTHEN
                        _asIP[pClient^.GlobalData.GlobalClientID] :=_VisuFbClientTagDataHelper.stIPv4;
                        IFpClient^.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_IFEND_WHILE
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
Is it possible to show different start visu for different clients according to their IP?
Originally created by: scott_cunningham
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.
Originally created by: barkamharikrishna
write small logic in the plc to which Screen to be active depends on Ip .
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.
Hi, this won't work for me.
In debugging it shows -1 for GlobalClientID, seems the property is missing in VisuGlobals.
The Codesys and library version 3.5.16.3
Could you please check do you have the same variables in the respective library? (see attached)