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

Side by Side Diff: device/generic_sensor/platform_sensor_fusion_relative_orientation.h

Issue 2929603003: Add RELATIVE_ORIENTATION sensor implementation on macOS to //device/generic_sensor (Closed)
Patch Set: updated IsSignificantlyDifferent() Created 3 years, 6 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 2017 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_FUSION_RELATIVE_ORIENTATION_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_FUSION_RELATIVE_ORIENTATION_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/timer/timer.h"
12 #include "device/generic_sensor/platform_sensor.h"
13 #include "device/generic_sensor/platform_sensor_provider_base.h"
14
15 namespace device {
16
17 class RelativeOrientationFusionAlgorithm;
18
19 // Implementation of relative orientation PlatformSensor using fusion.
20 // This is a single instance object per browser process which is created by
21 // The singleton PlatformSensorProvider. If there are no clients, this instance
22 // is not created.
23 class PlatformSensorFusionRelativeOrientation : public PlatformSensor,
24 public PlatformSensor::Client {
25 public:
26 // Construct a platform fusion sensor of type RELATIVE_ORIENTATION, given a
27 // buffer |mapping| where readings will be written.
28 PlatformSensorFusionRelativeOrientation(
29 mojo::ScopedSharedBufferMapping mapping,
30 PlatformSensorProvider* provider,
31 const PlatformSensorProviderBase::CreateSensorCallback& callback);
32
33 // PlatformSensor:
34 mojom::ReportingMode GetReportingMode() override;
35 PlatformSensorConfiguration GetDefaultConfiguration() override;
36 // Can only be called once, the first time or after a StopSensor call.
37 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
38 void StopSensor() override;
39 bool CheckSensorConfiguration(
40 const PlatformSensorConfiguration& configuration) override;
41
42 // PlatformSensor::Client:
43 void OnSensorReadingChanged() override;
44 void OnSensorError() override;
45 bool IsNotificationSuspended() override;
46
47 protected:
48 ~PlatformSensorFusionRelativeOrientation() override;
49
50 private:
51 void CreateAccelerometerCallback(scoped_refptr<PlatformSensor> accelerometer);
52 void CreateAccelerometerSucceeded();
53
54 PlatformSensorProviderBase::CreateSensorCallback callback_;
55 SensorReading reading_;
56 scoped_refptr<PlatformSensor> accelerometer_;
57 std::unique_ptr<RelativeOrientationFusionAlgorithm> fusion_algorithm_;
58
59 DISALLOW_COPY_AND_ASSIGN(PlatformSensorFusionRelativeOrientation);
60 };
61
62 } // namespace device
63
64 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_FUSION_RELATIVE_ORIENTATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698