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


C# SensorType类代码示例

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


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

示例1: GetUnit

        private static string GetUnit(SensorType type, byte scale)
        {
            var tankCapacityUnits = new[] { "l", "cbm", "gal" };
            var distanceUnits = new [] { "m", "cm", "ft" };

            switch (type)
            {
                case SensorType.Temperature: return(scale == 1 ? "°F" : "°C");
                case SensorType.General: return (scale == 1 ? "" : "%");
                case SensorType.Luminance: return(scale == 1 ? "lux" : "%");
                case SensorType.Power: return(scale == 1 ? "BTU/h" : "W");
                case SensorType.RelativeHumidity: return("%");
                case SensorType.Velocity: return(scale == 1 ? "mph" : "m/s");
                case SensorType.Direction: return("");
                case SensorType.AtmosphericPressure: return(scale == 1 ? "inHg" : "kPa");
                case SensorType.BarometricPressure: return(scale == 1 ? "inHg" : "kPa");
                case SensorType.SolarRadiation: return("W/m2");
                case SensorType.DewPoint: return(scale == 1 ? "in/h" : "mm/h");
                case SensorType.RainRate: return(scale == 1 ? "F" : "C");
                case SensorType.TideLevel: return(scale == 1 ? "ft" : "m");
                case SensorType.Weight: return(scale == 1 ? "lb" : "kg");
                case SensorType.Voltage: return(scale == 1 ? "mV" : "V");
                case SensorType.Current: return(scale == 1 ? "mA" : "A");
                case SensorType.CO2: return("ppm");
                case SensorType.AirFlow: return(scale == 1 ? "cfm" : "m3/h");
                case SensorType.TankCapacity: return(tankCapacityUnits[scale]);
                case SensorType.Distance: return(distanceUnits[scale]);
                default: return string.Empty;
            }
        }
开发者ID:roblans,项目名称:ZWave4Net,代码行数:30,代码来源:SensorMultiLevelReport.cs

示例2: Sensor

   public Sensor(string name, int index, SensorType sensorType,
 Hardware hardware, ParameterDescription[] parameterDescriptions, 
 ISettings settings)
       : this(name, index, false, sensorType, hardware,
   parameterDescriptions, settings)
   {
   }
开发者ID:adamsp,项目名称:beastmon,代码行数:7,代码来源:Sensor.cs

示例3: SimulateDeviceDataTransmission

        private static void SimulateDeviceDataTransmission(SensorType type, string topic, string deviceId)
        {
            int value = Random.Next(1, Math.Min(120, 100 + (_count/25)));

            if (value%13 == 0)
            {
                value = value/2;
            }
            else if (value%17 == 0)
            {
                value = value*2;
            }

            var payload =
                Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(
                    new SensorData
                    {
                        Value = value.ToString(),
                        DeviceId = deviceId,
                        Type = type
                    }));

            Client.Publish(topic, payload,
                MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE,
                true);
        }
开发者ID:ryanrdl,项目名称:mqtt-rabbitmq-nservicebus-signalr,代码行数:26,代码来源:Program.cs

示例4: Sensor

        public Sensor(string name, int index, bool defaultHidden, 
            SensorType sensorType, Hardware hardware,
            ParameterDescription[] parameterDescriptions, ISettings settings)
        {
            this.index = index;
              this.defaultHidden = defaultHidden;
              this.sensorType = sensorType;
              this.hardware = hardware;
              Parameter[] parameters = new Parameter[parameterDescriptions == null ?
            0 : parameterDescriptions.Length];
              for (int i = 0; i < parameters.Length; i++ )
            parameters[i] = new Parameter(parameterDescriptions[i], this, settings);
              this.parameters = parameters;

              this.settings = settings;
              this.defaultName = name;
              this.name = settings.GetValue(
            new Identifier(Identifier, "name").ToString(), name);

              GetSensorValuesFromSettings();

              hardware.Closing += delegate(IHardware h) {
            SetSensorValuesToSettings();
              };
        }
开发者ID:AlexVallat,项目名称:openhardwaremonitor,代码行数:25,代码来源:Sensor.cs

示例5: GradientChanger

 public GradientChanger(SensorManager sensorManager, SensorType sensorType, AbsoluteLayout layout)
 {
     this._sensorManager = sensorManager;
     this._sensorType = sensorType;
     _layout = layout;
     this.StartListening();
 }
开发者ID:flozi76,项目名称:Android,代码行数:7,代码来源:GradientChanger.cs

示例6: 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

