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{});
230 return tof_camera_config_index(this->ptr_, TOF_ERROR_HANDLER{});
238 return tof_camera_switch_config(this->ptr_,
config_index, TOF_ERROR_HANDLER{});
245 size_t size = tof_camera_possible_frame_types(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
246 std::vector<FrameType> vec(size);
247 size = tof_camera_possible_frame_types(this->ptr_,
reinterpret_cast<tof_frame_type*
>(vec.data()), vec.size(), TOF_ERROR_HANDLER{});
255 size_t size = tof_camera_get_output_frame_types(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
256 std::vector<FrameType> vec(size);
257 size = tof_camera_get_output_frame_types(this->ptr_,
reinterpret_cast<tof_frame_type*
>(vec.data()), vec.size(), TOF_ERROR_HANDLER{});
265 return tof_camera_set_output_frame_types(this->ptr_,
reinterpret_cast<const tof_frame_type*
>(output_frame_types.data()), output_frame_types.size(), TOF_ERROR_HANDLER{});
273 return tof_camera_has_multiple_configurations(this->ptr_, TOF_ERROR_HANDLER{});
280 size_t size = tof_camera_get_multiple_camera_configurations(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
281 std::vector<CameraConfig> vec;
283 for (
size_t i = 0; i < size; i++)
284 vec.emplace_back(
static_cast<tof_camera_config_t
>(
nullptr));
285 auto data =
reinterpret_cast<tof_camera_config_t*
>(vec.data());
286 size = tof_camera_get_multiple_camera_configurations(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
294 size_t size = tof_camera_get_multiple_processing_configurations(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
295 std::vector<ProcessingConfig> vec;
297 for (
size_t i = 0; i < size; i++)
298 vec.emplace_back(
static_cast<tof_processing_config_t
>(
nullptr));
299 auto data =
reinterpret_cast<tof_processing_config_t*
>(vec.data());
300 size = tof_camera_get_multiple_processing_configurations(this->ptr_, data, vec.size(), TOF_ERROR_HANDLER{});
308 size_t size = tof_camera_get_multiple_names(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
309 std::vector<const char*> vec(size);
310 size = tof_camera_get_multiple_names(this->ptr_, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
318 size_t size = tof_camera_get_multiple_descriptions(this->ptr_,
nullptr, 0, TOF_ERROR_HANDLER{});
319 std::vector<const char*> vec(size);
320 size = tof_camera_get_multiple_descriptions(this->ptr_, vec.data(), vec.size(), TOF_ERROR_HANDLER{});
331inline size_t select_streams(
const Camera &camera,
const std::vector<FrameType> &frame_types) {
332 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{});
342inline size_t select_streams_mod_freq(
const Camera &camera,
const std::vector<FrameType> &frame_types,
float mod_freq) {
343 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.
std::vector< FrameType > possible_frame_types() const
Get the frame types that this camera can output.
std::vector< CameraConfig > get_multiple_camera_configurations() const
Get all the set camera configurations.
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.
std::vector< const char * > get_multiple_descriptions() const
Get the description for each configuration.
std::vector< FrameType > get_output_frame_types() const
Get the frame types the camera should output.
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.
void set_output_frame_types(const std::vector< FrameType > &output_frame_types)
Set the frame types the camera should output.
ProcessingConfig get_process_config() const
Get the processing config of the camera.
bool has_frames() const
Check if the camera has frames available.
uint32_t config_index() const
Get the currently set configuration index.
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.
std::vector< const char * > get_multiple_names() const
Get the name for each configuration.
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.
std::vector< ProcessingConfig > get_multiple_processing_configurations() const
Get all the set processing configurations.
Calibration get_calibration() const
Get calibration from the camera.
void switch_config(uint32_t config_index)
Switch to a different config in real time, depending on configuration and camera, this can take 100-3...
std::vector< Data > get_frames()
Get data frames from camera.
void start()
Start streaming of the camera.
bool has_multiple_configurations() const
Check if multiple configurations are set.
Processing that can be done.