tm-info.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
4 #include <mutex>
5 #include <chrono>
6 #include <vector>
7 #include <iterator>
8 #include <cstddef>
9 #include <thread>
10 
11 #include "tm-info.h"
12 #include "tm-device.h"
13 #include "common/fw/target.h"
14 
15 namespace librealsense
16 {
17  tm2_info::tm2_info(std::shared_ptr<context> ctx, platform::usb_device_info hwm)
18  : device_info(ctx), _hwm(std::move(hwm))
19  {
20  LOG_DEBUG("tm2_info created for " << this);
21  }
22 
24  {
25  LOG_DEBUG("tm2_info destroyed for " << this);
26  }
27 
28  std::shared_ptr<device_interface> tm2_info::create(std::shared_ptr<context> ctx,
29  bool register_device_notifications) const
30  {
31  LOG_DEBUG("tm2_info::create " << this);
32  return std::make_shared<tm2_device>(ctx, get_device_data(), register_device_notifications);
33  }
34 
36  {
37  LOG_DEBUG("tm2_info::get_device_data " << this);
38  auto bdg = platform::backend_device_group({}, { _hwm });
39  return bdg;
40  }
41 
42  std::vector<std::shared_ptr<device_info>> tm2_info::pick_tm2_devices(
43  std::shared_ptr<context> ctx,
44  std::vector<platform::usb_device_info>& usb)
45  {
46  std::vector<std::shared_ptr<device_info>> results;
47  // We shouldn't talk to the device here, it might not
48  // even be around anymore (this gets called with an out of
49  // date list on disconnect).
50  auto correct_pid = filter_by_product(usb, { 0x0B37 });
51  if (correct_pid.size())
52  {
53  LOG_INFO("Picked " << correct_pid.size() << "/" << usb.size() << " devices");
54 
55  for(auto & dev : correct_pid)
56  results.push_back(std::make_shared<tm2_info>(ctx, dev));
57  }
58 
59  return results;
60  }
61 }
std::vector< platform::uvc_device_info > filter_by_product(const std::vector< platform::uvc_device_info > &devices, const std::set< uint16_t > &pid_list)
Definition: context.cpp:478
platform::usb_device_info _hwm
Definition: tm-info.h:25
platform::backend_device_group get_device_data() const override
Definition: tm-info.cpp:35
tm2_info(std::shared_ptr< context > ctx, platform::usb_device_info hwm)
Definition: tm-info.cpp:17
LOG_INFO("Log message using LOG_INFO()")
static std::vector< std::shared_ptr< device_info > > pick_tm2_devices(std::shared_ptr< context > ctx, std::vector< platform::usb_device_info > &usb)
Definition: tm-info.cpp:42
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
std::shared_ptr< device_interface > create(std::shared_ptr< context > ctx, bool register_device_notifications) const override
Definition: tm-info.cpp:28
#define LOG_DEBUG(...)
Definition: src/types.h:239


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