Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b9015f6
[sw-dev] add rw option support, new ro option implementation
Nov 21, 2019
314c8ac
add get_active_streams to sensor API
Nov 21, 2019
fce98fc
make get_active_streams threadsafe
Nov 27, 2019
a9900c1
[sw-dev] add device destruction callback and support for simulating s…
Dec 12, 2019
ddbe825
[Bugfix] `add_*_stream` function errors hidden bug
Jun 19, 2019
6a4e9ff
[Refactor] Reduce duplicative search for stream by uid
Jun 19, 2019
6ebcb67
Expanded the software device API for emulating realsense devices
Jun 19, 2019
95a22a6
[sw-dev] add ability to flag stream_profile as default.
Dec 12, 2019
c56e0e6
Add missing functions to realsense.def
Dec 12, 2019
e44bc52
fix error handling in rs2_software_sensor_on_notification
Dec 12, 2019
a98c99a
Additional fixes
Dec 12, 2019
77bae3c
minor documentation tweaks
Jan 15, 2020
61ed068
[python] Wrapped software_device, including all new functionality
Jan 15, 2020
58d44c8
[python] Release gil during fw update processes, add constructor for …
Jan 15, 2020
bc2003f
Only call swdev on_destruction_callback if its initialized
Jan 15, 2020
dff8f96
[python] handle discrepancy between MSVC and g++
Jan 16, 2020
89486c2
Merge branch 'development' of https://github.com/IntelRealSense/libre…
Feb 16, 2020
72d9751
add missing typename in python bindings
Feb 16, 2020
1f38d1f
Add software_device constructor with name argument
Feb 16, 2020
e5aa265
[python] remove constexpr from function
Feb 17, 2020
6666424
Code review changes
Mar 5, 2020
69328da
Add live unit test for get_active_streams
Mar 5, 2020
09d115a
Add missing else
Mar 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 103 additions & 8 deletions include/librealsense2/h/rs_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typedef enum rs2_recording_mode
RS2_RECORDING_MODE_COUNT
} rs2_recording_mode;

/** \brief All the parameters are required to define video stream*/
/** \brief All the parameters required to define a video stream. */
typedef struct rs2_video_stream
{
rs2_stream type;
Expand All @@ -44,7 +44,7 @@ typedef struct rs2_video_stream
rs2_intrinsics intrinsics;
} rs2_video_stream;

/** \brief All the parameters are required to define motion stream*/
/** \brief All the parameters required to define a motion stream. */
typedef struct rs2_motion_stream
{
rs2_stream type;
Expand All @@ -55,7 +55,7 @@ typedef struct rs2_motion_stream
rs2_motion_device_intrinsic intrinsics;
} rs2_motion_stream;

/** \brief All the parameters are required to define pose stream*/
/** \brief All the parameters required to define a pose stream. */
typedef struct rs2_pose_stream
{
rs2_stream type;
Expand All @@ -65,7 +65,7 @@ typedef struct rs2_pose_stream
rs2_format fmt;
} rs2_pose_stream;

/** \brief All the parameters are required to define video frame*/
/** \brief All the parameters required to define a video frame. */
typedef struct rs2_software_video_frame
{
void* pixels;
Expand All @@ -78,7 +78,7 @@ typedef struct rs2_software_video_frame
const rs2_stream_profile* profile;
} rs2_software_video_frame;

/** \brief All the parameters are required to define motion frame*/
/** \brief All the parameters required to define a motion frame. */
typedef struct rs2_software_motion_frame
{
void* data;
Expand All @@ -89,7 +89,7 @@ typedef struct rs2_software_motion_frame
const rs2_stream_profile* profile;
} rs2_software_motion_frame;

/** \brief All the parameters are required to define pose frame*/
/** \brief All the parameters required to define a pose frame. */
typedef struct rs2_software_pose_frame
{
struct pose_frame_info
Expand All @@ -111,6 +111,18 @@ typedef struct rs2_software_pose_frame
const rs2_stream_profile* profile;
} rs2_software_pose_frame;

