Intel® RealSense™ Cross Platform API  2.13.0
Intel Realsense Cross-platform API
Functions
rs_context.h File Reference

Exposes RealSense context functionality for C compilers. More...

#include "rs_types.h"

Go to the source code of this file.

Functions

rs2_contextrs2_create_context (int api_version, rs2_error **error)
 Creates RealSense context that is required for the rest of the API. More...
 
void rs2_delete_context (rs2_context *context)
 Frees the relevant context object. More...
 
void rs2_set_devices_changed_callback_cpp (rs2_context *context, rs2_devices_changed_callback *callback, rs2_error **error)
 
void rs2_set_devices_changed_callback (const rs2_context *context, rs2_devices_changed_callback_ptr callback, void *user, rs2_error **error)
 
rs2_devicers2_context_add_device (rs2_context *ctx, const char *file, rs2_error **error)
 
void rs2_context_remove_device (rs2_context *ctx, const char *file, rs2_error **error)
 
rs2_device_listrs2_query_devices (const rs2_context *context, rs2_error **error)
 
rs2_device_hubrs2_create_device_hub (const rs2_context *context, rs2_error **error)
 Creates RealSense device_hub . More...
 
void rs2_delete_device_hub (const rs2_device_hub *hub)
 Frees the relevant device hub object. More...
 
rs2_devicers2_device_hub_wait_for_device (rs2_context *ctx, const rs2_device_hub *hub, rs2_error **error)
 
int rs2_device_hub_is_device_connected (const rs2_device_hub *hub, const rs2_device *device, rs2_error **error)
 

Detailed Description

Exposes RealSense context functionality for C compilers.

Function Documentation

◆ rs2_context_add_device()

rs2_device* rs2_context_add_device ( rs2_context ctx,
const char *  file,
rs2_error **  error 
)

Create a new device and add it to the context

Parameters
ctxThe context to which the new device will be added
fileThe file from which the device should be created
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
A pointer to a device that plays data from the file, or null in case of failure

◆ rs2_context_remove_device()

void rs2_context_remove_device ( rs2_context ctx,
const char *  file,
rs2_error **  error 
)

Removes a playback device from the context, if exists

Parameters
[in]ctxThe context from which the device should be removed
[in]fileThe file name that was used to add the device
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_create_context()

rs2_context* rs2_create_context ( int  api_version,
rs2_error **  error 
)

Creates RealSense context that is required for the rest of the API.

Parameters
[in]api_versionUsers are expected to pass their version of RS2_API_VERSION to make sure they are running the correct librealsense version.
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored.
Returns
Context object

◆ rs2_create_device_hub()

rs2_device_hub* rs2_create_device_hub ( const rs2_context context,
rs2_error **  error 
)

Creates RealSense device_hub .

Parameters
[in]contextThe context for the device hub
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored.
Returns
Device hub object

◆ rs2_delete_context()

void rs2_delete_context ( rs2_context context)

Frees the relevant context object.

Parameters
[in]contextObject that is no longer needed

◆ rs2_delete_device_hub()

void rs2_delete_device_hub ( const rs2_device_hub hub)

Frees the relevant device hub object.

Parameters
[in]hubObject that is no longer needed

◆ rs2_device_hub_is_device_connected()

int rs2_device_hub_is_device_connected ( const rs2_device_hub hub,
const rs2_device device,
rs2_error **  error 
)

Checks if device is still connected

Parameters
[in]hubThe device hub object
[in]deviceThe device
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored.
Returns
1 if the device is connected, 0 otherwise

◆ rs2_device_hub_wait_for_device()

rs2_device* rs2_device_hub_wait_for_device ( rs2_context ctx,
const rs2_device_hub hub,
rs2_error **  error 
)

If any device is connected return it, otherwise wait until next RealSense device connects. Calling this method multiple times will cycle through connected devices

Parameters
[in]ctxThe context to creat the device
[in]hubThe device hub object
[out]errorIf non-null, receives any error that occurs during this call, otherwise, errors are ignored.
Returns
device object

◆ rs2_query_devices()

rs2_device_list* rs2_query_devices ( const rs2_context context,
rs2_error **  error 
)

create a static snapshot of all connected devices at the time of the call

Parameters
contextObject representing librealsense session
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
the list of devices, should be released by rs2_delete_device_list

◆ rs2_set_devices_changed_callback()

void rs2_set_devices_changed_callback ( const rs2_context context,
rs2_devices_changed_callback_ptr  callback,
void *  user,
rs2_error **  error 
)

set callback to get devices changed events these events will be raised by the context whenever new RealSense device is connected or existing device gets disconnected

Parameters
contextObject representing librealsense session
[in]callbackfunction pointer to register as per-notifications callback
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_set_devices_changed_callback_cpp()

void rs2_set_devices_changed_callback_cpp ( rs2_context context,
rs2_devices_changed_callback callback,
rs2_error **  error 
)

set callback to get devices changed events these events will be raised by the context whenever new RealSense device is connected or existing device gets disconnected

Parameters
contextObject representing librealsense session
[in]callbackcallback object created from c++ application. ownership over the callback object is moved into the context
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored