Announcement

Collapse
No announcement yet.

External App - Connect and Send Data to multiple engines

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • External App - Connect and Send Data to multiple engines

    Hi All,

    Have a simple external app that is sending triggers to engine.

    What we are using:
    1. Feed Streamer (feed data to scene)
    2. Social Plugins (connect feed to scene)
    3. VizConnect.dll (library to connect external app to viz engine)
    4. C# WPF (form to connect and control vizrt scene)
    5. DataPool Plugins (receive data)

    I can connect to multiple engines using a foreach loop and can trigger the scenes too using the send commands. All I'm doing is controlling the directors.

    What I'm trying to do is set the data depending on network during and after foreach loop.

    How can I send data individually to each engine or group?

    Any direction would be very much appreciated.

    Thank you,
    Charlotte

  • #2
    Did you look at the REST API?
    On the machine of your MSE, go to a browser and type http://localhost:8081/api/v1/documentation
    You can try the VizSend way too. http://forum.vizrt.com/forum/viz-art...-always-needed

    Comment


    • #3
      Hi Lars,

      Thanks for reply and resources, I really appreciate it.

      I have checked out the documentation and VizSend. We are utilizing both. I will loop back to it in case there is something I may have missed.

      We have 13 networks for elections with different data for each network.

      First test: trigger individual or a group of networks with success.

      Second test: send custom data to individual or group of network with no success yet.

      What's happening is that it's sending the same data to all even if I only have one engine I'm sending to.

      If you have other ideas. I would love to brainstorm. Thanks!!

      Comment


      • #4
        Has anyone used the FPS Toolkit. I've only used it once.

        I'm checking the documents and when I add the reference library to my c# application the toolkit does not show up? Any ideas why.

        Thanks.

        Comment


        • #5
          In case we have elements that needs to react to data on different engines we have a script in the scene that checks which engine it is actually on.
          Basically we send the data via Shared memory to System.Map and then have the script check, If I am HostnameA.... then do something with this data otherwise ignore it. Why did you choose the DataPool route?

          Comment


          • #6
            Using Feed Streamer that feeds our scenes. We need data pool with this workflow.

            That is another option. So you are using System.IPAddressString?

            I was going to do that and have a select case that checks then sends the data the corresponds with that ip address.

            I don't know how to get the port number yet. We are running dual engines. 2 networks in each box.

            Comment


            • #7
              Actually, I just tested on dual engines. I'm going to go forward with this option. Thanks so much for your help!

              0 = engine 1
              1 = engine 2

              Code:
              sub OnExecPerField()
                  dim EngineNuI as Integer
                  dim IpAddress as String
                  
                  EngineNuI = System.EngineInstance
                  IpAddress = System.IPAddressString
                  
                  println EngineNuI & "---- EngineNuI"
                  println IpAddress & "---- IpAddress"
              end sub
              If anyone has any idea why VizManager does not show up in toolset in visual studio once the reference has been added in library. Please let me know.

              Thanks again Lars!

              Comment


              • #8
                We are trying to move away from the ipaddressing as they can change. we use the system.HostName instead.
                As for dual engines, its usually port 6100 and 6800.

                Instead of doing a OnExecPerField you should do it as OnExecAction and have a "buttonpush" on your stage that triggers the check on load or something. The other method gets heavy and draws from your performance.
                Here is an example of our scenescript that checks if I'm on the Wall/LED engine or on the AR engine.
                Code:
                ' ---------------------- GLOBALS ---------------
                
                dim localHostName as String = system.HostName
                
                Dim TargetHost as String
                Dim Port as Integer
                
                ' Flag if a start has been send. True = message has been sent once
                Dim StartSend as Boolean
                
                ' ---------------------- SETUP ---------------
                    
                sub OnInit()
                    Println(16, "on host " & System.Hostname & ", open scene: " & Scene.Name)
                    
                    GetARHostName()    
                    Port = GetParameterInt("targetPort")    
                    
                    System.Map.RegisterChangedCallBack("AR_ENGINE.status")
                    System.Map.RegisterChangedCallBack("AR_ENGINE.host")
                    
                    SendToSystemMap(targetHost, Port, "LED_ENGINE.control", "Idle", "string")
                    
                    StartSend = False
                
                    EngineCheck()    
                end sub
                
                
                
                sub OnInitParameters()
                    RegisterPushButton("CheckEngine", "Check Engine", 1)
                    RegisterParameterInt("targetPort", "targetPort:", 6100, 0, 1000000)
                end sub
                
                
                ' ---------------------- REACT TO CHANGE ---------------
                
                sub OnExecAction(buttonId As Integer)
                    Select Case buttonID
                        Case 1
                            EngineCheck()           
                    End Select
                end sub
                
                Sub OnParameterChanged(parameterName As String)
                    EngineCheck()
                    Port = GetParameterInt("targetPort")
                End Sub
                
                Sub OnSharedMemoryVariableChanged(map as Sharedmemory, mapKey as string)
                    
                    Dim shmValue as String = System.Map[mapKey]
                    Println(12, "Detected SHM change: " & mapKey & " - value:" & shmValue)
                
                    If mapKey = "AR_ENGINE.host" Then
                        GetARHostName()
                    End If
                
                End Sub
                
                
                ' ---------------------- DOMAIN ---------------
                
                Sub GetARHostName()
                    TargetHost = System.Map["AR_ENGINE.host"]
                End Sub
                
                
                
                Sub ContinueScene()
                    Dim mainDirector as Director = Stage.FindDirector("Default")    
                    mainDirector.ContinueAnimation()
                    
                    Println(16, "@@ LED scene, triggering continue via SHM")
                    
                    'This line triggers the AR scene
                    SendToSystemMap(targetHost, Port, "LED_ENGINE.control", "Start", "string")
                    
                    'This line will reset the SHM value, so a later change can be detected on the AR host
                    SendToSystemMap(targetHost, Port, "LED_ENGINE.control", "Idle", "string")
                    
                    StartSend = True
                End Sub
                
                    
                sub EngineCheck()
                    if localHostName ==  "MyEngineHostName" then  
                        println(14, "Live on LED Engine")   
                    else
                        println(14, "Previewing on the PreviewEngine")
                    end if
                end sub
                
                
                
                Sub SendToSystemMap(host as string, port as Integer, key as String, value as string, type as string)    
                    type.MakeLower()        
                
                    Dim _messageType         as String    
                    Dim _messageToSend as String
                    
                    Select Case type
                        case "string"
                            _messageType = "SET_STRING_ELEMENT"
                        
                        case "double"
                            _messageType = "SET_DOUBLE_ELEMENT"
                        
                        case "integer"
                            _messageType = "SET_INTEGER_ELEMENT"
                    End Select
                    
                    _messageToSend = "vizsend 0 GLOBAL*MAP " & _messageType & " " & key & " " & value
                        
                    Println(5, "Sending message to " & host & ":" & port &" - :" & _messageToSend)
                    System.TcpSend(host, port, _messageToSend, 0)    
                    
                End Sub

                Comment


                • #9
                  Hey Lars,

                  Thank you kindly for all this info. It helped a ton. I'll share what I did to in case it can help someone else.

                  Yes, I completely agree. I have it as an action key frame in my directors. It hits these actions key frames before I load the other templates.

                  Code:
                  '
                  =========================================================================
                  ' GLOBAL VARIABLES
                  '=========================================================================
                  
                  dim PartyVotesStvC as Container = FindSubContainer("DP_CONTENT_PV")
                  dim BreaknNewsStvC as Container = FindSubContainer("DP_CONTENT_BN")
                  dim CrawlStoryStvC as Container = FindSubContainer("DP_CONTENT_CS")
                  dim RideResultStvC as Container = FindSubContainer("DP_CONTENT_RR")
                  dim MajorMeterStvC as Container = FindSubContainer("DP_CONTENT_MM")
                  
                  dim PartyVotesStvP as PluginInstance
                  dim BreaknNewsStvP as PluginInstance
                  dim CrawlStoryStvP as PluginInstance
                  dim RideResultStvP as PluginInstance
                  dim MajorMeterStvP as PluginInstance
                  
                  dim PortNumbrI as Integer
                  dim IpAddressS as String
                  
                  '=========================================================================
                  ' INITIALIZE PARAMETERS AND BUTTONS FOR TESTING
                  '=========================================================================
                  
                  sub OnInitParameters()
                      RegisterPushButton("GetIpPort", "Get IpPort", 0)
                      RegisterPushButton("SetStvSource", "Set Stv Source", 1)
                  end sub
                  
                  sub OnInit()
                      IpAddressS = System.IPAddressString
                      PortNumbrI = System.EngineInstance
                      
                      PartyVotesStvP = PartyVotesStvC.GetFunctionPluginInstance("STV_MessagesReader")
                      BreaknNewsStvP = BreaknNewsStvC.GetFunctionPluginInstance("STV_MessagesReader")
                      CrawlStoryStvP = CrawlStoryStvC.GetFunctionPluginInstance("STV_MessagesReader")
                      RideResultStvP = RideResultStvC.GetFunctionPluginInstance("STV_MessagesReader")
                      MajorMeterStvP = MajorMeterStvC.GetFunctionPluginInstance("STV_MessagesReader")
                  end sub
                  
                  '=========================================================================
                  ' GET IP ADDRESS & PORT NUMBER
                  '=========================================================================
                  
                  sub GetIpPort()
                      IpAddressS = System.IPAddressString
                      PortNumbrI = System.EngineInstance
                      
                      println(13, "IpAddressS: " & IpAddressS)
                      println(13, "PortNumbrI: " & CStr(PortNumbrI))
                      
                      SetStvSource(IpAddressS, PortNumbrI)
                  end sub
                  
                  '=========================================================================
                  ' CHECK IP ADDRESS & PORT NUMBER
                  ' TODO: change groupName to sourceName once we get data
                  '=========================================================================
                  
                  sub SetStvSource(Address as String, PortNumber as Integer)
                      ' ----------------------- LOCALHOST -----------------------
                      if Address = "X.X.X.X" and PortNumber = 0 then
                          PartyVotesStvP.SetParameterString("groupName", "CHX_PARTY_VOTES")
                          BreaknNewsStvP.SetParameterString("groupName", "CHX_BREAKING_NEWS")
                          CrawlStoryStvP.SetParameterString("groupName", "CHX_CRAWL_STORIES")
                          RideResultStvP.SetParameterString("groupName", "CHX_RIDING_RESULTS")
                          MajorMeterStvP.SetParameterString("groupName", "CHX_MAJORITY_METER")
                          println(13, "NETWORK: CHX")
                      ' ----------------------- CHX -----------------------        
                      elseif Address = "X.X.X.X" and PortNumber = 0 then
                          PartyVotesStvP.SetParameterString("groupName", "CHX_PARTY_VOTES")
                          BreaknNewsStvP.SetParameterString("groupName", "CHX_BREAKING_NEWS")
                          CrawlStoryStvP.SetParameterString("groupName", "CHX_CRAWL_STORIES")
                          RideResultStvP.SetParameterString("groupName", "CHX_RIDING_RESULTS")
                          MajorMeterStvP.SetParameterString("groupName", "CHX_MAJORITY_METER")
                          println(13, "NETWORK: CHX")
                      ' ----------------------- CIHF -----------------------        
                      elseif Address = "X.X.X.X" and PortNumber = 0 then
                          PartyVotesStvP.SetParameterString("groupName", "CHX_PARTY_VOTES")
                          BreaknNewsStvP.SetParameterString("groupName", "CHX_BREAKING_NEWS")
                          CrawlStoryStvP.SetParameterString("groupName", "CHX_CRAWL_STORIES")
                          RideResultStvP.SetParameterString("groupName", "CHX_RIDING_RESULTS")
                          MajorMeterStvP.SetParameterString("groupName", "CHX_MAJORITY_METER")
                          println(13, "NETWORK: CHX")
                      ' ----------------------- CHX -----------------------        
                      elseif Address = "X.X.X.X" and PortNumber = 1 then
                          PartyVotesStvP.SetParameterString("groupName", "CHX_PARTY_VOTES")
                          BreaknNewsStvP.SetParameterString("groupName", "CHX_BREAKING_NEWS")
                          CrawlStoryStvP.SetParameterString("groupName", "CHX_CRAWL_STORIES")
                          RideResultStvP.SetParameterString("groupName", "CHX_RIDING_RESULTS")
                          MajorMeterStvP.SetParameterString("groupName", "CHX_MAJORITY_METER")
                          println(13, "NETWORK: CHX")
                      end if
                  end sub
                  
                  '=========================================================================
                  ' BUTTONS FOR TESTING
                  '=========================================================================
                  
                  sub OnExecAction(buttonId as Integer)
                      if buttonId = 0 then
                          GetIpPort()
                      elseif buttonId = 1 then
                          SetStvSource(IpAddressS, PortNumbrI)
                      end if
                  end sub
                  Last edited by clopez11; 02-22-2019, 03:10 PM. Reason: Add info

                  Comment

                  Working...
                  X