• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ISensor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SensorNode

        public SensorNode(ISensor sensor, PersistentSettings settings, 
            UnitManager unitManager)
            : base()
        {
            this.sensor = sensor;
              this.settings = settings;
              this.unitManager = unitManager;
              switch (sensor.SensorType) {
            case SensorType.Voltage: format = "{0:F3} V"; break;
            case SensorType.Clock: format = "{0:F0} MHz"; break;
            case SensorType.Load: format = "{0:F1} %"; break;
            case SensorType.Temperature: format = "{0:F1} °C"; break;
            case SensorType.Fan: format = "{0:F0} RPM"; break;
            case SensorType.Flow: format = "{0:F0} L/h"; break;
            case SensorType.Control: format = "{0:F1} %"; break;
            case SensorType.Level: format = "{0:F1} %"; break;
            case SensorType.Power: format = "{0:F1} W"; break;
            case SensorType.Data: format = "{0:F1} GB"; break;
            case SensorType.Factor: format = "{0:F3}"; break;
            case SensorType.DataRate: format = "{0:bf}/s"; break;
              }

              bool hidden = settings.GetValue(new Identifier(sensor.Identifier,
            "hidden").ToString(), sensor.IsDefaultHidden);
              base.IsVisible = !hidden;

              this.Plot = settings.GetValue(new Identifier(sensor.Identifier,
            "plot").ToString(), false);
        }
开发者ID:sbkxiaobai,项目名称:open-hardware-monitor,代码行数:29,代码来源:SensorNode.cs


示例2: OpenerDevice

		/// <summary>
		/// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Devices.Access.OpenerDevice"/>
		/// class with the relay, sensor, and the sensor state that indicates
		/// that the opener has opened.
		/// </summary>
		/// <param name="relay">
		/// The relay that controls the opener.
		/// </param>
		/// <param name="sensor">
		/// The reading the state of the opener.
		/// </param>
		/// <param name="openState">
		/// The sensor state that indicates the opener has opened.
		/// </param>
		public OpenerDevice(IRelay relay, ISensor sensor, SensorState openState)
			: base() {
			this._relay = relay;
			this._sensor = sensor;
			this._openState = openState;
			this._sensor.StateChanged += this.OnSensorStateChanged;
		}
开发者ID:cyrusbuilt,项目名称:MonoPi,代码行数:21,代码来源:OpenerDevice.cs


示例3: Control

        public Control(ISensor sensor, ISettings settings, float minSoftwareValue,
            float maxSoftwareValue)
        {
            this.identifier = new Identifier(sensor.Identifier, "control");
              this.settings = settings;
              this.minSoftwareValue = minSoftwareValue;
              this.maxSoftwareValue = maxSoftwareValue;

              if (!float.TryParse(settings.GetValue(
              new Identifier(identifier, "value").ToString(), "0"),
            NumberStyles.Float, CultureInfo.InvariantCulture,
            out this.softwareValue))
              {
            this.softwareValue = 0;
              }
              int mode;
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "mode").ToString(),
              ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out mode))
              {
            this.mode = ControlMode.Default;
              } else {
            this.mode = (ControlMode)mode;
              }
        }
开发者ID:Ryks,项目名称:open-hardware-monitor,代码行数:27,代码来源:Control.cs


示例4: RemoveInfo

        public override void RemoveInfo(ISensor sensor)
        {
            if (!(sensor is WiFiSensor))
            {
                if (sensor != null)
                {
                    throw new SensorDifferentException("Not able to calculate distance between differents Sensor");
                }
                throw new NullReferenceException();
            }
            var wiFisensor = (WiFiSensor) sensor;

            double bestproximity=0.0;
            double tmpproximity;
            WiFiNetworkSet networkSet=null;
            if (Datasets.Count == 1) throw new SensorDatasetException("Sensor "+ Id.ToString() + "has one only Dataset. It does not make sense to remove it.");
            foreach (var dataset in Datasets)
                if ((tmpproximity = dataset.GetDistance(wiFisensor.Datasets.First())) > bestproximity)
                {
                    bestproximity = tmpproximity;
                    networkSet = dataset;
                }
            Datasets.Remove(networkSet);
            networkSet.Sensor = null;
        }