/** \brief All the parameters required to define a sensor notification. */
typedef struct rs2_software_notification
{
rs2_notification_category category;
int type;
rs2_log_severity severity;
const char* description;
const char* serialized_data;
} rs2_software_notification;

struct rs2_software_device_destruction_callback;

/**
* Create librealsense context that will try to record all operations over librealsense into a file
* \param[in] api_version realsense API version as provided by RS2_API_VERSION macro
Expand Down Expand Up @@ -185,6 +197,15 @@ void rs2_software_sensor_on_motion_frame(rs2_sensor* sensor, rs2_software_motion
*/
void rs2_software_sensor_on_pose_frame(rs2_sensor* sensor, rs2_software_pose_frame frame, rs2_error** error);


/**
* Inject notification to software sonsor
* \param[in] sensor the software sensor
* \param[in] notif all the notification components
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_sensor_on_notification(rs2_sensor* sensor, rs2_software_notification notif, rs2_error** error);

/**
* Set frame metadata for the upcoming frames
* \param[in] sensor the software sensor
Expand All @@ -194,6 +215,22 @@ void rs2_software_sensor_on_pose_frame(rs2_sensor* sensor, rs2_software_pose_fra
*/
void rs2_software_sensor_set_metadata(rs2_sensor* sensor, rs2_frame_metadata_value value, rs2_metadata_type type, rs2_error** error);

/**
* set callback to be notified when a specific software device is destroyed
* \param[in] dev software device
* \param[in] on_notification function pointer to register as callback
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_device_set_destruction_callback(const rs2_device* dev, rs2_software_device_destruction_callback_ptr on_notification, void* user, rs2_error** error);

/**
* set callback to be notified when a specific software device is destroyed
* \param[in] dev software device
* \param[in] callback callback object created from c++ application. ownership over the callback object is moved into the relevant device lock
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_device_set_destruction_callback_cpp(const rs2_device* dev, rs2_software_device_destruction_callback* callback, rs2_error** error);

/**
* Set the wanted matcher type that will be used by the syncer
* \param[in] dev the software device
Expand All @@ -202,6 +239,24 @@ void rs2_software_sensor_set_metadata(rs2_sensor* sensor, rs2_frame_metadata_val
*/
void rs2_software_device_create_matcher(rs2_device* dev, rs2_matchers matcher, rs2_error** error);

/**
* Register a camera info value for the software device
* \param[in] dev the software device
* \param[in] info identifier for the camera info to add.
* \param[in] val string value for this new camera info.
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_device_register_info(rs2_device* dev, rs2_camera_info info, const char *val, rs2_error** error);

/**
* Update an existing camera info value for the software device
* \param[in] dev the software device
* \param[in] info identifier for the camera info to add.
* \param[in] val string value for this new camera info.
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_device_update_info(rs2_device* dev, rs2_camera_info info, const char * val, rs2_error** error);

/**
* Add video stream to sensor
* \param[in] sensor the software sensor
Expand All @@ -210,22 +265,49 @@ void rs2_software_device_create_matcher(rs2_device* dev, rs2_matchers matcher, r
*/
rs2_stream_profile* rs2_software_sensor_add_video_stream(rs2_sensor* sensor, rs2_video_stream video_stream, rs2_error** error);

