Esempio n. 1
0
 public void ClearSettings()
 {
     m3DSettings         = null;
     m6DOFSettings       = null;
     mAnalogSettings     = null;
     mForceSettings      = null;
     mGazeVectorSettings = null;
     mGeneralSettings    = null;
     mImageSettings      = null;
 }
Esempio n. 2
0
 public void ClearSettings()
 {
     m3DSettings                 = null;
     m6DOFSettings               = null;
     mAnalogSettings             = null;
     mForceSettings              = null;
     mGazeVectorSettings         = null;
     mSkeletonSettingsCollection = null;
     mGeneralSettings            = null;
     mImageSettings              = null;
 }
Esempio n. 3
0
        /// <summary>Disconnect from server</summary>
        public void Disconnect()
        {
            mBroadcastSocketCreated = false;
            mNetwork.Disconnect();

            m3DSettings     = null;
            m6DOFSettings   = null;
            mAnalogSettings = null;
            mDiscoveryResponses.Clear();
            mForceSettings      = null;
            mGazeVectorSettings = null;
            mGeneralSettings    = null;
            mImageSettings      = null;
        }
        private static List <ImageCamera> LoadImageSettings()
        {
            // Get assembly object
            Assembly assembly = typeof(SettingsService).Assembly;

            // Get General Settings file
            using (System.IO.Stream stream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".RunningImageSettings.xml"))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(SettingsImage));
                SettingsImage si            = (SettingsImage)xmlSerializer.Deserialize(stream);

                // Store mock settings
                return(si.Cameras);
            }
        }
Esempio n. 5
0
        public override void HandleStreaming()
        {
            // Check if connection to QTM is possible
            if (!mRtProtocol.IsConnected())
            {
                if (!mRtProtocol.Connect(mIpAddress))
                {
                    Console.WriteLine("QTM: Trying to connect");
                    Thread.Sleep(1000);
                    return;
                }
                Console.WriteLine("QTM: Connected");
            }

            if (mRtProtocol.GeneralSettings == null)
            {
                if (!mRtProtocol.GetGeneralSettings())
                {
                    Console.WriteLine("QTM: Trying to get General settings");
                    Thread.Sleep(500);
                    return;
                }
                Console.WriteLine("QTM: General settings available");

                Console.WriteLine("Frequency: {0}", mRtProtocol.GeneralSettings.CaptureFrequency);
                foreach (var camera in mRtProtocol.GeneralSettings.CameraSettings)
                {
                    Console.WriteLine("{0}", camera.Model);
                }

                if (!mRtProtocol.GetImageSettings())
                {
                    Console.WriteLine("QTM: Trying to get Image settings");
                    Thread.Sleep(500);
                    return;
                }

                Console.WriteLine("QTM: Image settings available");
                Console.WriteLine(mRtProtocol.ImageSettings.Xml);


                mRtProtocol.TakeControl("realtimestreamingpassword");

                SettingsImage      newImageSettings        = new SettingsImage();
                List <ImageCamera> newImageSettingsCameras = new List <ImageCamera>();
                for (int i = 0; i < mRtProtocol.ImageSettings.Cameras.Count; i++)
                {
                    var camera = mRtProtocol.ImageSettings.Cameras[i];
                    camera.Enabled = true;
                    camera.Width  /= 4;
                    camera.Height /= 4;
                    newImageSettingsCameras.Add(camera);
                }
                newImageSettings.Cameras = newImageSettingsCameras;


                string createSettingsError;
                var    xmlSettings = RTProtocol.CreateSettingsXml(newImageSettings, out createSettingsError);
                if (xmlSettings != string.Empty)
                {
                    string response;
                    mRtProtocol.SendXML(xmlSettings, out response);
                    Console.WriteLine(response);
                }
                else
                {
                    Console.WriteLine(createSettingsError);
                }

                mRtProtocol.StreamAllFrames(QTMRealTimeSDK.Data.ComponentType.ComponentImage);
                Console.WriteLine("QTM: Starting to stream Image data");
                Thread.Sleep(500);
            }

            // Get RTPacket from stream
            PacketType packetType;

            mRtProtocol.ReceiveRTPacket(out packetType, false);

            // Handle data packet
            if (packetType == PacketType.PacketData)
            {
                var imageData = mRtProtocol.GetRTPacket().GetImageData();
                if (imageData != null && imageData.Count() > 0)
                {
                    foreach (var imageFromCamera in imageData)
                    {
                        Console.WriteLine("Frame:{0:D5} Camera Index:{1:D3} Width:{2:D5} Height:{3:D5}",
                                          mRtProtocol.GetRTPacket().Frame, imageFromCamera.CameraID, imageFromCamera.Width, imageFromCamera.Height);
                    }
                }
            }

            // Handle event packet
            if (packetType == PacketType.PacketEvent)
            {
                // If an event comes from QTM then print it out
                var qtmEvent = mRtProtocol.GetRTPacket().GetEvent();
                if (qtmEvent == QTMEvent.EventConnectionClosed ||
                    qtmEvent == QTMEvent.EventRTFromFileStopped)
                {
                    mRtProtocol.ClearSettings();
                }
                Console.WriteLine("{0}", qtmEvent);
            }
        }