示例7: TypeNode

        public TypeNode(SensorType sensorType)
            : base()
        {
            this.sensorType = sensorType;

              switch (sensorType) {
            case SensorType.Voltage:
              this.Image = Utilities.EmbeddedResources.GetImage("voltage.png");
              this.Text = "电压";
              break;
            case SensorType.Clock:
              this.Image = Utilities.EmbeddedResources.GetImage("clock.png");
              this.Text = "频率";
              break;
            case SensorType.Load:
              this.Image = Utilities.EmbeddedResources.GetImage("load.png");
              this.Text = "负载";
              break;
            case SensorType.Temperature:
              this.Image = Utilities.EmbeddedResources.GetImage("temperature.png");
              this.Text = "温度";
              break;
            case SensorType.Fan:
              this.Image = Utilities.EmbeddedResources.GetImage("fan.png");
              this.Text = "风扇";
              break;
            case SensorType.Flow:
              this.Image = Utilities.EmbeddedResources.GetImage("flow.png");
              this.Text = "Flows";
              break;
            case SensorType.Control:
              this.Image = Utilities.EmbeddedResources.GetImage("control.png");
              this.Text = "控制台";
              break;
            case SensorType.TinyFanControl:
              this.Image = Utilities.EmbeddedResources.GetImage("control.png");
              this.Text = "控制台";
              break;
            case SensorType.Level:
              this.Image = Utilities.EmbeddedResources.GetImage("level.png");
              this.Text = "Levels";
              break;
            case SensorType.Power:
              this.Image = Utilities.EmbeddedResources.GetImage("power.png");
              this.Text = "功率";
              break;
            case SensorType.Data:
              this.Image = Utilities.EmbeddedResources.GetImage("data.png");
              this.Text = "Data";
              break;
            case SensorType.Factor:
              this.Image = Utilities.EmbeddedResources.GetImage("factor.png");
              this.Text = "Factors";
              break;
              }

              NodeAdded += new NodeEventHandler(TypeNode_NodeAdded);
              NodeRemoved += new NodeEventHandler(TypeNode_NodeRemoved);
        }
开发者ID:fkpwolf,项目名称:tinyFan,代码行数:59,代码来源:TypeNode.cs

示例8: AndroidSensorListener

 public AndroidSensorListener(SensorType sensorType, SensorDelay sensorDelay, Action<SensorStatus> sensorAccuracyChangedCallback, Action<SensorEvent> sensorValueChangedCallback)
 {
     _sensorType = sensorType;
     _sensorDelay = sensorDelay;
     _sensorAccuracyChangedCallback = sensorAccuracyChangedCallback;
     _sensorValueChangedCallback = sensorValueChangedCallback;
     _listening = false;
 }
开发者ID:trishalaneeraj,项目名称:sensus,代码行数:8,代码来源:AndroidSensorListener.cs

示例9: CreateVideoStream

 public VideoStream CreateVideoStream(SensorType sensorType)
 {
     if (!this.isValid)
         return null;
     if (!VideoStreams_Cache.ContainsKey(sensorType))
         VideoStreams_Cache[sensorType] = VideoStream.Private_Create(this, sensorType);
     return VideoStreams_Cache[sensorType];
 }
开发者ID:npapadop,项目名称:NiWrapper.Net,代码行数:8,代码来源:Device.cs

示例10: CollisionSensor

 public CollisionSensor(CollisionBox linkedCollisionBox, SensorType sensorType, int sensorDepth)
     : base(0, 0, Vector2.Zero, Color.Blue)
 {
     this.linkedCollisionBox = linkedCollisionBox;
     this.sensorType = sensorType;
     this.sensorDepth = sensorDepth;
     SetSensorDetails();
 }
开发者ID:amckendry,项目名称:FinalYearProject,代码行数:8,代码来源:CollisionSensor.cs

