| Index: device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
|
| diff --git a/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java b/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4d1621b781467bd279a8c95db830989650d74ea4
|
| --- /dev/null
|
| +++ b/device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java
|
| @@ -0,0 +1,48 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.device.sensors;
|
| +
|
| +import org.chromium.base.annotations.CalledByNative;
|
| +import org.chromium.base.annotations.JNINamespace;
|
| +
|
| +import java.nio.ByteBuffer;
|
| +import java.nio.ByteOrder;
|
| +
|
| +/**
|
| + * Base class that is wrapped by device::PlatformSensorAndroid and should be used to implement
|
| + * concrete sensors. Lifetime is controlled by the device::PlatformSensorAndroid.
|
| + */
|
| +@JNINamespace("device")
|
| +public abstract class PlatformSensor {
|
| + protected long mNativePlatformSensorAndroid;
|
| + protected ByteBuffer mBuffer;
|
| + protected ByteBuffer mSensorReadingData;
|
| +
|
| + protected PlatformSensor() {}
|
| +
|
| + @CalledByNative
|
| + private void initPlatformSensorAndroid(long nativePlatformSensorAndroid, ByteBuffer buffer) {
|
| + mNativePlatformSensorAndroid = nativePlatformSensorAndroid;
|
| + mBuffer = buffer;
|
| + mSensorReadingData = ByteBuffer.allocate(mBuffer.capacity());
|
| + mSensorReadingData.order(ByteOrder.nativeOrder());
|
| + }
|
| +
|
| + @CalledByNative
|
| + protected abstract int getReportingMode();
|
| +
|
| + @CalledByNative
|
| + protected abstract boolean startSensor(SensorConfiguration configuration);
|
| +
|
| + @CalledByNative
|
| + protected abstract void stopSensor();
|
| +
|
| + @CalledByNative
|
| + protected abstract boolean checkSensorConfiguration(SensorConfiguration configuration);
|
| +
|
| + protected native void nativeNotifyPlatformSensorReadingChanged(
|
| + long nativePlatformSensorAndroid);
|
| + protected native void nativeNotifyPlatformSensorError(long nativePlatformSensorAndroid);
|
| +}
|
|
|