├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── addon_config.mk
├── example
├── Makefile
├── Project.xcconfig
├── addons.make
├── config.make
├── example.sln
├── example.vcxproj
├── example.vcxproj.filters
├── example.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── example Debug.xcscheme
│ │ └── example Release.xcscheme
├── icon.rc
├── openFrameworks-Info.plist
└── src
│ ├── main.cpp
│ ├── ofApp.cpp
│ └── ofApp.h
├── libs
├── librealsense2
│ ├── export
│ │ ├── Win32
│ │ │ ├── Intel.Realsense.dll
│ │ │ └── realsense2.dll
│ │ └── x64
│ │ │ ├── Intel.Realsense.dll
│ │ │ └── realsense2.dll
│ ├── include
│ │ └── librealsense2
│ │ │ ├── h
│ │ │ ├── rs_advanced_mode_command.h
│ │ │ ├── rs_config.h
│ │ │ ├── rs_context.h
│ │ │ ├── rs_device.h
│ │ │ ├── rs_frame.h
│ │ │ ├── rs_internal.h
│ │ │ ├── rs_option.h
│ │ │ ├── rs_pipeline.h
│ │ │ ├── rs_processing.h
│ │ │ ├── rs_record_playback.h
│ │ │ ├── rs_sensor.h
│ │ │ └── rs_types.h
│ │ │ ├── hpp
│ │ │ ├── rs_context.hpp
│ │ │ ├── rs_device.hpp
│ │ │ ├── rs_export.hpp
│ │ │ ├── rs_frame.hpp
│ │ │ ├── rs_internal.hpp
│ │ │ ├── rs_options.hpp
│ │ │ ├── rs_pipeline.hpp
│ │ │ ├── rs_processing.hpp
│ │ │ ├── rs_record_playback.hpp
│ │ │ ├── rs_sensor.hpp
│ │ │ └── rs_types.hpp
│ │ │ ├── rs.h
│ │ │ ├── rs.hpp
│ │ │ ├── rs_advanced_mode.h
│ │ │ ├── rs_advanced_mode.hpp
│ │ │ └── rsutil.h
│ └── lib
│ │ ├── osx
│ │ ├── libfw.a
│ │ ├── librealsense-file.a
│ │ ├── librealsense2-gl.a
│ │ ├── librealsense2.a
│ │ ├── libtm.a
│ │ └── libuvc_fw.a
│ │ └── vs
│ │ ├── Win32
│ │ └── realsense2.lib
│ │ └── x64
│ │ └── realsense2.lib
└── libusb
│ └── lib
│ └── osx
│ └── libusb-1.0.a
└── src
├── ofxRealSense2.h
└── ofxRealSense2
├── Context.cpp
├── Context.h
├── Device.cpp
└── Device.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.a filter=lfs diff=lfs merge=lfs -text
2 | *.dll filter=lfs diff=lfs merge=lfs -text
3 | *.lib filter=lfs diff=lfs merge=lfs -text
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.depend
2 | *.layout
3 | *.mode*v3
4 | *.pbxuser
5 | *.app*
6 | *.DS_*
7 | ._*.*
8 |
9 | .svn/
10 | obj/
11 | bin/
12 | !bin/data/
13 | build/
14 | xcuserdata/
15 |
16 | ipch/
17 | *.suo
18 | *.opensdf
19 | *.vcxproj.user
20 | *.db
21 | *.opendb
22 |
23 | *.obj
24 | *.tlog
25 | *.sdf
26 | *.pdb
27 | *.idb
28 | *.pch
29 | Debug/
30 | Release/
31 |
32 |
33 | *~.xml
34 | .vs/
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Elie Zananiri - prisonerjohn.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## ofxRealSense2
2 |
3 | Intel RealSense 2 SDK bridge for openFrameworks.
4 |
5 | Includes support for:
6 | * depth, color, and infrared images.
7 | * point clouds.
8 | * post-processing filters.
9 |
10 | ### Compatibility
11 |
12 | Tested on OF 0.10.1 / Windows 10 / Intel RealSense D435.
13 |
14 | Should work on other platforms and using other 400-series devices.
--------------------------------------------------------------------------------
/addon_config.mk:
--------------------------------------------------------------------------------
1 | # All variables and this file are optional, if they are not present the PG and the
2 | # makefiles will try to parse the correct values from the file system.
3 | #
4 | # Variables that specify exclusions can use % as a wildcard to specify that anything in
5 | # that position will match. A partial path can also be specified to, for example, exclude
6 | # a whole folder from the parsed paths from the file system
7 | #
8 | # Variables can be specified using = or +=
9 | # = will clear the contents of that variable both specified from the file or the ones parsed
10 | # from the file system
11 | # += will add the values to the previous ones in the file or the ones parsed from the file
12 | # system
13 | #
14 | # The PG can be used to detect errors in this file, just create a new project with this addon
15 | # and the PG will write to the console the kind of error and in which line it is
16 |
17 | meta:
18 | ADDON_NAME = ofxRealSense2
19 | ADDON_DESCRIPTION = Intel RealSense 2 SDK bridge
20 | ADDON_AUTHOR = Elie Zananiri
21 | ADDON_TAGS =
22 | ADDON_URL = https://github.com/prisonerjohn/ofxRealSense2
23 |
24 | common:
25 | # dependencies with other addons, a list of them separated by spaces
26 | # or use += in several lines
27 | # ADDON_DEPENDENCIES =
28 |
29 | # include search paths, this will be usually parsed from the file system
30 | # but if the addon or addon libraries need special search paths they can be
31 | # specified here separated by spaces or one per line using +=
32 | # ADDON_INCLUDES =
33 |
34 | # any special flag that should be passed to the compiler when using this
35 | # addon
36 | # ADDON_CFLAGS =
37 |
38 | # any special flag that should be passed to the linker when using this
39 | # addon, also used for system libraries with -lname
40 | # ADDON_LDFLAGS =
41 |
42 | # linux only, any library that should be included in the project using
43 | # pkg-config
44 | # ADDON_PKG_CONFIG_LIBRARIES =
45 |
46 | # osx/iOS only, any framework that should be included in the project
47 | # ADDON_FRAMEWORKS =
48 |
49 | # source files, these will be usually parsed from the file system looking
50 | # in the src folders in libs and the root of the addon. if your addon needs
51 | # to include files in different places or a different set of files per platform
52 | # they can be specified here
53 | # ADDON_SOURCES =
54 |
55 | # some addons need resources to be copied to the bin/data folder of the project
56 | # specify here any files that need to be copied, you can use wildcards like * and ?
57 | # ADDON_DATA =
58 |
59 | # when parsing the file system looking for libraries exclude this for all or
60 | # a specific platform
61 | # ADDON_LIBS_EXCLUDE =
62 |
63 | ADDON_DLLS_TO_COPY =
64 | ADDON_DLLS_TO_COPY += "libs/librealsense2/export/x64/realsense2.dll"
65 | ADDON_DLLS_TO_COPY += "libs/librealsense2/export/x64/Intel.Realsense.dll"
66 |
67 | linux64:
68 | # binary libraries, these will be usually parsed from the file system but some
69 | # libraries need to passed to the linker in a specific order/
70 | #
71 | # For example in the ofxOpenCV addon we do something like this:
72 | #
73 | # ADDON_LIBS =
74 | # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_legacy.a
75 | # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_calib3d.a
76 | # ...
77 | linux:
78 | win_cb:
79 | linuxarmv6l:
80 | linuxarmv7l:
81 | android/armeabi:
82 | android/armeabi-v7a:
--------------------------------------------------------------------------------
/example/Makefile:
--------------------------------------------------------------------------------
1 | # Attempt to load a config.make file.
2 | # If none is found, project defaults in config.project.make will be used.
3 | ifneq ($(wildcard config.make),)
4 | include config.make
5 | endif
6 |
7 | # make sure the the OF_ROOT location is defined
8 | ifndef OF_ROOT
9 | OF_ROOT=$(realpath ../../..)
10 | endif
11 |
12 | # call the project makefile!
13 | include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk
14 |
--------------------------------------------------------------------------------
/example/Project.xcconfig:
--------------------------------------------------------------------------------
1 | //THE PATH TO THE ROOT OF OUR OF PATH RELATIVE TO THIS PROJECT.
2 | //THIS NEEDS TO BE DEFINED BEFORE CoreOF.xcconfig IS INCLUDED
3 | OF_PATH = ../../..
4 |
5 | //THIS HAS ALL THE HEADER AND LIBS FOR OF CORE
6 | #include "../../../libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"
7 |
8 | //ICONS - NEW IN 0072
9 | ICON_NAME_DEBUG = icon-debug.icns
10 | ICON_NAME_RELEASE = icon.icns
11 | ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/
12 |
13 | //IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to:
14 | //ICON_FILE_PATH = bin/data/
15 |
16 | OTHER_CFLAGS = $(OF_CORE_CFLAGS)
17 | OTHER_LDFLAGS = $(OF_CORE_LIBS) $(OF_CORE_FRAMEWORKS)
18 | HEADER_SEARCH_PATHS = $(OF_CORE_HEADERS)
19 |
--------------------------------------------------------------------------------
/example/addons.make:
--------------------------------------------------------------------------------
1 | ofxGui
2 | ofxRealSense2
3 |
--------------------------------------------------------------------------------
/example/config.make:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # CONFIGURE PROJECT MAKEFILE (optional)
3 | # This file is where we make project specific configurations.
4 | ################################################################################
5 |
6 | ################################################################################
7 | # OF ROOT
8 | # The location of your root openFrameworks installation
9 | # (default) OF_ROOT = ../../..
10 | ################################################################################
11 | # OF_ROOT = ../../..
12 |
13 | ################################################################################
14 | # PROJECT ROOT
15 | # The location of the project - a starting place for searching for files
16 | # (default) PROJECT_ROOT = . (this directory)
17 | #
18 | ################################################################################
19 | # PROJECT_ROOT = .
20 |
21 | ################################################################################
22 | # PROJECT SPECIFIC CHECKS
23 | # This is a project defined section to create internal makefile flags to
24 | # conditionally enable or disable the addition of various features within
25 | # this makefile. For instance, if you want to make changes based on whether
26 | # GTK is installed, one might test that here and create a variable to check.
27 | ################################################################################
28 | # None
29 |
30 | ################################################################################
31 | # PROJECT EXTERNAL SOURCE PATHS
32 | # These are fully qualified paths that are not within the PROJECT_ROOT folder.
33 | # Like source folders in the PROJECT_ROOT, these paths are subject to
34 | # exlclusion via the PROJECT_EXLCUSIONS list.
35 | #
36 | # (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank)
37 | #
38 | # Note: Leave a leading space when adding list items with the += operator
39 | ################################################################################
40 | # PROJECT_EXTERNAL_SOURCE_PATHS =
41 |
42 | ################################################################################
43 | # PROJECT EXCLUSIONS
44 | # These makefiles assume that all folders in your current project directory
45 | # and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations
46 | # to look for source code. The any folders or files that match any of the
47 | # items in the PROJECT_EXCLUSIONS list below will be ignored.
48 | #
49 | # Each item in the PROJECT_EXCLUSIONS list will be treated as a complete
50 | # string unless teh user adds a wildcard (%) operator to match subdirectories.
51 | # GNU make only allows one wildcard for matching. The second wildcard (%) is
52 | # treated literally.
53 | #
54 | # (default) PROJECT_EXCLUSIONS = (blank)
55 | #
56 | # Will automatically exclude the following:
57 | #
58 | # $(PROJECT_ROOT)/bin%
59 | # $(PROJECT_ROOT)/obj%
60 | # $(PROJECT_ROOT)/%.xcodeproj
61 | #
62 | # Note: Leave a leading space when adding list items with the += operator
63 | ################################################################################
64 | # PROJECT_EXCLUSIONS =
65 |
66 | ################################################################################
67 | # PROJECT LINKER FLAGS
68 | # These flags will be sent to the linker when compiling the executable.
69 | #
70 | # (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs
71 | #
72 | # Note: Leave a leading space when adding list items with the += operator
73 | ################################################################################
74 |
75 | # Currently, shared libraries that are needed are copied to the
76 | # $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to
77 | # add a runtime path to search for those shared libraries, since they aren't
78 | # incorporated directly into the final executable application binary.
79 | # TODO: should this be a default setting?
80 | # PROJECT_LDFLAGS=-Wl,-rpath=./libs
81 |
82 | ################################################################################
83 | # PROJECT DEFINES
84 | # Create a space-delimited list of DEFINES. The list will be converted into
85 | # CFLAGS with the "-D" flag later in the makefile.
86 | #
87 | # (default) PROJECT_DEFINES = (blank)
88 | #
89 | # Note: Leave a leading space when adding list items with the += operator
90 | ################################################################################
91 | # PROJECT_DEFINES =
92 |
93 | ################################################################################
94 | # PROJECT CFLAGS
95 | # This is a list of fully qualified CFLAGS required when compiling for this
96 | # project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS
97 | # defined in your platform specific core configuration files. These flags are
98 | # presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below.
99 | #
100 | # (default) PROJECT_CFLAGS = (blank)
101 | #
102 | # Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in
103 | # your platform specific configuration file will be applied by default and
104 | # further flags here may not be needed.
105 | #
106 | # Note: Leave a leading space when adding list items with the += operator
107 | ################################################################################
108 | # PROJECT_CFLAGS =
109 |
110 | ################################################################################
111 | # PROJECT OPTIMIZATION CFLAGS
112 | # These are lists of CFLAGS that are target-specific. While any flags could
113 | # be conditionally added, they are usually limited to optimization flags.
114 | # These flags are added BEFORE the PROJECT_CFLAGS.
115 | #
116 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets.
117 | #
118 | # (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank)
119 | #
120 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets.
121 | #
122 | # (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank)
123 | #
124 | # Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the
125 | # PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration
126 | # file will be applied by default and further optimization flags here may not
127 | # be needed.
128 | #
129 | # Note: Leave a leading space when adding list items with the += operator
130 | ################################################################################
131 | # PROJECT_OPTIMIZATION_CFLAGS_RELEASE =
132 | # PROJECT_OPTIMIZATION_CFLAGS_DEBUG =
133 |
134 | ################################################################################
135 | # PROJECT COMPILERS
136 | # Custom compilers can be set for CC and CXX
137 | # (default) PROJECT_CXX = (blank)
138 | # (default) PROJECT_CC = (blank)
139 | # Note: Leave a leading space when adding list items with the += operator
140 | ################################################################################
141 | # PROJECT_CXX =
142 | # PROJECT_CC =
143 |
--------------------------------------------------------------------------------
/example/example.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 15
3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcxproj", "{7FD42DF7-442E-479A-BA76-D0022F99702A}"
4 | EndProject
5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openframeworksLib", "..\..\..\libs\openFrameworksCompiled\project\vs\openframeworksLib.vcxproj", "{5837595D-ACA9-485C-8E76-729040CE4B0B}"
6 | EndProject
7 | Global
8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
9 | Debug|Win32 = Debug|Win32
10 | Debug|x64 = Debug|x64
11 | Release|Win32 = Release|Win32
12 | Release|x64 = Release|x64
13 | EndGlobalSection
14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
15 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.ActiveCfg = Debug|Win32
16 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|Win32.Build.0 = Debug|Win32
17 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.ActiveCfg = Debug|x64
18 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Debug|x64.Build.0 = Debug|x64
19 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.ActiveCfg = Release|Win32
20 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|Win32.Build.0 = Release|Win32
21 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.ActiveCfg = Release|x64
22 | {7FD42DF7-442E-479A-BA76-D0022F99702A}.Release|x64.Build.0 = Release|x64
23 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.ActiveCfg = Debug|Win32
24 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|Win32.Build.0 = Debug|Win32
25 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.ActiveCfg = Debug|x64
26 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Debug|x64.Build.0 = Debug|x64
27 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.ActiveCfg = Release|Win32
28 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|Win32.Build.0 = Release|Win32
29 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.ActiveCfg = Release|x64
30 | {5837595D-ACA9-485C-8E76-729040CE4B0B}.Release|x64.Build.0 = Release|x64
31 | EndGlobalSection
32 | GlobalSection(SolutionProperties) = preSolution
33 | HideSolutionNode = FALSE
34 | EndGlobalSection
35 | EndGlobal
36 |
--------------------------------------------------------------------------------
/example/example.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | src
6 |
7 |
8 | src
9 |
10 |
11 | src
12 |
13 |
14 | src
15 |
16 |
17 | addons\ofxGui\src
18 |
19 |
20 | addons\ofxGui\src
21 |
22 |
23 | addons\ofxGui\src
24 |
25 |
26 | addons\ofxGui\src
27 |
28 |
29 | addons\ofxGui\src
30 |
31 |
32 | addons\ofxGui\src
33 |
34 |
35 | addons\ofxGui\src
36 |
37 |
38 | addons\ofxGui\src
39 |
40 |
41 | addons\ofxGui\src
42 |
43 |
44 | addons\ofxGui\src
45 |
46 |
47 | addons\ofxRealSense2\src\ofxRealSense2
48 |
49 |
50 | addons\ofxRealSense2\src\ofxRealSense2
51 |
52 |
53 |
54 |
55 | {d8376475-7454-4a24-b08a-aac121d3ad6f}
56 |
57 |
58 | {71834F65-F3A9-211E-73B8-DC85}
59 |
60 |
61 | {4F2A59AF-5F4E-704B-D067-EC13}
62 |
63 |
64 | {645E9533-4DCD-6179-1CDF-CB65}
65 |
66 |
67 | {5E414EC7-938D-B210-1EA5-4B7E}
68 |
69 |
70 | {0AD0D798-2777-D570-3A9E-A47E}
71 |
72 |
73 | {4CD48D47-184F-1E2D-B37F-4A33}
74 |
75 |
76 | {31F61894-F298-D1AC-CA61-3602}
77 |
78 |
79 | {325F962A-28D1-7C54-A17F-044D}
80 |
81 |
82 | {C8A8D209-5674-CAC2-DF79-67F1}
83 |
84 |
85 | {068FD0DD-76A7-5248-0AD6-B638}
86 |
87 |
88 | {30018C1E-0A7B-5554-EBC0-4ED0}
89 |
90 |
91 | {30026F3B-2A45-B0D5-2BC8-8157}
92 |
93 |
94 |
95 |
96 | src
97 |
98 |
99 | src
100 |
101 |
102 | addons\ofxGui\src
103 |
104 |
105 | addons\ofxGui\src
106 |
107 |
108 | addons\ofxGui\src
109 |
110 |
111 | addons\ofxGui\src
112 |
113 |
114 | addons\ofxGui\src
115 |
116 |
117 | addons\ofxGui\src
118 |
119 |
120 | addons\ofxGui\src
121 |
122 |
123 | addons\ofxGui\src
124 |
125 |
126 | addons\ofxGui\src
127 |
128 |
129 | addons\ofxGui\src
130 |
131 |
132 | addons\ofxGui\src
133 |
134 |
135 | addons\ofxRealSense2\src\ofxRealSense2
136 |
137 |
138 | addons\ofxRealSense2\src\ofxRealSense2
139 |
140 |
141 | addons\ofxRealSense2\src
142 |
143 |
144 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
145 |
146 |
147 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
148 |
149 |
150 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
151 |
152 |
153 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
154 |
155 |
156 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
157 |
158 |
159 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
160 |
161 |
162 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
163 |
164 |
165 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
166 |
167 |
168 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
169 |
170 |
171 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
172 |
173 |
174 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
175 |
176 |
177 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\h
178 |
179 |
180 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
181 |
182 |
183 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
184 |
185 |
186 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
187 |
188 |
189 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
190 |
191 |
192 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
193 |
194 |
195 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
196 |
197 |
198 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
199 |
200 |
201 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
202 |
203 |
204 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
205 |
206 |
207 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
208 |
209 |
210 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2\hpp
211 |
212 |
213 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2
214 |
215 |
216 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2
217 |
218 |
219 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2
220 |
221 |
222 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2
223 |
224 |
225 | addons\ofxRealSense2\libs\librealsense2\include\librealsense2
226 |
227 |
228 |
229 |
230 |
231 |
232 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildSystemType
6 | Original
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/xcshareddata/xcschemes/example Debug.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example/example.xcodeproj/xcshareddata/xcschemes/example Release.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
78 |
79 |
81 |
82 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/example/icon.rc:
--------------------------------------------------------------------------------
1 | // Icon Resource Definition
2 | #define MAIN_ICON 102
3 |
4 | #if defined(_DEBUG)
5 | MAIN_ICON ICON "icon_debug.ico"
6 | #else
7 | MAIN_ICON ICON "icon.ico"
8 | #endif
9 |
--------------------------------------------------------------------------------
/example/openFrameworks-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | cc.openFrameworks.${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | APPL
15 | CFBundleSignature
16 | ????
17 | CFBundleVersion
18 | 1.0
19 | CFBundleIconFile
20 | ${ICON}
21 | NSCameraUsageDescription
22 | This app needs to access the camera
23 | NSMicrophoneUsageDescription
24 | This app needs to access the microphone
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "ofMain.h"
2 | #include "ofApp.h"
3 |
4 | //========================================================================
5 | int main( ){
6 | ofSetupOpenGL(1280,720,OF_WINDOW); // <-------- setup the GL context
7 |
8 | // this kicks off the running of my app
9 | // can be OF_WINDOW or OF_FULLSCREEN
10 | // pass in width and height too:
11 | ofRunApp(new ofApp());
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/example/src/ofApp.cpp:
--------------------------------------------------------------------------------
1 | #include "ofApp.h"
2 |
3 | void ofApp::setup()
4 | {
5 | ofDisableArbTex();
6 |
7 | this->guiPanel.setup("settings.xml");
8 |
9 | this->eventListeners.push(this->context.deviceAddedEvent.newListener([&](std::string serialNumber)
10 | {
11 | ofLogNotice(__FUNCTION__) << "Starting device " << serialNumber;
12 | auto device = this->context.getDevice(serialNumber);
13 | device->enableDepth();
14 | device->enableColor();
15 | device->enablePoints();
16 | device->startPipeline();
17 | this->guiPanel.add(device->params);
18 | }));
19 |
20 | try
21 | {
22 | this->context.setup(false);
23 | }
24 | catch (std::exception& e)
25 | {
26 | ofLogFatalError(__FUNCTION__) << e.what();
27 | }
28 | }
29 |
30 | void ofApp::exit()
31 | {
32 | this->context.clear();
33 | }
34 |
35 | void ofApp::update()
36 | {
37 | this->context.update();
38 | }
39 |
40 | void ofApp::draw()
41 | {
42 | ofBackground(0);
43 |
44 | int i = 0;
45 | auto it = this->context.getDevices().begin();
46 | while (it != this->context.getDevices().end())
47 | {
48 | int x = 640 * i;
49 | it->second->getDepthTex().draw(x, 0);
50 | it->second->getColorTex().draw(x, 360);
51 |
52 | if (ofInRange(ofGetMouseX(), x, x + 640) &&
53 | ofInRange(ofGetMouseY(), 0, 360))
54 | {
55 | float distance = it->second->getDistance(ofMap(ofGetMouseX(), x, x + 640, 0, 640), ofGetMouseY());
56 | ofDrawBitmapStringHighlight(ofToString(distance, 3) + " m", ofGetMouseX(), ofGetMouseY());
57 | }
58 |
59 | ++it;
60 | ++i;
61 | }
62 |
63 | this->cam.begin();
64 | ofEnableDepthTest();
65 | ofPushMatrix();
66 | ofScale(100);
67 | {
68 | auto it = this->context.getDevices().begin();
69 | while (it != this->context.getDevices().end())
70 | {
71 | it->second->getColorTex().bind();
72 | it->second->getPointsMesh().draw();
73 | it->second->getColorTex().unbind();
74 |
75 | ++it;
76 | }
77 | }
78 | ofPopMatrix();
79 | ofDisableDepthTest();
80 | this->cam.end();
81 |
82 | ofDrawBitmapString(ofToString(ofGetFrameRate()), 10, 10);
83 |
84 | this->guiPanel.draw();
85 | }
86 |
87 | void ofApp::keyPressed(int key)
88 | {
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/example/src/ofApp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ofMain.h"
4 | #include "ofxGui.h"
5 | #include "ofxRealSense2.h"
6 |
7 | class ofApp
8 | : public ofBaseApp
9 | {
10 | public:
11 | void setup();
12 | void exit();
13 |
14 | void update();
15 | void draw();
16 |
17 | void keyPressed(int key);
18 |
19 | ofxRealSense2::Context context;
20 | ofEventListeners eventListeners;
21 |
22 | ofEasyCam cam;
23 |
24 | ofxPanel guiPanel;
25 | };
26 |
--------------------------------------------------------------------------------
/libs/librealsense2/export/Win32/Intel.Realsense.dll:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:58046671bc678854e4d59ee0dc5dd353b9fd43d5450a5af20605a7363637ec06
3 | size 94064
4 |
--------------------------------------------------------------------------------
/libs/librealsense2/export/Win32/realsense2.dll:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:011023cc774305ea2931011f39d109316a86ef32fd97db3b4cb97d555c150702
3 | size 18483056
4 |
--------------------------------------------------------------------------------
/libs/librealsense2/export/x64/Intel.Realsense.dll:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:0b44333c04b9550368a963144fdba4c3e2eff083929cab8b7305763c9eae496f
3 | size 93552
4 |
--------------------------------------------------------------------------------
/libs/librealsense2/export/x64/realsense2.dll:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:03a7dd7da534218a0205a144aa4009205aa28cd76586be50ad2d157ce5a9086a
3 | size 21063536
4 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_advanced_mode_command.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /**
5 | * @file rs_advanced_mode_command.h
6 | * @brief Advanced Mode Commands header file
7 | */
8 |
9 | #ifndef RS2_ADVANCED_MODE_COMMAND_H
10 | #define RS2_ADVANCED_MODE_COMMAND_H
11 |
12 | #include
13 |
14 | typedef struct
15 | {
16 | uint32_t plusIncrement;
17 | uint32_t minusDecrement;
18 | uint32_t deepSeaMedianThreshold;
19 | uint32_t scoreThreshA;
20 | uint32_t scoreThreshB;
21 | uint32_t textureDifferenceThreshold;
22 | uint32_t textureCountThreshold;
23 | uint32_t deepSeaSecondPeakThreshold;
24 | uint32_t deepSeaNeighborThreshold;
25 | uint32_t lrAgreeThreshold;
26 | }STDepthControlGroup;
27 |
28 | typedef struct
29 | {
30 | uint32_t rsmBypass;
31 | float diffThresh;
32 | float sloRauDiffThresh;
33 | uint32_t removeThresh;
34 | }STRsm;
35 |
36 | typedef struct
37 | {
38 | uint32_t minWest;
39 | uint32_t minEast;
40 | uint32_t minWEsum;
41 | uint32_t minNorth;
42 | uint32_t minSouth;
43 | uint32_t minNSsum;
44 | uint32_t uShrink;
45 | uint32_t vShrink;
46 | }STRauSupportVectorControl;
47 |
48 | typedef struct
49 | {
50 | uint32_t disableSADColor;
51 | uint32_t disableRAUColor;
52 | uint32_t disableSLORightColor;
53 | uint32_t disableSLOLeftColor;
54 | uint32_t disableSADNormalize;
55 | }STColorControl;
56 |
57 | typedef struct
58 | {
59 | uint32_t rauDiffThresholdRed;
60 | uint32_t rauDiffThresholdGreen;
61 | uint32_t rauDiffThresholdBlue;
62 | }STRauColorThresholdsControl;
63 |
64 | typedef struct
65 | {
66 | uint32_t diffThresholdRed;
67 | uint32_t diffThresholdGreen;
68 | uint32_t diffThresholdBlue;
69 | }STSloColorThresholdsControl;
70 |
71 | typedef struct
72 | {
73 | uint32_t sloK1Penalty;
74 | uint32_t sloK2Penalty;
75 | uint32_t sloK1PenaltyMod1;
76 | uint32_t sloK2PenaltyMod1;
77 | uint32_t sloK1PenaltyMod2;
78 | uint32_t sloK2PenaltyMod2;
79 | }STSloPenaltyControl;
80 |
81 |
82 | typedef struct
83 | {
84 | float lambdaCensus;
85 | float lambdaAD;
86 | uint32_t ignoreSAD;
87 | }STHdad;
88 |
89 | typedef struct
90 | {
91 | float colorCorrection1;
92 | float colorCorrection2;
93 | float colorCorrection3;
94 | float colorCorrection4;
95 | float colorCorrection5;
96 | float colorCorrection6;
97 | float colorCorrection7;
98 | float colorCorrection8;
99 | float colorCorrection9;
100 | float colorCorrection10;
101 | float colorCorrection11;
102 | float colorCorrection12;
103 | }STColorCorrection;
104 |
105 | typedef struct
106 | {
107 | uint32_t meanIntensitySetPoint;
108 | }STAEControl;
109 |
110 | typedef struct
111 | {
112 | uint32_t depthUnits;
113 | int32_t depthClampMin;
114 | int32_t depthClampMax;
115 | uint32_t disparityMode;
116 | int32_t disparityShift;
117 | }STDepthTableControl;
118 |
119 | typedef struct
120 | {
121 | uint32_t uDiameter;
122 | uint32_t vDiameter;
123 | }STCensusRadius;
124 |
125 | typedef struct
126 | {
127 | float amplitude;
128 | }STAFactor;
129 |
130 | #ifdef __cplusplus
131 | extern "C"{
132 | #endif
133 |
134 |
135 | #ifdef __cplusplus
136 | }
137 | #endif
138 |
139 | #endif /*RS2_ADVANCED_MODE_COMMAND_H*/
140 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_config.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_pipeline.h
5 | * \brief
6 | * Exposes RealSense processing-block functionality for C compilers
7 | */
8 |
9 |
10 | #ifndef LIBREALSENSE_RS2_CONFIG_H
11 | #define LIBREALSENSE_RS2_CONFIG_H
12 |
13 | #define RS2_DEFAULT_TIMEOUT 15000
14 |
15 | #ifdef __cplusplus
16 | extern "C" {
17 | #endif
18 |
19 | #include "rs_types.h"
20 | #include "rs_sensor.h"
21 |
22 | /**
23 | * Create a config instance
24 | * The config allows pipeline users to request filters for the pipeline streams and device selection and configuration.
25 | * This is an optional step in pipeline creation, as the pipeline resolves its streaming device internally.
26 | * Config provides its users a way to set the filters and test if there is no conflict with the pipeline requirements
27 | * from the device. It also allows the user to find a matching device for the config filters and the pipeline, in order to
28 | * select a device explicitly, and modify its controls before streaming starts.
29 | *
30 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
31 | * \return rs2_config* A pointer to a new config instance
32 | */
33 | rs2_config* rs2_create_config(rs2_error** error);
34 |
35 | /**
36 | * Deletes an instance of a config
37 | *
38 | * \param[in] config A pointer to an instance of a config
39 | */
40 | void rs2_delete_config(rs2_config* config);
41 |
42 | /**
43 | * Enable a device stream explicitly, with selected stream parameters.
44 | * The method allows the application to request a stream with specific configuration. If no stream is explicitly enabled, the pipeline
45 | * configures the device and its streams according to the attached computer vision modules and processing blocks requirements, or
46 | * default configuration for the first available device.
47 | * The application can configure any of the input stream parameters according to its requirement, or set to 0 for don't care value.
48 | * The config accumulates the application calls for enable configuration methods, until the configuration is applied. Multiple enable
49 | * stream calls for the same stream with conflicting parameters override each other, and the last call is maintained.
50 | * Upon calling \c resolve(), the config checks for conflicts between the application configuration requests and the attached computer
51 | * vision modules and processing blocks requirements, and fails if conflicts are found. Before \c resolve() is called, no conflict
52 | * check is done.
53 | *
54 | * \param[in] config A pointer to an instance of a config
55 | * \param[in] stream Stream type to be enabled
56 | * \param[in] index Stream index, used for multiple streams of the same type. -1 indicates any.
57 | * \param[in] width Stream image width - for images streams. 0 indicates any.
58 | * \param[in] height Stream image height - for images streams. 0 indicates any.
59 | * \param[in] format Stream data format - pixel format for images streams, of data type for other streams. RS2_FORMAT_ANY indicates any.
60 | * \param[in] framerate Stream frames per second. 0 indicates any.
61 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
62 | */
63 | void rs2_config_enable_stream(rs2_config* config,
64 | rs2_stream stream,
65 | int index,
66 | int width,
67 | int height,
68 | rs2_format format,
69 | int framerate,
70 | rs2_error** error);
71 |
72 | /**
73 | * Enable all device streams explicitly.
74 | * The conditions and behavior of this method are similar to those of \c enable_stream().
75 | * This filter enables all raw streams of the selected device. The device is either selected explicitly by the application,
76 | * or by the pipeline requirements or default. The list of streams is device dependent.
77 | *
78 | * \param[in] config A pointer to an instance of a config
79 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
80 | */
81 | void rs2_config_enable_all_stream(rs2_config* config, rs2_error ** error);
82 |
83 | /**
84 | * Select a specific device explicitly by its serial number, to be used by the pipeline.
85 | * The conditions and behavior of this method are similar to those of \c enable_stream().
86 | * This method is required if the application needs to set device or sensor settings prior to pipeline streaming, to enforce
87 | * the pipeline to use the configured device.
88 | *
89 | * \param[in] config A pointer to an instance of a config
90 | * \param[in] serial device serial number, as returned by RS2_CAMERA_INFO_SERIAL_NUMBER
91 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
92 | */
93 | void rs2_config_enable_device(rs2_config* config, const char* serial, rs2_error ** error);
94 |
95 | /**
96 | * Select a recorded device from a file, to be used by the pipeline through playback.
97 | * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
98 | * as available.
99 | * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
100 | * By default, playback is repeated once the file ends. To control this, see 'rs2_config_enable_device_from_file_repeat_option'.
101 | *
102 | * \param[in] config A pointer to an instance of a config
103 | * \param[in] file The playback file of the device
104 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
105 | */
106 | void rs2_config_enable_device_from_file(rs2_config* config, const char* file, rs2_error ** error);
107 |
108 | /**
109 | * Select a recorded device from a file, to be used by the pipeline through playback.
110 | * The device available streams are as recorded to the file, and \c resolve() considers only this device and configuration
111 | * as available.
112 | * This request cannot be used if enable_record_to_file() is called for the current config, and vise versa
113 | *
114 | * \param[in] config A pointer to an instance of a config
115 | * \param[in] file The playback file of the device
116 | * \param[in] repeat_playback if true, when file ends the playback starts again, in an infinite loop;
117 | if false, when file ends playback does not start again, and should by stopped manually by the user.
118 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
119 | */
120 | void rs2_config_enable_device_from_file_repeat_option(rs2_config* config, const char* file, int repeat_playback, rs2_error ** error);
121 |
122 | /**
123 | * Requires that the resolved device would be recorded to file
124 | * This request cannot be used if enable_device_from_file() is called for the current config, and vise versa
125 | *
126 | * \param[in] config A pointer to an instance of a config
127 | * \param[in] file The desired file for the output record
128 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
129 | */
130 | void rs2_config_enable_record_to_file(rs2_config* config, const char* file, rs2_error ** error);
131 |
132 |
133 | /**
134 | * Disable a device stream explicitly, to remove any requests on this stream type.
135 | * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
136 | * stream configuration.
137 | *
138 | * \param[in] config A pointer to an instance of a config
139 | * \param[in] stream Stream type, for which the filters are cleared
140 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
141 | */
142 | void rs2_config_disable_stream(rs2_config* config, rs2_stream stream, rs2_error ** error);
143 |
144 | /**
145 | * Disable a device stream explicitly, to remove any requests on this stream profile.
146 | * The stream can still be enabled due to pipeline computer vision module request. This call removes any filter on the
147 | * stream configuration.
148 | *
149 | * \param[in] config A pointer to an instance of a config
150 | * \param[in] stream Stream type, for which the filters are cleared
151 | * \param[in] index Stream index, for which the filters are cleared
152 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
153 | */
154 | void rs2_config_disable_indexed_stream(rs2_config* config, rs2_stream stream, int index, rs2_error ** error);
155 |
156 | /**
157 | * Disable all device stream explicitly, to remove any requests on the streams profiles.
158 | * The streams can still be enabled due to pipeline computer vision module request. This call removes any filter on the
159 | * streams configuration.
160 | *
161 | * \param[in] config A pointer to an instance of a config
162 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
163 | */
164 | void rs2_config_disable_all_streams(rs2_config* config, rs2_error ** error);
165 |
166 | /**
167 | * Resolve the configuration filters, to find a matching device and streams profiles.
168 | * The method resolves the user configuration filters for the device and streams, and combines them with the requirements of
169 | * the computer vision modules and processing blocks attached to the pipeline. If there are no conflicts of requests, it looks
170 | * for an available device, which can satisfy all requests, and selects the first matching streams configuration. In the absence
171 | * of any request, the rs2::config selects the first available device and the first color and depth streams configuration.
172 | * The pipeline profile selection during \c start() follows the same method. Thus, the selected profile is the same, if no
173 | * change occurs to the available devices occurs.
174 | * Resolving the pipeline configuration provides the application access to the pipeline selected device for advanced control.
175 | * The returned configuration is not applied to the device, so the application doesn't own the device sensors. However, the
176 | * application can call \c enable_device(), to enforce the device returned by this method is selected by pipeline \c start(),
177 | * and configure the device and sensors options or extensions before streaming starts.
178 | *
179 | * \param[in] config A pointer to an instance of a config
180 | * \param[in] pipe The pipeline for which the selected filters are applied
181 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
182 | * \return A matching device and streams profile, which satisfies the filters and pipeline requests.
183 | */
184 | rs2_pipeline_profile* rs2_config_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
185 |
186 | /**
187 | * Check if the config can resolve the configuration filters, to find a matching device and streams profiles.
188 | * The resolution conditions are as described in \c resolve().
189 | *
190 | * \param[in] config A pointer to an instance of a config
191 | * \param[in] pipe The pipeline for which the selected filters are applied
192 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
193 | * \return True if a valid profile selection exists, false if no selection can be found under the config filters and the available devices.
194 | */
195 | int rs2_config_can_resolve(rs2_config* config, rs2_pipeline* pipe, rs2_error ** error);
196 |
197 | #ifdef __cplusplus
198 | }
199 | #endif
200 | #endif
201 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_context.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_context.h
5 | * \brief Exposes RealSense context functionality for C compilers
6 | */
7 |
8 |
9 | #ifndef LIBREALSENSE_RS2_CONTEXT_H
10 | #define LIBREALSENSE_RS2_CONTEXT_H
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 | #include "rs_types.h"
16 |
17 | /**
18 | * \brief Creates RealSense context that is required for the rest of the API.
19 | * \param[in] api_version Users are expected to pass their version of \c RS2_API_VERSION to make sure they are running the correct librealsense version.
20 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
21 | * \return Context object
22 | */
23 | rs2_context* rs2_create_context(int api_version, rs2_error** error);
24 |
25 | /**
26 | * \brief Frees the relevant context object.
27 | * \param[in] context Object that is no longer needed
28 | */
29 | void rs2_delete_context(rs2_context* context);
30 |
31 | /**
32 | * set callback to get devices changed events
33 | * these events will be raised by the context whenever new RealSense device is connected or existing device gets disconnected
34 | * \param context Object representing librealsense session
35 | * \param[in] callback callback object created from c++ application. ownership over the callback object is moved into the context
36 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
37 | */
38 | void rs2_set_devices_changed_callback_cpp(rs2_context* context, rs2_devices_changed_callback* callback, rs2_error** error);
39 |
40 | /**
41 | * set callback to get devices changed events
42 | * these events will be raised by the context whenever new RealSense device is connected or existing device gets disconnected
43 | * \param context Object representing librealsense session
44 | * \param[in] callback function pointer to register as per-notifications callback
45 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
46 | */
47 | void rs2_set_devices_changed_callback(const rs2_context* context, rs2_devices_changed_callback_ptr callback, void* user, rs2_error** error);
48 |
49 | /**
50 | * Create a new device and add it to the context
51 | * \param ctx The context to which the new device will be added
52 | * \param file The file from which the device should be created
53 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
54 | * @return A pointer to a device that plays data from the file, or null in case of failure
55 | */
56 | rs2_device* rs2_context_add_device(rs2_context* ctx, const char* file, rs2_error** error);
57 |
58 | /**
59 | * Add an instance of software device to the context
60 | * \param ctx The context to which the new device will be added
61 | * \param dev Instance of software device to register into the context
62 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
63 | */
64 | void rs2_context_add_software_device(rs2_context* ctx, rs2_device* dev, rs2_error** error);
65 |
66 | /**
67 | * Removes a playback device from the context, if exists
68 | * \param[in] ctx The context from which the device should be removed
69 | * \param[in] file The file name that was used to add the device
70 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
71 | */
72 | void rs2_context_remove_device(rs2_context* ctx, const char* file, rs2_error** error);
73 |
74 | /**
75 | * Removes tracking module.
76 | * function query_devices() locks the tracking module in the tm_context object.
77 | * If the tracking module device is not used it should be removed using this function, so that other applications could find it.
78 | * This function can be used both before the call to query_device() to prevent enabling tracking modules or afterwards to
79 | * release them.
80 | */
81 | void rs2_context_unload_tracking_module(rs2_context* ctx, rs2_error** error);
82 |
83 | /**
84 | * create a static snapshot of all connected devices at the time of the call
85 | * \param context Object representing librealsense session
86 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
87 | * \return the list of devices, should be released by rs2_delete_device_list
88 | */
89 | rs2_device_list* rs2_query_devices(const rs2_context* context, rs2_error** error);
90 |
91 | #define RS2_PRODUCT_LINE_ANY 0xff
92 | #define RS2_PRODUCT_LINE_ANY_INTEL 0xfe
93 | #define RS2_PRODUCT_LINE_NON_INTEL 0x01
94 | #define RS2_PRODUCT_LINE_D400 0x02
95 | #define RS2_PRODUCT_LINE_SR300 0x04
96 | #define RS2_PRODUCT_LINE_L500 0x08
97 | #define RS2_PRODUCT_LINE_T200 0x10
98 | #define RS2_PRODUCT_LINE_DEPTH (RS2_PRODUCT_LINE_L500 | RS2_PRODUCT_LINE_SR300 | RS2_PRODUCT_LINE_D400)
99 | #define RS2_PRODUCT_LINE_TRACKING RS2_PRODUCT_LINE_T200
100 |
101 | /**
102 | * create a static snapshot of all connected devices at the time of the call
103 | * \param context Object representing librealsense session
104 | * \param product_mask Controls what kind of devices will be returned
105 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
106 | * \return the list of devices, should be released by rs2_delete_device_list
107 | */
108 | rs2_device_list* rs2_query_devices_ex(const rs2_context* context, int product_mask, rs2_error** error);
109 |
110 | /**
111 | * \brief Creates RealSense device_hub .
112 | * \param[in] context The context for the device hub
113 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
114 | * \return Device hub object
115 | */
116 | rs2_device_hub* rs2_create_device_hub(const rs2_context* context, rs2_error** error);
117 |
118 | /**
119 | * \brief Frees the relevant device hub object.
120 | * \param[in] hub Object that is no longer needed
121 | */
122 | void rs2_delete_device_hub(const rs2_device_hub* hub);
123 |
124 | /**
125 | * If any device is connected return it, otherwise wait until next RealSense device connects.
126 | * Calling this method multiple times will cycle through connected devices
127 | * \param[in] ctx The context to creat the device
128 | * \param[in] hub The device hub object
129 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
130 | * \return device object
131 | */
132 | rs2_device* rs2_device_hub_wait_for_device(const rs2_device_hub* hub, rs2_error** error);
133 |
134 | /**
135 | * Checks if device is still connected
136 | * \param[in] hub The device hub object
137 | * \param[in] device The device
138 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored.
139 | * \return 1 if the device is connected, 0 otherwise
140 | */
141 | int rs2_device_hub_is_device_connected(const rs2_device_hub* hub, const rs2_device* device, rs2_error** error);
142 |
143 |
144 | #ifdef __cplusplus
145 | }
146 | #endif
147 | #endif
148 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_device.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_device.h
5 | * \brief Exposes RealSense device functionality for C compilers
6 | */
7 |
8 |
9 | #ifndef LIBREALSENSE_RS2_DEVICE_H
10 | #define LIBREALSENSE_RS2_DEVICE_H
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | #include "rs_types.h"
17 | #include "rs_sensor.h"
18 |
19 | /**
20 | * Determines number of devices in a list.
21 | * \param[in] info_list The list of connected devices captured using rs2_query_devices
22 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
23 | * \return Device count
24 | */
25 | int rs2_get_device_count(const rs2_device_list* info_list, rs2_error** error);
26 |
27 | /**
28 | * Deletes device list, any devices created using this list will remain unaffected.
29 | * \param[in] info_list List to delete
30 | */
31 | void rs2_delete_device_list(rs2_device_list* info_list);
32 |
33 | /**
34 | * Checks if a specific device is contained inside a device list.
35 | * \param[in] info_list The list of devices to check in
36 | * \param[in] device RealSense device to check for
37 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
38 | * \return True if the device is in the list and false otherwise
39 | */
40 | int rs2_device_list_contains(const rs2_device_list* info_list, const rs2_device* device, rs2_error** error);
41 |
42 | /**
43 | * Creates a device by index. The device object represents a physical camera and provides the means to manipulate it.
44 | * \param[in] info_list the list containing the device to retrieve
45 | * \param[in] index The zero based index of device to retrieve
46 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
47 | * \return The requested device, should be released by rs2_delete_device
48 | */
49 | rs2_device* rs2_create_device(const rs2_device_list* info_list, int index, rs2_error** error);
50 |
51 | /**
52 | * Delete RealSense device
53 | * \param[in] device Realsense device to delete
54 | */
55 | void rs2_delete_device(rs2_device* device);
56 |
57 | /**
58 | * Retrieve camera specific information, like versions of various internal components.
59 | * \param[in] device The RealSense device
60 | * \param[in] info Camera info type to retrieve
61 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
62 | * \return The requested camera info string, in a format specific to the device model
63 | */
64 | const char* rs2_get_device_info(const rs2_device* device, rs2_camera_info info, rs2_error** error);
65 |
66 | /**
67 | * Check if a camera supports a specific camera info type.
68 | * \param[in] device The RealSense device to check
69 | * \param[in] info The parameter to check for support
70 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
71 | * \return True if the parameter both exist and well-defined for the specific device
72 | */
73 | int rs2_supports_device_info(const rs2_device* device, rs2_camera_info info, rs2_error** error);
74 |
75 | /**
76 | * Send hardware reset request to the device. The actual reset is asynchronous.
77 | * Note: Invalidates all handles to this device.
78 | * \param[in] device The RealSense device to reset
79 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
80 | */
81 | void rs2_hardware_reset(const rs2_device * device, rs2_error ** error);
82 |
83 | /**
84 | * Send raw data to device
85 | * \param[in] device RealSense device to send data to
86 | * \param[in] raw_data_to_send Raw data to be sent to device
87 | * \param[in] size_of_raw_data_to_send Size of raw_data_to_send in bytes
88 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
89 | * \return Device's response in a rs2_raw_data_buffer, which should be released by rs2_delete_raw_data
90 | */
91 | const rs2_raw_data_buffer* rs2_send_and_receive_raw_data(rs2_device* device, void* raw_data_to_send, unsigned size_of_raw_data_to_send, rs2_error** error);
92 |
93 | /**
94 | * Test if the given device can be extended to the requested extension.
95 | * \param[in] device Realsense device
96 | * \param[in] extension The extension to which the device should be tested if it is extendable
97 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
98 | * \return Non-zero value iff the device can be extended to the given extension
99 | */
100 | int rs2_is_device_extendable_to(const rs2_device* device, rs2_extension extension, rs2_error ** error);
101 |
102 | /**
103 | * Create a static snapshot of all connected sensors within a specific device.
104 | * \param[in] device Specific RealSense device
105 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
106 | * \return The list of sensors, should be released by rs2_delete_sensor_list
107 | */
108 | rs2_sensor_list* rs2_query_sensors(const rs2_device* device, rs2_error** error);
109 |
110 | /**
111 | * Enter the given device into loopback operation mode that uses the given file as input for raw data
112 | * \param[in] device Device to enter into loopback operation mode
113 | * \param[in] from_file Path to bag file with raw data for loopback
114 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
115 | */
116 | void rs2_loopback_enable(const rs2_device* device, const char* from_file, rs2_error** error);
117 |
118 | /**
119 | * Restores the given device into normal operation mode
120 | * \param[in] device Device to restore to normal operation mode
121 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
122 | */
123 | void rs2_loopback_disable(const rs2_device* device, rs2_error** error);
124 |
125 | /**
126 | * Checks if the device is in loopback mode or not
127 | * \param[in] device Device to check for operation mode
128 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
129 | * \return true if the device is in loopback operation mode
130 | */
131 | int rs2_loopback_is_enabled(const rs2_device* device, rs2_error** error);
132 |
133 | /**
134 | * Connects to a given tm2 controller
135 | * \param[in] device Device to connect to the controller
136 | * \param[in] mac_addr The MAC address of the desired controller
137 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
138 | */
139 | void rs2_connect_tm2_controller(const rs2_device* device, const unsigned char* mac_addr, rs2_error** error);
140 |
141 | /**
142 | * Disconnects a given tm2 controller
143 | * \param[in] device Device to disconnect the controller from
144 | * \param[in] id The ID of the desired controller
145 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
146 | */
147 | void rs2_disconnect_tm2_controller(const rs2_device* device, int id, rs2_error** error);
148 |
149 | /**
150 | * Update device to the provided firmware, the device must be extendable to RS2_EXTENSION_UPDATABLE.
151 | * This call is executed on the caller's thread and it supports progress notifications via the optional callback.
152 | * \param[in] device Device to update
153 | * \param[in] fw_image Firmware image buffer
154 | * \param[in] fw_image_size Firmware image buffer size
155 | * \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
156 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
157 | */
158 | void rs2_update_firmware_cpp(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback* callback, rs2_error** error);
159 |
160 | /**
161 | * Update device to the provided firmware, the device must be extendable to RS2_EXTENSION_UPDATABLE.
162 | * This call is executed on the caller's thread and it supports progress notifications via the optional callback.
163 | * \param[in] device Device to update
164 | * \param[in] fw_image Firmware image buffer
165 | * \param[in] fw_image_size Firmware image buffer size
166 | * \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
167 | * \param[in] client_data Optional client data for the callback
168 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
169 | */
170 | void rs2_update_firmware(const rs2_device* device, const void* fw_image, int fw_image_size, rs2_update_progress_callback_ptr callback, void* client_data, rs2_error** error);
171 |
172 | /**
173 | * Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
174 | * loaded back to the device, but it does contain all calibration and device information.
175 | * \param[in] device Device to update
176 | * \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
177 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
178 | */
179 | const rs2_raw_data_buffer* rs2_create_flash_backup_cpp(const rs2_device* device, rs2_update_progress_callback* callback, rs2_error** error);
180 |
181 | /**
182 | * Create backup of camera flash memory. Such backup does not constitute valid firmware image, and cannot be
183 | * loaded back to the device, but it does contain all calibration and device information.
184 | * \param[in] device Device to update
185 | * \param[in] callback Optional callback for update progress notifications, the progress value is normailzed to 1
186 | * \param[in] client_data Optional client data for the callback
187 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
188 | */
189 | const rs2_raw_data_buffer* rs2_create_flash_backup(const rs2_device* device, rs2_update_progress_callback_ptr callback, void* client_data, rs2_error** error);
190 |
191 | /**
192 | * Enter the device to update state, this will cause the updatable device to disconnect and reconnect as update device.
193 | * \param[in] device Device to update
194 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
195 | */
196 | void rs2_enter_update_state(const rs2_device* device, rs2_error** error);
197 |
198 | #ifdef __cplusplus
199 | }
200 | #endif
201 | #endif
202 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_internal.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_internal.h
5 | * \brief
6 | * Exposes RealSense internal functionality for C compilers
7 | */
8 |
9 |
10 | #ifndef LIBREALSENSE_RS2_INTERNAL_H
11 | #define LIBREALSENSE_RS2_INTERNAL_H
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 | #include "rs_types.h"
17 | #include "rs_context.h"
18 | #include "rs_sensor.h"
19 | #include "rs_frame.h"
20 | #include "rs_option.h"
21 | /**
22 | * librealsense Recorder is intended for effective unit-testing
23 | * Currently supports three modes of operation:
24 | */
25 | typedef enum rs2_recording_mode
26 | {
27 | RS2_RECORDING_MODE_BLANK_FRAMES, /* frame metadata will be recorded, but pixel data will be replaced with zeros to save space */
28 | RS2_RECORDING_MODE_COMPRESSED, /* frames will be encoded using a proprietary lossy encoding, aiming at x5 compression at some CPU expense */
29 | RS2_RECORDING_MODE_BEST_QUALITY, /* frames will not be compressed, but rather stored as-is. This gives best quality and low CPU overhead, but you might run out of memory */
30 | RS2_RECORDING_MODE_COUNT
31 | } rs2_recording_mode;
32 |
33 | /** \brief All the parameters are required to define video stream*/
34 | typedef struct rs2_video_stream
35 | {
36 | rs2_stream type;
37 | int index;
38 | int uid;
39 | int width;
40 | int height;
41 | int fps;
42 | int bpp;
43 | rs2_format fmt;
44 | rs2_intrinsics intrinsics;
45 | } rs2_video_stream;
46 |
47 | /** \brief All the parameters are required to define motion stream*/
48 | typedef struct rs2_motion_stream
49 | {
50 | rs2_stream type;
51 | int index;
52 | int uid;
53 | int fps;
54 | rs2_format fmt;
55 | rs2_motion_device_intrinsic intrinsics;
56 | } rs2_motion_stream;
57 |
58 | /** \brief All the parameters are required to define pose stream*/
59 | typedef struct rs2_pose_stream
60 | {
61 | rs2_stream type;
62 | int index;
63 | int uid;
64 | int fps;
65 | rs2_format fmt;
66 | } rs2_pose_stream;
67 |
68 | /** \brief All the parameters are required to define video frame*/
69 | typedef struct rs2_software_video_frame
70 | {
71 | void* pixels;
72 | void(*deleter)(void*);
73 | int stride;
74 | int bpp;
75 | rs2_time_t timestamp;
76 | rs2_timestamp_domain domain;
77 | int frame_number;
78 | const rs2_stream_profile* profile;
79 | } rs2_software_video_frame;
80 |
81 | /** \brief All the parameters are required to define motion frame*/
82 | typedef struct rs2_software_motion_frame
83 | {
84 | void* data;
85 | void(*deleter)(void*);
86 | rs2_time_t timestamp;
87 | rs2_timestamp_domain domain;
88 | int frame_number;
89 | const rs2_stream_profile* profile;
90 | } rs2_software_motion_frame;
91 |
92 | /** \brief All the parameters are required to define pose frame*/
93 | typedef struct rs2_software_pose_frame
94 | {
95 | struct pose_frame_info
96 | {
97 | float translation[3];
98 | float velocity[3];
99 | float acceleration[3];
100 | float rotation[4];
101 | float angular_velocity[3];
102 | float angular_acceleration[3];
103 | int tracker_confidence;
104 | int mapper_confidence;
105 | };
106 | void* data;
107 | void(*deleter)(void*);
108 | rs2_time_t timestamp;
109 | rs2_timestamp_domain domain;
110 | int frame_number;
111 | const rs2_stream_profile* profile;
112 | } rs2_software_pose_frame;
113 |
114 | /**
115 | * Create librealsense context that will try to record all operations over librealsense into a file
116 | * \param[in] api_version realsense API version as provided by RS2_API_VERSION macro
117 | * \param[in] filename string representing the name of the file to record
118 | * \param[in] section string representing the name of the section within existing recording
119 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
120 | * \return context object, should be released by rs2_delete_context
121 | */
122 | rs2_context* rs2_create_recording_context(int api_version, const char* filename, const char* section, rs2_recording_mode mode, rs2_error** error);
123 |
124 | /**
125 | * Create librealsense context that given a file will respond to calls exactly as the recording did
126 | * if the user calls a method that was either not called during recording or violates causality of the recording error will be thrown
127 | * \param[in] api_version realsense API version as provided by RS2_API_VERSION macro
128 | * \param[in] filename string representing the name of the file to play back from
129 | * \param[in] section string representing the name of the section within existing recording
130 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
131 | * \return context object, should be released by rs2_delete_context
132 | */
133 | rs2_context* rs2_create_mock_context(int api_version, const char* filename, const char* section, rs2_error** error);
134 |
135 | /**
136 | * Create librealsense context that given a file will respond to calls exactly as the recording did
137 | * if the user calls a method that was either not called during recording or violates causality of the recording error will be thrown
138 | * \param[in] api_version realsense API version as provided by RS2_API_VERSION macro
139 | * \param[in] filename string representing the name of the file to play back from
140 | * \param[in] section string representing the name of the section within existing recording
141 | * \param[in] min_api_version reject any file that was recorded before this version
142 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
143 | * \return context object, should be released by rs2_delete_context
144 | */
145 | rs2_context* rs2_create_mock_context_versioned(int api_version, const char* filename, const char* section, const char* min_api_version, rs2_error** error);
146 |
147 | /**
148 | * Create software device to enable use librealsense logic without getting data from backend
149 | * but inject the data from outside
150 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
151 | * \return software device object, should be released by rs2_delete_device
152 | */
153 | rs2_device* rs2_create_software_device(rs2_error** error);
154 |
155 | /**
156 | * Add sensor to the software device
157 | * \param[in] dev the software device
158 | * \param[in] sensor_name the name of the sensor
159 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
160 | * \return software sensor object, should be released by rs2_delete_sensor
161 | */
162 | rs2_sensor* rs2_software_device_add_sensor(rs2_device* dev, const char* sensor_name, rs2_error** error);
163 |
164 | /**
165 | * Inject video frame to software sonsor
166 | * \param[in] sensor the software sensor
167 | * \param[in] frame all the frame components
168 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
169 | */
170 | void rs2_software_sensor_on_video_frame(rs2_sensor* sensor, rs2_software_video_frame frame, rs2_error** error);
171 |
172 | /**
173 | * Inject motion frame to software sonsor
174 | * \param[in] sensor the software sensor
175 | * \param[in] frame all the frame components
176 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
177 | */
178 | void rs2_software_sensor_on_motion_frame(rs2_sensor* sensor, rs2_software_motion_frame frame, rs2_error** error);
179 |
180 | /**
181 | * Inject pose frame to software sonsor
182 | * \param[in] sensor the software sensor
183 | * \param[in] frame all the frame components
184 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
185 | */
186 | void rs2_software_sensor_on_pose_frame(rs2_sensor* sensor, rs2_software_pose_frame frame, rs2_error** error);
187 |
188 | /**
189 | * Set frame metadata for the upcoming frames
190 | * \param[in] sensor the software sensor
191 | * \param[in] value metadata key to set
192 | * \param[in] type metadata value
193 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
194 | */
195 | void rs2_software_sensor_set_metadata(rs2_sensor* sensor, rs2_frame_metadata_value value, rs2_metadata_type type, rs2_error** error);
196 |
197 | /**
198 | * Set the wanted matcher type that will be used by the syncer
199 | * \param[in] dev the software device
200 | * \param[in] matcher matcher type
201 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
202 | */
203 | void rs2_software_device_create_matcher(rs2_device* dev, rs2_matchers matcher, rs2_error** error);
204 |
205 | /**
206 | * Add video stream to sensor
207 | * \param[in] sensor the software sensor
208 | * \param[in] video_stream all the stream components
209 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
210 | */
211 | rs2_stream_profile* rs2_software_sensor_add_video_stream(rs2_sensor* sensor, rs2_video_stream video_stream, rs2_error** error);
212 |
213 | /**
214 | * Add motion stream to sensor
215 | * \param[in] sensor the software sensor
216 | * \param[in] video_stream all the stream components
217 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
218 | */
219 | rs2_stream_profile* rs2_software_sensor_add_motion_stream(rs2_sensor* sensor, rs2_motion_stream motion_stream, rs2_error** error);
220 |
221 | /**
222 | * Add pose stream to sensor
223 | * \param[in] sensor the software sensor
224 | * \param[in] video_stream all the stream components
225 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
226 | */
227 | rs2_stream_profile* rs2_software_sensor_add_pose_stream(rs2_sensor* sensor, rs2_pose_stream pose_stream, rs2_error** error);
228 |
229 | /**
230 | * Add read only option to sensor
231 | * \param[in] sensor the software sensor
232 | * \param[in] option the wanted option
233 | * \param[in] val the initial value
234 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
235 | */
236 | void rs2_software_sensor_add_read_only_option(rs2_sensor* sensor, rs2_option option, float val, rs2_error** error);
237 |
238 | /**
239 | * Update the read only option added to sensor
240 | * \param[in] sensor the software sensor
241 | * \param[in] option the wanted option
242 | * \param[in] val the wanted value
243 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
244 | */
245 | void rs2_software_sensor_update_read_only_option(rs2_sensor* sensor, rs2_option option, float val, rs2_error** error);
246 | #ifdef __cplusplus
247 | }
248 | #endif
249 | #endif
250 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_option.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_option.h
5 | * \brief
6 | * Exposes sensor options functionality for C compilers
7 | */
8 |
9 |
10 | #ifndef LIBREALSENSE_RS2_OPTION_H
11 | #define LIBREALSENSE_RS2_OPTION_H
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | #include "rs_types.h"
18 |
19 | /** \brief Defines general configuration controls.
20 | These can generally be mapped to camera UVC controls, and can be set / queried at any time unless stated otherwise.
21 | */
22 | typedef enum rs2_option
23 | {
24 | RS2_OPTION_BACKLIGHT_COMPENSATION, /**< Enable / disable color backlight compensation*/
25 | RS2_OPTION_BRIGHTNESS, /**< Color image brightness*/
26 | RS2_OPTION_CONTRAST, /**< Color image contrast*/
27 | RS2_OPTION_EXPOSURE, /**< Controls exposure time of color camera. Setting any value will disable auto exposure*/
28 | RS2_OPTION_GAIN, /**< Color image gain*/
29 | RS2_OPTION_GAMMA, /**< Color image gamma setting*/
30 | RS2_OPTION_HUE, /**< Color image hue*/
31 | RS2_OPTION_SATURATION, /**< Color image saturation setting*/
32 | RS2_OPTION_SHARPNESS, /**< Color image sharpness setting*/
33 | RS2_OPTION_WHITE_BALANCE, /**< Controls white balance of color image. Setting any value will disable auto white balance*/
34 | RS2_OPTION_ENABLE_AUTO_EXPOSURE, /**< Enable / disable color image auto-exposure*/
35 | RS2_OPTION_ENABLE_AUTO_WHITE_BALANCE, /**< Enable / disable color image auto-white-balance*/
36 | RS2_OPTION_VISUAL_PRESET, /**< Provide access to several recommend sets of option presets for the depth camera */
37 | RS2_OPTION_LASER_POWER, /**< Power of the F200 / SR300 projector, with 0 meaning projector off*/
38 | RS2_OPTION_ACCURACY, /**< Set the number of patterns projected per frame. The higher the accuracy value the more patterns projected. Increasing the number of patterns help to achieve better accuracy. Note that this control is affecting the Depth FPS */
39 | RS2_OPTION_MOTION_RANGE, /**< Motion vs. Range trade-off, with lower values allowing for better motion sensitivity and higher values allowing for better depth range*/
40 | RS2_OPTION_FILTER_OPTION, /**< Set the filter to apply to each depth frame. Each one of the filter is optimized per the application requirements*/
41 | RS2_OPTION_CONFIDENCE_THRESHOLD, /**< The confidence level threshold used by the Depth algorithm pipe to set whether a pixel will get a valid range or will be marked with invalid range*/
42 | RS2_OPTION_EMITTER_ENABLED, /**< Laser Emitter enabled */
43 | RS2_OPTION_FRAMES_QUEUE_SIZE, /**< Number of frames the user is allowed to keep per stream. Trying to hold-on to more frames will cause frame-drops.*/
44 | RS2_OPTION_TOTAL_FRAME_DROPS, /**< Total number of detected frame drops from all streams */
45 | RS2_OPTION_AUTO_EXPOSURE_MODE, /**< Auto-Exposure modes: Static, Anti-Flicker and Hybrid */
46 | RS2_OPTION_POWER_LINE_FREQUENCY, /**< Power Line Frequency control for anti-flickering Off/50Hz/60Hz/Auto */
47 | RS2_OPTION_ASIC_TEMPERATURE, /**< Current Asic Temperature */
48 | RS2_OPTION_ERROR_POLLING_ENABLED, /**< disable error handling */
49 | RS2_OPTION_PROJECTOR_TEMPERATURE, /**< Current Projector Temperature */
50 | RS2_OPTION_OUTPUT_TRIGGER_ENABLED, /**< Enable / disable trigger to be outputed from the camera to any external device on every depth frame */
51 | RS2_OPTION_MOTION_MODULE_TEMPERATURE, /**< Current Motion-Module Temperature */
52 | RS2_OPTION_DEPTH_UNITS, /**< Number of meters represented by a single depth unit */
53 | RS2_OPTION_ENABLE_MOTION_CORRECTION, /**< Enable/Disable automatic correction of the motion data */
54 | RS2_OPTION_AUTO_EXPOSURE_PRIORITY, /**< Allows sensor to dynamically ajust the frame rate depending on lighting conditions */
55 | RS2_OPTION_COLOR_SCHEME, /**< Color scheme for data visualization */
56 | RS2_OPTION_HISTOGRAM_EQUALIZATION_ENABLED, /**< Perform histogram equalization post-processing on the depth data */
57 | RS2_OPTION_MIN_DISTANCE, /**< Minimal distance to the target */
58 | RS2_OPTION_MAX_DISTANCE, /**< Maximum distance to the target */
59 | RS2_OPTION_TEXTURE_SOURCE, /**< Texture mapping stream unique ID */
60 | RS2_OPTION_FILTER_MAGNITUDE, /**< The 2D-filter effect. The specific interpretation is given within the context of the filter */
61 | RS2_OPTION_FILTER_SMOOTH_ALPHA, /**< 2D-filter parameter controls the weight/radius for smoothing.*/
62 | RS2_OPTION_FILTER_SMOOTH_DELTA, /**< 2D-filter range/validity threshold*/
63 | RS2_OPTION_HOLES_FILL, /**< Enhance depth data post-processing with holes filling where appropriate*/
64 | RS2_OPTION_STEREO_BASELINE, /**< The distance in mm between the first and the second imagers in stereo-based depth cameras*/
65 | RS2_OPTION_AUTO_EXPOSURE_CONVERGE_STEP, /**< Allows dynamically ajust the converge step value of the target exposure in Auto-Exposure algorithm*/
66 | RS2_OPTION_INTER_CAM_SYNC_MODE, /**< Impose Inter-camera HW synchronization mode. Applicable for D400/Rolling Shutter SKUs */
67 | RS2_OPTION_STREAM_FILTER, /**< Select a stream to process */
68 | RS2_OPTION_STREAM_FORMAT_FILTER, /**< Select a stream format to process */
69 | RS2_OPTION_STREAM_INDEX_FILTER, /**< Select a stream index to process */
70 | RS2_OPTION_EMITTER_ON_OFF, /**< When supported, this option make the camera to switch the emitter state every frame. 0 for disabled, 1 for enabled */
71 | RS2_OPTION_ZERO_ORDER_POINT_X, /**< Zero order point x*/
72 | RS2_OPTION_ZERO_ORDER_POINT_Y, /**< Zero order point y*/
73 | RS2_OPTION_LLD_TEMPERATURE, /**< LLD temperature*/
74 | RS2_OPTION_MC_TEMPERATURE, /**< MC temperature*/
75 | RS2_OPTION_MA_TEMPERATURE, /**< MA temperature*/
76 | RS2_OPTION_HARDWARE_PRESET, /**< Hardware stream configuration */
77 | RS2_OPTION_GLOBAL_TIME_ENABLED, /**< disable global time */
78 | RS2_OPTION_APD_TEMPERATURE, /**< APD temperature*/
79 | RS2_OPTION_ENABLE_MAPPING, /**< Enable an internal map */
80 | RS2_OPTION_ENABLE_RELOCALIZATION, /**< Enable appearance based relocalization */
81 | RS2_OPTION_ENABLE_POSE_JUMPING, /**< Enable position jumping */
82 | RS2_OPTION_ENABLE_DYNAMIC_CALIBRATION, /**< Enable dynamic calibration */
83 | RS2_OPTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
84 | } rs2_option;
85 |
86 | // This function is being deprecated. For existing options it will return option name, but for future API additions the user should call rs2_get_option_name instead.
87 | const char* rs2_option_to_string(rs2_option option);
88 |
89 | /** \brief For SR300 devices: provides optimized settings (presets) for specific types of usage. */
90 | typedef enum rs2_sr300_visual_preset
91 | {
92 | RS2_SR300_VISUAL_PRESET_SHORT_RANGE, /**< Preset for short range */
93 | RS2_SR300_VISUAL_PRESET_LONG_RANGE, /**< Preset for long range */
94 | RS2_SR300_VISUAL_PRESET_BACKGROUND_SEGMENTATION, /**< Preset for background segmentation */
95 | RS2_SR300_VISUAL_PRESET_GESTURE_RECOGNITION, /**< Preset for gesture recognition */
96 | RS2_SR300_VISUAL_PRESET_OBJECT_SCANNING, /**< Preset for object scanning */
97 | RS2_SR300_VISUAL_PRESET_FACE_ANALYTICS, /**< Preset for face analytics */
98 | RS2_SR300_VISUAL_PRESET_FACE_LOGIN, /**< Preset for face login */
99 | RS2_SR300_VISUAL_PRESET_GR_CURSOR, /**< Preset for GR cursor */
100 | RS2_SR300_VISUAL_PRESET_DEFAULT, /**< Camera default settings */
101 | RS2_SR300_VISUAL_PRESET_MID_RANGE, /**< Preset for mid-range */
102 | RS2_SR300_VISUAL_PRESET_IR_ONLY, /**< Preset for IR only */
103 | RS2_SR300_VISUAL_PRESET_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
104 | } rs2_sr300_visual_preset;
105 | const char* rs2_sr300_visual_preset_to_string(rs2_sr300_visual_preset preset);
106 |
107 | /** \brief For RS400 devices: provides optimized settings (presets) for specific types of usage. */
108 | typedef enum rs2_rs400_visual_preset
109 | {
110 | RS2_RS400_VISUAL_PRESET_CUSTOM,
111 | RS2_RS400_VISUAL_PRESET_DEFAULT,
112 | RS2_RS400_VISUAL_PRESET_HAND,
113 | RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY,
114 | RS2_RS400_VISUAL_PRESET_HIGH_DENSITY,
115 | RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY,
116 | RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN,
117 | RS2_RS400_VISUAL_PRESET_COUNT
118 | } rs2_rs400_visual_preset;
119 | const char* rs2_rs400_visual_preset_to_string(rs2_rs400_visual_preset preset);
120 |
121 | /**
122 | * check if an option is read-only
123 | * \param[in] sensor the RealSense sensor
124 | * \param[in] option option id to be checked
125 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
126 | * \return true if option is read-only
127 | */
128 | int rs2_is_option_read_only(const rs2_options* options, rs2_option option, rs2_error** error);
129 |
130 | /**
131 | * read option value from the sensor
132 | * \param[in] sensor the RealSense sensor
133 | * \param[in] option option id to be queried
134 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
135 | * \return value of the option
136 | */
137 | float rs2_get_option(const rs2_options* options, rs2_option option, rs2_error** error);
138 |
139 | /**
140 | * write new value to sensor option
141 | * \param[in] sensor the RealSense sensor
142 | * \param[in] option option id to be queried
143 | * \param[in] value new value for the option
144 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
145 | */
146 | void rs2_set_option(const rs2_options* options, rs2_option option, float value, rs2_error** error);
147 |
148 | /**
149 | * get the list of supported options of options container
150 | * \param[in] options the options container
151 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
152 | */
153 | rs2_options_list* rs2_get_options_list(const rs2_options* options, rs2_error** error);
154 |
155 | /**
156 | * get the size of options list
157 | * \param[in] options the option list
158 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
159 | */
160 | int rs2_get_options_list_size(const rs2_options_list* options, rs2_error** error);
161 |
162 | /**
163 | * get option name
164 | * \param[in] options options object
165 | * \param[in] option option id to be checked
166 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
167 | * \return human-readable option name
168 | */
169 | const char* rs2_get_option_name(const rs2_options* options, rs2_option option, rs2_error** error);
170 |
171 | /**
172 | * get the specific option from options list
173 | * \param[in] i the index of the option
174 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
175 | */
176 | rs2_option rs2_get_option_from_list(const rs2_options_list* options, int i, rs2_error** error);
177 |
178 | /**
179 | * Deletes options list
180 | * \param[in] list list to delete
181 | */
182 | void rs2_delete_options_list(rs2_options_list* list);
183 |
184 | /**
185 | * check if particular option is supported by a subdevice
186 | * \param[in] sensor the RealSense sensor
187 | * \param[in] option option id to be checked
188 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
189 | * \return true if option is supported
190 | */
191 | int rs2_supports_option(const rs2_options* options, rs2_option option, rs2_error** error);
192 |
193 | /**
194 | * retrieve the available range of values of a supported option
195 | * \param[in] sensor the RealSense device
196 | * \param[in] option the option whose range should be queried
197 | * \param[out] min the minimum value which will be accepted for this option
198 | * \param[out] max the maximum value which will be accepted for this option
199 | * \param[out] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
200 | * \param[out] def the default value of the option
201 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
202 | */
203 | void rs2_get_option_range(const rs2_options* sensor, rs2_option option, float* min, float* max, float* step, float* def, rs2_error** error);
204 |
205 | /**
206 | * get option description
207 | * \param[in] sensor the RealSense sensor
208 | * \param[in] option option id to be checked
209 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
210 | * \return human-readable option description
211 | */
212 | const char* rs2_get_option_description(const rs2_options* options, rs2_option option, rs2_error ** error);
213 |
214 | /**
215 | * get option value description (in case specific option value hold special meaning)
216 | * \param[in] device the RealSense device
217 | * \param[in] option option id to be checked
218 | * \param[in] value value of the option
219 | * \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
220 | * \return human-readable description of a specific value of an option or null if no special meaning
221 | */
222 | const char* rs2_get_option_value_description(const rs2_options* options, rs2_option option, float value, rs2_error ** error);
223 |
224 | #ifdef __cplusplus
225 | }
226 | #endif
227 | #endif
228 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_record_playback.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_record_playback.h
5 | * \brief
6 | * Exposes record and playback functionality for C compilers
7 | */
8 |
9 |
10 | #ifndef LIBREALSENSE_RS2_RECORD_PLAYBACK_H
11 | #define LIBREALSENSE_RS2_RECORD_PLAYBACK_H
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | #include "rs_types.h"
18 |
19 | typedef enum rs2_playback_status
20 | {
21 | RS2_PLAYBACK_STATUS_UNKNOWN, /**< Unknown state */
22 | RS2_PLAYBACK_STATUS_PLAYING, /**< One or more sensors were started, playback is reading and raising data */
23 | RS2_PLAYBACK_STATUS_PAUSED, /**< One or more sensors were started, but playback paused reading and paused raising data*/
24 | RS2_PLAYBACK_STATUS_STOPPED, /**< All sensors were stopped, or playback has ended (all data was read). This is the initial playback status*/
25 | RS2_PLAYBACK_STATUS_COUNT
26 | } rs2_playback_status;
27 |
28 | const char* rs2_playback_status_to_string(rs2_playback_status status);
29 |
30 | typedef void (*rs2_playback_status_changed_callback_ptr)(rs2_playback_status);
31 |
32 | /**
33 | * Creates a recording device to record the given device and save it to the given file
34 | * \param[in] device The device to record
35 | * \param[in] file The desired path to which the recorder should save the data
36 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
37 | * \return A pointer to a device that records its data to file, or null in case of failure
38 | */
39 | rs2_device* rs2_create_record_device(const rs2_device* device, const char* file, rs2_error** error);
40 |
41 | /**
42 | * Creates a recording device to record the given device and save it to the given file
43 | * \param[in] device The device to record
44 | * \param[in] file The desired path to which the recorder should save the data
45 | * \param[in] compression_enabled Indicates if compression is enabled, 0 means false, otherwise true
46 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
47 | * \return A pointer to a device that records its data to file, or null in case of failure
48 | */
49 | rs2_device* rs2_create_record_device_ex(const rs2_device* device, const char* file, int compression_enabled, rs2_error** error);
50 |
51 | /**
52 | * Pause the recording device without stopping the actual device from streaming.
53 | * Pausing will cause the device to stop writing new data to the file, in particular, frames and changes to extensions
54 | * \param[in] device A recording device
55 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
56 | */
57 | void rs2_record_device_pause(const rs2_device* device, rs2_error** error);
58 |
59 | /**
60 | * Unpause the recording device. Resume will cause the device to continue writing new data to the file, in particular, frames and changes to extensions
61 | * \param[in] device A recording device
62 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
63 | */
64 | void rs2_record_device_resume(const rs2_device* device, rs2_error** error);
65 |
66 | /**
67 | * Gets the name of the file to which the recorder is writing
68 | * \param[in] device A recording device
69 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
70 | * \return The name of the file to which the recorder is writing
71 | */
72 | const char* rs2_record_device_filename(const rs2_device* device, rs2_error** error);
73 |
74 | /**
75 | * Creates a playback device to play the content of the given file
76 | * \param[in] file Path to the file to play
77 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
78 | * \return A pointer to a device that plays data from the file, or null in case of failure
79 | */
80 | rs2_device* rs2_create_playback_device(const char* file, rs2_error** error);
81 |
82 | /**
83 | * Gets the path of the file used by the playback device
84 | * \param[in] device A playback device
85 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
86 | * \return Path to the file used by the playback device
87 | */
88 | const char* rs2_playback_device_get_file_path(const rs2_device* device, rs2_error** error);
89 |
90 | /**
91 | * Gets the total duration of the file in units of nanoseconds
92 | * \param[in] device A playback device
93 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
94 | * \return Total duration of the file in units of nanoseconds
95 | */
96 | unsigned long long int rs2_playback_get_duration(const rs2_device* device, rs2_error** error);
97 |
98 | /**
99 | * Set the playback to a specified time point of the played data
100 | * \param[in] device A playback device.
101 | * \param[in] time The time point to which playback should seek, expressed in units of nanoseconds (zero value = start)
102 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
103 | */
104 | void rs2_playback_seek(const rs2_device* device, long long int time, rs2_error** error);
105 |
106 | /**
107 | * Gets the current position of the playback in the file in terms of time. Units are expressed in nanoseconds
108 | * \param[in] device A playback device
109 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
110 | * \return Current position of the playback in the file in terms of time. Units are expressed in nanoseconds
111 | */
112 | unsigned long long int rs2_playback_get_position(const rs2_device* device, rs2_error** error);
113 |
114 | /**
115 | * Pauses the playback
116 | * Calling pause() in "Paused" status does nothing
117 | * If pause() is called while playback status is "Playing" or "Stopped", the playback will not play until resume() is called
118 | * \param[in] device A playback device
119 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
120 | */
121 | void rs2_playback_device_resume(const rs2_device* device, rs2_error** error);
122 |
123 | /**
124 | * Un-pauses the playback
125 | * Calling resume() while playback status is "Playing" or "Stopped" does nothing
126 | * \param[in] device A playback device
127 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
128 | */
129 | void rs2_playback_device_pause(const rs2_device* device, rs2_error** error);
130 |
131 | /**
132 | * Set the playback to work in real time or non real time
133 | *
134 | * In real time mode, playback will play the same way the file was recorded.
135 | * In real time mode if the application takes too long to handle the callback, frames may be dropped.
136 | * In non real time mode, playback will wait for each callback to finish handling the data before
137 | * reading the next frame. In this mode no frames will be dropped, and the application controls the
138 | * frame rate of the playback (according to the callback handler duration).
139 | * \param[in] device A playback device
140 | * \param[in] real_time Indicates if real time is requested, 0 means false, otherwise true
141 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
142 | */
143 | void rs2_playback_device_set_real_time(const rs2_device* device, int real_time, rs2_error** error);
144 |
145 | /**
146 | * Indicates if playback is in real time mode or non real time
147 | * \param[in] device A playback device
148 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
149 | * \return True iff playback is in real time mode. 0 means false, otherwise true
150 | */
151 | int rs2_playback_device_is_real_time(const rs2_device* device, rs2_error** error);
152 |
153 | /**
154 | * Register to receive callback from playback device upon its status changes
155 | *
156 | * Callbacks are invoked from the reading thread, any heavy processing in the callback handler will affect
157 | * the reading thread and may cause frame drops\ high latency
158 | * \param[in] device A playback device
159 | * \param[in] callback A callback handler that will be invoked when the playback status changes
160 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
161 | */
162 | void rs2_playback_device_set_status_changed_callback(const rs2_device* device, rs2_playback_status_changed_callback* callback, rs2_error** error);
163 |
164 | /**
165 | * Returns the current state of the playback device
166 | * \param[in] device A playback device
167 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
168 | * \return Current state of the playback
169 | */
170 | rs2_playback_status rs2_playback_device_get_current_status(const rs2_device* device, rs2_error** error);
171 |
172 | /**
173 | * Set the playing speed
174 | *
175 | * \param[in] device A playback device
176 | * \param[in] speed Indicates a multiplication of the speed to play (e.g: 1 = normal, 0.5 twice as slow)
177 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
178 | */
179 | void rs2_playback_device_set_playback_speed(const rs2_device* device, float speed, rs2_error** error);
180 |
181 | /**
182 | * Stops the playback
183 | * Calling stop() will stop all streaming playbakc sensors and will reset the playback (returning to beginning of file)
184 | * \param[in] device A playback device
185 | * \param[out] error If non-null, receives any error that occurs during this call, otherwise, errors are ignored
186 | */
187 | void rs2_playback_device_stop(const rs2_device* device, rs2_error** error);
188 |
189 | #ifdef __cplusplus
190 | }
191 | #endif
192 | #endif
193 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/h/rs_types.h:
--------------------------------------------------------------------------------
1 | /* License: Apache 2.0. See LICENSE file in root directory.
2 | Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
3 |
4 | /** \file rs_types.h
5 | * \brief
6 | * Exposes RealSense structs
7 | */
8 |
9 | #ifndef LIBREALSENSE_RS2_TYPES_H
10 | #define LIBREALSENSE_RS2_TYPES_H
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif
15 |
16 | /** \brief Category of the librealsense notification. */
17 | typedef enum rs2_notification_category{
18 | RS2_NOTIFICATION_CATEGORY_FRAMES_TIMEOUT, /**< Frames didn't arrived within 5 seconds */
19 | RS2_NOTIFICATION_CATEGORY_FRAME_CORRUPTED, /**< Received partial/incomplete frame */
20 | RS2_NOTIFICATION_CATEGORY_HARDWARE_ERROR, /**< Error reported from the device */
21 | RS2_NOTIFICATION_CATEGORY_HARDWARE_EVENT, /**< General Hardeware notification that is not an error */
22 | RS2_NOTIFICATION_CATEGORY_UNKNOWN_ERROR, /**< Received unknown error from the device */
23 | RS2_NOTIFICATION_CATEGORY_FIRMWARE_UPDATE_RECOMMENDED, /**< Current firmware version installed is not the latest available */
24 | RS2_NOTIFICATION_CATEGORY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
25 | } rs2_notification_category;
26 | const char* rs2_notification_category_to_string(rs2_notification_category category);
27 |
28 | /** \brief Exception types are the different categories of errors that RealSense API might return. */
29 | typedef enum rs2_exception_type
30 | {
31 | RS2_EXCEPTION_TYPE_UNKNOWN,
32 | RS2_EXCEPTION_TYPE_CAMERA_DISCONNECTED, /**< Device was disconnected, this can be caused by outside intervention, by internal firmware error or due to insufficient power */
33 | RS2_EXCEPTION_TYPE_BACKEND, /**< Error was returned from the underlying OS-specific layer */
34 | RS2_EXCEPTION_TYPE_INVALID_VALUE, /**< Invalid value was passed to the API */
35 | RS2_EXCEPTION_TYPE_WRONG_API_CALL_SEQUENCE, /**< Function precondition was violated */
36 | RS2_EXCEPTION_TYPE_NOT_IMPLEMENTED, /**< The method is not implemented at this point */
37 | RS2_EXCEPTION_TYPE_DEVICE_IN_RECOVERY_MODE, /**< Device is in recovery mode and might require firmware update */
38 | RS2_EXCEPTION_TYPE_IO, /**< IO Device failure */
39 | RS2_EXCEPTION_TYPE_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
40 | } rs2_exception_type;
41 | const char* rs2_exception_type_to_string(rs2_exception_type type);
42 |
43 | /** \brief Distortion model: defines how pixel coordinates should be mapped to sensor coordinates. */
44 | typedef enum rs2_distortion
45 | {
46 | RS2_DISTORTION_NONE , /**< Rectilinear images. No distortion compensation required. */
47 | RS2_DISTORTION_MODIFIED_BROWN_CONRADY, /**< Equivalent to Brown-Conrady distortion, except that tangential distortion is applied to radially distorted points */
48 | RS2_DISTORTION_INVERSE_BROWN_CONRADY , /**< Equivalent to Brown-Conrady distortion, except undistorts image instead of distorting it */
49 | RS2_DISTORTION_FTHETA , /**< F-Theta fish-eye distortion model */
50 | RS2_DISTORTION_BROWN_CONRADY , /**< Unmodified Brown-Conrady distortion model */
51 | RS2_DISTORTION_KANNALA_BRANDT4 , /**< Four parameter Kannala Brandt distortion model */
52 | RS2_DISTORTION_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
53 | } rs2_distortion;
54 | const char* rs2_distortion_to_string(rs2_distortion distortion);
55 |
56 | /** \brief Video stream intrinsics. */
57 | typedef struct rs2_intrinsics
58 | {
59 | int width; /**< Width of the image in pixels */
60 | int height; /**< Height of the image in pixels */
61 | float ppx; /**< Horizontal coordinate of the principal point of the image, as a pixel offset from the left edge */
62 | float ppy; /**< Vertical coordinate of the principal point of the image, as a pixel offset from the top edge */
63 | float fx; /**< Focal length of the image plane, as a multiple of pixel width */
64 | float fy; /**< Focal length of the image plane, as a multiple of pixel height */
65 | rs2_distortion model; /**< Distortion model of the image */
66 | float coeffs[5]; /**< Distortion coefficients */
67 | } rs2_intrinsics;
68 |
69 | /** \brief Motion device intrinsics: scale, bias, and variances. */
70 | typedef struct rs2_motion_device_intrinsic
71 | {
72 | /* \internal
73 | * Scale X cross axis cross axis Bias X \n
74 | * cross axis Scale Y cross axis Bias Y \n
75 | * cross axis cross axis Scale Z Bias Z */
76 | float data[3][4]; /**< Interpret data array values */
77 |
78 | float noise_variances[3]; /**< Variance of noise for X, Y, and Z axis */
79 | float bias_variances[3]; /**< Variance of bias for X, Y, and Z axis */
80 | } rs2_motion_device_intrinsic;
81 |
82 | /** \brief 3D coordinates with origin at topmost left corner of the lense,
83 | with positive Z pointing away from the camera, positive X pointing camera right and positive Y pointing camera down */
84 | typedef struct rs2_vertex
85 | {
86 | float xyz[3];
87 | } rs2_vertex;
88 |
89 | /** \brief Pixel location within 2D image. (0,0) is the topmost, left corner. Positive X is right, positive Y is down */
90 | typedef struct rs2_pixel
91 | {
92 | int ij[2];
93 | } rs2_pixel;
94 |
95 | /** \brief 3D vector in Euclidean coordinate space */
96 | typedef struct rs2_vector
97 | {
98 | float x, y, z;
99 | }rs2_vector;
100 |
101 | /** \brief Quaternion used to represent rotation */
102 | typedef struct rs2_quaternion
103 | {
104 | float x, y, z, w;
105 | }rs2_quaternion;
106 |
107 | typedef struct rs2_pose
108 | {
109 | rs2_vector translation; /**< X, Y, Z values of translation, in meters (relative to initial position) */
110 | rs2_vector velocity; /**< X, Y, Z values of velocity, in meters/sec */
111 | rs2_vector acceleration; /**< X, Y, Z values of acceleration, in meters/sec^2 */
112 | rs2_quaternion rotation; /**< Qi, Qj, Qk, Qr components of rotation as represented in quaternion rotation (relative to initial position) */
113 | rs2_vector angular_velocity; /**< X, Y, Z values of angular velocity, in radians/sec */
114 | rs2_vector angular_acceleration; /**< X, Y, Z values of angular acceleration, in radians/sec^2 */
115 | unsigned int tracker_confidence; /**< Pose confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
116 | unsigned int mapper_confidence; /**< Pose map confidence 0x0 - Failed, 0x1 - Low, 0x2 - Medium, 0x3 - High */
117 | } rs2_pose;
118 |
119 | /** \brief Severity of the librealsense logger. */
120 | typedef enum rs2_log_severity {
121 | RS2_LOG_SEVERITY_DEBUG, /**< Detailed information about ordinary operations */
122 | RS2_LOG_SEVERITY_INFO , /**< Terse information about ordinary operations */
123 | RS2_LOG_SEVERITY_WARN , /**< Indication of possible failure */
124 | RS2_LOG_SEVERITY_ERROR, /**< Indication of definite failure */
125 | RS2_LOG_SEVERITY_FATAL, /**< Indication of unrecoverable failure */
126 | RS2_LOG_SEVERITY_NONE , /**< No logging will occur */
127 | RS2_LOG_SEVERITY_COUNT /**< Number of enumeration values. Not a valid input: intended to be used in for-loops. */
128 | } rs2_log_severity;
129 | const char* rs2_log_severity_to_string(rs2_log_severity info);
130 |
131 | /** \brief Specifies advanced interfaces (capabilities) objects may implement. */
132 | typedef enum rs2_extension
133 | {
134 | RS2_EXTENSION_UNKNOWN,
135 | RS2_EXTENSION_DEBUG,
136 | RS2_EXTENSION_INFO,
137 | RS2_EXTENSION_MOTION,
138 | RS2_EXTENSION_OPTIONS,
139 | RS2_EXTENSION_VIDEO,
140 | RS2_EXTENSION_ROI,
141 | RS2_EXTENSION_DEPTH_SENSOR,
142 | RS2_EXTENSION_VIDEO_FRAME,
143 | RS2_EXTENSION_MOTION_FRAME,
144 | RS2_EXTENSION_COMPOSITE_FRAME,
145 | RS2_EXTENSION_POINTS,
146 | RS2_EXTENSION_DEPTH_FRAME,
147 | RS2_EXTENSION_ADVANCED_MODE,
148 | RS2_EXTENSION_RECORD,
149 | RS2_EXTENSION_VIDEO_PROFILE,
150 | RS2_EXTENSION_PLAYBACK,
151 | RS2_EXTENSION_DEPTH_STEREO_SENSOR,
152 | RS2_EXTENSION_DISPARITY_FRAME,
153 | RS2_EXTENSION_MOTION_PROFILE,
154 | RS2_EXTENSION_POSE_FRAME,
155 | RS2_EXTENSION_POSE_PROFILE,
156 | RS2_EXTENSION_TM2,
157 | RS2_EXTENSION_SOFTWARE_DEVICE,
158 | RS2_EXTENSION_SOFTWARE_SENSOR,
159 | RS2_EXTENSION_DECIMATION_FILTER,
160 | RS2_EXTENSION_THRESHOLD_FILTER,
161 | RS2_EXTENSION_DISPARITY_FILTER,
162 | RS2_EXTENSION_SPATIAL_FILTER,
163 | RS2_EXTENSION_TEMPORAL_FILTER,
164 | RS2_EXTENSION_HOLE_FILLING_FILTER,
165 | RS2_EXTENSION_ZERO_ORDER_FILTER,
166 | RS2_EXTENSION_RECOMMENDED_FILTERS,
167 | RS2_EXTENSION_POSE,
168 | RS2_EXTENSION_POSE_SENSOR,
169 | RS2_EXTENSION_WHEEL_ODOMETER,
170 | RS2_EXTENSION_GLOBAL_TIMER,
171 | RS2_EXTENSION_UPDATABLE,
172 | RS2_EXTENSION_UPDATE_DEVICE,
173 | RS2_EXTENSION_COUNT
174 | } rs2_extension;
175 | const char* rs2_extension_type_to_string(rs2_extension type);
176 | const char* rs2_extension_to_string(rs2_extension type);
177 |
178 | /** \brief Specifies types of different matchers */
179 | typedef enum rs2_matchers
180 | {
181 | RS2_MATCHER_DI, //compare depth and ir based on frame number
182 |
183 | RS2_MATCHER_DI_C, //compare depth and ir based on frame number,
184 | //compare the pair of corresponding depth and ir with color based on closest timestamp,
185 | //commonly used by SR300
186 |
187 | RS2_MATCHER_DLR_C, //compare depth, left and right ir based on frame number,
188 | //compare the set of corresponding depth, left and right with color based on closest timestamp,
189 | //commonly used by RS415, RS435
190 |
191 | RS2_MATCHER_DLR, //compare depth, left and right ir based on frame number,
192 | //commonly used by RS400, RS405, RS410, RS420, RS430
193 |
194 | RS2_MATCHER_DIC, //compare depth, ir and confidence based on frame number used by RS500
195 |
196 | RS2_MATCHER_DIC_C, //compare depth, ir and confidence based on frame number,
197 | //compare the set of corresponding depth, ir and confidence with color based on closest timestamp,
198 | //commonly used by RS515
199 |
200 | RS2_MATCHER_DEFAULT, //the default matcher compare all the streams based on closest timestamp
201 |
202 | RS2_MATCHER_COUNT
203 | }rs2_matchers;
204 |
205 | typedef struct rs2_device_info rs2_device_info;
206 | typedef struct rs2_device rs2_device;
207 | typedef struct rs2_error rs2_error;
208 | typedef struct rs2_raw_data_buffer rs2_raw_data_buffer;
209 | typedef struct rs2_frame rs2_frame;
210 | typedef struct rs2_frame_queue rs2_frame_queue;
211 | typedef struct rs2_pipeline rs2_pipeline;
212 | typedef struct rs2_pipeline_profile rs2_pipeline_profile;
213 | typedef struct rs2_config rs2_config;
214 | typedef struct rs2_device_list rs2_device_list;
215 | typedef struct rs2_stream_profile_list rs2_stream_profile_list;
216 | typedef struct rs2_processing_block_list rs2_processing_block_list;
217 | typedef struct rs2_stream_profile rs2_stream_profile;
218 | typedef struct rs2_frame_callback rs2_frame_callback;
219 | typedef struct rs2_log_callback rs2_log_callback;
220 | typedef struct rs2_syncer rs2_syncer;
221 | typedef struct rs2_device_serializer rs2_device_serializer;
222 | typedef struct rs2_source rs2_source;
223 | typedef struct rs2_processing_block rs2_processing_block;
224 | typedef struct rs2_frame_processor_callback rs2_frame_processor_callback;
225 | typedef struct rs2_playback_status_changed_callback rs2_playback_status_changed_callback;
226 | typedef struct rs2_update_progress_callback rs2_update_progress_callback;
227 | typedef struct rs2_context rs2_context;
228 | typedef struct rs2_device_hub rs2_device_hub;
229 | typedef struct rs2_sensor_list rs2_sensor_list;
230 | typedef struct rs2_sensor rs2_sensor;
231 | typedef struct rs2_options rs2_options;
232 | typedef struct rs2_options_list rs2_options_list;
233 | typedef struct rs2_devices_changed_callback rs2_devices_changed_callback;
234 | typedef struct rs2_notification rs2_notification;
235 | typedef struct rs2_notifications_callback rs2_notifications_callback;
236 | typedef void (*rs2_notification_callback_ptr)(rs2_notification*, void*);
237 | typedef void (*rs2_devices_changed_callback_ptr)(rs2_device_list*, rs2_device_list*, void*);
238 | typedef void (*rs2_frame_callback_ptr)(rs2_frame*, void*);
239 | typedef void (*rs2_frame_processor_callback_ptr)(rs2_frame*, rs2_source*, void*);
240 | typedef void(*rs2_update_progress_callback_ptr)(const float, void*);
241 |
242 | typedef double rs2_time_t; /**< Timestamp format. units are milliseconds */
243 | typedef long long rs2_metadata_type; /**< Metadata attribute type is defined as 64 bit signed integer*/
244 |
245 | rs2_error * rs2_create_error(const char* what, const char* name, const char* args, rs2_exception_type type);
246 | rs2_exception_type rs2_get_librealsense_exception_type(const rs2_error* error);
247 | const char* rs2_get_failed_function (const rs2_error* error);
248 | const char* rs2_get_failed_args (const rs2_error* error);
249 | const char* rs2_get_error_message (const rs2_error* error);
250 | void rs2_free_error (rs2_error* error);
251 |
252 | #ifdef __cplusplus
253 | }
254 | #endif
255 | #endif
256 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/hpp/rs_context.hpp:
--------------------------------------------------------------------------------
1 | // License: Apache 2.0. See LICENSE file in root directory.
2 | // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 |
4 | #ifndef LIBREALSENSE_RS2_CONTEXT_HPP
5 | #define LIBREALSENSE_RS2_CONTEXT_HPP
6 |
7 | #include "rs_types.hpp"
8 | #include "rs_record_playback.hpp"
9 | #include "rs_processing.hpp"
10 |
11 | namespace rs2
12 | {
13 | class event_information
14 | {
15 | public:
16 | event_information(device_list removed, device_list added)
17 | :_removed(removed), _added(added) {}
18 |
19 | /**
20 | * check if a specific device was disconnected
21 | * \return true if device disconnected, false if device connected
22 | */
23 | bool was_removed(const rs2::device& dev) const
24 | {
25 | rs2_error* e = nullptr;
26 |
27 | if (!dev)
28 | return false;
29 |
30 | auto res = rs2_device_list_contains(_removed.get_list(), dev.get().get(), &e);
31 | error::handle(e);
32 |
33 | return res > 0;
34 | }
35 |
36 | /**
37 | * check if a specific device was added
38 | * \return true if device added, false otherwise
39 | */
40 | bool was_added(const rs2::device& dev) const
41 | {
42 | rs2_error* e = nullptr;
43 |
44 | if (!dev)
45 | return false;
46 |
47 | auto res = rs2_device_list_contains(_added.get_list(), dev.get().get(), &e);
48 | error::handle(e);
49 |
50 | return res > 0;
51 | }
52 |
53 | /**
54 | * returns a list of all newly connected devices
55 | * \return the list of all new connected devices
56 | */
57 | device_list get_new_devices() const
58 | {
59 | return _added;
60 | }
61 |
62 | private:
63 | device_list _removed;
64 | device_list _added;
65 | };
66 |
67 | template
68 | class devices_changed_callback : public rs2_devices_changed_callback
69 | {
70 | T _callback;
71 |
72 | public:
73 | explicit devices_changed_callback(T callback) : _callback(callback) {}
74 |
75 | void on_devices_changed(rs2_device_list* removed, rs2_device_list* added) override
76 | {
77 | std::shared_ptr old(removed, rs2_delete_device_list);
78 | std::shared_ptr news(added, rs2_delete_device_list);
79 |
80 |
81 | event_information info({ device_list(old), device_list(news) });
82 | _callback(info);
83 | }
84 |
85 | void release() override { delete this; }
86 | };
87 |
88 | class pipeline;
89 | class device_hub;
90 | class software_device;
91 |
92 | /**
93 | * default librealsense context class
94 | * includes realsense API version as provided by RS2_API_VERSION macro
95 | */
96 | class context
97 | {
98 | public:
99 | context()
100 | {
101 | rs2_error* e = nullptr;
102 | _context = std::shared_ptr(
103 | rs2_create_context(RS2_API_VERSION, &e),
104 | rs2_delete_context);
105 | error::handle(e);
106 | }
107 |
108 | /**
109 | * create a static snapshot of all connected devices at the time of the call
110 | * \return the list of devices connected devices at the time of the call
111 | */
112 | device_list query_devices() const
113 | {
114 | rs2_error* e = nullptr;
115 | std::shared_ptr list(
116 | rs2_query_devices(_context.get(), &e),
117 | rs2_delete_device_list);
118 | error::handle(e);
119 |
120 | return device_list(list);
121 | }
122 |
123 | /**
124 | * create a static snapshot of all connected devices at the time of the call
125 | * \return the list of devices connected devices at the time of the call
126 | */
127 | device_list query_devices(int mask) const
128 | {
129 | rs2_error* e = nullptr;
130 | std::shared_ptr list(
131 | rs2_query_devices_ex(_context.get(), mask, &e),
132 | rs2_delete_device_list);
133 | error::handle(e);
134 |
135 | return device_list(list);
136 | }
137 |
138 | /**
139 | * @brief Generate a flat list of all available sensors from all RealSense devices
140 | * @return List of sensors
141 | */
142 | std::vector query_all_sensors() const
143 | {
144 | std::vector results;
145 | for (auto&& dev : query_devices())
146 | {
147 | auto sensors = dev.query_sensors();
148 | std::copy(sensors.begin(), sensors.end(), std::back_inserter(results));
149 | }
150 | return results;
151 | }
152 |
153 |
154 | device get_sensor_parent(const sensor& s) const
155 | {
156 | rs2_error* e = nullptr;
157 | std::shared_ptr dev(
158 | rs2_create_device_from_sensor(s._sensor.get(), &e),
159 | rs2_delete_device);
160 | error::handle(e);
161 | return device{ dev };
162 | }
163 |
164 | /**
165 | * register devices changed callback
166 | * \param[in] callback devices changed callback
167 | */
168 | template
169 | void set_devices_changed_callback(T callback)
170 | {
171 | rs2_error* e = nullptr;
172 | rs2_set_devices_changed_callback_cpp(_context.get(),
173 | new devices_changed_callback(std::move(callback)), &e);
174 | error::handle(e);
175 | }
176 |
177 | /**
178 | * Creates a device from a RealSense file
179 | *
180 | * On successful load, the device will be appended to the context and a devices_changed event triggered
181 | * @param file Path to a RealSense File
182 | * @return A playback device matching the given file
183 | */
184 | playback load_device(const std::string& file)
185 | {
186 | rs2_error* e = nullptr;
187 | auto device = std::shared_ptr(
188 | rs2_context_add_device(_context.get(), file.c_str(), &e),
189 | rs2_delete_device);
190 | rs2::error::handle(e);
191 |
192 | return playback { device };
193 | }
194 |
195 | void unload_device(const std::string& file)
196 | {
197 | rs2_error* e = nullptr;
198 | rs2_context_remove_device(_context.get(), file.c_str(), &e);
199 | rs2::error::handle(e);
200 | }
201 |
202 | void unload_tracking_module()
203 | {
204 | rs2_error* e = nullptr;
205 | rs2_context_unload_tracking_module(_context.get(), &e);
206 | rs2::error::handle(e);
207 | }
208 |
209 | context(std::shared_ptr ctx)
210 | : _context(ctx)
211 | {}
212 | explicit operator std::shared_ptr() { return _context; };
213 | protected:
214 | friend class rs2::pipeline;
215 | friend class rs2::device_hub;
216 | friend class rs2::software_device;
217 |
218 | std::shared_ptr _context;
219 | };
220 |
221 | /**
222 | * device_hub class - encapsulate the handling of connect and disconnect events
223 | */
224 | class device_hub
225 | {
226 | public:
227 | explicit device_hub(context ctx)
228 | {
229 | rs2_error* e = nullptr;
230 | _device_hub = std::shared_ptr(
231 | rs2_create_device_hub(ctx._context.get(), &e),
232 | rs2_delete_device_hub);
233 | error::handle(e);
234 | }
235 |
236 | /**
237 | * If any device is connected return it, otherwise wait until next RealSense device connects.
238 | * Calling this method multiple times will cycle through connected devices
239 | */
240 | device wait_for_device() const
241 | {
242 | rs2_error* e = nullptr;
243 | std::shared_ptr dev(
244 | rs2_device_hub_wait_for_device(_device_hub.get(), &e),
245 | rs2_delete_device);
246 |
247 | error::handle(e);
248 |
249 | return device(dev);
250 |
251 | }
252 |
253 | /**
254 | * Checks if device is still connected
255 | */
256 | bool is_connected(const device& dev) const
257 | {
258 | rs2_error* e = nullptr;
259 | auto res = rs2_device_hub_is_device_connected(_device_hub.get(), dev._dev.get(), &e);
260 | error::handle(e);
261 |
262 | return res > 0 ? true : false;
263 |
264 | }
265 |
266 | explicit operator std::shared_ptr() { return _device_hub; }
267 | explicit device_hub(std::shared_ptr hub) : _device_hub(std::move(hub)) {}
268 | private:
269 | std::shared_ptr _device_hub;
270 | };
271 |
272 | }
273 | #endif // LIBREALSENSE_RS2_CONTEXT_HPP
274 |
--------------------------------------------------------------------------------
/libs/librealsense2/include/librealsense2/hpp/rs_export.hpp:
--------------------------------------------------------------------------------
1 | // License: Apache 2.0. See LICENSE file in root directory.
2 | // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 |
4 | #ifndef LIBREALSENSE_RS2_EXPORT_HPP
5 | #define LIBREALSENSE_RS2_EXPORT_HPP
6 |
7 | #include