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

C# Sensor类代码示例

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

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



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

示例1: SSDSandforce

 public SSDSandforce(ISmart smart, string name, string firmwareRevision, 
   int index, ISettings settings) 
   : base(smart, name, firmwareRevision,  index, smartAttributes, settings) 
 {
   this.writeAmplification = new Sensor("Write Amplification", 1, 
     SensorType.Factor, this, settings);    
 }
开发者ID:reimashi,项目名称:jotai,代码行数:7,代码来源:SSDSandforce.cs


示例2: OnDataReportChanged

        void OnDataReportChanged(Sensor sender, EventArgs e)
        {
            // get sensor
            WeTabSensor sensor = sender as WeTabSensor;
            if (sensor != null)
            {
                Logger.Debug("Sensor reported");

                // get data object
                WeTabSensorData r = sensor.CurrentWeTabSensorData;
                switch (r.Message)
                {
                    case WeTabSensorMessage.SensorButtonDown:
                        Logger.Debug("Sensor button pressed");
                        _timer.Enabled = true;
                        Logger.Debug("Sensortimer started");
                        break;
                    case WeTabSensorMessage.SensorButtonUp:
                        Logger.Debug("Sensor button released");
                        _timer.Enabled = false;
                        Logger.Debug("Sensortimer interupted");
                        break;
                }
            }
        }
开发者ID:Danielku15,项目名称:WeTabLock,代码行数:25,代码来源:WeTabWindowsApi.cs


示例3: BearTrap

        public BearTrap(Vector3 pos)
            : base("BearTrap", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(pos),
            new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero, true)
        {
            Allies = PlayState.PlayerFaction;
            Sensor = new Sensor("Sensor", this, Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero)
            {
                FireTimer = new Timer(0.5f, false)
            };
            Sensor.OnSensed += Sensor_OnSensed;
            DeathTimer = new Timer(0.6f, true);
            DeathParticles = new ParticleTrigger("puff", PlayState.ComponentManager, "DeathParticles", this,
                Matrix.Identity, new Vector3(0.5f, 0.5f, 0.5f), Vector3.Zero)
            {
                SoundToPlay = ""
            };

            DamageAmount = 200;
            Voxel voxUnder = new Voxel();
            PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(pos, ref voxUnder);
            VoxListener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxUnder);
            Sprite = new Sprite(PlayState.ComponentManager, "Sprite", this, Matrix.Identity, new SpriteSheet(ContentPaths.Entities.DwarfObjects.beartrap), false);
            Sprite.AddAnimation(new Animation(0, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32,  0) {Name = IdleAnimation});
            Sprite.AddAnimation(new Animation(1, ContentPaths.Entities.DwarfObjects.beartrap, 32, 32,  0, 1, 2, 3) {Name = TriggerAnimation, Speeds =  new List<float>() {6.6f}, Loops = true});
        }
开发者ID:maroussil,项目名称:dwarfcorp,代码行数:25,代码来源:BearTrap.cs


示例4: AddSensor

        // Insertion of a new sensor into sensor table.
        public int AddSensor(Sensor sensor)
        {
            MySqlConnection sqlConnection = new MySqlConnection(connectionString);
            MySqlCommand sqlCmd = sqlConnection.CreateCommand();
            int id = -1;
            try
            {
                sqlConnection.Open();
                sqlCmd.CommandText = "INSERT INTO " +
                                          "SENSORS ( ISENABLE, THRESHOLD, LOCATION, SENSORTYPE, PARENTID ) " +
                                          "VALUES ( " + sensor.IsEnabled + ", " + sensor.Threshold + ", \"" + sensor.Location + "\", \"" + sensor.Type + "\", " + sensor.ParentId + ")";

                sqlCmd.ExecuteNonQuery();
                sqlCmd.CommandText = "SELECT LAST_INSERT_ID() FROM SENSORS";
                id = Convert.ToInt32(sqlCmd.ExecuteScalar());
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not connect to database!");
                Console.WriteLine("{0} Exception caught.", e);
            }
            finally
            {
                sqlConnection.Close();
            }
            return id;
        }
开发者ID:Bilzac,项目名称:Mesmerize-One-Prime-X2,代码行数:28,代码来源:DB_Manager.cs


示例5: ActivateDeviceSensor

    protected override bool ActivateDeviceSensor(Type sensorID, Sensor.Delay sensorSpeed)
    {
        switch (sensorID)
        {
            case Type.Accelerometer:
                SetSensorOn(sensorID);
                return true;

            case Type.Orientation:
            case Type.MagneticField:
                Input.compass.enabled = true;
                SetSensorOn(sensorID);
                return true;

            case Type.Gyroscope:
            case Type.Gravity:
            case Type.RotationVector:
            case Type.LinearAcceleration:
                Input.gyro.enabled = true;
                SetSensorOn(sensorID);
                return true;

            case Type.Light:
            case Type.Pressure:
            case Type.Temperature:
            case Type.Proximity:
            default:
                return base.ActivateDeviceSensor(sensorID, sensorSpeed);
        }
    }
