/// <summary>
    /// Utility method/callback which initialises a new sensor stream.
    /// </summary>
    private void StartNewSensorStream()
    {
        if (CurrentSensorStream == null)
        {
            CurrentSensorStream = new SensorStream(SensorStreamSessionID);
        }
        else
        {
            CurrentSensorStream.SessionID = SensorStreamSessionID;
            CurrentSensorStream.Clear();
        }

        IsSensorStreamActive = true;
        SensorStreamSessionID++;
    }
示例#2
0
        private static void ReadFreame(SensorStream stream)
        {
            using (var frame = stream.ReadFrame())
            {
                Console.WriteLine("Video frame acquired:");
                DescribeFrame(frame);

                // write frame
                using (Stream fileStream = File.Open("sensor.frame", FileMode.Create))
                    using (var writer = new BinaryWriter(fileStream))
                    {
                        // stream properties
                        //writer.Write(hFov);
                        //writer.Write(vFov);
                        //writer.Write(minValue);
                        //writer.Write(maxValue);
                        //writer.Write(videoMode.PixelFormat.BytesPerPixel());

                        //// frame properties
                        //writer.Write(frame.CroppingEnabled);
                        //writer.Write(frame.CropOriginX);
                        //writer.Write(frame.CropOriginY);
                        //writer.Write(frame.Width);
                        //writer.Write(frame.Height);
                        //writer.Write(frame.Stride);
                        writer.Write(frame.Data.Size);

                        // data
                        using (var dataStream = frame.Data.CreateStream())
                        {
                            dataStream.CopyTo(fileStream);
                        }

                        fileStream.Flush();
                    }
            }
        }
示例#3
0
 internal ReadingLength(SensorStream output)
 {
     this.output = output;
 }
示例#4
0
 internal ReadingPayload(SensorStream output)
 {
     this.output = output;
 }
 /// <summary>
 /// Check if the device stream is operating at an acceptable rate.
 /// </summary>
 /// <param name="streamIdentifier">The identifier of the stream to check.</param>
 /// <returns>whether the stream identified by the identifier is OK</returns>
 public bool IsStreamHealthy(SensorStream streamIdentifier)
 {
     return((_streamingStatus & (int)streamIdentifier) > 0);
 }
示例#6
0
 internal AwaitingStart(SensorStream output)
 {
     this.output = output;
 }