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

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 OnSensorError() 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 class SensorSharedBufferReader;
19
20 // Implementation of relative orientation PlatformSensor using fusion.
21 // This is a single instance object per browser process which is created by
22 // The singleton PlatformSensorProvider. If there are no clients, this instance
23 // is not created.
24 class PlatformSensorFusionRelativeOrientation : public PlatformSensor,
25 public PlatformSensor::Client {
26 public:
27 // Construct a platform fusion sensor of type RELATIVE_ORIENTATION, given a
28 // buffer |mapping| where readings will be written.
29 PlatformSensorFusionRelativeOrientation(
30 mojo::ScopedSharedBufferMapping mapping,
31 PlatformSensorProvider* provider,
32 const PlatformSensorProviderBase::CreateSensorCallback& callback);
33
34 // PlatformSensor:
35 mojom::ReportingMode GetReportingMode() override;
36 PlatformSensorConfiguration GetDefaultConfiguration() override;
37 // Can only be called once, the first time or after a StopSensor call.
38 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
39 void StopSensor() override;
40
41 // PlatformSensor::Client:
42 void OnSensorReadingChanged() override;
43 void OnSensorError() override;
44 bool IsNotificationSuspended() override;
45
46 protected:
47 ~PlatformSensorFusionRelativeOrientation() override;
48
49 // PlatformSensor:
50 bool CheckSensorConfiguration(
51 const PlatformSensorConfiguration& configuration) override;
52
53 private:
54 void CreateAccelerometerCallback(scoped_refptr<PlatformSensor> accelerometer);
55
56 PlatformSensorProviderBase::CreateSensorCallback callback_;
57 SensorReading reading_;
58 scoped_refptr<PlatformSensor> accelerometer_;
59 std::unique_ptr<SensorSharedBufferReader> accelerometer_reader_;
60 std::unique_ptr<RelativeOrientationFusionAlgorithm> fusion_algorithm_;
61
62 DISALLOW_COPY_AND_ASSIGN(PlatformSensorFusionRelativeOrientation);
63 };
64
65 } // namespace device
66
67 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_FUSION_RELATIVE_ORIENTATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698