/// <summary> /// Stream frames from QTM server ///</summary> /// <param name="streamRate">what rate server should stream at</param> /// <param name="streamValue">related to streamrate, not used if all frames are streamed</param> /// <param name="components">List of all component types deisred to stream</param> /// <param name="port">if set, streaming will be done by UDP on this port. Has to be set if ipAddress is specified</param> /// <param name="ipAddress">if UDP streaming should occur to other ip adress, /// if not set streaming occurs on same ip as command came from</param> /// <returns></returns> public bool StreamFrames(StreamRate streamRate, int streamValue, List <ComponentType> components = null, short udpPort = -1, string ipAddress = "") { string command = "streamframes"; switch (streamRate) { case StreamRate.RateAllFrames: command += " allFrames"; break; case StreamRate.RateFrequency: command += " Frequency:" + streamValue; break; case StreamRate.RateFrequencyDivisor: command += " FrequencyDivisor:" + streamValue; break; } if (udpPort > 0) { command += " udp:"; if (!String.IsNullOrEmpty(ipAddress)) { command += ipAddress + ":"; } command += udpPort; } command += BuildStreamString(components); return(SendString(command, PacketType.PacketCommand)); }
public bool StreamFrames(StreamRate streamRate, int streamValue, ComponentType component, int port = -1, string ipaddress = "") { List <ComponentType> list = new List <ComponentType>(); list.Add(component); return(StreamFrames(streamRate, streamValue, list, port, ipaddress)); }
static bool StartStreaming(RTState state, RTProtocol rtProtocol, StreamRate streamRate, short udpPort) { if (rtProtocol.StreamFrames(streamRate, -1, state.componentsInStream, udpPort) == false) { state.isStreaming = false; } else { state.isStreaming = true; } return(state.isStreaming); }
public bool ConnectStream(short udpPort, StreamRate streamRate, bool stream6d, bool stream3d) { List <ComponentType> streamedTypes = new List <ComponentType>(); if (stream3d) { streamedTypes.Add(ComponentType.Component3d); } if (stream6d) { streamedTypes.Add(ComponentType.Component6d); } //Start streaming and get the settings if (mProtocol.StreamFrames(streamRate, -1, false, streamedTypes, udpPort)) { if (stream3d) { if (!Get3DSettings()) { Debug.Log("Error retrieving settings"); return(false); } } if (stream6d) { if (!Get6DOFSettings()) { Debug.Log("Error retrieving settings"); return(false); } } // we register our function "process" as a callback for when protocol receives real time data packets // (eventDataCallback is also available to listen to events) mProtocol.RealTimeDataCallback += Process; mProtocol.EventDataCallback += Events; //Tell protocol to start listening to real time data mProtocol.ListenToStream(); mStreamingStatus = true; return(true); } else { Debug.Log("Error Creating Connection to server"); } return(false); }
/// <summary>Stream frames from QTM server</summary> /// <param name="streamRate">what rate server should stream at</param> /// <param name="streamValue">related to streamrate, not used if all frames are streamed</param> /// <param name="components">List of all component types deisred to stream</param> /// <param name="udpPort">if set, streaming will be done by UDP on this port. Has to be set if ip address is specified</param> /// <param name="ipAddress">if UDP streaming should occur to other ip address, if not set streaming occurs on same ip as command came from</param> /// <returns>true if streaming started</returns> public bool StreamFrames(StreamRate streamRate, int streamValue, List <ComponentType> components = null, int udpPort = -1, string ipAddress = "") { string command = "streamframes"; switch (streamRate) { case StreamRate.RateAllFrames: command += " allframes"; break; case StreamRate.RateFrequency: command += " frequency:" + streamValue; break; case StreamRate.RateFrequencyDivisor: command += " frequencydivisor:" + streamValue; break; } if (ipAddress != "") { if (udpPort > 0) { command += " udp:" + ipAddress + ":" + udpPort; } else { mErrorString = "If an IP-address was specified for UDP streaming, a port must be specified as well"; return(false); } } else if (udpPort > 0) { command += " udp:" + udpPort; } command += BuildStreamString(components); return(SendString(command, PacketType.PacketCommand)); }
public RTStreamThread(string IpAddress, short udpPort, StreamRate streamRate, bool stream6d, bool stream3d, bool stream3dNoLabels, bool streamGaze, bool streamAnalog, bool streamSkeleton) { this.writerThreadState = new RTState(); this.ReaderThreadState = new RTState(); this.IpAddress = IpAddress; this.streamRate = streamRate; this.udpPort = udpPort; if (stream3d) { componentSelection.Add(ComponentType.Component3dResidual); } if (stream3dNoLabels) { componentSelection.Add(ComponentType.Component3dNoLabelsResidual); } if (stream6d) { componentSelection.Add(ComponentType.Component6d); } if (streamGaze) { componentSelection.Add(ComponentType.ComponentGazeVector); } if (streamAnalog) { componentSelection.Add(ComponentType.ComponentAnalog); } if (streamSkeleton) { componentSelection.Add(ComponentType.ComponentSkeleton); } killThread = false; writerThread = new Thread(WriterThreadFunction); writerThread.Name = "RTStreamThread::WriterThreadFunction"; writerThread.Start(); }
public bool StreamFrames(StreamRate streamRate, int streamValue, bool streamAllComponents, ComponentType component, short port = -1, string ipAdress = "") { List<ComponentType> list = new List<ComponentType>(); list.Add(component); return StreamFrames(streamRate, streamValue, streamAllComponents, list, port, ipAdress); }
/// <summary> /// Stream frames from QTM server ///</summary> /// <param name="streamRate">what rate server should stream at</param> /// <param name="streamValue">related to streamrate, not used if all frames are streamed</param> /// <param name="streamAllComponents">If all component types should be streamed</param> /// <param name="components">List of all component types deisred to stream</param> /// <param name="port">if set, streaming will be done by UDP on this port. Has to be set if ipadress is specified</param> /// <param name="ipAdress">if UDP streaming should occur to other ip adress, /// if not set streaming occurs on same ip as command came from</param> /// <returns></returns> public bool StreamFrames(StreamRate streamRate, int streamValue, bool streamAllComponents, List<ComponentType> components = null, short port = -1, string ipAdress = "") { string command = "streamframes"; switch (streamRate) { case StreamRate.RateAllFrames: command += " allFrames"; break; case StreamRate.RateFrequency: command += " Frequency:" + streamValue; break; case StreamRate.RateFrequencyDivisor: command += " FrequencyDivisor:" + streamValue; break; } if (ipAdress != "") { if (port > 0) { command += " UDP:" + ipAdress + ":" + port; } else { mErrorString = "If an IP-adress was specified for UDP streaming, a port must be specified aswell"; return false; } } else if (port > 0) { command += " UDP:" + port; } if (streamAllComponents) command += " all"; else command += BuildStreamString(components); return SendString(command, PacketType.PacketCommand); }
public bool ConnectStream(short udpPort, StreamRate streamRate, bool stream6d, bool stream3d) { List<ComponentType> streamedTypes = new List<ComponentType>(); if (stream3d) streamedTypes.Add(ComponentType.Component3d); if (stream6d) streamedTypes.Add(ComponentType.Component6d); //Start streaming and get the settings if (mProtocol.StreamFrames(streamRate, -1, false, streamedTypes, udpPort)) { if (stream3d) { if (!Get3DSettings()) { Debug.Log("Error retrieving settings"); return false; } } if (stream6d) { if (!Get6DOFSettings()) { Debug.Log("Error retrieving settings"); return false; } } // we register our function "process" as a callback for when protocol receives real time data packets // (eventDataCallback is also available to listen to events) mProtocol.RealTimeDataCallback += Process; mProtocol.EventDataCallback += Events; //Tell protocol to start listening to real time data mProtocol.ListenToStream(); mStreamingStatus = true; return true; } else { Debug.Log("Error Creating Connection to server"); } return false; }
public bool ConnectStream(short udpPort, StreamRate streamRate, bool stream6d, bool stream3d, bool streamgaze) { List <ComponentType> streamedTypes = new List <ComponentType>(); if (stream3d) { streamedTypes.Add(ComponentType.Component3d); } if (stream6d) { streamedTypes.Add(ComponentType.Component6d); } if (streamgaze) { streamedTypes.Add(ComponentType.ComponentGazeVector); } if (!mProtocol.GetGeneralSettings()) { Debug.Log("Error retrieving general QTM streaming settings"); return(false); } if (stream3d) { if (!Get3DSettings()) { Debug.Log("Error retrieving 3d settings from stream"); return(false); } } if (stream6d) { if (!Get6DOFSettings()) { Debug.Log("Error retrieving 6dof settings from stream"); return(false); } } if (streamgaze) { if (!GetGazeVectorSettings()) { // Don't fail too hard since gaze only has been available for a short while... but still give an error in the log. Debug.Log("Error retrieving gaze settings from stream"); } } // we register our function "process" as a callback for when protocol receives real time data packets // (eventDataCallback is also available to listen to events) mProtocol.RealTimeDataCallback += Process; mProtocol.EventDataCallback += Events; //Start streaming and get the settings if (mProtocol.StreamFrames(streamRate, -1, streamedTypes, udpPort)) { //Tell protocol to start listening to real time data mProtocol.ListenToStream(); mStreamingStatus = true; return(true); } else { Debug.Log("Error creating connection to server"); } return(false); }
public bool ConnectStream(short udpPort, StreamRate streamRate, bool stream6d, bool stream3d, bool stream3dNoLabels, bool streamGaze, bool streamAnalog, bool streamSkeleton) { List <ComponentType> streamedTypes = new List <ComponentType>(); if (!mProtocol.GetGeneralSettings()) { Debug.Log("Error retrieving general QTM streaming settings"); return(false); } if (stream3d || stream3dNoLabels) { if (Get3DSettings()) { if (stream3d) { streamedTypes.Add(ComponentType.Component3dResidual); } if (stream3dNoLabels) { streamedTypes.Add(ComponentType.Component3dNoLabelsResidual); } } else { Debug.Log("Error retrieving 3d settings from stream"); return(false); } } if (stream6d) { if (Get6DOFSettings()) { streamedTypes.Add(ComponentType.Component6d); } else { Debug.Log("Error retrieving 6dof settings from stream"); } } if (streamGaze) { if (GetGazeVectorSettings()) { streamedTypes.Add(ComponentType.ComponentGazeVector); } else { // Don't fail too hard since gaze only has been available for a short while... but still give an error in the log. Debug.Log("Error retrieving gaze settings from stream"); } } if (streamAnalog) { if (GetAnalogSettings()) { streamedTypes.Add(ComponentType.ComponentAnalog); } else { // Don't fail too hard since gaze only has been available for a short while... but still give an error in the log. Debug.Log("Error retrieving analog settings from stream"); } } if (streamSkeleton) { if (GetSkeletonSettings()) { streamedTypes.Add(ComponentType.ComponentSkeleton); } else { Debug.Log("Error retrieving skeleton settings from stream"); } } //Start streaming and get the settings if (mProtocol.StreamFrames(streamRate, -1, streamedTypes, udpPort)) { //Tell protocol to start listening to real time data mProtocol.ListenToStream(); mStreamingStatus = true; return(true); } else { Debug.Log("Error creating connection to server"); } return(false); }