开发者ID:ecanzonieri,项目名称:JimbeSoftware,代码行数:25,代码来源:WiFiSensor.cs


示例5: Translate

        private static Camera Translate(this Camera camera, ISensor sensor, double moveFactor, double zoomFactor, double rotationFactor, double tiltFactor)
        {
            var x = sensor.Translation.X;
            var y = -sensor.Translation.Z;
            var move = sensor.Translation.Length;
            var zoom = sensor.Translation.Y;
            var rotation = -Math.Sign(sensor.Rotation.Y) * sensor.Rotation.Angle;
            var tilt = sensor.Rotation.X;

            //Rotate
            var rotation1 = rotation * rotationFactor;
            var rotation2 = rotation1 < 0 && camera.Heading < 0.1 ? 359.5 : rotation1;
            var camera1 = camera.Rotate(rotation2, 0);

            //Zoom
            var deltaAltitude = zoom * camera1.Location.Z * zoomFactor;
            var camera2 = camera1.Elevate(deltaAltitude);

            //Move
            var azimuth1 = Math.Atan(y / x) / Math.PI * 180;
            var azimuth2 = x > 0 ? 90 - azimuth1 : x < 0 ? 270 - azimuth1 : y >= 0 ? 0 : 180;
            var azimuth3 = (azimuth2 + camera2.Heading) % 360;
            var point1 = camera2.Location;
            var point2 = GeometryEngine.GeodesicMove(point1, point1.Z * move * moveFactor, LinearUnits.Meters, azimuth3);
            var point3 = new MapPoint(point2.X, point2.Y, point1.Z + deltaAltitude);
            var camera3 = camera2.SetLocation(point3);

            //Tilt
            var pitch1 = camera3.Pitch + tilt * tiltFactor;
            var pitch2 = pitch1 < 0 ? 0 : (pitch1 > 180 ? 180 : pitch1);
            var camera4 = camera3.SetPitch(pitch2);

            return camera4;
        }
开发者ID:jshirota,项目名称:EsriNetSpaceNavigator,代码行数:34,代码来源:SpaceNavigator.cs


示例6: IoTHub

 public IoTHub(ISensor[] sensors, int sampleRateMilliseconds = 2000)
 {
     this.sensors = sensors;
     this.sampleRateMilliseconds = sampleRateMilliseconds;
     StartMeasuringAsync();
    
 }
开发者ID:faister,项目名称:IoT-Maker-Den-Windows-for-IoT,代码行数:7,代码来源:IoTHub.cs


示例7: Parameter

 public Parameter(ParameterDescription description, ISensor sensor)
 {
     this.sensor = sensor;
       this.description = description;
       this.isDefault = true;
       this.value = description.DefaultValue;
 }
开发者ID:TwistedMexi,项目名称:CudaManager,代码行数:7,代码来源:Parameter.cs


示例8: Control

        public Control(ISensor sensor, ISettings settings, float minSoftwareValue,
            float maxSoftwareValue)
        {
            this.identifier = new Identifier(sensor.Identifier, "control");
              this.settings = settings;
              this.minSoftwareValue = minSoftwareValue;
              this.maxSoftwareValue = maxSoftwareValue;
              //fan add
              this.sensorType = sensor.SensorType;

              float softValue = 0;
              if (!float.TryParse(settings.GetValue(
              new Identifier(identifier, "value").ToString(), "-a"),
            NumberStyles.Float, CultureInfo.InvariantCulture,
            out softValue)){
              this.softwareValue = 0;
              if (this.sensorType.Equals(SensorType.TinyFanControl))
              this.SoftwareValue = 50; //init value(when .config was not exist)
              }
              else
              this.softwareValue = softValue;
              int mode;
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "mode").ToString(),
              ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out mode))
              {
            this.mode = ControlMode.Default;
              } else {
            this.mode = (ControlMode)mode;
              }
              int fanMode;
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "fanMode").ToString(),
              ((int)FanMode.Pin4).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out fanMode))
              {
              this.fanMode = FanMode.Pin4;
              }
              else
              {
              this.fanMode = (FanMode)fanMode;
              }
              int fanFollow;//again
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "fanFollow").ToString(),
              ((int)FanFollow.NONE).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out fanFollow))
              {
              this.fanFollow = FanFollow.NONE;
              }
              else
              {
              this.fanFollow = (FanFollow)fanFollow;
              }
        }
