1#ifndef _CHRONOPTICS_TOF_CAMERA_HPP_ 
    2#define _CHRONOPTICS_TOF_CAMERA_HPP_ 
    4#include <chronoptics/tof/camera.h> 
    6#include <chronoptics/tof/stream.hpp> 
    7#include <chronoptics/tof/processing_config.hpp> 
    8#include <chronoptics/tof/data.hpp> 
    9#include <chronoptics/tof/camera_config.hpp> 
   10#include <chronoptics/tof/calibration.hpp> 
   12namespace chronoptics {
 
   17class Camera : 
public detail::Base<tof_camera, tof_camera_delete> {
 
   27    return tof_camera_start(this->ptr_, TOF_ERROR_HANDLER{});
 
   33    return tof_camera_stop(this->ptr_, TOF_ERROR_HANDLER{});
 
   40    return tof_camera_is_streaming(this->ptr_, TOF_ERROR_HANDLER{});
 
   47    return tof_camera_is_connected(this->ptr_, TOF_ERROR_HANDLER{});
 
   54    size_t size = tof_camera_get_stream_list(this->ptr_, 
nullptr, 0, TOF_ERROR_HANDLER{});
 
   55    std::vector<Stream> vec;
 
   57    for (
size_t i = 0; i < size; i++)
 
   58      vec.emplace_back(
static_cast<tof_stream_t
>(
nullptr));
 
   59    auto data = 
reinterpret_cast<tof_stream_t*
>(vec.data());
 
   60    size = tof_camera_get_stream_list(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
 
   68    return tof_camera_set_stream_list(this->ptr_, 
reinterpret_cast<const tof_stream_t*
>(streams.data()), streams.size(), TOF_ERROR_HANDLER{});
 
   75    return tof_camera_is_stream_list_set(this->ptr_, TOF_ERROR_HANDLER{});
 
   82    size_t size = tof_camera_get_set_stream_list(this->ptr_, 
nullptr, 0, TOF_ERROR_HANDLER{});
 
   83    std::vector<Stream> vec;
 
   85    for (
size_t i = 0; i < size; i++)
 
   86      vec.emplace_back(
static_cast<tof_stream_t
>(
nullptr));
 
   87    auto data = 
reinterpret_cast<tof_stream_t*
>(vec.data());
 
   88    size = tof_camera_get_set_stream_list(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
 
   96    ProcessingConfig new_processing_config(
static_cast<tof_processing_config_t
>(
nullptr));
 
   97    auto ptr = 
reinterpret_cast<tof_processing_config_t*
>(&new_processing_config);
 
   98    *ptr = tof_camera_get_process_config(this->ptr_, TOF_ERROR_HANDLER{});
 
   99    return new_processing_config;
 
  106    return tof_camera_set_process_config(this->ptr_, *
reinterpret_cast<tof_processing_config_t*
>(&config), TOF_ERROR_HANDLER{});
 
  113    return tof_camera_has_frames(this->ptr_, TOF_ERROR_HANDLER{});
 
  120    size_t size = tof_camera_get_frames(this->ptr_, 
nullptr, 0, TOF_ERROR_HANDLER{});
 
  121    std::vector<Data> vec;
 
  123    for (
size_t i = 0; i < size; i++)
 
  124      vec.emplace_back(
static_cast<tof_data_t
>(
nullptr));
 
  125    auto data = 
reinterpret_cast<tof_data_t*
>(vec.data());
 
  126    size = tof_camera_get_frames(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
 
  133    return tof_camera_clear_buffer(this->ptr_, TOF_ERROR_HANDLER{});
 
  141    return tof_camera_get_buffer_size(this->ptr_, TOF_ERROR_HANDLER{});
 
  149    return tof_camera_set_buffer_size(this->ptr_, size, TOF_ERROR_HANDLER{});
 
  156    CameraConfig new_camera_config(
static_cast<tof_camera_config_t
>(
nullptr));
 
  157    auto ptr = 
reinterpret_cast<tof_camera_config_t*
>(&new_camera_config);
 
  158    *ptr = tof_camera_get_camera_config(this->ptr_, TOF_ERROR_HANDLER{});
 
  159    return new_camera_config;
 
  166    return tof_camera_get_serial(this->ptr_, TOF_ERROR_HANDLER{});
 
  173    Calibration new_calibration(
static_cast<tof_calibration_t
>(
nullptr));
 
  174    auto ptr = 
reinterpret_cast<tof_calibration_t*
>(&new_calibration);
 
  175    *ptr = tof_camera_get_calibration(this->ptr_, TOF_ERROR_HANDLER{});
 
  176    return new_calibration;
 
  183    return tof_camera_get_user_pointer_capacity(this->ptr_, TOF_ERROR_HANDLER{});
 
  190    return tof_camera_set_user_pointer_capacity(this->ptr_, capacity, TOF_ERROR_HANDLER{});
 
  202  void add_user_pointer(uint8_t* pointer, 
size_t capacity, user_pointer_destructed_fn &callback, FrameType frame_type) {
 
  203    return tof_camera_add_user_pointer(this->ptr_, pointer, capacity, user_pointer_destructed_cb_handler, &callback, 
static_cast<tof_frame_type
>(frame_type), TOF_ERROR_HANDLER{});
 
  216  void add_user_pointer(uint8_t* pointer, 
size_t capacity, tof_user_pointer_destructed_t callback, 
void* callback_user_data, FrameType frame_type) {
 
  217    return tof_camera_add_user_pointer(this->ptr_, pointer, capacity, callback, callback_user_data, 
static_cast<tof_frame_type
>(frame_type), TOF_ERROR_HANDLER{});
 
  223    return tof_camera_clear_user_pointers(this->ptr_, TOF_ERROR_HANDLER{});
 
  233inline size_t select_streams(
const Camera &camera, 
const std::vector<FrameType> &frame_types) {
 
  234  return tof_select_streams(*
reinterpret_cast<const tof_camera_t*
>(&camera), 
reinterpret_cast<const tof_frame_type*
>(frame_types.data()), frame_types.size(), TOF_ERROR_HANDLER{});
 
  244inline size_t select_streams_mod_freq(
const Camera &camera, 
const std::vector<FrameType> &frame_types, 
float mod_freq) {
 
  245  return tof_select_streams_mod_freq(*
reinterpret_cast<const tof_camera_t*
>(&camera), 
reinterpret_cast<const tof_frame_type*
>(frame_types.data()), frame_types.size(), mod_freq, TOF_ERROR_HANDLER{});
 
This class contains all the calibration information.
 
This class allows you to view/edit the camera settings.
 
The main interface to the depth cameras.
 
const char * get_serial() const
Get the serial number of the current camera.
 
bool is_streaming() const
Check whether the camera is streaming.
 
bool is_connected() const
Check whether the camera is still connected.
 
void clear_buffer()
Clear the circular buffer used to store frames.
 
void stop()
Stop streaming of the camera.
 
void set_process_config(ProcessingConfig &config)
Set the processing config of the camera.
 
void set_user_pointer_capacity(size_t capacity)
Set the amount of user pointers that can be stored.
 
std::vector< Stream > get_stream_list() const
Get the different output streams the camera can provide.
 
void set_stream_list(const std::vector< Stream > &streams)
Set the streams that you want to get from the camera.
 
CameraConfig get_camera_config() const
Get the currently active camera config.
 
void clear_user_pointers()
Clear all user pointers in memory.
 
Camera(tof_camera_t ptr=nullptr)
Construct from pointer.
 
bool is_stream_list_set() const
Check whether the stream list is set.
 
void add_user_pointer(uint8_t *pointer, size_t capacity, tof_user_pointer_destructed_t callback, void *callback_user_data, FrameType frame_type)
Add a pointer that will be filled with the specified data type.
 
size_t get_user_pointer_capacity() const
Get the amount of user pointers that can be stored.
 
ProcessingConfig get_process_config() const
Get the processing config of the camera.
 
bool has_frames() const
Check if the camera has frames available.
 
size_t get_buffer_size() const
Get the circular buffer size.
 
std::vector< Stream > get_set_stream_list()
Get the stream list that is set on the camera.
 
void set_buffer_size(size_t size)
Set the circular buffer size.
 
void add_user_pointer(uint8_t *pointer, size_t capacity, user_pointer_destructed_fn &callback, FrameType frame_type)
Add a pointer that will be filled with the specified data type.
 
Calibration get_calibration() const
Get calibration from the camera.
 
std::vector< Data > get_frames()
Get data frames from camera.
 
void start()
Start streaming of the camera.
 
Processing that can be done.