/**
* Add video stream to sensor
* \param[in] sensor the software sensor
* \param[in] video_stream all the stream components
* \param[in] is_default whether or not the stream should be a default stream for the device
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_stream_profile* rs2_software_sensor_add_video_stream_ex(rs2_sensor* sensor, rs2_video_stream video_stream, int is_default, rs2_error** error);

/**
* Add motion stream to sensor
* \param[in] sensor the software sensor
* \param[in] video_stream all the stream components
* \param[in] motion_stream all the stream components
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_stream_profile* rs2_software_sensor_add_motion_stream(rs2_sensor* sensor, rs2_motion_stream motion_stream, rs2_error** error);

/**
* Add motion stream to sensor
* \param[in] sensor the software sensor
* \param[in] motion_stream all the stream components
* \param[in] is_default whether or not the stream should be a default stream for the device
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_stream_profile* rs2_software_sensor_add_motion_stream_ex(rs2_sensor* sensor, rs2_motion_stream motion_stream, int is_default, rs2_error** error);

/**
* Add pose stream to sensor
* \param[in] sensor the software sensor
* \param[in] video_stream all the stream components
* \param[in] pose_stream all the stream components
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_stream_profile* rs2_software_sensor_add_pose_stream(rs2_sensor* sensor, rs2_pose_stream pose_stream, rs2_error** error);

/**
* Add pose stream to sensor
* \param[in] sensor the software sensor
* \param[in] pose_stream all the stream components
* \param[in] is_default whether or not the stream should be a default stream for the device
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
rs2_stream_profile* rs2_software_sensor_add_pose_stream_ex(rs2_sensor* sensor, rs2_pose_stream pose_stream, int is_default, rs2_error** error);

/**
* Add read only option to sensor
* \param[in] sensor the software sensor
Expand All @@ -243,6 +325,19 @@ void rs2_software_sensor_add_read_only_option(rs2_sensor* sensor, rs2_option opt
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_sensor_update_read_only_option(rs2_sensor* sensor, rs2_option option, float val, rs2_error** error);

/**
* Add an option to sensor
* \param[in] sensor the software sensor
* \param[in] option the wanted option
* \param[in] min the minimum value which will be accepted for this option
* \param[in] max the maximum value which will be accepted for this option
* \param[in] step the granularity of options which accept discrete values, or zero if the option accepts continuous values
* \param[in] def the initial value of the option
* \param[in] is_writable should the option be read-only or not
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
*/
void rs2_software_sensor_add_option(rs2_sensor* sensor, rs2_option option, float min, float max, float step, float def, int is_writable, rs2_error** error);
#ifdef __cplusplus
}
#endif
Expand Down
12 changes: 10 additions & 2 deletions include/librealsense2/h/rs_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,19 @@ const char* rs2_get_notification_serialized_data(rs2_notification* notification,

/**
* check if physical subdevice is supported
* \param[in] device input RealSense device
* \param[in] sensor input RealSense subdevice
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
* \return list of stream profiles that given subdevice can provide, should be released by rs2_delete_profiles_list
*/
rs2_stream_profile_list* rs2_get_stream_profiles(rs2_sensor* device, rs2_error** error);
rs2_stream_profile_list* rs2_get_stream_profiles(rs2_sensor* sensor, rs2_error** error);

/**
* check how subdevice is streaming
* \param[in] sensor input RealSense subdevice
* \param[out] error if non-null, receives any error that occurs during this call, otherwise, errors are ignored
* \return list of stream profiles that given subdevice is currently streaming, should be released by rs2_delete_profiles_list
*/
rs2_stream_profile_list* rs2_get_active_streams(rs2_sensor* sensor, rs2_error** error);

/**
* Get pointer to specific stream profile
Expand Down
1 change: 1 addition & 0 deletions include/librealsense2/h/rs_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ typedef struct rs2_notification rs2_notification;
typedef struct rs2_notifications_callback rs2_notifications_callback;
typedef void (*rs2_log_callback_ptr)(rs2_log_severity, rs2_log_message const *, void * arg);
typedef void (*rs2_notification_callback_ptr)(rs2_notification*, void*);
typedef void(*rs2_software_device_destruction_callback_ptr)(void*);
typedef void (*rs2_devices_changed_callback_ptr)(rs2_device_list*, rs2_device_list*, void*);
typedef void (*rs2_frame_callback_ptr)(rs2_frame*, void*);
typedef void (*rs2_frame_processor_callback_ptr)(rs2_frame*, rs2_source*, void*);
Expand Down
Loading