Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Macros | Functions
rs.h File Reference

Exposes librealsense functionality for C compilers. More...

#include "rsutil.h"
#include "h/rs_types.h"
#include "h/rs_context.h"
#include "h/rs_device.h"
#include "h/rs_frame.h"
#include "h/rs_option.h"
#include "h/rs_processing.h"
#include "h/rs_record_playback.h"
#include "h/rs_sensor.h"

Go to the source code of this file.

Macros

#define RS2_API_MAJOR_VERSION   2
 
#define RS2_API_MINOR_VERSION   56
 
#define RS2_API_PATCH_VERSION   0
 
#define RS2_API_BUILD_VERSION   0
 
#define STRINGIFY(arg)   #arg
 
#define VAR_ARG_STRING(arg)   STRINGIFY(arg)
 
#define RS2_API_VERSION   (((RS2_API_MAJOR_VERSION) * 10000) + ((RS2_API_MINOR_VERSION) * 100) + (RS2_API_PATCH_VERSION))
 
#define RS2_API_VERSION_STR   (VAR_ARG_STRING(RS2_API_MAJOR_VERSION.RS2_API_MINOR_VERSION.RS2_API_PATCH_VERSION))
 
#define RS2_API_FULL_VERSION_STR   (VAR_ARG_STRING(RS2_API_MAJOR_VERSION.RS2_API_MINOR_VERSION.RS2_API_PATCH_VERSION.RS2_API_BUILD_VERSION))
 
#define RS2_CONFIG_FILENAME   "realsense-config.json"
 

Functions

int rs2_get_raw_data_size (const rs2_raw_data_buffer *buffer, rs2_error **error)
 
void rs2_delete_raw_data (const rs2_raw_data_buffer *buffer)
 
const unsigned char * rs2_get_raw_data (const rs2_raw_data_buffer *buffer, rs2_error **error)
 
int rs2_get_api_version (rs2_error **error)
 
void rs2_log_to_console (rs2_log_severity min_severity, rs2_error **error)
 
void rs2_log_to_file (rs2_log_severity min_severity, const char *file_path, rs2_error **error)
 
void rs2_log_to_callback_cpp (rs2_log_severity min_severity, rs2_log_callback *callback, rs2_error **error)
 
void rs2_log_to_callback (rs2_log_severity min_severity, rs2_log_callback_ptr callback, void *arg, rs2_error **error)
 
void rs2_reset_logger (rs2_error **error)
 
void rs2_enable_rolling_log_file (unsigned max_size, rs2_error **error)
 
unsigned rs2_get_log_message_line_number (rs2_log_message const *msg, rs2_error **error)
 
const char * rs2_get_log_message_filename (rs2_log_message const *msg, rs2_error **error)
 
const char * rs2_get_raw_log_message (rs2_log_message const *msg, rs2_error **error)
 
const char * rs2_get_full_log_message (rs2_log_message const *msg, rs2_error **error)
 
void rs2_log (rs2_log_severity severity, const char *message, rs2_error **error)
 
float rs2_depth_frame_get_distance (const rs2_frame *frame_ref, int x, int y, rs2_error **error)
 
rs2_time_t rs2_get_time (rs2_error **error)
 

Detailed Description

Exposes librealsense functionality for C compilers.

Macro Definition Documentation

◆ RS2_API_BUILD_VERSION

#define RS2_API_BUILD_VERSION   0

◆ RS2_API_FULL_VERSION_STR

◆ RS2_API_MAJOR_VERSION

#define RS2_API_MAJOR_VERSION   2

◆ RS2_API_MINOR_VERSION

#define RS2_API_MINOR_VERSION   56

◆ RS2_API_PATCH_VERSION

#define RS2_API_PATCH_VERSION   0

◆ RS2_API_VERSION

#define RS2_API_VERSION   (((RS2_API_MAJOR_VERSION) * 10000) + ((RS2_API_MINOR_VERSION) * 100) + (RS2_API_PATCH_VERSION))

◆ RS2_API_VERSION_STR

◆ RS2_CONFIG_FILENAME

#define RS2_CONFIG_FILENAME   "realsense-config.json"

The library keeps persistent global settings in a per-user configuration file. These settings can relate to tool behavior (e.g., realsense-viewer) or library functionality (context creation, etc.) where settings are accepted (e.g., rs2_create_context_ex).

The filename is appended to the user's AppData folder on Windows (<AppData>/<filename>) and home directory as a hidden file on Linux (~/.<filename>).