开发者ID:LennonWilloughby,项目名称:Candlelight,代码行数:30,代码来源:SensorDeviceIPhone.cs


示例6: Apply

 internal override void Apply(Sensor.BaseSensorDevice sensor)
 {
     if (!(sensor is TemperatureControllableSensor))
         throw new ArgumentException();
     ((TemperatureControllableSensor)sensor).SetTemperatureSensor(thermistor);
     Refresh(sensor);
 }
开发者ID:Doridian,项目名称:CorsairLinkPlusPlus,代码行数:7,代码来源:TemperatureDependantControllerBase.cs


示例7: Refresh

 internal override void Refresh(Sensor.BaseSensorDevice sensor)
 {
     if (!(sensor is TemperatureControllableSensor))
         throw new ArgumentException();
     if (CoreUtil.DoesThermistorNeedManualPush(sensor, thermistor))
         ((TemperatureControllableSensor)sensor).SetTemperature(GetTemperature());
 }
开发者ID:Doridian,项目名称:CorsairLinkPlusPlus,代码行数:7,代码来源:TemperatureDependantControllerBase.cs


示例8: btnSeleziona_Click

    protected void btnSeleziona_Click(object sender, EventArgs e)
    {
        if (DropDownList1.SelectedIndex == 0)
        {
            lblUnitàDiMisura.Text = "Gradi";
            lblNomeSensore.Text = "DS-1822";
            lblInterfaccia.Text = "1-Wire";
            // creazione del temometro conoscendo l'ID:
            //k = new Temperature_DS1822("Temperatura aria", false, "48-02034234", logger);
            // creazione del termometro con identificazione automatica del codice
            k = new Temperature_DS1822("Temperatura aria", false, logger);

        }
        else if (DropDownList1.SelectedIndex == 1)
        {
            lblUnitàDiMisura.Text = "Percentuale";
            lblNomeSensore.Text = "HIH-4000";
            lblInterfaccia.Text = "1-Wire";
            k = new Humidity_Air_HIH4000("Air humidity", false, new Adc_MCP3208(), 1, logger);
        }
        else if (DropDownList1.SelectedIndex == 2)
        {
            lblUnitàDiMisura.Text = "Percentuale";
            lblNomeSensore.Text = "YL-69-YL-38";
            lblInterfaccia.Text = "1-Wire";
            k = new Humidity_Terrain_YL69YL38("Terrain Humidity", false, new Adc_MCP3208(), 1, logger);
        }
        else if (DropDownList1.SelectedIndex == 3)
        {
            lblUnitàDiMisura.Text = "[lx]";
            lblNomeSensore.Text = "Fotoresistor";
            lblInterfaccia.Text = "###";
            k = new Light_PhotoResistor("Temperature", false, new Adc_MCP3208(), 1, logger);
        }
    }
开发者ID:gamondue,项目名称:GOR-4H-16,代码行数:35,代码来源:Calibration.aspx.cs


示例9: Update

	void Update() {
		leftRayDirection = transform.TransformDirection(new Vector3(-1, 0, 1));
		rightRayDirection = transform.TransformDirection(new Vector3(1, 0, 1));

		if(Physics.Raycast(transform.position, leftRayDirection, out hitLeft, minimumDistanceToAvoid)) {
			if(hitLeft.transform != transform) { // Intersection with own collider is omitted
				touch = Sensor.LEFT;
			}
		}

		if(Physics.Raycast(transform.position, rightRayDirection, out hitRight, minimumDistanceToAvoid)) {
			if(hitRight.transform != transform) { // Intersection with own collider is omitted
				touch = Sensor.RIGHT;
			}
		}

		switch(touch) {
			case Sensor.LEFT:
				Vector3 leftHitNormal = hitLeft.normal;
				Debug.DrawRay(hitLeft.point, leftHitNormal, Color.red);
				leftHitNormal.y = 0.0f; // Restrict movement in y direction
				direction = transform.forward + leftHitNormal * steerForce;
				break;
			case Sensor.RIGHT:
				Vector3 rightHitNormal = hitRight.normal;
				Debug.DrawRay(hitRight.point, rightHitNormal, Color.blue);
				rightHitNormal.y = 0.0f; // Restrict movement in y direction
				direction = transform.forward + rightHitNormal * steerForce;
				break;
		}

		rotate = Quaternion.LookRotation(direction.normalized);
		transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * rotateSpeed);
		transform.position += transform.forward * Time.deltaTime * translateSpeed;
	}
开发者ID:Foodpunch,项目名称:ZOMBIETOWNVR,代码行数:35,代码来源:ImprovedCollisionAvoidance.cs


