Time-of-Flight Library(ToF)  3.2.2
kea_camera.hpp
1 #ifndef _CHRONOPTICS_TOF_KEA_CAMERA_HPP_
2 #define _CHRONOPTICS_TOF_KEA_CAMERA_HPP_
3 
4 #include <chronoptics/tof/kea_camera.h>
5 
6 #include <chronoptics/tof/camera.hpp>
7 #include <chronoptics/tof/processing_config.hpp>
8 #include <chronoptics/tof/camera_config.hpp>
9 
10 namespace chronoptics {
11 namespace tof {
12 
13 /** The main interface to the kea camera
14 */
15 class KeaCamera : public Camera {
16  public:
17  /** Construct from pointer */
18  KeaCamera(tof_kea_camera_t ptr = nullptr) : Camera(reinterpret_cast<tof_camera_t>(ptr)) {}
19 
20  /** Construct the kea camera
21  * @param processing_config The processing config
22  * @param serial The serial number of the camera to connect to, if the camera
23  * is available over both usb and gige it will be connected over usb. If an
24  * empty string is supplied the camera will connect to the first usb camera,
25  * if no usb camera is connected it will connect to the first gige camera that
26  * replies (this reply time is random, so you might connect to a different
27  * camera each time if you've got multiple cameras connected to your network).
28  * If no camera is found with the given serial number a nullptr and error is
29  * returned.
30  */
31  KeaCamera(const ProcessingConfig &processing_config, StringView serial) {
32  this->ptr_ = reinterpret_cast<tof_camera_t>(tof_kea_camera_new(*reinterpret_cast<const tof_processing_config_t*>(&processing_config), serial, TOF_ERROR_HANDLER{}));
33  }
34 
35  /** Check whether this kea camera can do on camera processing
36  * @return On camera processing capable
37  */
39  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
40  return tof_kea_camera_on_camera_processing_capable(ptr, TOF_ERROR_HANDLER{});
41  }
42 
43  /** Get on camera processing
44  * @return True on camera processing, false on host processing
45  */
46  bool get_on_camera_processing() const {
47  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
48  return tof_kea_camera_get_on_camera_processing(ptr, TOF_ERROR_HANDLER{});
49  }
50 
51  /** Set on camera processing
52  * @param on_camera_processing True on camera processing, false on host
53  * processing
54  */
55  void set_on_camera_processing(bool on_camera_processing) {
56  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
57  return tof_kea_camera_set_on_camera_processing(ptr, on_camera_processing, TOF_ERROR_HANDLER{});
58  }
59 
60  /** Get delay between network packets
61  * @return The delay, depending on the camera software it is in nanoseconds or
62  * in cpu instruction
63  */
64  uint32_t get_delay() const {
65  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
66  return tof_kea_camera_get_delay(ptr, TOF_ERROR_HANDLER{});
67  }
68 
69  /** Set delay between network packets
70  * @param delay The delay, depending on the camera software it is in
71  * nanoseconds or in cpu instruction
72  */
73  void set_delay(uint32_t delay) {
74  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
75  return tof_kea_camera_set_delay(ptr, delay, TOF_ERROR_HANDLER{});
76  }
77 
78  /** Get maximum size of each network packet transmitted
79  * @return Packet size in bytes
80  */
81  uint16_t get_packet_size() const {
82  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
83  return tof_kea_camera_get_packet_size(ptr, TOF_ERROR_HANDLER{});
84  }
85 
86  /** Set maximum size of each network packet transmitted
87  * @param size Packet size in bytes
88  */
89  void set_packet_size(uint16_t size) {
90  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
91  return tof_kea_camera_set_packet_size(ptr, size, TOF_ERROR_HANDLER{});
92  }
93 
94  /** Set the camera config
95  * @param camera_config Camera config
96  */
97  void set_camera_config(const CameraConfig &camera_config) {
98  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
99  return tof_kea_camera_set_camera_config(ptr, *reinterpret_cast<const tof_camera_config_t*>(&camera_config), TOF_ERROR_HANDLER{});
100  }
101 
102  /** Set both the camera and processing config
103  * @param camera_config Camera config
104  * @param processing_config Processing config
105  */
106  void set_configurations(const CameraConfig &camera_config, const ProcessingConfig &processing_config) {
107  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
108  return tof_kea_camera_set_configurations(ptr, *reinterpret_cast<const tof_camera_config_t*>(&camera_config), *reinterpret_cast<const tof_processing_config_t*>(&processing_config), TOF_ERROR_HANDLER{});
109  }
110 
111  /** Get the tof library version running on the camera
112  * @return Version
113  */
114  const char* version() {
115  auto ptr = reinterpret_cast<tof_kea_camera_t>(this->ptr_);
116  return tof_kea_camera_version(ptr, TOF_ERROR_HANDLER{});
117  }
118 
119 };
120 
121 } // tof
122 } // chronoptics
123 
124 #endif
This class allows you to view/edit the camera settings.
The main interface to the depth cameras.
Definition: camera.hpp:17
The main interface to the kea camera.
Definition: kea_camera.hpp:15
bool on_camera_processing_capable() const
Check whether this kea camera can do on camera processing.
Definition: kea_camera.hpp:38
KeaCamera(tof_kea_camera_t ptr=nullptr)
Construct from pointer.
Definition: kea_camera.hpp:18
void set_on_camera_processing(bool on_camera_processing)
Set on camera processing.
Definition: kea_camera.hpp:55
void set_packet_size(uint16_t size)
Set maximum size of each network packet transmitted.
Definition: kea_camera.hpp:89
bool get_on_camera_processing() const
Get on camera processing.
Definition: kea_camera.hpp:46
void set_configurations(const CameraConfig &camera_config, const ProcessingConfig &processing_config)
Set both the camera and processing config.
Definition: kea_camera.hpp:106
uint32_t get_delay() const
Get delay between network packets.
Definition: kea_camera.hpp:64
const char * version()
Get the tof library version running on the camera.
Definition: kea_camera.hpp:114
uint16_t get_packet_size() const
Get maximum size of each network packet transmitted.
Definition: kea_camera.hpp:81
void set_camera_config(const CameraConfig &camera_config)
Set the camera config.
Definition: kea_camera.hpp:97
void set_delay(uint32_t delay)
Set delay between network packets.
Definition: kea_camera.hpp:73
KeaCamera(const ProcessingConfig &processing_config, StringView serial)
Construct the kea camera.
Definition: kea_camera.hpp:31
Processing that can be done.