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


C# Sensor类代码示例

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


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


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