|
1 | 1 | // License: Apache 2.0. See LICENSE file in root directory.
|
2 |
| -// Copyright(c) 2015 Intel Corporation. All Rights Reserved. |
| 2 | +// Copyright(c) 2015-24 Intel Corporation. All Rights Reserved. |
3 | 3 | #pragma once
|
4 | 4 |
|
5 | 5 | #include "core/sensor-interface.h"
|
|
13 | 13 |
|
14 | 14 | #include <rsutils/lazy.h>
|
15 | 15 | #include <rsutils/signal.h>
|
| 16 | +#include <rsutils/deferred.h> |
16 | 17 |
|
17 | 18 | #include <chrono>
|
18 | 19 | #include <memory>
|
@@ -90,6 +91,16 @@ namespace librealsense
|
90 | 91 | return {};
|
91 | 92 | }
|
92 | 93 |
|
| 94 | + // Sometimes it is more efficient to prepare for large or repeating operations. Depending on the actual sensor |
| 95 | + // type we might want to change power state or encapsulate small transactions into a large one. |
| 96 | + virtual void prepare_for_bulk_operation() {} |
| 97 | + virtual void finished_bulk_operation() {} |
| 98 | + rsutils::deferred bulk_operation() |
| 99 | + { |
| 100 | + prepare_for_bulk_operation(); |
| 101 | + return rsutils::deferred( [this] { finished_bulk_operation(); } ); |
| 102 | + } |
| 103 | + |
93 | 104 | // recordable< recommended_proccesing_blocks_interface > is needed to record our recommended processing blocks
|
94 | 105 | public:
|
95 | 106 | void enable_recording( std::function< void( const recommended_proccesing_blocks_interface & ) > ) override {}
|
@@ -196,11 +207,6 @@ namespace librealsense
|
196 | 207 |
|
197 | 208 | std::shared_ptr< std::map< uint32_t, rs2_format > > & get_fourcc_to_rs2_format_map();
|
198 | 209 | std::shared_ptr< std::map< uint32_t, rs2_stream > > & get_fourcc_to_rs2_stream_map();
|
199 |
| - |
200 |
| - // Sometimes it is more efficient to prepare for large or repeating operations. Depending on the actual sensor |
201 |
| - // type we might want to change power state or encapsulate small transactions into a large one. |
202 |
| - virtual void prepare_for_bulk_operation() {} |
203 |
| - virtual void finished_bulk_operation(){} |
204 | 210 | };
|
205 | 211 |
|
206 | 212 | // A sensor pointer to another "raw sensor", usually UVC/HID
|
@@ -254,6 +260,9 @@ namespace librealsense
|
254 | 260 | virtual void register_option_to_update( rs2_option id, std::shared_ptr< option > option );
|
255 | 261 | virtual void unregister_option_from_update( rs2_option id );
|
256 | 262 |
|
| 263 | + void prepare_for_bulk_operation() override { _raw_sensor->prepare_for_bulk_operation(); } |
| 264 | + void finished_bulk_operation() override { _raw_sensor->finished_bulk_operation(); } |
| 265 | + |
257 | 266 | private:
|
258 | 267 | void register_processing_block_options(const processing_block& pb);
|
259 | 268 | void unregister_processing_block_options(const processing_block& pb);
|
|
0 commit comments