当前位置: 首页>>代码示例>>C#>>正文


C# SensorData类代码示例

本文整理汇总了C#中SensorData的典型用法代码示例。如果您正苦于以下问题:C# SensorData类的具体用法?C# SensorData怎么用?C# SensorData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SensorData类属于命名空间,在下文中一共展示了SensorData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAverageBySensor

 private static double[] GetAverageBySensor(SensorData[] resultParse)
 {
     int counterFirstSensor = 0;
     int counterSecondSensor = 0;
     int counterThirdSensor = 0;
     int sumFirstSensor = 0;
     int sumSecondSensor = 0;
     int sumThirdSensor = 0;
     for (int i = 0; i < resultParse.Length; i++)
     {
         switch (resultParse[i].codeSensor)
         {
             case 1:
                 counterFirstSensor++;
                 sumFirstSensor += resultParse[i].valueSensor;
                 break;
             case 2:
                 counterSecondSensor++;
                 sumSecondSensor += resultParse[i].valueSensor;
                 break;
             case 3:
                 counterThirdSensor++;
                 sumThirdSensor += resultParse[i].valueSensor;
                 break;
             default:
                 break;
         }
     }
     double[] AverageBySensor = { (sumFirstSensor / counterFirstSensor), (sumSecondSensor / counterSecondSensor), (sumThirdSensor / counterThirdSensor) };
     return AverageBySensor;
 }
开发者ID:AlinaKulishdp,项目名称:ISD-courses,代码行数:31,代码来源:BitOperations.cs

示例2: GetParse

 private static SensorData[] GetParse(ushort[] dataSensors)
 {
     SensorData[] resultParse = new SensorData[dataSensors.Length];
     uint firstMask = 0x1;
     uint secondMask = 0x1FFE;
     for (int i = 0; i < dataSensors.Length; i++)
     {
         int counter = 0;
         int dataResult = dataSensors[i];
         while (dataResult > 0)
         {
             dataResult = dataResult >> 1;
             counter++;
         }
         int amountOfBits = counter - 1;
         int cod = dataSensors[i] >> 13;
         uint controlBit = dataSensors[i] & firstMask;
         uint val = (dataSensors[i] & secondMask) >> 1;
         if ((amountOfBits % 2 == 0 && controlBit == 0) || (amountOfBits % 2 != 0 && controlBit == 1))
         {
             resultParse[i] = new SensorData(Convert.ToUInt16(cod), Convert.ToUInt16(val), Convert.ToUInt16(controlBit));
         }
         else
         {
             Console.WriteLine("Данные {0} со счетчика {1} повреждены", dataSensors[i], cod);
         }
     }
     return resultParse;
 }
开发者ID:AlinaKulishdp,项目名称:ISD-courses,代码行数:29,代码来源:BitOperations.cs

示例3: SensorClientData

 public SensorClientData(SensorInfo ci, SensorData sd)
 {
     this.SensorId = ci.SensorId.ToString();
     this.Lat = ci.Lat;
     this.Lng = ci.Lng;
     this.Name = ci.Name;
     this.Organization = ci.Organization;
     this.Humidity = sd.Humidity;
     this.Temperature = sd.Temperature;
 }
开发者ID:uffebjorklund,项目名称:HackZurich,代码行数:10,代码来源:SensorClientData.cs

示例4: getMessage

 private void getMessage()
 {
     while (true) {
         NetworkStream stream = _clientSocket.GetStream ();
         BinaryFormatter formatter = new BinaryFormatter ();
         object obj = formatter.Deserialize (stream);
         SensorData data = (SensorData)obj;
         //Console.WriteLine (data.BottomLeft + " - " + data.BottomoRight + " - " + data.TopLeft + " - " + data.TopRight);
         _data = (SensorData)obj;
     }
 }
开发者ID:simonmoosbrugger,项目名称:SmartChair,代码行数:11,代码来源:GameController.cs

示例5: SquaredDistanceFrom

        public override double SquaredDistanceFrom(SensorData other)
        {
            other.GetType();
            var otherSensor = other as WlanSensorData;

            if (!BusinessEquals(otherSensor, false))
                return 1d;

            Debug.Assert(otherSensor != null, "otherSensor != null");
            return Math.Pow(SignalStrength - otherSensor.SignalStrength, 2);
        }
开发者ID:andrea-rockt,项目名称:Jarvis.Service,代码行数:11,代码来源:WlanSensorData.cs

