9 #ifndef LIBREALSENSE_TYPES_H 10 #define LIBREALSENSE_TYPES_H 15 #pragma warning(disable : 4275) 16 #pragma warning(disable : 4251) 18 #define LRS_EXTENSION_API __declspec(dllexport) 20 #define LRS_EXTENSION_API 23 #include "../include/librealsense2/hpp/rs_types.hpp" 25 #ifndef _USE_MATH_DEFINES 26 #define _USE_MATH_DEFINES 40 #include <condition_variable> 48 #if BUILD_EASYLOGGINGPP 49 #include "../third-party/easyloggingpp/src/easylogging++.h" 50 #endif // BUILD_EASYLOGGINGPP 52 typedef unsigned char byte;
57 static const double pi = std::acos(-1);
58 static const double d2r =
pi / 180;
59 static const double r2d = 180 /
pi;
68 #pragma warning(disable: 4250) 71 #include "../common/android_helpers.h" 74 #define UNKNOWN_VALUE "UNKNOWN" 78 #pragma pack (push, 1) 99 std::ostringstream
ss;
107 template<
typename T,
size_t sz>
113 template<
typename T,
size_t sz>
122 std::stringstream ss;
124 ss <<
" [" <<
i <<
"] = " << data[
i] <<
"\t";
129 template <
typename T,
typename S>
130 struct isNarrowing {
static bool constexpr
value = std::numeric_limits<S>::max() > std::numeric_limits<T>::max(); };
132 template<const
bool force_narrowing=false,
typename T,
typename S,
size_t size_tgt,
size_t size_src>
135 static_assert((size_tgt && (size_tgt == size_src)),
"copy_array requires similar non-zero size for target and source containers");
139 static_assert(!(
isNarrowing<T, S>::value && !force_narrowing),
"Passing narrowing conversion to copy_array requires setting the force flag on");
143 for (
size_t i = 0;
i < size_tgt;
i++)
150 template<const
bool force_narrowing=false,
typename T,
typename S,
size_t tgt_m,
size_t tgt_n,
size_t src_m,
size_t src_n>
153 static_assert((src_m && src_n && (tgt_n == src_n) && (tgt_m == src_m)),
"copy_array requires similar non-zero size for target and source containers");
157 static_assert(!(
isNarrowing<T, S>::value && !force_narrowing),
"Passing narrowing conversion to copy_2darray requires setting the force flag on");
161 for (
size_t i = 0;
i < src_m;
i++)
163 for (
size_t j = 0;
j < src_n;
j++)
168 return src_m * src_n;
173 template <
typename T>
176 for (
const auto&
i : list) {
189 std::ostringstream oss;
190 oss << std::setw(
sizeof(
T)*2) << std::setfill(
'0') << std::uppercase << std::hex <<
val;
191 return oss.str().c_str();
210 #if BUILD_EASYLOGGINGPP 212 #ifdef RS2_USE_ANDROID_BACKEND 213 #include <android/log.h> 215 #define LOG_TAG "librs" 217 #define LOG_INFO(...) do { std::stringstream ss; ss << __VA_ARGS__; __android_log_write(librealsense::ANDROID_LOG_INFO, LOG_TAG, ss.str().c_str()); } while(false) 218 #define LOG_WARNING(...) do { std::stringstream ss; ss << __VA_ARGS__; __android_log_write(librealsense::ANDROID_LOG_WARN, LOG_TAG, ss.str().c_str()); } while(false) 219 #define LOG_ERROR(...) do { std::stringstream ss; ss << __VA_ARGS__; __android_log_write(librealsense::ANDROID_LOG_ERROR, LOG_TAG, ss.str().c_str()); } while(false) 220 #define LOG_FATAL(...) do { std::stringstream ss; ss << __VA_ARGS__; __android_log_write(librealsense::ANDROID_LOG_ERROR, LOG_TAG, ss.str().c_str()); } while(false) 222 #define LOG_DEBUG(...) 224 #define LOG_DEBUG(...) do { std::stringstream ss; ss << __VA_ARGS__; __android_log_write(librealsense::ANDROID_LOG_DEBUG, LOG_TAG, ss.str().c_str()); } while(false) 227 #else //RS2_USE_ANDROID_BACKEND 229 #define LOG_DEBUG(...) do { CLOG(DEBUG ,"librealsense") << __VA_ARGS__; } while(false) 230 #define LOG_INFO(...) do { CLOG(INFO ,"librealsense") << __VA_ARGS__; } while(false) 231 #define LOG_WARNING(...) do { CLOG(WARNING ,"librealsense") << __VA_ARGS__; } while(false) 232 #define LOG_ERROR(...) do { CLOG(ERROR ,"librealsense") << __VA_ARGS__; } while(false) 233 #define LOG_FATAL(...) do { CLOG(FATAL ,"librealsense") << __VA_ARGS__; } while(false) 235 #endif // RS2_USE_ANDROID_BACKEND 237 #else // BUILD_EASYLOGGINGPP 239 #define LOG_DEBUG(...) do { ; } while(false) 240 #define LOG_INFO(...) do { ; } while(false) 241 #define LOG_WARNING(...) do { ; } while(false) 242 #define LOG_ERROR(...) do { ; } while(false) 243 #define LOG_FATAL(...) do { ; } while(false) 245 #endif // BUILD_EASYLOGGINGPP 249 template<
typename T>
254 const T t = val < min ? min :
val;
255 return t > max ? max :
t;
257 return std::min(std::max(val, min), max);
261 #ifdef BUILD_INTERNAL_UNIT_TESTS 262 #define PRIVATE_TESTABLE public 264 #define PRIVATE_TESTABLE private 281 return _exception_type;
284 const char*
what() const noexcept
override 293 _exception_type(exception_type)
352 return msg +
" Last Error: " + strerror(errno);
390 #pragma pack(push, 1) 398 for (
unsigned int i = 0; i < sizeof(T); ++i) reinterpret_cast<char *>(&le_value)[
i] = reinterpret_cast<const char *>(&be_value)[
sizeof(
T) -
i - 1];
409 lazy(std::function<
T()> initializer) : _init(
std::
move(initializer)) {}
428 std::lock_guard<std::mutex>
lock(other._mtx);
429 if (!other._was_init)
431 _init =
move(other._init);
436 _init =
move(other._init);
438 _ptr =
move(other._ptr);
449 std::lock_guard<std::mutex> lock1(_mtx);
450 std::lock_guard<std::mutex> lock2(other._mtx);
451 if (!other._was_init)
453 _init =
move(other._init);
458 _init =
move(other._init);
460 _ptr =
move(other._ptr);
468 std::lock_guard<std::mutex>
lock(_mtx);
479 std::lock_guard<std::mutex>
lock(_mtx);
482 _ptr = std::unique_ptr<T>(
new T(_init()));
489 mutable bool _was_init =
false;
491 mutable std::unique_ptr<T>
_ptr;
499 static std::atomic<uint64_t>
id(0);
514 #define RS2_ENUM_HELPERS( TYPE, PREFIX ) \ 515 RS2_ENUM_HELPERS_CUSTOMIZED( TYPE, 0, RS2_##PREFIX##_COUNT - 1 ) 518 #define RS2_ENUM_HELPERS_CUSTOMIZED( TYPE, FIRST, LAST ) \ 519 LRS_EXTENSION_API const char * get_string( TYPE value ); \ 520 inline bool is_valid( TYPE value ) { return value >= FIRST && value <= LAST; } \ 521 inline std::ostream & operator<<( std::ostream & out, TYPE value ) \ 523 if( is_valid( value ) ) \ 524 return out << get_string( value ); \ 526 return out << (int)value; \ 528 inline bool try_parse( const std::string & str, TYPE & res ) \ 530 for( int i = FIRST; i <= LAST; i++ ) \ 532 auto v = static_cast< TYPE >( i ); \ 533 if( str == get_string( v ) ) \ 570 #pragma pack(push, 1) 572 struct float2 {
float x,
y;
float & operator [] (
int i) {
return (&x)[
i]; } };
573 struct float3 {
float x,
y,
z;
float & operator [] (
int i) {
return (&x)[
i]; } };
574 struct float4 {
float x,
y,
z,
w;
float & operator [] (
int i) {
return (&x)[
i]; } };
597 for (
int j = 0;
j < 3;
j++)
598 for (
int i = 0;
i < 3;
i++)
606 for (
int j = 0;
j < 3;
j++)
607 for (
int i = 0;
i < 3;
i++)
615 for (
int j = 0;
j < 3;
j++)
616 for (
int i = 0;
i < 3;
i++)
630 return stream << elem.
x <<
" " << elem.
y <<
" " << elem.
z;
635 return stream << elem.
x <<
" " << elem.
y <<
" " << elem.
z <<
" " << elem.
w;
640 return stream << elem.
x <<
"\n" << elem.
y <<
"\n" << elem.
z;
645 return stream <<
"Position:\n " << elem.
position <<
"\n Orientation :\n" << elem.
orientation;
654 typedef std::tuple<platform::stream_profile_tuple, native_pixel_format_tuple, std::vector<output_tuple>>
request_mapping_tuple;
679 std::pair< uint32_t, uint32_t >
width_height()
const {
return std::make_pair( width, height ); }
713 rs2_format format_in,
715 : stream_desc(stream_desc_in),
717 stream_resolution(res_func)
734 auto it = std::find_if(
begin(uvc_profiles),
end(uvc_profiles),
737 for (
auto & o : outputs)
740 if (o.stream_desc.type == request.
stream && o.stream_desc.index == request.
index &&
747 if (
it !=
end(uvc_profiles))
756 auto uvc_profile = get_uvc_profile(request, fourcc, uvc_profiles);
757 return provides_stream(request, fourcc, uvc_profile) &&
763 for (
auto& o : outputs)
766 if (o.stream_desc.type == request.
stream && o.stream_desc.index == request.
index &&
775 for (
auto& o : outputs)
776 if (o.stream_desc.type == stream && o.stream_desc.index == index)
782 operator std::vector<output_tuple>()
784 std::vector<output_tuple> tuple_outputs;
786 for (
auto output : outputs)
788 tuple_outputs.push_back(std::make_tuple(output.stream_desc.type, output.stream_desc.index, output.format));
790 return tuple_outputs;
813 : m_major(major), m_minor(minor), m_patch(patch), m_build(build), is_any(is_any), string_representation(
to_string()) {}
824 : m_major(parse_part(name, 0)), m_minor(parse_part(name, 1)), m_patch(parse_part(name, 2)), m_build(parse_part(name, 3)), is_any(false), string_representation(
to_string()) {}
828 if (is_any || other.
is_any)
return true;
829 if (m_major > other.
m_major)
return false;
830 if ((m_major == other.
m_major) && (m_minor > other.
m_minor))
return false;
831 if ((m_major == other.
m_major) && (m_minor == other.
m_minor) && (m_patch > other.
m_patch))
return false;
847 return (from <= *
this) && (*
this <= until);
850 operator const char*()
const 852 return string_representation.c_str();
857 return string_representation.c_str();
872 void activate() {
if (!active) { struct_ = reader(); active =
true; } }
873 template<
class U>
double get(U
T::* field) { activate();
return static_cast<double>(struct_.*field); }
874 template<
class U,
class V>
void set(U
T::* field,
V value) { activate(); struct_.*field =
static_cast<U
>(
value); }
875 void commit() {
if (active) writer(struct_); }
878 template<
class T,
class R,
class W>
881 return std::make_shared<struct_interface<T, R, W>>(
r,
w);
885 template <
typename T,
typename S>
890 last_input(
std::numeric_limits<
T>::lowest()), accumulated(0) {
894 (std::numeric_limits<T>::max() < std::numeric_limits<S>::max()) &&
895 (std::numeric_limits<T>::lowest() >= std::numeric_limits<S>::lowest())
896 ,
"Wraparound class requirements are not met");
901 accumulated +=
static_cast<T>(input - last_input);
903 return (accumulated);
906 void reset() { last_input = std::numeric_limits<T>::lowest(); accumulated = 0; }
923 operator bool()
const {
return fptr !=
nullptr; }
927 try { fptr(frame, user); }
catch (...)
929 LOG_ERROR(
"Received an exception from frame callback!");
943 : fptr(on_frame), user(user) {}
945 operator bool()
const {
return fptr !=
nullptr; }
949 try { fptr(frame, source, user); }
952 LOG_ERROR(
"Received an exception from frame callback!");
985 operator bool()
const {
return nptr !=
nullptr; }
989 try { nptr(notification, user); }
992 LOG_ERROR(
"Received an exception from notification callback!");
1008 : nptr(on_destruction), user(user) {}
1010 operator bool()
const {
return nptr !=
nullptr; }
1017 LOG_ERROR(
"Received an exception from software device destruction callback!");
1034 operator bool()
const {
return nptr !=
nullptr; }
1038 try { nptr(removed, added, user); }
1041 LOG_ERROR(
"Received an exception from devices_changed callback!");
1055 : _nptr(on_update_progress), _client_data(client_data){}
1057 operator bool()
const {
return _nptr !=
nullptr; }
1061 try { _nptr(progress, _client_data); }
1064 LOG_ERROR(
"Received an exception from firmware update progress callback!");
1086 : _callback(callback)
1091 _callback(removed , added);
1101 :category(category), type(type), severity(severity), description(description)
1120 virtual notification decode(
int value) = 0;
1129 void set_callback(notifications_callback_ptr
callback);
1130 notifications_callback_ptr get_callback()
const;
1131 void raise_notification(
const notification);
1144 return{ i.
width + pad_crop * 2, i.
height + pad_crop * 2, i.
ppx + pad_crop, i.
ppy + pad_crop,
1150 const float sx =
static_cast<float>(
width) / i.
width, sy = static_cast<float>(height) / i.
height;
1159 return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
1162 template<
class T,
int C>
1168 bool keep_allocating =
true;
1169 std::condition_variable
cv;
1177 for (
auto i = 0;
i < C;
i++)
1186 std::unique_lock<std::mutex>
lock(mutex);
1187 if (!keep_allocating)
return nullptr;
1189 for (
auto i = 0;
i < C;
i++)
1203 if (item < buffer || item >= buffer + C)
1212 std::unique_lock<std::mutex>
lock(mutex);
1227 std::unique_lock<std::mutex>
lock(mutex);
1228 keep_allocating =
false;
1233 std::unique_lock<std::mutex>
lock(mutex);
1235 const auto ready = [
this]()
1239 if (!ready() && !cv.wait_for(lock, std::chrono::hours(1000), ready))
1260 std::stringstream
s;
1261 s <<
"id- " <<
id <<
1262 "\nvid- " << std::hex << vid <<
1263 "\npid- " << std::hex << pid <<
1265 "\nunique_id- " << unique_id <<
1266 "\npath- " << device_path;
1275 return (a.
vid == b.
vid) &&
1294 std::stringstream
s;
1296 s <<
"vid- " << std::hex << vid <<
1297 "\npid- " << std::hex << pid <<
1299 "\nunique_id- " << unique_id;
1308 return (a.
id == b.
id) &&
1325 std::stringstream
s;
1326 s <<
"id- " <<
id <<
1327 "\nvid- " << std::hex << vid <<
1328 "\npid- " << std::hex << pid <<
1329 "\nunique_id- " << unique_id <<
1330 "\npath- " << device_path;
1339 return (a.
id == b.
id) &&
1349 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices, std::vector<hid_device_info> hid_devices)
1350 :_uvc_devices(uvc_devices), _usb_devices(usb_devices), _hid_devices(hid_devices) {}
1353 :_usb_devices(usb_devices) {}
1355 devices_data(std::vector<uvc_device_info> uvc_devices, std::vector<usb_device_info> usb_devices)
1356 :_uvc_devices(uvc_devices), _usb_devices(usb_devices) {}
1371 s = _uvc_devices.size()>0 ?
"uvc devices:\n" :
"";
1372 for (
auto uvc : _uvc_devices)
1378 s += _usb_devices.size()>0 ?
"usb devices:\n" :
"";
1379 for (
auto usb : _usb_devices)
1385 s += _hid_devices.size()>0 ?
"hid devices: \n" :
"";
1386 for (
auto hid : _hid_devices)
1399 std::chrono::high_resolution_clock::time_point
started;
1400 std::chrono::high_resolution_clock::time_point
ended;
1412 : invocation(other.invocation), owner(other.owner)
1414 other.invocation =
nullptr;
1418 : invocation(invocation), owner(owner)
1423 if (invocation) owner->deallocate(invocation);
1429 owner = other.owner;
1430 other.invocation =
nullptr;
1436 return invocation !=
nullptr;
1447 const void* protected_data =
nullptr;
1454 explicit frame_continuation(std::function<
void()> continuation,
const void* protected_data) : continuation(continuation), protected_data(protected_data) {}
1459 other.continuation = []() {};
1460 other.protected_data =
nullptr;
1466 continuation = []() {};
1467 protected_data =
nullptr;
1472 protected_data =
nullptr;
1473 continuation = [](){};
1476 const void*
get_data()
const {
return protected_data; }
1481 protected_data = other.protected_data;
1482 continuation = other.continuation;
1483 other.continuation = []() {};
1484 other.protected_data =
nullptr;
1500 std::function<
bool(
rs2_stream)> intrinsic_validator);
1513 return std::find_if(data.begin(), data.end(), [](
byte b){
return b!=0; }) != data.end();
1518 auto t = time(
nullptr);
1520 const tm* time = localtime(&
t);
1521 if (
nullptr != time)
1522 strftime(buffer,
sizeof(buffer),
"%Y-%m-%d-%H_%M_%S", time);
1540 _backend(backend_ref),_active_object([this](
dispatcher::cancellable_timer cancellable_timer)
1545 _devices_data = { _backend->query_uvc_devices(),
1546 _backend->query_usb_devices(),
1547 _backend->query_hid_devices() };
1560 if(
list_changed(_devices_data.uvc_devices, curr.uvc_devices ) ||
1561 list_changed(_devices_data.usb_devices, curr.usb_devices ) ||
1562 list_changed(_devices_data.hid_devices, curr.hid_devices ))
1567 _callback(_devices_data, curr);
1568 _devices_data = curr;
1578 _active_object.start();
1583 _active_object.stop();
1585 _callback_inflight.wait_until_empty();
1600 template<
typename HostingClass,
typename... Args>
1611 std::lock_guard<std::mutex> locker(other.m_mutex);
1612 m_subscribers =
std::move(other.m_subscribers);
1614 other.m_subscribers.clear();
1619 std::lock_guard<std::mutex> locker(other.m_mutex);
1620 m_subscribers =
std::move(other.m_subscribers);
1622 other.m_subscribers.clear();
1628 std::lock_guard<std::mutex> locker(m_mutex);
1631 for (
int i = 0; i < (std::numeric_limits<int>::max)();
i++)
1633 if (m_subscribers.find(
i) == m_subscribers.end())
1642 m_subscribers.emplace(token,
func);
1650 std::lock_guard<std::mutex> locker(m_mutex);
1652 bool retVal =
false;
1653 typename std::map<int, std::function<
void(Args...)>>::iterator
it = m_subscribers.find(token);
1654 if (it != m_subscribers.end())
1656 m_subscribers.erase(token);
1665 return subscribe(
func);
1670 return unsubscribe(token);
1679 std::vector<std::function<
void(Args...)>> functions;
1680 bool retVal =
false;
1682 std::unique_lock<std::mutex> locker(m_mutex);
1683 if (m_subscribers.size() > 0)
1685 typename std::map<int, std::function<
void(Args...)>>::iterator
it = m_subscribers.begin();
1686 while (it != m_subscribers.end())
1688 functions.emplace_back(it->second);
1694 if (functions.size() > 0)
1696 for (
auto func : functions)
1709 return raise(std::forward<Args>(
args)...);
1716 template <
typename T>
1723 operator bool()
const 1741 if (!_valid)
throw std::runtime_error(
"bad optional access");
1747 if (!_valid)
throw std::runtime_error(
"bad optional access");
1774 return this->_value == other;
1779 return !(*
this == other);
1800 <<
" p[" << i.
ppx <<
" " << i.
ppy <<
"]" 1801 <<
" f[" << i.
fx <<
" " << i.
fy <<
"]" 1813 time_t
t =
self.timestamp;
1814 auto ptm = localtime( &t );
1816 strftime( buf,
sizeof( buf ),
"%F.%T ", ptm );
1819 unsigned patch =
self.version & 0xF;
1820 unsigned minor = (
self.version >> 4) & 0xFF;
1821 unsigned major = (
self.version >> 12);
1822 s << major <<
'.' << minor <<
'.' << patch <<
' ';
1828 switch(
self.
model )
1834 s <<
"x[" <<
self.h_scale <<
" " <<
self.v_scale <<
"] ";
1835 s <<
"+[" <<
self.h_offset <<
" " <<
self.v_offset;
1836 if(
self.rtd_offset )
1837 s <<
" rtd " <<
self.rtd_offset;
1840 s <<
" @" << float(
self.temp_x2 ) / 2 <<
"degC";
1845 template<
typename T>
1849 return ((static_cast<uint32_t>(a) << 24) |
1850 (static_cast<uint32_t>(b) << 16) |
1851 (static_cast<uint32_t>(c) << 8) |
1852 (static_cast<uint32_t>(d) << 0));
1864 return (hash<uint32_t>()(k.
height))
1865 ^ (hash<uint32_t>()(k.
width))
1866 ^ (hash<uint32_t>()(k.
fps))
1867 ^ (hash<uint32_t>()(k.
format))
1868 ^ (hash<uint32_t>()(k.
stream));
1879 return (hash<uint32_t>()(k.
height))
1880 ^ (hash<uint32_t>()(k.
width))
1881 ^ (hash<uint32_t>()(k.
fps))
1882 ^ (hash<uint32_t>()(k.
format));
1887 struct hash<rs2_format>
1893 return hash<uint32_t>()(f);
1901 return first == second;
1905 std::vector<std::shared_ptr<T>>
subtract_sets(
const std::vector<std::shared_ptr<T>>&
first,
const std::vector<std::shared_ptr<T>>& second)
1907 std::vector<std::shared_ptr<T>> results;
1908 std::for_each(
first.begin(),
first.end(), [&](std::shared_ptr<T>
data)
1910 if (std::find_if(second.begin(), second.end(), [&](std::shared_ptr<T> new_dev) {
1914 results.push_back(
data);
1933 else if (width < 640)
1941 for(
int i = 0;
i < 3;
i++ )
1944 for(
int j = 0;
j < 3;
j++ )
1945 for(
int i = 0;
i < 3;
i++ )
1947 > std::numeric_limits<float>::epsilon() )
static const textual_icon lock
internal_frame_callback(T on_frame)
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
rs2_intrinsics scale_intrinsics(const rs2_intrinsics &i, int width, int height)
resolution_func stream_resolution
static const double TIMESTAMP_USEC_TO_MSEC
GLboolean GLboolean GLboolean b
std::function< bool(rs2_stream from_stream, rs2_stream to_stream)> extrinsic_validator
camera_disconnected_exception(const std::string &msg) noexcept
rs2_exception_type
Exception types are the different categories of errors that RealSense API might return.
GLenum GLuint GLenum severity
const char * get_string(rs2_rs400_visual_preset value)
typedef void(APIENTRY *GLDEBUGPROC)(GLenum source
bool list_changed(const std::vector< T > &list1, const std::vector< T > &list2, std::function< bool(T, T)> equal=[](T first, T second){return first==second;})
GLuint const GLchar * name
wrong_api_call_sequence_exception(const std::string &msg) noexcept
std::vector< usb_device_info > _usb_devices
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
rs2_extrinsics from_pose(pose a)
io_exception(const std::string &msg) noexcept
std::tuple< rs2_stream, int, rs2_format > output_tuple
rs2_notification_category category
float3 operator-(const float3 &a, const float3 &b)
void(* rs2_frame_processor_callback_ptr)(rs2_frame *, rs2_source *, void *)
std::shared_ptr< rs2_frame_callback > frame_callback_ptr
std::vector< uint32_t > split(const std::string &s, char delim)
rs2_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
std::shared_ptr< struct_interface< T, R, W > > make_struct_interface(R r, W w)
std::string array2str(T &data)
void log_to_callback(rs2_log_severity min_severity, log_callback_ptr callback)
std::string make_less_screamy(const char *str)
rs2_sr300_visual_preset
For SR300 devices: provides optimized settings (presets) for specific types of usage.
bool val_in_range(const T &val, const std::initializer_list< T > &list)
const void * get_data() const
internal_frame_processor_fptr_callback()
Video DSM (Digital Sync Module) parameters for calibration (same layout as in FW ac_depth_params) Thi...
std::chrono::high_resolution_clock::time_point started
float3 operator*(const float3 &a, float b)
void polling(dispatcher::cancellable_timer cancellable_timer)
stream_descriptor(rs2_stream type, int index=0)
platform::device_changed_callback _callback
rs2_calib_target_type
Calibration target type.
std::function< void(frame_interface *)> on_frame
void(* frame_callback_function_ptr)(rs2_frame *frame, void *user)
notifications_callback_ptr _callback
backend_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
devices_changed_callback()
stream_output(stream_descriptor stream_desc_in, rs2_format format_in, resolution_func res_func=[](resolution res){return res;})
frame_callback(frame_callback_function_ptr on_frame, void *user)
lazy(std::function< T()> initializer)
GLenum GLuint GLsizei bufsize
std::mutex _callback_mutex
std::function< void()> continuation
void(* notifications_callback_function_ptr)(rs2_notification *notification, void *user)
update_progress_callback(rs2_update_progress_callback_ptr on_update_progress, void *client_data=NULL)
GLdouble GLdouble GLdouble w
GLsizei const GLchar *const * string
bool check_not_all_zeros(std::vector< byte > data)
void on_update_progress(const float progress)
bool is_between(const firmware_version &from, const firmware_version &until) const
void log_to_file(rs2_log_severity min_severity, const char *file_path)
rs2_host_perf_mode
values for RS2_OPTION_HOST_PERFORMANCE option.
signal & operator=(signal &&other)
#define LRS_EXTENSION_API
librealsense::small_heap< callback_invocation, 1 > callbacks_heap
GLfloat GLfloat GLfloat GLfloat h
void on_frame(rs2_frame *fref) override
static firmware_version any()
bool operator>(failed, failed)
bool unsubscribe(int token)
static const textual_icon stop
rs2_cah_trigger
values for RS2_OPTION_TRIGGER_CAMERA_ACCURACY_HEALTH option.
rs2_extrinsics identity_matrix()
frame_callback_function_ptr fptr
std::tuple< platform::stream_profile_tuple, native_pixel_format_tuple, std::vector< output_tuple > > request_mapping_tuple
std::map< int, std::function< void(Args...)> > m_subscribers
lazy & operator=(lazy &&other) noexcept
lazy & operator=(std::function< T()> func) noexcept
callback_invocation * invocation
#define RS2_ENUM_HELPERS_CUSTOMIZED(TYPE, FIRST, LAST)
void(* rs2_update_progress_callback_ptr)(const float, void *)
std::shared_ptr< rs2_update_progress_callback > update_progress_callback_ptr
std::ostream & operator<<(std::ostream &os, const stream_profiles &profiles)
GLboolean GLboolean GLboolean GLboolean a
GLenum GLuint GLenum GLsizei const GLchar * buf
#define RS2_ENUM_HELPERS(TYPE, PREFIX)
float3x3 transpose(const float3x3 &a)
pose inverse(const pose &a)
std::shared_ptr< rs2_log_callback > log_callback_ptr
const int RS2_USER_QUEUE_SIZE
pose to_pose(const rs2_extrinsics &a)
software_device_destruction_callback()
struct_interface(R r, W w)
std::string hexify(const T &val)
constexpr size_t arr_size(T const &)
rs2_extrinsics to_raw_extrinsics(rs2_extrinsics extr)
std::function< void(devices_data old, devices_data curr)> device_changed_callback
invalid_value_exception(const std::string &msg) noexcept
devices_changed_function_ptr nptr
bool operator!=(const firmware_version &other) const
unrecoverable_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
platform::backend_device_group _devices_data
~polling_device_watcher()
frame_continuation(frame_continuation &&other)
frame_continuation & operator=(frame_continuation &&other)
rs2_extrinsics from_raw_extrinsics(rs2_extrinsics extr)
devices_changed_callback_internal(internal_callback callback)
size_t operator()(const librealsense::stream_profile &k) const
std::shared_ptr< rs2_frame_processor_callback > frame_processor_callback_ptr
std::vector< std::shared_ptr< T > > subtract_sets(const std::vector< std::shared_ptr< T >> &first, const std::vector< std::shared_ptr< T >> &second)
std::vector< uvc_device_info > _uvc_devices
rs2_matchers
Specifies types of different matchers.
bool file_exists(const char *filename)
devices_changed_callback(devices_changed_function_ptr on_devices_changed, void *user)
T & operator=(const T &v)
std::shared_ptr< rs2_notifications_callback > notifications_callback_ptr
T clamp_val(T val, const T &min, const T &max)
bool operator<(const stream_profile &lhs, const stream_profile &rhs)
firmware_version(const std::string &name)
const T & operator*() const
bool experimental() const
rs2_exception_type _exception_type
std::string datetime_string()
uint32_t rs_fourcc(const T a, const T b, const T c, const T d)
internal_frame_processor_fptr_callback(rs2_frame_processor_callback_ptr on_frame, void *user)
std::string generate_last_error_message(const std::string &msg) const
GLint GLsizei GLsizei height
bool operator==(const T &other) const
GLint GLint GLsizei GLint GLenum format
notifications_callback(notifications_callback_function_ptr on_notification, void *user)
std::function< void(rs2_device_list *removed, rs2_device_list *added)> internal_callback
std::chrono::high_resolution_clock::time_point ended
const T * operator->() const
unsigned __int64 uint64_t
std::string string_representation
void on_frame(rs2_frame *frame, rs2_source *source) override
rs2_update_progress_callback_ptr _nptr
rs2_format
A stream's format identifies how binary data is encoded within a frame.
callback_invocation_holder(callback_invocation *invocation, callbacks_heap *owner)
bool operator<=(const firmware_version &other) const
notifications_callback_function_ptr nptr
stream_profile(rs2_format fmt=RS2_FORMAT_ANY, rs2_stream strm=RS2_STREAM_ANY, int idx=0, uint32_t w=0, uint32_t h=0, uint32_t framerate=0, resolution_func res_func=[](resolution res){return res;})
size_t copy_2darray(T(&dst)[tgt_m][tgt_n], const S(&src)[src_m][src_n])
bool contains(const T &first, const T &second)
devices_data(std::vector< uvc_device_info > uvc_devices, std::vector< usb_device_info > usb_devices, std::vector< hid_device_info > hid_devices)
update_progress_callback()
bool operator>=(const firmware_version &other) const
rs2_stream
Streams are different types of data provided by RealSense devices.
bool operator==(const hdr_params &first, const hdr_params &second)
void on_notification(rs2_notification *notification) override
constexpr size_t arr_size_bytes(T(&arr)[sz])
windows_backend_exception(const std::string &msg) noexcept
bool operator<(const firmware_version &other) const
rs2_sensor_mode
For setting the camera_mode option.
int operator+=(const std::function< void(Args...)> &func)
bool operator!=(const T &other) const
notification(rs2_notification_category category, int type, rs2_log_severity severity, std::string description)
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
const T & operator*() const &
callback_invocation_holder()
optional_value(const T &v)
std::function< T()> _init
active_object _active_object
rs2_exception_type get_exception_type() const noexcept
resolution_func stream_resolution
void enable_rolling_log_file(unsigned max_size)
software_device_destruction_callback(software_device_destruction_callback_function_ptr on_destruction, void *user)
bool operator()(Args...args)
~callback_invocation_holder()
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
bool operator==(const firmware_version &other) const
rs2_frame_processor_callback_ptr fptr
void on_destruction() override
lazy(lazy &&other) noexcept
rs2_notification_category
Category of the librealsense notification.
GLenum GLenum GLenum input
devices_data(std::vector< uvc_device_info > uvc_devices, std::vector< usb_device_info > usb_devices)
not_implemented_exception(const std::string &msg) noexcept
const char * what() const noexceptoverride
stream_descriptor stream_desc
const platform::backend * _backend
std::pair< uint32_t, uint32_t > width_height() const
std::string serialized_data
void on_frame(rs2_frame *frame) override
internal_callback _callback
size_t copy_array(T(&dst)[size_tgt], const S(&src)[size_src])
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
callback_invocation_holder(callback_invocation_holder &&other)
polling_device_watcher(const platform::backend *backend_ref)
rs2_ambient_light
DEPRECATED! - Use RS2_OPTION_DIGITAL_GAIN instead.
rs2_intrinsics pad_crop_intrinsics(const rs2_intrinsics &i, int pad_crop)
GLsizei GLsizei GLchar * source
rs2_digital_gain
digital gain for RS2_OPTION_DIGITAL_GAIN option.
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
firmware_version(int major, int minor, int patch, int build, bool is_any=false)
librealsense_exception(const std::string &msg, rs2_exception_type exception_type) noexcept
void start(platform::device_changed_callback callback) override
std::shared_ptr< rs2_devices_changed_callback > devices_changed_callback_ptr
static uint64_t generate_id()
int subscribe(const std::function< void(Args...)> &func)
callback_invocation_holder & operator=(callback_invocation_holder &&other)
software_device_destruction_callback_function_ptr nptr
std::function< bool(rs2_stream stream)> intrinsic_validator
void log_to_console(rs2_log_severity min_severity)
void(* software_device_destruction_callback_function_ptr)(void *user)
std::tuple< uint32_t, int, size_t > native_pixel_format_tuple
devices_data(std::vector< usb_device_info > usb_devices)
float3 operator+(const float3 &a, const float3 &b)
void on_devices_changed(rs2_device_list *removed, rs2_device_list *added) override
bool operator-=(int token)
void(* devices_changed_function_ptr)(rs2_device_list *removed, rs2_device_list *added, void *user)
rs2_log_severity
Severity of the librealsense logger.
std::shared_ptr< rs2_software_device_destruction_callback > software_device_destruction_callback_ptr
rs2_log_severity severity
std::condition_variable cv
uint32_t pack(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3)
const char * get_message() const noexcept
callbacks_heap _callback_inflight
std::unique_ptr< T > _ptr
bool try_sleep(std::chrono::milliseconds::rep ms)
std::function< resolution(resolution res)> resolution_func
frame_continuation(std::function< void()> continuation, const void *protected_data)
linux_backend_exception(const std::string &msg) noexcept
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
float3x3 calc_rotation_from_rodrigues_angles(const std::vector< double > rot)
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
std::vector< hid_device_info > _hid_devices
struct rs2_frame rs2_frame
std::shared_ptr< rs2_calibration_change_callback > calibration_change_callback_ptr
void copy(void *dst, void const *src, size_t size)
uint32_t calc_crc32(const uint8_t *buf, size_t bufsize)
Calculate CRC code for arbitrary characters buffer.
res_type get_res_type(uint32_t width, uint32_t height)
std::string to_string(T value)
rs2_l500_visual_preset
For L500 devices: provides optimized settings (presets) for specific types of usage.
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.