Time-of-Flight Library(ToF) 3.13.2
 
usb_interface.h
1#ifndef _CHRONOPTICS_TOF_USB_INTERFACE_H_
2#define _CHRONOPTICS_TOF_USB_INTERFACE_H_
3
4#include <chronoptics/tof/camera_config.h>
5#include <chronoptics/tof/calibration.h>
6#include <chronoptics/tof/data.h>
7#include <chronoptics/tof/gige_interface.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/** USB device
14 */
15typedef struct tof_usb_device* tof_usb_device_t;
16
17/** Destruct tof_usb_device */
18TOF_EXPORT void tof_usb_device_delete(tof_usb_device_t ptr);
19
20/** Get serial corresponding with USB device
21 * @param ptr Pointer to class
22 * @param error Pointer to error
23 * @return Serial
24 */
25TOF_EXPORT const char* tof_usb_device_serial(tof_usb_device_t ptr, tof_error_t *error);
26
27/** DEPRECATED, use KeaCamera. Connect to a camera directly using the USB
28 * interface
29 */
30typedef struct tof_usb_interface* tof_usb_interface_t;
31
32/** Destruct tof_usb_interface */
33TOF_EXPORT void tof_usb_interface_delete(tof_usb_interface_t ptr);
34
35/** Create USB camera from a usb device
36 * @param ptr Pointer to class
37 * @param usb_device USB device
38 * @param error Pointer to error
39 * @return New object
40 */
41TOF_EXPORT tof_usb_interface_t tof_usb_interface_new(tof_usb_device_t usb_device, tof_error_t *error);
42
43/** Check whether a connection is still maintained with the camera
44 * @param ptr Pointer to class
45 * @param error Pointer to error
46 * @return Is connected
47 */
48TOF_EXPORT bool tof_usb_interface_is_connected(const tof_usb_interface_t ptr, tof_error_t *error);
49
50/** Tests the connection speed of the USB port. This is useful to check whether
51 * a hub or USB port works well. The maximum speed that the camera is able to
52 * transmit is ~3.0 Gbps.
53 * @param ptr Pointer to class
54 * @param error Pointer to error
55 * @return Connection speed in Gpbs (bits)
56 */
57TOF_EXPORT double tof_usb_interface_test_stream_speed(tof_usb_interface_t ptr, tof_error_t *error);
58
59/** Download camera configuration from the camera
60 * @param ptr Pointer to class
61 * @param error Pointer to error
62 * @return Camera configuration
63 */
64TOF_EXPORT tof_camera_config_t tof_usb_interface_download_configuration(tof_usb_interface_t ptr, tof_error_t *error);
65
66/** Download calibration from the camera
67 * @param ptr Pointer to class
68 * @param error Pointer to error
69 * @return Calibration
70 */
71TOF_EXPORT tof_calibration_t tof_usb_interface_download_calibration(tof_usb_interface_t ptr, tof_error_t *error);
72
73/** Upload camera configuration to the camera
74 * @param ptr Pointer to class
75 * @param config Camera configuration
76 * @param error Pointer to error
77 */
78TOF_EXPORT void tof_usb_interface_upload_configuration(tof_usb_interface_t ptr, const tof_camera_config_t config, tof_error_t *error);
79
80/** Check whether this camera is capable of streaming the specified type
81 * @param ptr Pointer to class
82 * @param stream Depth stream type
83 * @param error Pointer to error
84 * @return Is capable
85 */
86TOF_EXPORT bool tof_usb_interface_depth_stream_capable(const tof_usb_interface_t ptr, enum tof_depth_stream_type stream, tof_error_t *error);
87
88/** Start the depth stream
89 * @param ptr Pointer to class
90 * @param stream Depth stream type
91 * @param error Pointer to error
92 */
93TOF_EXPORT void tof_usb_interface_start_depth_stream(tof_usb_interface_t ptr, enum tof_depth_stream_type stream, tof_error_t *error);
94
95/** Stop the depth stream
96 * @param ptr Pointer to class
97 * @param error Pointer to error
98 */
99TOF_EXPORT void tof_usb_interface_stop_depth_stream(tof_usb_interface_t ptr, tof_error_t *error);
100
101/** Returns true if a depth frame is available
102 * @param ptr Pointer to class
103 * @param error Pointer to error
104 * @return Depth frame available
105 */
106TOF_EXPORT bool tof_usb_interface_has_depth_data(const tof_usb_interface_t ptr, tof_error_t *error);
107
108/** Get a depth frame
109 * @param ptr Pointer to class
110 * @param error Pointer to error
111 * @return Depth frame
112 */
113TOF_EXPORT tof_data_t tof_usb_interface_get_depth_data(tof_usb_interface_t ptr, tof_error_t *error);
114
115/** Check whether camera supports an image stream
116 * @param ptr Pointer to class
117 * @param error Pointer to error
118 * @return Camera supports an image stream
119 */
120TOF_EXPORT bool tof_usb_interface_image_stream_capable(const tof_usb_interface_t ptr, tof_error_t *error);
121
122/** Start image stream
123 * @param ptr Pointer to class
124 * @param error Pointer to error
125 */
126TOF_EXPORT void tof_usb_interface_start_image_stream(tof_usb_interface_t ptr, tof_error_t *error);
127
128/** Stop image stream
129 * @param ptr Pointer to class
130 * @param error Pointer to error
131 */
132TOF_EXPORT void tof_usb_interface_stop_image_stream(tof_usb_interface_t ptr, tof_error_t *error);
133
134/** Check whether image frame is available
135 * @param ptr Pointer to class
136 * @param error Pointer to error
137 * @return Image frame available
138 */
139TOF_EXPORT bool tof_usb_interface_has_image_data(const tof_usb_interface_t ptr, tof_error_t *error);
140
141/** Get image frame
142 * @param ptr Pointer to class
143 * @param error Pointer to error
144 * @return Image data
145 */
146TOF_EXPORT tof_data_t tof_usb_interface_get_image_data(tof_usb_interface_t ptr, tof_error_t *error);
147
148/** Get the image frame into the supplied pointer
149 * @param ptr Pointer to class
150 * @param pointer The pointer to the data to write into
151 * @param capacity The amount of data the pointer can hold
152 * @param callback Callback that will be called when pointer is no longer in use
153 * @param callback_user_data User data that will be passed back when the function pointer is called
154 * @param error Pointer to error
155 * @return Image data
156 */
157TOF_EXPORT tof_data_t tof_usb_interface_get_image_data_into_pointer(tof_usb_interface_t ptr, uint8_t* pointer, size_t capacity, tof_user_pointer_destructed_t callback, void* callback_user_data, tof_error_t *error);
158
159/** Get the capacity for amount of user pointers that can be registered
160 * @param ptr Pointer to class
161 * @param error Pointer to error
162 * @return User pointer capacity
163 */
164TOF_EXPORT size_t tof_usb_interface_get_user_pointer_capacity(const tof_usb_interface_t ptr, tof_error_t *error);
165
166/** Set the capacity for amount of user pointers that can be registered
167 * @param ptr Pointer to class
168 * @param capacity User pointer capacity
169 * @param error Pointer to error
170 */
171TOF_EXPORT void tof_usb_interface_set_user_pointer_capacity(tof_usb_interface_t ptr, size_t capacity, tof_error_t *error);
172
173/** Add a pointer that will be filled with depth data. This method allows you to
174 * fill data straight into your own data structure without any additional
175 * copying.
176 * @param ptr Pointer to class
177 * @param pointer The pointer to the data to write into
178 * @param capacity The amount of data the pointer can hold
179 * @param callback Callback that will be called when pointer is no longer in use
180 * @param callback_user_data User data that will be passed back when the function pointer is called
181 * @param error Pointer to error
182 */
183TOF_EXPORT void tof_usb_interface_add_depth_user_pointer(tof_usb_interface_t ptr, uint8_t* pointer, size_t capacity, tof_user_pointer_destructed_t callback, void* callback_user_data, tof_error_t *error);
184
185/** Get the tof library version running on the camera
186 * @param ptr Pointer to class
187 * @param error Pointer to error
188 * @return Version
189 */
190TOF_EXPORT const char* tof_usb_interface_version(tof_usb_interface_t ptr, tof_error_t *error);
191
192/** Check whether the camera is capable of software trigger
193 * @param ptr Pointer to class
194 * @param error Pointer to error
195 * @return Software trigger capable
196 */
197TOF_EXPORT bool tof_usb_interface_software_trigger_capable(tof_usb_interface_t ptr, tof_error_t *error);
198
199/** Software trigger the camera
200 * @param ptr Pointer to class
201 * @param error Pointer to error
202 */
203TOF_EXPORT void tof_usb_interface_software_trigger(tof_usb_interface_t ptr, tof_error_t *error);
204
205/** Discover all connected chronoptics usb cameras
206 * @param usb_devices The usb devices
207 * @param capacity The amount of data the above pointer can hold
208 * @param error Pointer to error
209 * @return Number of pointers filled or complete array size
210 */
211TOF_EXPORT size_t tof_usb_device_discover(tof_usb_device_t* usb_devices, size_t capacity, tof_error_t *error);
212
213/** Discover one chronoptics usb camera
214 * @param error Pointer to error
215 * @return A USB device
216 */
217TOF_EXPORT tof_usb_device_t tof_usb_device_discover_one(tof_error_t *error);
218
219/** Discover usb camera with the given serial
220 * @param serial Serial of the camera to find
221 * @param error Pointer to error
222 * @return A USB device
223 */
224TOF_EXPORT tof_usb_device_t tof_usb_device_find(const char* serial, tof_error_t *error);
225
226#ifdef __cplusplus
227}
228#endif
229
230#endif