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


Java SensorManager.SENSOR_DELAY_FASTEST属性代码示例

本文整理汇总了Java中android.hardware.SensorManager.SENSOR_DELAY_FASTEST属性的典型用法代码示例。如果您正苦于以下问题:Java SensorManager.SENSOR_DELAY_FASTEST属性的具体用法?Java SensorManager.SENSOR_DELAY_FASTEST怎么用?Java SensorManager.SENSOR_DELAY_FASTEST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.hardware.SensorManager的用法示例。


在下文中一共展示了SensorManager.SENSOR_DELAY_FASTEST属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: before

@Override
protected void before(XParam param) throws Throwable {
	switch (mMethod) {
	case getDefaultSensor:
		if (isRestricted(param))
			param.setResult(null);
		else if (param.args.length > 0 && param.args[0] instanceof Integer)
			if (isRestricted(param, (Integer) param.args[0]))
				param.setResult(null);
		break;

	case getSensorList:
		if (isRestricted(param))
			param.setResult(new ArrayList<Sensor>());
		else if (param.args.length > 0 && param.args[0] instanceof Integer)
			if (isRestricted(param, (Integer) param.args[0]))
				param.setResult(new ArrayList<Sensor>());
		break;

	case registerListener:
		if (param.args.length > 2 && param.args[1] instanceof Sensor && param.args[2] instanceof Integer) {
			int type = ((Sensor) param.args[1]).getType();
			if (type == Sensor.TYPE_GYROSCOPE || type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {
				int rateUs = (Integer) param.args[2];

				// http://developer.android.com/guide/topics/sensors/sensors_overview.html
				if (rateUs == SensorManager.SENSOR_DELAY_NORMAL)
					return; // 200,000 us
				else if (rateUs == SensorManager.SENSOR_DELAY_UI)
					return; // 60,000 us
				else if (rateUs == SensorManager.SENSOR_DELAY_GAME)
					return; // 20,000 us
				else if (rateUs == SensorManager.SENSOR_DELAY_FASTEST)
					; // 0 us

				if (rateUs < cMaxRateUs) // 10,000 us
					if (isRestricted(param))
						param.args[2] = cMaxRateUs;
			}
		}
		break;
	}
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:43,代码来源:XSensorManager.java

示例2: configurarSensor

private void configurarSensor() {
    this.mSensorManager = (SensorManager) mContext.getSystemService(mContext.SENSOR_SERVICE);

    this.mAccelerometer = mSensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_ACCELEROMETER);
    this.mGyroscope = mSensorManager.getDefaultSensor(android.hardware.Sensor.TYPE_GYROSCOPE);

    this.miSensorEventListenerAcelerometro = new MiSensorEventListener(this.mAccelerometer, this.mSensorManager, SensorManager.SENSOR_DELAY_FASTEST);
    this.miSensorEventListenerGiroscopio = new MiSensorEventListener(this.mGyroscope, this.mSensorManager, SensorManager.SENSOR_DELAY_FASTEST);
}
 
开发者ID:TfgReconocimientoPulseras,项目名称:TrainAppTFG,代码行数:9,代码来源:SensorMovil.java

示例3: sensorsSpeed

@ProtoMethod(description = "Set the speed of the sensor 'slow', 'fast', 'normal'", example = "")
@ProtoMethodParam(params = {"speed=['slow', 'fast', 'normal']"})
public void sensorsSpeed(String speed) {
    if (speed.equals("slow")) {
        this.speed = SensorManager.SENSOR_DELAY_UI;
    } else if (speed.equals("fast")) {
        this.speed = SensorManager.SENSOR_DELAY_FASTEST;
    } else {
        this.speed = SensorManager.SENSOR_DELAY_NORMAL;
    }
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:11,代码来源:CustomSensorManager.java


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