Time-of-Flight Library(ToF) 3.13.2
 
camera.h
1#ifndef _CHRONOPTICS_TOF_CAMERA_H_
2#define _CHRONOPTICS_TOF_CAMERA_H_
3
4#include <chronoptics/tof/stream.h>
5#include <chronoptics/tof/processing_config.h>
6#include <chronoptics/tof/data.h>
7#include <chronoptics/tof/camera_config.h>
8#include <chronoptics/tof/calibration.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/** The main interface to the depth cameras
15 */
16typedef struct tof_camera* tof_camera_t;
17
18/** Destruct tof_camera */
19TOF_EXPORT void tof_camera_delete(tof_camera_t ptr);
20
21/** Start streaming of the camera
22 * @param ptr Pointer to class
23 * @param error Pointer to error
24 */
25TOF_EXPORT void tof_camera_start(tof_camera_t ptr, tof_error_t *error);
26
27/** Stop streaming of the camera
28 * @param ptr Pointer to class
29 * @param error Pointer to error
30 */
31TOF_EXPORT void tof_camera_stop(tof_camera_t ptr, tof_error_t *error);
32
33/** Check whether the camera is streaming
34 * @param ptr Pointer to class
35 * @param error Pointer to error
36 * @return Is streaming
37 */
38TOF_EXPORT bool tof_camera_is_streaming(const tof_camera_t ptr, tof_error_t *error);
39
40/** Check whether the camera is still connected
41 * @param ptr Pointer to class
42 * @param error Pointer to error
43 * @return Is connected
44 */
45TOF_EXPORT bool tof_camera_is_connected(const tof_camera_t ptr, tof_error_t *error);
46
47/** Get the different output streams the camera can provide
48 * @param ptr Pointer to class
49 * @param streams The streams
50 * @param capacity The amount of data the above pointer can hold
51 * @param error Pointer to error
52 * @return Number of pointers filled or complete array size
53 */
54TOF_EXPORT size_t tof_camera_get_stream_list(const tof_camera_t ptr, tof_stream_t* streams, size_t capacity, tof_error_t *error);
55
56/** Set the streams that you want to get from the camera
57 * @param ptr Pointer to class
58 * @param streams The wanted streams
59 * @param streams_size The size of the above array
60 * @param error Pointer to error
61 */
62TOF_EXPORT void tof_camera_set_stream_list(tof_camera_t ptr, const tof_stream_t* streams, size_t streams_size, tof_error_t *error);
63
64/** Check whether the stream list is set
65 * @param ptr Pointer to class
66 * @param error Pointer to error
67 * @return Is stream list set
68 */
69TOF_EXPORT bool tof_camera_is_stream_list_set(const tof_camera_t ptr, tof_error_t *error);
70
71/** Get the stream list that is set on the camera
72 * @param ptr Pointer to class
73 * @param streams The currently set streams
74 * @param capacity The amount of data the above pointer can hold
75 * @param error Pointer to error
76 * @return Number of pointers filled or complete array size
77 */
78TOF_EXPORT size_t tof_camera_get_set_stream_list(tof_camera_t ptr, tof_stream_t* streams, size_t capacity, tof_error_t *error);
79
80/** Get the processing config of the camera
81 * @param ptr Pointer to class
82 * @param error Pointer to error
83 * @return The processing config
84 */
85TOF_EXPORT tof_processing_config_t tof_camera_get_process_config(const tof_camera_t ptr, tof_error_t *error);
86
87/** Set the processing config of the camera
88 * @param ptr Pointer to class
89 * @param config The processing config
90 * @param error Pointer to error
91 */
92TOF_EXPORT void tof_camera_set_process_config(tof_camera_t ptr, tof_processing_config_t config, tof_error_t *error);
93
94/** Check if the camera has frames available
95 * @param ptr Pointer to class
96 * @param error Pointer to error
97 * @return Has frames available
98 */
99TOF_EXPORT bool tof_camera_has_frames(const tof_camera_t ptr, tof_error_t *error);
100
101/** Get data frames from camera
102 * @param ptr Pointer to class
103 * @param frames Data frames
104 * @param capacity The amount of data the above pointer can hold
105 * @param error Pointer to error
106 * @return Number of pointers filled or complete array size
107 */
108TOF_EXPORT size_t tof_camera_get_frames(tof_camera_t ptr, tof_data_t* frames, size_t capacity, tof_error_t *error);
109
110/** Clear the circular buffer used to store frames
111 * @param ptr Pointer to class
112 * @param error Pointer to error
113 */
114TOF_EXPORT void tof_camera_clear_buffer(tof_camera_t ptr, tof_error_t *error);
115
116/** Get the circular buffer size
117 * @param ptr Pointer to class
118 * @param error Pointer to error
119 * @return The maximum number of sets of frames that is stored before the oldest
120 * is overwritten
121 */
122TOF_EXPORT size_t tof_camera_get_buffer_size(const tof_camera_t ptr, tof_error_t *error);
123
124/** Set the circular buffer size
125 * @param ptr Pointer to class
126 * @param size The maximum number of sets of frames that is stored before the
127 * oldest is overwritten
128 * @param error Pointer to error
129 */
130TOF_EXPORT void tof_camera_set_buffer_size(tof_camera_t ptr, size_t size, tof_error_t *error);
131
132/** Get the currently active camera config
133 * @param ptr Pointer to class
134 * @param error Pointer to error
135 * @return The camera config
136 */
137TOF_EXPORT tof_camera_config_t tof_camera_get_camera_config(const tof_camera_t ptr, tof_error_t *error);
138
139/** Get the serial number of the current camera
140 * @param ptr Pointer to class
141 * @param error Pointer to error
142 * @return The serial
143 */
144TOF_EXPORT const char* tof_camera_get_serial(const tof_camera_t ptr, tof_error_t *error);
145
146/** Get calibration from the camera
147 * @param ptr Pointer to class
148 * @param error Pointer to error
149 * @return The calibration
150 */
151TOF_EXPORT tof_calibration_t tof_camera_get_calibration(const tof_camera_t ptr, tof_error_t *error);
152
153/** Get the amount of user pointers that can be stored
154 * @param ptr Pointer to class
155 * @param error Pointer to error
156 * @return The capacity
157 */
158TOF_EXPORT size_t tof_camera_get_user_pointer_capacity(const tof_camera_t ptr, tof_error_t *error);
159
160/** Set the amount of user pointers that can be stored
161 * @param ptr Pointer to class
162 * @param capacity The capacity
163 * @param error Pointer to error
164 */
165TOF_EXPORT void tof_camera_set_user_pointer_capacity(tof_camera_t ptr, size_t capacity, tof_error_t *error);
166
167/** Add a pointer that will be filled with the specified data type. This method
168 * allows you to fill data straight into your own data type without any
169 * additional copying.
170 * @param ptr Pointer to class
171 * @param pointer The pointer to the data to write into
172 * @param capacity The amount of data the pointer can hold
173 * @param callback Callback that will be called when pointer is no longer in use
174 * @param callback_user_data User data that will be passed back when the function pointer is called
175 * @param frame_type The frame type that will be filled into the pointer
176 * @param error Pointer to error
177 */
178TOF_EXPORT void tof_camera_add_user_pointer(tof_camera_t ptr, uint8_t* pointer, size_t capacity, tof_user_pointer_destructed_t callback, void* callback_user_data, enum tof_frame_type frame_type, tof_error_t *error);
179
180/** Clear all user pointers in memory
181 * @param ptr Pointer to class
182 * @param error Pointer to error
183 */
184TOF_EXPORT void tof_camera_clear_user_pointers(tof_camera_t ptr, tof_error_t *error);
185
186/** Get the currently set configuration index
187 * @param ptr Pointer to class
188 * @param error Pointer to error
189 * @return config index
190 */
191TOF_EXPORT uint32_t tof_camera_config_index(const tof_camera_t ptr, tof_error_t *error);
192
193/** Switch to a different config in real time, depending on configuration and
194 * camera, this can take 100-300ms
195 * @param ptr Pointer to class
196 * @param config_index Config index to switch to
197 * @param error Pointer to error
198 */
199TOF_EXPORT void tof_camera_switch_config(tof_camera_t ptr, uint32_t config_index, tof_error_t *error);
200
201/** Get the frame types that this camera can output
202 * @param ptr Pointer to class
203 * @param frame_types Possible frame types
204 * @param capacity The amount of data the above pointer can hold
205 * @param error Pointer to error
206 * @return Number of pointers filled or complete array size
207 */
208TOF_EXPORT size_t tof_camera_possible_frame_types(const tof_camera_t ptr, enum tof_frame_type* frame_types, size_t capacity, tof_error_t *error);
209
210/** Whether output frame types have been set
211 * @param ptr Pointer to class
212 * @param error Pointer to error
213 * @return Output frame types set
214 */
215TOF_EXPORT bool tof_camera_output_frame_types_set(tof_camera_t ptr, tof_error_t *error);
216
217/** Get the frame types the camera should output
218 * @param ptr Pointer to class
219 * @param output_frame_types Output frame types
220 * @param capacity The amount of data the above pointer can hold
221 * @param error Pointer to error
222 * @return Number of pointers filled or complete array size
223 */
224TOF_EXPORT size_t tof_camera_get_output_frame_types(const tof_camera_t ptr, enum tof_frame_type* output_frame_types, size_t capacity, tof_error_t *error);
225
226/** Set the frame types the camera should output
227 * @param ptr Pointer to class
228 * @param output_frame_types Output frame types
229 * @param output_frame_types_size The size of the above array
230 * @param error Pointer to error
231 */
232TOF_EXPORT void tof_camera_set_output_frame_types(tof_camera_t ptr, const enum tof_frame_type* output_frame_types, size_t output_frame_types_size, tof_error_t *error);
233
234/** Check if multiple configurations are set. Switch config can only be used
235 * when this is the case.
236 * @param ptr Pointer to class
237 * @param error Pointer to error
238 * @return Is set
239 */
240TOF_EXPORT bool tof_camera_has_multiple_configurations(const tof_camera_t ptr, tof_error_t *error);
241
242/** Get all the set camera configurations
243 * @param ptr Pointer to class
244 * @param cam_configs Multiple camera configurations
245 * @param capacity The amount of data the above pointer can hold
246 * @param error Pointer to error
247 * @return Number of pointers filled or complete array size
248 */
249TOF_EXPORT size_t tof_camera_get_multiple_camera_configurations(const tof_camera_t ptr, tof_camera_config_t* cam_configs, size_t capacity, tof_error_t *error);
250
251/** Get all the set processing configurations
252 * @param ptr Pointer to class
253 * @param processing_configs Multiple processing configurations
254 * @param capacity The amount of data the above pointer can hold
255 * @param error Pointer to error
256 * @return Number of pointers filled or complete array size
257 */
258TOF_EXPORT size_t tof_camera_get_multiple_processing_configurations(const tof_camera_t ptr, tof_processing_config_t* processing_configs, size_t capacity, tof_error_t *error);
259
260/** Get the name for each configuration
261 * @param ptr Pointer to class
262 * @param names Names
263 * @param capacity The amount of data the above pointer can hold
264 * @param error Pointer to error
265 * @return Number of pointers filled or complete array size
266 */
267TOF_EXPORT size_t tof_camera_get_multiple_names(const tof_camera_t ptr, const char** names, size_t capacity, tof_error_t *error);
268
269/** Get the description for each configuration
270 * @param ptr Pointer to class
271 * @param description Descriptions
272 * @param capacity The amount of data the above pointer can hold
273 * @param error Pointer to error
274 * @return Number of pointers filled or complete array size
275 */
276TOF_EXPORT size_t tof_camera_get_multiple_descriptions(const tof_camera_t ptr, const char** description, size_t capacity, tof_error_t *error);
277
278/** Select the streams you want to get from the camera
279 * @param camera A camera
280 * @param frame_types The frame types to select
281 * @param frame_types_size The size of the above array
282 * @param error Pointer to error
283 * @return The amount of selected streams
284 */
285TOF_EXPORT size_t tof_select_streams(const tof_camera_t camera, const enum tof_frame_type* frame_types, size_t frame_types_size, tof_error_t *error);
286
287/** Select the streams you want to get from the camera with the specified
288 * modulation frequency
289 * @param camera A camera
290 * @param frame_types The frame types to select
291 * @param frame_types_size The size of the above array
292 * @param mod_freq The modulation frequency to select
293 * @param error Pointer to error
294 * @return The amount of selected streams
295 */
296TOF_EXPORT size_t tof_select_streams_mod_freq(const tof_camera_t camera, const enum tof_frame_type* frame_types, size_t frame_types_size, float mod_freq, tof_error_t *error);
297
298#ifdef __cplusplus
299}
300#endif
301
302#endif