當前位置: 首頁>>代碼示例>>Java>>正文


Java Sensor.TYPE_GYROSCOPE_UNCALIBRATED屬性代碼示例

本文整理匯總了Java中android.hardware.Sensor.TYPE_GYROSCOPE_UNCALIBRATED屬性的典型用法代碼示例。如果您正苦於以下問題:Java Sensor.TYPE_GYROSCOPE_UNCALIBRATED屬性的具體用法?Java Sensor.TYPE_GYROSCOPE_UNCALIBRATED怎麽用?Java Sensor.TYPE_GYROSCOPE_UNCALIBRATED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在android.hardware.Sensor的用法示例。


在下文中一共展示了Sensor.TYPE_GYROSCOPE_UNCALIBRATED屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isXYZ

private boolean isXYZ(Sensor s) {
    switch (s.getType()) {
        case Sensor.TYPE_ACCELEROMETER:
        case Sensor.TYPE_GRAVITY:
        case Sensor.TYPE_GYROSCOPE:
        case Sensor.TYPE_LINEAR_ACCELERATION:
        case Sensor.TYPE_MAGNETIC_FIELD:
        case Sensor.TYPE_ROTATION_VECTOR:
            return true;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        if (s.getType() == Sensor.TYPE_GAME_ROTATION_VECTOR
                || s.getType() == Sensor.TYPE_GYROSCOPE_UNCALIBRATED
                || s.getType() == Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED) {
            return true;
        }
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (s.getType() == Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR) {
            return true;
        }
    }

    return false;
}
 
開發者ID:if710,項目名稱:2017.2-codigo,代碼行數:27,代碼來源:SensorListActivity.java

示例2: isRestricted

@SuppressWarnings("deprecation")
private boolean isRestricted(XParam param, int type) throws Throwable {
	if (type == Sensor.TYPE_ALL)
		return false;
	else if (type == Sensor.TYPE_ACCELEROMETER || type == Sensor.TYPE_LINEAR_ACCELERATION) {
		if (isRestricted(param, "acceleration"))
			return true;
	} else if (type == Sensor.TYPE_GRAVITY) {
		if (isRestricted(param, "gravity"))
			return true;
	} else if (type == Sensor.TYPE_RELATIVE_HUMIDITY) {
		if (isRestricted(param, "humidity"))
			return true;
	} else if (type == Sensor.TYPE_LIGHT) {
		if (isRestricted(param, "light"))
			return true;
	} else if (type == Sensor.TYPE_MAGNETIC_FIELD || type == Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED) {
		if (isRestricted(param, "magnetic"))
			return true;
	} else if (type == Sensor.TYPE_SIGNIFICANT_MOTION) {
		if (isRestricted(param, "motion"))
			return true;
	} else if (type == Sensor.TYPE_ORIENTATION || type == Sensor.TYPE_GYROSCOPE
			|| type == Sensor.TYPE_GYROSCOPE_UNCALIBRATED) {
		if (isRestricted(param, "orientation"))
			return true;
	} else if (type == Sensor.TYPE_PRESSURE) {
		if (isRestricted(param, "pressure"))
			return true;
	} else if (type == Sensor.TYPE_PROXIMITY) {
		if (isRestricted(param, "proximity"))
			return true;
	} else if (type == Sensor.TYPE_GAME_ROTATION_VECTOR || type == Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR
			|| type == Sensor.TYPE_ROTATION_VECTOR) {
		if (isRestricted(param, "rotation"))
			return true;
	} else if (type == Sensor.TYPE_TEMPERATURE || type == Sensor.TYPE_AMBIENT_TEMPERATURE) {
		if (isRestricted(param, "temperature"))
			return true;
	} else if (type == Sensor.TYPE_STEP_COUNTER || type == Sensor.TYPE_STEP_DETECTOR) {
		if (isRestricted(param, "step"))
			return true;
	} else if (type == Sensor.TYPE_HEART_RATE) {
		if (isRestricted(param, "heartrate"))
			return true;
	} else if (type == 22) {
		// 22 = TYPE_TILT_DETECTOR
		// Do nothing
	} else if (type == 23 || type == 24 || type == 25) {
		// 23 = TYPE_WAKE_GESTURE
		// 24 = TYPE_GLANCE_GESTURE
		// 25 = TYPE_PICK_UP_GESTURE
		// 23/24 This sensor is expected to only be used by the system ui
		// 25 Expected to be used internally for always on display
	} else
		Util.log(this, Log.WARN, "Unknown sensor type=" + type);
	return false;
}
 
開發者ID:ukanth,項目名稱:XPrivacy,代碼行數:58,代碼來源:XSensorManager.java

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

示例4: onSensorChanged

@Override
public void onSensorChanged(SensorEvent event)
{
	if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
	{
		// Get a local copy of the raw magnetic values from the device
		// sensor.
		//Log.d(tag, "Hello ~~");
		System.arraycopy(event.values, 0, this.vAcceleration, 0,
				this.vGyroscope.length);

		if (meanFilterSmoothingEnabled)
		{
			this.vAcceleration = meanFilterAcceleration	//榪涜縐誨姩騫衝潎婊ゆ嘗
					.addSamples(this.vAcceleration);
		}

		// We fuse the orientation of the magnetic and acceleration sensor
		// based on acceleration sensor updates. It could be done when the
		// magnetic sensor updates or when they both have updated if you
		// want to spend the resources to make the checks.
		calculateOrientationAccelMag();		//?
	}

	if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD)
	{
		// Get a local copy of the raw magnetic values from the device
		// sensor.
		//Log.d(tag, "Hello ~~");
		System.arraycopy(event.values, 0, this.vMagnetic, 0,
				this.vGyroscope.length);

		if (meanFilterSmoothingEnabled)
		{
			this.vMagnetic = meanFilterMagnetic.addSamples(this.vMagnetic);
		}
	}

	if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE)
	{
		//Log.d(tag, "Hello ~~");
		System.arraycopy(event.values, 0, this.vGyroscope, 0,
				this.vGyroscope.length);

		if (meanFilterSmoothingEnabled)
		{
			this.vGyroscope = meanFilterGyroscope
					.addSamples(this.vGyroscope);
		}

		timeStampGyroscope = event.timestamp;

		onGyroscopeChanged();
	}

	if (event.sensor.getType() == Sensor.TYPE_GYROSCOPE_UNCALIBRATED)
	{
		System.arraycopy(event.values, 0, this.vGyroscope, 0,
				this.vGyroscope.length);

		if (meanFilterSmoothingEnabled)
		{
			this.vGyroscope = meanFilterGyroscope
					.addSamples(this.vGyroscope);
		}

		timeStampGyroscope = event.timestamp;

		onGyroscopeChanged();
	}

}
 
開發者ID:HyfUestc,項目名稱:PDR,代碼行數:72,代碼來源:Orientation.java


注:本文中的android.hardware.Sensor.TYPE_GYROSCOPE_UNCALIBRATED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。