示例6: UpdateUI

        private void UpdateUI(SensorData.Vector reading)
        {
            ScenarioOutput_X.Text = String.Format("{0,5:0.00}", reading.X);
            ScenarioOutput_Y.Text = String.Format("{0,5:0.00}", reading.Y);
            ScenarioOutput_Z.Text = String.Format("{0,5:0.00}", reading.Z);

            // Show the values graphically
            xLine.X2 = xLine.X1 + reading.X * 100;
            yLine.Y2 = yLine.Y1 - reading.Y * 100;
            zLine.X2 = zLine.X1 - reading.Z * 50;
            zLine.Y2 = zLine.Y1 + reading.Z * 50;
        }
开发者ID:henriquetomaz,项目名称:win8-samples,代码行数:12,代码来源:Scenario1.xaml.cs

示例7: OnWeatherData

        public async Task OnWeatherData(SensorData data)
        {
            if (this.SensorInfo == null) return;
            var o = new SensorClientData(this.SensorInfo, data);

            //Tell monitors about the new data (not the sensors)
            await this.InvokeTo<Monitor>(p => p.ClientType == ClientType.Monitor && p.TempThreshold < o.Temperature, o, "wd");

            await this.ScaleOut(o, "swd");

            //Store data on Azure Storage
            await this.StorageSet(o.SensorId, o);
        }
开发者ID:uffebjorklund,项目名称:HackZurich,代码行数:13,代码来源:Sensor.data.cs

示例8: UpdateUI

        private void UpdateUI(SensorData.Vector reading)
        {
            statusTextBlock.Text = "Receiving data from accelerometer...";

            // Show the numeric values
            xTextBlock.Text = "X: " + reading.X.ToString("0.00");
            yTextBlock.Text = "Y: " + reading.Y.ToString("0.00");
            zTextBlock.Text = "Z: " + reading.Z.ToString("0.00");

            // Show the values graphically
            xLine.X2 = xLine.X1 + reading.X * 100;
            yLine.Y2 = yLine.Y1 - reading.Y * 100;
            zLine.X2 = zLine.X1 - reading.Z * 50;
            zLine.Y2 = zLine.Y1 + reading.Z * 50;            
        }
开发者ID:henriquetomaz,项目名称:win8-samples,代码行数:15,代码来源:AccelerometerPage.xaml.cs

示例9: test

        /// <summary>
        /// Tests for the lineparser format. Additionally it looks for the header row and 
        /// trys to determine the third value seperated by semicolom.
        /// </summary>
        /// <param name="line">The line to parse</param>
        /// <returns>True is successful</returns>
        /// <exception cref="LineparserException">If no linematcher is set</exception>
        public override bool test(string line)
        {
            // Is header line?
            if (line.IndexOf("Date;Time;") != -1)
            {
                // Split header line by semicolom.
                String[] splits = line.Split(';');
                if (splits.Length != 3)
                {
                    return false;
                }

                // set additional value
                SensorData tValue = (SensorData)Enum.Parse(typeof(SensorData), splits[splits.Length - 1]);
                this.extraValue = tValue;

                // set supported values
                SensorData[] t = { SensorData.Date, tValue };
                this.SupportedValues = t;
            }

            // run the actual test
            return base.test(line);
        }
开发者ID:JJasonWang40,项目名称:motion-sensor-analysis-package,代码行数:31,代码来源:RExportedLineParser.cs

示例10: GetForegroundAlphaFrame

        private static bool GetForegroundAlphaFrame(SensorData sensorData, bool bLimitedUsers, ICollection<int> alTrackedIndexes, ref byte[] fgAlphaFrame)
        {
            if (sensorData == null || sensorData.bodyIndexImage == null)
                return false;

            CvMat cvAlphaMap = new CvMat(sensorData.depthImageHeight, sensorData.depthImageWidth, MatrixType.U8C1);

            System.IntPtr rawPtrAlpha;
            cvAlphaMap.GetRawData(out rawPtrAlpha);

            if (sensorData.selectedBodyIndex != 255 || bLimitedUsers)
            {
                // copy body-index selectively
                byte btSelBI = sensorData.selectedBodyIndex;
                int iBodyIndexLength = sensorData.bodyIndexImage.Length;

                for (int i = 0; i < iBodyIndexLength; i++)
                {
                    byte btBufBI = sensorData.bodyIndexImage[i];

                    bool bUserTracked = btSelBI != 255 ? btSelBI == btBufBI :
                        (btBufBI != 255 ? alTrackedIndexes.Contains((int)btBufBI) : false);

                    if (bUserTracked)
                    {
                        cvAlphaMap.Set1D(i, btBufBI);
                    }
                    else
                    {
                        cvAlphaMap.Set1D(i, 255);
                    }
                }
            }
            else
            {
                // copy the entire body-index buffer
                Marshal.Copy(sensorData.bodyIndexImage, 0, rawPtrAlpha, sensorData.bodyIndexImage.Length);
            }

            // make the image b&w
            cvAlphaMap.Threshold(cvAlphaMap, 254, 255, ThresholdType.BinaryInv);

            // apply erode, dilate and blur
            cvAlphaMap.Erode(cvAlphaMap);
            cvAlphaMap.Dilate(cvAlphaMap);
            cvAlphaMap.Smooth(cvAlphaMap, SmoothType.Blur, 5, 5);
            //cvAlphaMap.Smooth(cvAlphaMap, SmoothType.Median, 7);

            // get the foreground image
            Marshal.Copy(rawPtrAlpha, fgAlphaFrame, 0, fgAlphaFrame.Length);

            return true;
        }
