Time-of-Flight Library(ToF)  3.2.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
11 extern "C" {
12 #endif
13 
14 /** The main interface to the depth cameras
15  */
16 typedef struct tof_camera* tof_camera_t;
17 
18 /** Destruct tof_camera */
19 TOF_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  */
25 TOF_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  */
31 TOF_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  */
38 TOF_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  */
45 TOF_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  */
54 TOF_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  */
62 TOF_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  */
69 TOF_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  */
78 TOF_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  */
85 TOF_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  */
92 TOF_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  */
99 TOF_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  */
108 TOF_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  */
114 TOF_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  */
122 TOF_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  */
130 TOF_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  */
137 TOF_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  */
144 TOF_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  */
151 TOF_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  */
158 TOF_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  */
165 TOF_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
174  * use
175  * @param callback_user_data User data that will be passed back when the function pointer is called
176  * @param frame_type The frame type that will be filled into the pointer
177  * @param error Pointer to error
178  */
179 TOF_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);
180 
181 /** Clear all user pointers in memory
182  * @param ptr Pointer to class
183  * @param error Pointer to error
184  */
185 TOF_EXPORT void tof_camera_clear_user_pointers(tof_camera_t ptr, tof_error_t *error);
186 
187 /** Select the streams you want to get from the camera
188  * @param camera A camera
189  * @param frame_types The frame types to select
190  * @param frame_types_size The size of the above array
191  * @param error Pointer to error
192  * @return The amount of selected streams
193  */
194 TOF_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);
195 
196 /** Select the streams you want to get from the camera with the specified
197  * modulation frequency
198  * @param camera A camera
199  * @param frame_types The frame types to select
200  * @param frame_types_size The size of the above array
201  * @param mod_freq The modulation frequency to select
202  * @param error Pointer to error
203  * @return The amount of selected streams
204  */
205 TOF_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);
206 
207 #ifdef __cplusplus
208 }
209 #endif
210 
211 #endif