Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
rs_net.hpp
Go to the documentation of this file.
1// License: Apache 2.0. See LICENSE file in root directory.
2// Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3
4#ifndef LIBREALSENSE_RS2_NET_HPP
5#define LIBREALSENSE_RS2_NET_HPP
6
8#include "rs_net.h"
9
10#include <memory>
11
12namespace rs2
13{
14 class net_device : public rs2::device
15 {
16 public:
17 net_device(const std::string& address) : rs2::device(init(address)) { }
18
26 void add_to(context& ctx)
27 {
28 rs2_error* e = nullptr;
29 rs2_context_add_software_device(((std::shared_ptr<rs2_context>)ctx).get(), _dev.get(), &e);
31 }
32
33
34 private:
35 std::shared_ptr<rs2_device> init(const std::string& address)
36 {
37 rs2_error* e = nullptr;
38 auto dev = std::shared_ptr<rs2_device>(
39 rs2_create_net_device(RS2_API_VERSION, address.c_str(), &e),
42
43 return dev;
44 }
45 };
46}
47#endif // LIBREALSENSE_RS2_NET_HPP
Definition: rs_context.hpp:97
Definition: rs_device.hpp:19
const std::shared_ptr< rs2_device > & get() const
Definition: rs_device.hpp:116
std::shared_ptr< rs2_device > _dev
Definition: rs_device.hpp:146
static void handle(rs2_error *e)
Definition: rs_types.hpp:144
Definition: rs_net.hpp:15
void add_to(context &ctx)
Definition: rs_net.hpp:26
net_device(const std::string &address)
Definition: rs_net.hpp:17
Definition: rs_processing_gl.hpp:13
#define RS2_API_VERSION
Definition: rs.h:42
void rs2_context_add_software_device(rs2_context *ctx, rs2_device *dev, rs2_error **error)
void rs2_delete_device(rs2_device *device)
rs2_device * rs2_create_net_device(int api_version, const char *address, rs2_error **error)
struct rs2_error rs2_error
Definition: rs_types.h:259