开发者ID:BrainProject,项目名称:UnityTemp,代码行数:53,代码来源:KinectInterop.cs

示例11: CloseSensor

        // closes opened readers and closes the sensor
        public static void CloseSensor(SensorData sensorData)
        {
            if (sensorData != null && sensorData.sensorInterface != null)
            {
                sensorData.sensorInterface.CloseSensor(sensorData);
            }

            if (sensorData.bodyIndexBuffer != null)
            {
                sensorData.bodyIndexBuffer.Release();
                sensorData.bodyIndexBuffer = null;
            }

            if (sensorData.depthImageBuffer != null)
            {
                sensorData.depthImageBuffer.Release();
                sensorData.depthImageBuffer = null;
            }

            if (sensorData.depthHistBuffer != null)
            {
                sensorData.depthHistBuffer.Release();
                sensorData.depthHistBuffer = null;
            }

            if (sensorData.depth2ColorBuffer != null)
            {
                sensorData.depth2ColorBuffer.Release();
                sensorData.depth2ColorBuffer = null;
            }
        }
开发者ID:BrainProject,项目名称:UnityTemp,代码行数:32,代码来源:KinectInterop.cs

示例12: MapDepthFrameToColorCoords

	// estimates color-map coordinates for the current depth frame
	public static bool MapDepthFrameToColorCoords(SensorData sensorData, ref Vector2[] vColorCoords)
	{
		bool bResult = false;

		if(sensorData.sensorInterface != null)
		{
			bResult = sensorData.sensorInterface.MapDepthFrameToColorCoords(sensorData, ref vColorCoords);
		}

		return bResult;
	}
开发者ID:ly774508966,项目名称:IUILab_Lecture_KinectAndOculusWithUnity3D,代码行数:12,代码来源:KinectInterop.cs

示例13: MapDepthPointToColorCoords

	// returns color-map coordinates for the given depth point
	public static Vector2 MapDepthPointToColorCoords(SensorData sensorData, Vector2 depthPos, ushort depthVal)
	{
		Vector2 vPoint = Vector2.zero;

		if(sensorData.sensorInterface != null)
		{
			vPoint = sensorData.sensorInterface.MapDepthPointToColorCoords(sensorData, depthPos, depthVal);
		}

		return vPoint;
	}
开发者ID:ly774508966,项目名称:IUILab_Lecture_KinectAndOculusWithUnity3D,代码行数:12,代码来源:KinectInterop.cs

示例14: GetForegroundFrameRect

        // returns the foregound frame rectangle, as to the required resolution
        public static Rect GetForegroundFrameRect(SensorData sensorData, bool isHiResPrefered)
        {
            if (isHiResPrefered && sensorData != null && sensorData.sensorInterface != null)
            {
                if (sensorData.sensorInterface.IsBRHiResSupported() && sensorData.colorImage != null)
                {
                    return new Rect(0f, 0f, sensorData.colorImageWidth, sensorData.colorImageHeight);
                }
            }

            return sensorData != null ? new Rect(0f, 0f, sensorData.depthImageWidth, sensorData.depthImageHeight) : new Rect();
        }
开发者ID:BrainProject,项目名称:UnityTemp,代码行数:13,代码来源:KinectInterop.cs

示例15: OnMeasurementCompleteEvent

 //    public static EventHandler<SensorData> MeasurementComplete;
 /// <summary>
 /// Raises the <see cref="MeasurementComplete"/> event.
 /// </summary>
 /// <param name="sender">The object that raised the event.</param>
 /// <param name="sensorData">The <see cref="SensorData"/> object that contains the results of the measurement.</param>
 public void OnMeasurementCompleteEvent(Magnetometer sender, SensorData sensorData)
 {
     if (_OnMeasurementComplete == null)
         _OnMeasurementComplete = OnMeasurementCompleteEvent;
 }
开发者ID:gitsoll,项目名称:MinIMU-9-Gyro-C--,代码行数:11,代码来源:Magnetometer.cs


注:本文中的SensorData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。