示例10: Activate

 protected override void Activate()
 {
     ipw = registry.Sensor("InjectorPulseWidth");
     rpm = registry.Sensor("RPM");
     registry.AddListener(ipw, OnSensorChange, ListenInterval);
     registry.AddListener(rpm, OnSensorChange, ListenInterval);
 }
开发者ID:cail,项目名称:hobd,代码行数:7,代码来源:LitersPerHourSensor.cs


示例11: SensorControl

        //----------------------------------------------------------------------------//
        // Constructors                                                               //
        //----------------------------------------------------------------------------//
        ////////////////////////////////////////////////////////////////////////////////
        /// <summary> </summary>
        public SensorControl(Sensor sensor)
        {
            sensor.Control = this;
            InitializeComponent();

            // Load static resources
            if (uiBrushCenter == null)
            {
                // Brushes
                uiBrushCenter  = (Brush) FindResource ("uiBrushCenter" );
                uiBrushCenterS = (Brush) FindResource ("uiBrushCenterS");

                uiBrushAngle  = (Brush) FindResource ("uiBrushAngle" );
                uiBrushRange  = (Brush) FindResource ("uiBrushRange" );
                uiBrushStroke = (Brush) FindResource ("uiBrushStroke");

                uiBrushOrientation = (Brush) FindResource ("uiBrushOrientation");

                // Storyboards
                uiStoryboardFadeIn   = (Storyboard) FindResource ("uiStoryboardFadeIn"  );
                uiStoryboardFadeOut  = (Storyboard) FindResource ("uiStoryboardFadeOut" );
                uiStoryboardExpand   = (Storyboard) FindResource ("uiStoryboardExpand"  );
                uiStoryboardContract = (Storyboard) FindResource ("uiStoryboardContract");
            }

            sensor.PropertyChanged += ActionPropertyChanged;
            sensor.MouseOver       += ActionMouseOver;
            sensor.Selected        += ActionSelected;

            ActionPropertyChanged (sensor);
            ActionMouseOver       (sensor);
            ActionSelected        (sensor);
        }
开发者ID:dkrutsko,项目名称:Sensor-Simulator,代码行数:38,代码来源:SensorControl.xaml.cs


示例12: ATIGPU

        public ATIGPU(string name, int adapterIndex, int busNumber, int deviceNumber, ISettings settings)
            : base(name, new Identifier("atigpu", adapterIndex.ToString(CultureInfo.InvariantCulture)), settings)
        {
            this.adapterIndex = adapterIndex;
            this.busNumber = busNumber;
            this.deviceNumber = deviceNumber;

            this.temperature = new Sensor("GPU Core", 0, SensorType.Temperature, this, settings);
            this.fan = new Sensor("GPU Fan", 0, SensorType.Fan, this, settings);
            this.coreClock = new Sensor("GPU Core", 0, SensorType.Clock, this, settings);
            this.memoryClock = new Sensor("GPU Memory", 1, SensorType.Clock, this, settings);
            this.coreVoltage = new Sensor("GPU Core", 0, SensorType.Voltage, this, settings);
            this.coreLoad = new Sensor("GPU Core", 0, SensorType.Load, this, settings);
            this.controlSensor = new Sensor("GPU Fan", 0, SensorType.Control, this, settings);

            ADLOD6ThermalControllerCaps adltcc = new ADLOD6ThermalControllerCaps();
            if (ADL.ADL_Overdrive6_ThermalController_Caps(adapterIndex, ref adltcc) != ADL.ADL_OK)
            {
                adltcc.iFanMinPercent = 0;
                adltcc.iFanMaxPercent = 100;
            }

            this.fanControl = new Control(controlSensor, settings, adltcc.iFanMinPercent, adltcc.iFanMaxPercent);
            this.fanControl.ControlModeChanged += ControlModeChanged;
            this.fanControl.SoftwareControlValueChanged += SoftwareControlValueChanged;
            ControlModeChanged(fanControl);
            this.controlSensor.Control = fanControl;
            Update();
        }
开发者ID:kurdtkobain,项目名称:openhardwaremonitor,代码行数:29,代码来源:ATIGPU.cs


