OLD | NEW |
(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 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ |
| 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ |
| 7 |
| 8 #include "device/generic_sensor/platform_sensor.h" |
| 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 |
| 12 namespace device { |
| 13 |
| 14 class PlatformSensorAndroid : public PlatformSensor { |
| 15 public: |
| 16 // Register C++ methods exposed to Java using JNI. |
| 17 static bool RegisterJNI(JNIEnv* env); |
| 18 |
| 19 PlatformSensorAndroid(mojom::SensorType type, |
| 20 mojo::ScopedSharedBufferMapping mapping, |
| 21 PlatformSensorProvider* provider, |
| 22 const base::android::JavaRef<jobject>& java_sensor); |
| 23 |
| 24 mojom::ReportingMode GetReportingMode() override; |
| 25 PlatformSensorConfiguration GetDefaultConfiguration() override; |
| 26 double GetMaximumSupportedFrequency() override; |
| 27 |
| 28 void NotifyPlatformSensorError(JNIEnv*, |
| 29 const base::android::JavaRef<jobject>& caller); |
| 30 |
| 31 void UpdatePlatformSensorReading( |
| 32 JNIEnv*, |
| 33 const base::android::JavaRef<jobject>& caller, |
| 34 jdouble timestamp, |
| 35 jdouble value1, |
| 36 jdouble value2, |
| 37 jdouble value3, |
| 38 jdouble value4); |
| 39 |
| 40 protected: |
| 41 ~PlatformSensorAndroid() override; |
| 42 bool StartSensor(const PlatformSensorConfiguration& configuration) override; |
| 43 void StopSensor() override; |
| 44 bool CheckSensorConfiguration( |
| 45 const PlatformSensorConfiguration& configuration) override; |
| 46 |
| 47 private: |
| 48 // Java object org.chromium.device.sensors.PlatformSensor |
| 49 base::android::ScopedJavaGlobalRef<jobject> j_object_; |
| 50 DISALLOW_COPY_AND_ASSIGN(PlatformSensorAndroid); |
| 51 }; |
| 52 |
| 53 } // namespace device |
| 54 |
| 55 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_ANDROID_H_ |
OLD | NEW |