开发者ID:fkpwolf,项目名称:tinyFan,代码行数:59,代码来源:Control.cs


示例9: VisitSensor

 public void VisitSensor(ISensor sensor)
 {
     if (sensor.SensorType == SensorType.Temperature)
     {
         Logger.Warn($"{sensor.Identifier} : {sensor.Name} : {sensor.Value}");
         Console.WriteLine($"{sensor.Identifier} : {sensor.Name} : {sensor.Value}");
     }
 }
开发者ID:botanik,项目名称:lessons,代码行数:8,代码来源:DataVisitor.cs


示例10: HardwareSensorAdded

    private void HardwareSensorAdded(ISensor data) {
      Sensor sensor = new Sensor(data);
      activeInstances.Add(sensor);

      try {
        Instrumentation.Publish(sensor);
      } catch (Exception) { }
    }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:8,代码来源:WmiProvider.cs


示例11: Update

        private static async void Update(this SceneView sceneView, ISensor sensor, double moveFactor, double zoomFactor, double rotationFactor, double tiltFactor)
        {
            if (sceneView?.Camera == null)
                return;

            var camera = sceneView.Camera.Translate(sensor, moveFactor, zoomFactor, rotationFactor, tiltFactor);
            await sceneView.SetViewAsync(camera, TimeSpan.MinValue);
        }
开发者ID:jshirota,项目名称:EsriNetSpaceNavigator,代码行数:8,代码来源:SpaceNavigator.cs


示例12: Main

	  public static void Main(string[] args)
	  {
	    object sensorLock = new object();
	    bool run = true;
	    ISensor[] sensor = new ISensor[4];
	    for (int i = 0; i < 4; i++)
	    {
	      sensor[i] = null;
	    }
	    using (SensorListner listner = new SensorListner())
	    {
	      listner.SensorAttached += delegate(ISensor obj)
	      {
	        lock (sensorLock)
	        {
	          if (obj != null)
	          {
	            sensor[(int) obj.Port] = obj;
	            Console.WriteLine(obj.GetSensorName() + " attached on " + obj.Port);
	          }
	        }
	      };
	      listner.SensorDetached += delegate(SensorPort obj)
	      {
	        lock (sensorLock)
	        {
	          Console.WriteLine(sensor[(int) obj] + " detached from " + obj);
	          sensor[(int) obj] = null;
	        }
	      };
	      ButtonEvents buts = new ButtonEvents();
	      buts.EscapePressed += delegate
	      {
	        run = false;
	      };
	      while (run)
	      {

	        lock (sensorLock)
	        {

	          /*for (int i = 0; i < sensor.Length; i++) {
						if (sensor[i] != null) {
							typeLabel [i].Text = sensor[i].GetSensorName ();
							modeLabel [i].Text = sensor[i].SelectedMode ();
							valueLabel[i].Text = sensor[i].ReadAsString ();
						} else {
							typeLabel [i].Text = "Not connected";
							modeLabel [i].Text = "-";
							valueLabel [i].Text = "-";
						}
					}*/
	        }
	        System.Threading.Thread.Sleep(1000);
	      }
	    }
	  }
