pyrs_context.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 "python.hpp"
5 #include "../include/librealsense2/hpp/rs_context.hpp"
6 
7 void init_context(py::module &m) {
8  /* rs2_context.hpp */
9  py::class_<rs2::event_information> event_information(m, "event_information"); // No docstring in C++
10  event_information.def("was_removed", &rs2::event_information::was_removed, "Check if "
11  "a specific device was disconnected.", "dev"_a)
12  .def("was_added", &rs2::event_information::was_added, "Check if "
13  "a specific device was added.", "dev"_a)
14  .def("get_new_devices", &rs2::event_information::get_new_devices, "Returns a "
15  "list of all newly connected devices");
16 
17  // Not binding devices_changed_callback, templated
18 
19  py::class_<rs2::context> context(m, "context", "Librealsense context class. Includes realsense API version.");
20  context.def(py::init<>())
21  .def("query_devices", (rs2::device_list(rs2::context::*)() const) &rs2::context::query_devices, "Create a static"
22  " snapshot of all connected devices at the time of the call.")
23  .def( "query_devices", ( rs2::device_list( rs2::context::* )(int) const ) & rs2::context::query_devices, "Create a static"
24  " snapshot of all connected devices of specific product line at the time of the call." )
25  .def_property_readonly("devices", (rs2::device_list(rs2::context::*)() const) &rs2::context::query_devices,
26  "A static snapshot of all connected devices at time of access. Identical to calling query_devices.")
27  .def("query_all_sensors", &rs2::context::query_all_sensors, "Generate a flat list of "
28  "all available sensors from all RealSense devices.")
29  .def_property_readonly("sensors", &rs2::context::query_all_sensors, "A flat list of "
30  "all available sensors from all RealSense devices. Identical to calling query_all_sensors.")
31  .def("get_sensor_parent", &rs2::context::get_sensor_parent, "s"_a) // no docstring in C++
32  .def("set_devices_changed_callback", [](rs2::context& self, std::function<void(rs2::event_information)> &callback) {
33  self.set_devices_changed_callback(callback);
34  }, "Register devices changed callback.", "callback"_a)
35  .def("load_device", &rs2::context::load_device, "Creates a devices from a RealSense file.\n"
36  "On successful load, the device will be appended to the context and a devices_changed event triggered.",
37  "filename"_a)
38  .def("unload_device", &rs2::context::unload_device, "filename"_a) // No docstring in C++
39  .def("unload_tracking_module", &rs2::context::unload_tracking_module); // No docstring in C++
40 
41  // rs2::device_hub
43 }
std::vector< sensor > query_all_sensors() const
Generate a flat list of all available sensors from all RealSense devices.
Definition: rs_context.hpp:142
void unload_device(const std::string &file)
Definition: rs_context.hpp:195
const GLfloat * m
Definition: glext.h:6814
device get_sensor_parent(const sensor &s) const
Definition: rs_context.hpp:154
bool was_removed(const rs2::device &dev) const
Definition: rs_context.hpp:23
playback load_device(const std::string &file)
Definition: rs_context.hpp:184
device_list query_devices() const
Definition: rs_context.hpp:112
void unload_tracking_module()
Definition: rs_context.hpp:202
bool was_added(const rs2::device &dev) const
Definition: rs_context.hpp:40
void init_context(py::module &m)
Definition: pyrs_context.cpp:7
def callback(frame)
Definition: t265_stereo.py:91
device_list get_new_devices() const
Definition: rs_context.hpp:57


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