示例13: getDistance

        public float getDistance(Sensor type)
        {
            float value = 0;
            float[] values = new float[5];
            float[] auxValues = new float[5];

            switch (type)
            {
                case Sensor.Central:
                    for (int i = 0; i < 5; i++)
                    {
                        //value += central.GetDistance_cm();
                        values[i] = central.GetDistance_cm();
                    }
                    break;
                case Sensor.Wall:
                    for (int i = 0; i < 5; i++)
                    {
                        //value += wall.GetDistance_cm();
                        values[i] = wall.GetDistance_cm();
                    }
                    break;
                case Sensor.wall_back: for (int i = 0; i < 5; i++)
                    {
                        //value += wall_back.GetDistance_cm();
                        values[i] = wall_back.GetDistance_cm();
                    }
                    break;
                case Sensor.Right: for (int i = 0; i < 5; i++)
                    {
                        //value += right.GetDistance_cm();
                        values[i] = right.GetDistance_cm();
                    }
                    break;
                default:
                    return 0;

            }
            int count = 0;

            while (count < 5)
            {
                float min = float.MaxValue;
                short lastMin = -1;
                for (short i = 0; i < 5; i++)
                {
                    if (values[i] < min)
                    {
                        min = values[i];
                        lastMin = i;
                    }
                }
                auxValues[count++] = values[lastMin];
                values[lastMin] = float.MaxValue;
            }

            //MEdIAN FILTER
            return auxValues[2];
        }
开发者ID:AlexAlbala,项目名称:MaCRo,代码行数:59,代码来源:SensorManager.cs


示例14: Apply

        internal override void Apply(Sensor.BaseSensorDevice sensor)
        {
            if (!(sensor is Sensor.LED))
                throw new ArgumentException();
            base.Apply(sensor);

            ((Sensor.LED)sensor).SetFixedRGBCycleColors(m_color.ToArray());
        }
开发者ID:Doridian,项目名称:CorsairLinkPlusPlus,代码行数:8,代码来源:SingleColor.cs


示例15: ActivateDeviceSensor

    protected override bool ActivateDeviceSensor(Type sensorID, Sensor.Delay sensorSpeed)
    {
		Input.gyro.enabled = true;
		Input.compass.enabled = true;
		Get (sensorID).available = this.GetSensorDebugAvailable((int)sensorID);
		Get (sensorID).active = true;
		return true;
	}
开发者ID:SHEePYTaGGeRNeP,项目名称:FontysMobileGameJam,代码行数:8,代码来源:SensorEditorUnity.cs


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


示例17: Apply

        internal override void Apply(Sensor.BaseSensorDevice sensor)
        {
            if(!(sensor is Sensor.LED))
                throw new ArgumentException();
            base.Apply(sensor);

            ((Sensor.LED)sensor).SetControlCurve(curve);
        }
开发者ID:Doridian,项目名称:CorsairLinkPlusPlus,代码行数:8,代码来源:CustomCurve.cs


示例18: GetRelativeThermistorByte

 internal static byte GetRelativeThermistorByte(Sensor.BaseSensorDevice sensor, IThermistor thermistor)
 {
     if (thermistor == null)
         return 0;
     if (!(thermistor is Thermistor))
         return 7;
     Thermistor thermistorCast = (Thermistor)thermistor;
     return (byte)((sensor.device == thermistorCast.device) ? thermistorCast.id : 7);
 }
开发者ID:Doridian,项目名称:CorsairLinkPlusPlus,代码行数:9,代码来源:CoreUtil.cs


示例19: OnSensorChange

 /**
  * Calculates as following:
  *
  * rpm/60 * cilinders * injector * 0.001 * injectorFlow * 60 / 1000
  *
  * rpm/60 is rotations per second
  * cilinders number of cilinders
  * injector*0.001 is how long injector is open during one rotation (in seconds)
  * injectorFlow how much cubic centimeters (CC) come through the injector in 1 minute
  * /60 is to give an second
  * /1000 is to give liters from CC
  *
  */
 public void OnSensorChange(Sensor s)
 {
     TimeStamp = s.TimeStamp;
     // liters per second
     Value = rpm.Value/60 * cylinders * ipw.Value * 0.001 * injectorccpm/60 / 1000;
     // to hour
     Value = Value*3600;
     registry.TriggerListeners(this);
 }
开发者ID:cail,项目名称:hobd,代码行数:22,代码来源:LitersPerHourSensor.cs


示例20: OnSensorChange

        /**
         * Calculates as following:
         *
           LPH = 3600 * maf /  (14.7 * 454*6.17 / 3.78 )

           14.7 grams of air to 1 gram of gasoline - ideal air/fuel ratio

           6.17 pounds per gallon - density of gasoline
           454 grams per pound - conversion
           454*6.17/3.78 - grams per liter

           3600 seconds per hour - conversion
           MAF - mass air flow rate in grams per second
         *
         */
        public void OnSensorChange(Sensor maf)
        {
            TimeStamp = maf.TimeStamp;
            // per second
            Value = maf.Value / (stoich * 454*6.17 / 3.78 );
            // to hour
            Value = Value*3600;
            registry.TriggerListeners(this);
        }
开发者ID:victorchalian,项目名称:hobd,代码行数:24,代码来源:LitersPerHourSensor.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SensorData类代码示例发布时间:2022-05-24
下一篇:
C# SenseRepeatClass类代码示例发布时间: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