Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: device/generic_sensor/android/java/src/org/chromium/device/sensors/PlatformSensor.java

Issue 2284613002: [sensors] Android platform adaptation for Generic Sensor API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.device.sensors;
6
7 import org.chromium.base.annotations.CalledByNative;
8 import org.chromium.base.annotations.JNINamespace;
9
10 import java.nio.ByteBuffer;
11 import java.nio.ByteOrder;
12
13 /**
14 * Base class that is wrapped by device::PlatformSensorAndroid and should be use d to implement
15 * concrete sensors. Lifetime is controlled by the device::PlatformSensorAndroid .
16 */
17 @JNINamespace("device")
18 public abstract class PlatformSensor {
Ted C 2016/09/01 00:12:36 seeing that we are in the generic_sensor directory
shalamov 2016/09/06 12:36:43 Agree, removed abstraction, if in the future non S
19 protected long mNativePlatformSensorAndroid;
Ted C 2016/09/01 00:12:36 I think this should be private. Then expose helpe
shalamov 2016/09/06 12:36:43 Done.
20 protected ByteBuffer mBuffer;
21 protected ByteBuffer mSensorReadingData;
22
23 protected PlatformSensor() {}
Ted C 2016/09/01 00:12:36 you want this protected to prevent sensors from be
shalamov 2016/09/06 12:36:43 added public static create() that returns null in
24
25 @CalledByNative
26 private void initPlatformSensorAndroid(long nativePlatformSensorAndroid, Byt eBuffer buffer) {
27 mNativePlatformSensorAndroid = nativePlatformSensorAndroid;
28 mBuffer = buffer;
Ted C 2016/09/01 00:12:36 I would just have another abstract method that exp
shalamov 2016/09/06 12:36:43 not needed, since I merged classes.
29 mSensorReadingData = ByteBuffer.allocate(mBuffer.capacity());
30 mSensorReadingData.order(ByteOrder.nativeOrder());
31 }
32
33 @CalledByNative
34 protected abstract int getReportingMode();
Ted C 2016/09/01 00:12:36 javadoc for all non-private methods
shalamov 2016/09/06 12:36:43 Done.
35
36 @CalledByNative
37 protected abstract PlatformSensorConfiguration getDefaultConfiguration();
38
39 @CalledByNative
40 protected abstract boolean startSensor(PlatformSensorConfiguration configura tion);
41
42 @CalledByNative
43 protected abstract void stopSensor();
44
45 @CalledByNative
46 protected abstract boolean checkSensorConfiguration(PlatformSensorConfigurat ion configuration);
47
48 protected native void nativeNotifyPlatformSensorReadingChanged(
49 long nativePlatformSensorAndroid);
50 protected native void nativeNotifyPlatformSensorError(long nativePlatformSen sorAndroid);
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698