示例11: UpdateValue

        private void UpdateValue(Device sd, ZibaseDll.ZiBase.SensorInfo si, SensorType st)
        {
            DeviceValue dv = null;

            var q = sd.Values.Where(x => x.ValueType == st);
            if (q.Any())
            {
                dv = q.First();
                dv.Value = si.sHTMLValue;

                if (st == SensorType.ENERGY_KW || st == SensorType.ENERGY_KWH)
                {
                    String[] splitted = si.sValue.Split(new char[] { ' ' });
                    if (splitted.Length == 2)
                    {
                        float val = Convert.ToSingle(dv.Value,System.Globalization.CultureInfo.InvariantCulture); // Convert.ToInt32(splitted[0]);
                        //val /= 1000.0F;
                        dv.DisplayValue = val + " " + splitted[1];
                    }
                }
                else
                    dv.DisplayValue = si.sValue;
            }
            else
            {
                dv = new DeviceValue {Value = si.sHTMLValue, ValueType = st};
                if (st == SensorType.ENERGY_KW || st == SensorType.ENERGY_KWH)
                {
                    String[] splitted = si.sValue.Split(new char[] { ' ' });
                    if (splitted.Length == 2)
                    {
                        //float val = Convert.ToInt32(splitted[0]);
                        //val /= 1000.0F;
                        float val = Convert.ToSingle(dv.Value, System.Globalization.CultureInfo.InvariantCulture); // Convert.ToInt32(splitted[0]);
                        dv.DisplayValue = val + " " + splitted[1];
                    }
                }
                else
                    dv.DisplayValue = si.sValue;
                sd.Values.Add(dv);
            }

            // if no HSDevice associated,look for the current device in HS
            // IOMisc contains the ID followed by the SensorType
            if (dv.HSDevice == null)
            {
                var q2 = HSDevice.Where(x => x.iomisc.Contains(si.sID) && x.iomisc.Contains(st.ToString()));

                if (q2.Any())
                {
                    dv.AlreadyInHS = true;
                    dv.HSDevice = q2.First();
                }
            }
            dv.DwValue = si.dwValue;
            dv.HSUpdate();
        }
开发者ID:BGCX261,项目名称:zibase-homeseer-plugin-svn-to-git,代码行数:57,代码来源:SensorDataManager.cs

示例12: SmartAttribute

 /// <summary>
 /// Initializes a new instance of the <see cref="SmartAttribute"/> class.
 /// </summary>
 /// <param name="identifier">The SMART identifier of the attribute.</param>
 /// <param name="name">The name of the attribute.</param>
 /// <param name="rawValueConversion">A delegate for converting the raw byte 
 /// array into a value (or null to use the attribute value).</param>
 /// <param name="sensorType">Type of the sensor or null if no sensor is to 
 /// be created.</param>
 /// <param name="sensorChannel">If there exists more than one attribute with 
 /// the same sensor channel and type, then a sensor is created only for the  
 /// first attribute.</param>
 /// <param name="defaultHiddenSensor">True to hide the sensor initially.</param>
 public SmartAttribute(byte identifier, string name,
     RawValueConversion rawValueConversion, SensorType? sensorType,
     int sensorChannel, bool defaultHiddenSensor = false)
 {
     this.Identifier = identifier;
       this.Name = name;
       this.rawValueConversion = rawValueConversion;
       this.SensorType = sensorType;
       this.SensorChannel = sensorChannel;
       this.DefaultHiddenSensor = defaultHiddenSensor;
 }
开发者ID:pklinef,项目名称:open-hardware-monitor,代码行数:24,代码来源:SmartAttribute.cs

示例13: SensorMultiLevelReport

        internal SensorMultiLevelReport(Node node, byte[] payload) : base(node)
        {
            if (payload == null)
                throw new ArgumentNullException(nameof(payload));
            if (payload.Length < 3)
                throw new ReponseFormatException($"The response was not in the expected format. {GetType().Name}: Payload: {BitConverter.ToString(payload)}");

            Type = (SensorType)payload[0];
            Value = PayloadConverter.ToFloat(payload.Skip(1).ToArray(), out Scale);
            Unit = GetUnit(Type, Scale);
        }
开发者ID:roblans,项目名称:ZWave4Net,代码行数:11,代码来源:SensorMultiLevelReport.cs

示例14: SensorInfoImpl

        public SensorInfoImpl(int aId, string aName, SensorType aSensorType, SensorSide aSide, double aShift)
        {
            if (string.IsNullOrEmpty(aName)) {
                throw new ArgumentNullException("aName");
            }

            id = aId;
            name = aName;
            sType = aSensorType;
            side = aSide;
            shift = aShift;
        }
开发者ID:desla,项目名称:SlabGeometryControl,代码行数:12,代码来源:SensorInfoImpl.cs

示例15: GetImageArray

        public object GetImageArray(Bitmap bmp, SensorType sensorType, LumaConversionMode conversionMode)
        {
            this.imageWidth = bmp.Width;
            this.imageHeight = bmp.Height;

            if (sensorType == SensorType.Monochrome)
                return NativeHelpers.GetMonochromePixelsFromBitmap(bmp, conversionMode);
            else if (sensorType == SensorType.Color)
                return NativeHelpers.GetColourPixelsFromBitmap(bmp);
            else
                throw new NotSupportedException(string.Format("Sensor type {0} is not currently supported.", sensorType));
        }
开发者ID:hpavlov,项目名称:horus,代码行数:12,代码来源:CameraImage.cs


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