ds5-thermal-monitor.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3 #pragma once
4 
5 #include "sensor.h"
6 #include "device-calibration.h"
7 
8 namespace librealsense
9 {
10 
12  {
13  public:
14  ds5_thermal_monitor(std::shared_ptr<option> temp_option,
15  std::shared_ptr<option> tl_toggle);
17 
18  void update(bool on);
19  void add_observer(std::function<void(float)> callback)
20  {
22  }
23 
24  private:
25  ds5_thermal_monitor(const ds5_thermal_monitor&) = delete; // disable copy and assignment ctors
27 
28  // Active Object's main routine
29  void polling(dispatcher::cancellable_timer cancellable_timer);
30  void notify(float temperature);
31 
33  unsigned int _poll_intervals_ms;
35  float _temp_base;
37  std::weak_ptr<option> _temperature_sensor;
38  std::weak_ptr<option> _tl_activation;
39  std::vector<std::function<void(float)>> _thermal_changes_callbacks; // Distribute notifications on device thermal changes
40  };
41 
46  {
47  public:
48  ds5_thermal_tracking(std::shared_ptr<ds5_thermal_monitor> monitor):
49  _monitor(monitor)
50  {
51  if (auto mon = _monitor.lock())
52  mon->add_observer([&](float)
53  {
54  for (auto && cb : _user_callbacks)
55  cb->on_calibration_change(rs2_calibration_status::RS2_CALIBRATION_SUCCESSFUL);
56  });
57  }
58 
60  {
61  {
62  _user_callbacks.insert(callback);
63  }
64  }
65 
66  private:
67  std::weak_ptr<ds5_thermal_monitor> _monitor;
68  std::set<calibration_change_callback_ptr> _user_callbacks;
69  };
70 
71 }
void polling(dispatcher::cancellable_timer cancellable_timer)
std::set< calibration_change_callback_ptr > _user_callbacks
ds5_thermal_monitor & operator=(const ds5_thermal_monitor &)=delete
ds5_thermal_tracking(std::shared_ptr< ds5_thermal_monitor > monitor)
std::weak_ptr< ds5_thermal_monitor > _monitor
def callback(frame)
Definition: t265_stereo.py:91
ds5_thermal_monitor(std::shared_ptr< option > temp_option, std::shared_ptr< option > tl_toggle)
std::weak_ptr< option > _temperature_sensor
std::weak_ptr< option > _tl_activation
std::vector< std::function< void(float)> > _thermal_changes_callbacks
void add_observer(std::function< void(float)> callback)
void register_calibration_change_callback(calibration_change_callback_ptr callback) override
std::shared_ptr< rs2_calibration_change_callback > calibration_change_callback_ptr
Definition: src/types.h:1074


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:13