开发者ID:Sirokujira,项目名称:ET2015_MonoBrick,代码行数:57,代码来源:Program.cs


示例13: SensorAdded

    private void SensorAdded(ISensor sensor) {
      if (sensors == null)
        return;

      for (int i = 0; i < sensors.Length; i++) {
        if (sensor.Identifier.ToString() == identifiers[i])
          sensors[i] = sensor;
      }
    }
开发者ID:jwolfm98,项目名称:HardwareMonitor,代码行数:9,代码来源:Logger.cs


示例14: GetCurrentData

        public String GetCurrentData(ISensor baseSensor, out int samples)
        {
            Sensor<float> sensor = (Sensor<float>)baseSensor;

            float[] data = sensor.GetData(255);
            samples = data.Length;

            return String.Format("{0:0.000}", data.Last());
        }
开发者ID:Faham,项目名称:emophiz,代码行数:9,代码来源:XnaAudioTestDevice.cs


示例15: SensorRemoved

    private void SensorRemoved(ISensor sensor) {
      if (sensors == null)
        return;

      for (int i = 0; i < sensors.Length; i++) {
        if (sensor == sensors[i])
          sensors[i] = null;
      }
    }
开发者ID:jwolfm98,项目名称:HardwareMonitor,代码行数:9,代码来源:Logger.cs


示例16: GetCurrentData

        public String GetCurrentData(ISensor baseSensor, out int samples)
        {
            Sensor<EyeData> sensor = (Sensor<EyeData>)baseSensor;

            EyeData[] data = sensor.GetData(255);
            samples = data.Length;

            return String.Format("{0:0.000}", data.Last().left.eyePos.X);
        }
开发者ID:Faham,项目名称:emophiz,代码行数:9,代码来源:EyeTrackerTestDevice.cs


示例17: InsertSorted

 private void InsertSorted(Node node, ISensor sensor) {
   int i = 0;
   while (i < node.Nodes.Count &&
     ((SensorNode)node.Nodes[i]).Sensor.Index < sensor.Index)
     i++;
   SensorNode sensorNode = new SensorNode(sensor, settings, unitManager);
   sensorNode.PlotSelectionChanged += SensorPlotSelectionChanged;
   node.Nodes.Insert(i, sensorNode);
 }
开发者ID:AndrewTPohlmann,项目名称:open-hardware-monitor,代码行数:9,代码来源:HardwareNode.cs


示例18: Register

        /// <summary>
        /// Registers a hardware sensor with the sensor engine, ensuring that it is
        /// updated as the game runs.
        /// </summary>
        /// <param name="sensor">The hardware sensor to register.</param>
        public void Register(ISensor sensor)
        {
            if (sensor == null)
            {
                throw new ArgumentNullException(nameof(sensor));
            }

            _sensors.Add(sensor);
        }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:14,代码来源:DefaultSensorEngine.cs


示例19: Deregister

        /// <summary>
        /// Deregisters a hardware sensor from the sensor engine, ensuring that it is
        /// no longer updated as the game runs.
        /// </summary>
        /// <param name="sensor">The hardware sensor to deregister.</param>
        public void Deregister(ISensor sensor)
        {
            if (sensor == null)
            {
                throw new ArgumentNullException(nameof(sensor));
            }

            _sensors.Remove(sensor);
        }
开发者ID:RedpointGames,项目名称:Protogame,代码行数:14,代码来源:DefaultSensorEngine.cs


示例20: GetCurrentData

        public String GetCurrentData(ISensor baseSensor, out int samples)
        {
            Sensor<BrainData> sensor = (Sensor<BrainData>)baseSensor;

            BrainData[] data = sensor.GetData(255);
            samples = data.Length;

            return String.Format("{0:0.000}", data.Last().signal);
        }
开发者ID:Faham,项目名称:emophiz,代码行数:9,代码来源:MindsetTestDevice.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ISeq类代码示例发布时间:2022-05-24
下一篇:
C# ISender类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap