Webvisu client connection monitoring

lota
2020-04-30
2024-09-10
<< < 1 2 3 (Page 3 of 3)
  • docker - 2024-08-26

    Thanks for the reply,

    i am using codesys SP16 patch 5 as this is the version that is compatible with my IFM controller.

    i am accessing the lastusage variable from the VisuStructClientData structure through a pointer.

    when i log in it lists the time since last log in but does not continually count, it remains a static value which isnt useful.

    hopefully you can help. Thankyou

     
  • dkugler - 2024-08-30

    is your pointer set to the correct visu client? set a breakpoint in your client iteration and step through the active visu clients like programming system, targetvisu, webvisu,... and check the last usage value of each client

     
    • docker - 2024-09-09

      can you send me some code snippets of the declarations and code need i am unsure of how to set the pointer to the correct visu client.

      Thanks i appreciate your help.

       
  • dkugler - 2024-09-09

    you can give this code snippet a try. It's extracted and simplyfied from my code:

    Install VisuElemBase lib if not installed yet.

    Execute in visu task:

    VAR
        pClientData     :  ARRAY [-1..100] OF  POINTER TO VisuElemBase.VisuStructClientData;
    END_VAR
    
    VisuElemBase.g_ClientManager.BeginIteration();
    pClientData := VisuElemBase.g_ClientManager.GetNextClient();
    
    WHILE pClientData <> 0 DO
        pClientData[pClientData^.GlobalData.GlobalClientID] := pClientData;
    END_WHILE
    

    You have to make shure every no longer updated pointers in the array have to be deleted and no longer used by your code!

    Usage of this pointer access at your own risk :-)

    Works with SP16. From SP17 and newer there will be warnigs etc. using this solution as I remember.
    It will be great, if Codesys publishes a example or give a hint how to accesse this client values with the VisuUtil lib or other future-proof way!

     
    • docker - 2024-09-10

      Hi mate,

      With this snippet i was able to see the lastusage variable count, but it would not iterate between clients? i was only able to access the data of the target visu.

      it threw an error with the array of pointers stating it was not able to convert etc. also when i tried it with the while loop it created an endless loop and crashed the program.

      any ideas? Thankyou

       
<< < 1 2 3 (Page 3 of 3)

Log in to post a comment.