OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SensorProxy_h | 5 #ifndef SensorProxy_h |
6 #define SensorProxy_h | 6 #define SensorProxy_h |
7 | 7 |
8 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" | 8 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" |
9 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" | 9 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 void removeObserver(Observer*); | 42 void removeObserver(Observer*); |
43 | 43 |
44 void initialize(); | 44 void initialize(); |
45 | 45 |
46 bool isInitializing() const { return m_state == Initializing; } | 46 bool isInitializing() const { return m_state == Initializing; } |
47 bool isInitialized() const { return m_state == Initialized; } | 47 bool isInitialized() const { return m_state == Initialized; } |
48 | 48 |
49 void addConfiguration(device::mojom::blink::SensorConfigurationPtr, std::uni
que_ptr<Function<void(bool)>>); | 49 void addConfiguration(device::mojom::blink::SensorConfigurationPtr, std::uni
que_ptr<Function<void(bool)>>); |
50 void removeConfiguration(device::mojom::blink::SensorConfigurationPtr, std::
unique_ptr<Function<void(bool)>>); | 50 void removeConfiguration(device::mojom::blink::SensorConfigurationPtr, std::
unique_ptr<Function<void(bool)>>); |
51 | 51 |
| 52 void suspend(); |
| 53 void resume(); |
| 54 |
52 device::mojom::blink::SensorType type() const { return m_type; } | 55 device::mojom::blink::SensorType type() const { return m_type; } |
53 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } | 56 device::mojom::blink::ReportingMode reportingMode() const { return m_mode; } |
54 | 57 |
55 struct Reading { | 58 struct Reading { |
56 double timestamp; | 59 double timestamp; |
57 double reading[3]; | 60 double reading[3]; |
58 }; | 61 }; |
59 static_assert(sizeof(Reading) == device::mojom::blink::SensorReadBuffer::kRe
adBufferSize, "Check reading size"); | 62 static_assert(sizeof(Reading) == device::mojom::blink::SensorReadBuffer::kRe
adBufferSize, "Check reading size"); |
60 | 63 |
61 const Reading& reading() const { return m_reading; } | 64 const Reading& reading() const { return m_reading; } |
(...skipping 26 matching lines...) Expand all Loading... |
88 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; | 91 mojo::Binding<device::mojom::blink::SensorClient> m_clientBinding; |
89 enum State { | 92 enum State { |
90 Uninitialized, | 93 Uninitialized, |
91 Initializing, | 94 Initializing, |
92 Initialized | 95 Initialized |
93 }; | 96 }; |
94 State m_state; | 97 State m_state; |
95 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; | 98 mojo::ScopedSharedBufferHandle m_sharedBufferHandle; |
96 mojo::ScopedSharedBufferMapping m_sharedBuffer; | 99 mojo::ScopedSharedBufferMapping m_sharedBuffer; |
97 Reading m_reading; | 100 Reading m_reading; |
| 101 bool m_suspended; |
98 }; | 102 }; |
99 | 103 |
100 } // namespace blink | 104 } // namespace blink |
101 | 105 |
102 #endif // SensorProxy_h | 106 #endif // SensorProxy_h |
OLD | NEW |