The content is a JSON file and by default contains an empty object so default values are used. JSON ordering may shift when written to by the various tools but the contents should stay the same. Any values that do not match the expected type may be ignored.

◆ STRINGIFY

#define STRINGIFY (   arg)    #arg

◆ VAR_ARG_STRING

#define VAR_ARG_STRING (   arg)    STRINGIFY(arg)

Function Documentation

◆ rs2_delete_raw_data()

void rs2_delete_raw_data ( const rs2_raw_data_buffer buffer)

Delete rs2_raw_data_buffer

Parameters
[in]bufferrs2_raw_data_buffer returned by rs2_send_and_receive_raw_data

◆ rs2_depth_frame_get_distance()

float rs2_depth_frame_get_distance ( const rs2_frame frame_ref,
int  x,
int  y,
rs2_error **  error 
)

Given the 2D depth coordinate (x,y) provide the corresponding depth in metric units

Parameters
[in]frame_ref2D depth pixel coordinates (Left-Upper corner origin)
[in]x,y2D depth pixel coordinates (Left-Upper corner origin)
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_enable_rolling_log_file()

void rs2_enable_rolling_log_file ( unsigned  max_size,
rs2_error **  error 
)

Enable rolling log file when used with rs2_log_to_file: Upon reaching (max_size/2) bytes, the log will be renamed with an ".old" suffix and a new log created. Any previous .old file will be erased. Must have permissions to remove/rename files in log file directory.

Parameters
[in]max_sizemax file size in megabytes
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_get_api_version()

int rs2_get_api_version ( rs2_error **  error)

Retrieve the API version from the source code. Evaluate that the value is conformant to the established policies

Parameters
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
the version API encoded into integer value "1.9.3" -> 10903

◆ rs2_get_full_log_message()

const char* rs2_get_full_log_message ( rs2_log_message const *  msg,
rs2_error **  error 
)

◆ rs2_get_log_message_filename()

const char* rs2_get_log_message_filename ( rs2_log_message const *  msg,
rs2_error **  error 
)

◆ rs2_get_log_message_line_number()

unsigned rs2_get_log_message_line_number ( rs2_log_message const *  msg,
rs2_error **  error 
)

◆ rs2_get_raw_data()

const unsigned char* rs2_get_raw_data ( const rs2_raw_data_buffer buffer,
rs2_error **  error 
)

Retrieve char array from rs2_raw_data_buffer

Parameters
[in]bufferrs2_raw_data_buffer returned by rs2_send_and_receive_raw_data
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
raw data

◆ rs2_get_raw_data_size()

int rs2_get_raw_data_size ( const rs2_raw_data_buffer buffer,
rs2_error **  error 
)

get the size of rs2_raw_data_buffer

Parameters
[in]bufferpointer to rs2_raw_data_buffer returned by rs2_send_and_receive_raw_data
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
size of rs2_raw_data_buffer

◆ rs2_get_raw_log_message()

const char* rs2_get_raw_log_message ( rs2_log_message const *  msg,
rs2_error **  error 
)

◆ rs2_get_time()

rs2_time_t rs2_get_time ( rs2_error **  error)

return the time at specific time point

Parameters
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored
Returns
the time at specific time point, in live and record mode it will return the system time and in playback mode it will return the recorded time

◆ rs2_log()

void rs2_log ( rs2_log_severity  severity,
const char *  message,
rs2_error **  error 
)

Add custom message into librealsense log

Parameters
[in]severityThe log level for the message to be written under
[in]messageMessage to be logged
[out]errorif non-null, receives any error that occurs during this call, otherwise, errors are ignored

◆ rs2_log_to_callback()

void rs2_log_to_callback ( rs2_log_severity  min_severity,
rs2_log_callback_ptr  callback,
void *  arg,
rs2_error **  error 
)

◆ rs2_log_to_callback_cpp()

void rs2_log_to_callback_cpp ( rs2_log_severity  min_severity,
rs2_log_callback callback,
rs2_error **  error 
)

◆ rs2_log_to_console()

void rs2_log_to_console ( rs2_log_severity  min_severity,
rs2_error **  error 
)

◆ rs2_log_to_file()

void rs2_log_to_file ( rs2_log_severity  min_severity,
const char *  file_path,
rs2_error **  error 
)

◆ rs2_reset_logger()

void rs2_reset_logger ( rs2_error **  error)