Time-of-Flight-SDK
camera.h
1 /*
2  * BSD 3-Clause License
3  *
4  * Copyright (c) 2019, Analog Devices, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  * list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #ifndef CAMERA_H
33 #define CAMERA_H
34 
35 #include "aditof/adsd_errs.h"
36 #include "camera_definitions.h"
37 #include "sdk_exports.h"
38 #include "status_definitions.h"
39 
40 #include <functional>
41 #include <map>
42 #include <string>
43 #include <vector>
44 
45 namespace aditof {
46 
47 class Frame;
48 class DepthSensorInterface;
49 
54 class SDK_API Camera {
55  public:
59  virtual ~Camera() = default;
60 
68  virtual Status initialize(const std::string &configFilepath = {}) = 0;
69 
75  virtual Status start() = 0;
76 
81  virtual Status stop() = 0;
82 
93  virtual Status setMode(const std::string &mode,
94  const std::string &modeFilename = {}) = 0;
95 
103  virtual Status
104  getAvailableModes(std::vector<std::string> &availableModes) const = 0;
105 
111  virtual Status setFrameType(const std::string &frameType) = 0;
112 
118  virtual Status getIniParams(std::map<std::string, float> &params) = 0;
119 
125  virtual Status setIniParams(std::map<std::string, float> &params) = 0;
126 
132  virtual Status adsd3500SetIniParams(
133  const std::map<std::string, float> &iniKeyValPairs) = 0;
134 
140  virtual Status getAvailableFrameTypes(
141  std::vector<std::string> &availableFrameTypes) const = 0;
142 
149  virtual Status getFrameTypeNameFromId(int id, std::string &name) const = 0;
150 
156  virtual Status requestFrame(Frame *frame) = 0;
157 
163  virtual Status getDetails(CameraDetails &details) const = 0;
164 
170  virtual Status
171  getAvailableControls(std::vector<std::string> &controls) const = 0;
172 
179  virtual Status setControl(const std::string &control,
180  const std::string &value) = 0;
181 
188  virtual Status getControl(const std::string &control,
189  std::string &value) const = 0;
190 
196  virtual std::shared_ptr<DepthSensorInterface> getSensor() = 0;
197 
205  virtual Status enableXYZframe(bool enable) = 0;
206 
213  virtual Status saveModuleCFG(const std::string &filepath) const = 0;
214 
221  virtual Status saveModuleCCB(const std::string &filepath) = 0;
222 
229  virtual Status enableDepthCompute(bool enable) = 0;
230 
237  virtual Status adsd3500UpdateFirmware(const std::string &fwFilePath) = 0;
238 
244  virtual Status adsd3500SetToggleMode(int mode) = 0;
245 
250  virtual Status adsd3500ToggleFsync() = 0;
251 
257  virtual Status adsd3500SetABinvalidationThreshold(int threshold) = 0;
258 
264  virtual Status adsd3500GetABinvalidationThreshold(int &threshold) = 0;
265 
271  virtual Status adsd3500SetConfidenceThreshold(int threshold) = 0;
272 
278  virtual Status adsd3500GetConfidenceThreshold(int &threshold) = 0;
279 
285  virtual Status adsd3500SetJBLFfilterEnableState(bool enable) = 0;
286 
292  virtual Status adsd3500GetJBLFfilterEnableState(bool &enabled) = 0;
293 
299  virtual Status adsd3500SetJBLFfilterSize(int size) = 0;
300 
306  virtual Status adsd3500GetJBLFfilterSize(int &size) = 0;
307 
313  virtual Status adsd3500SetRadialThresholdMin(int threshold) = 0;
314 
320  virtual Status adsd3500GetRadialThresholdMin(int &threshold) = 0;
321 
327  virtual Status adsd3500SetRadialThresholdMax(int threshold) = 0;
328 
334  virtual Status adsd3500GetRadialThresholdMax(int &threshold) = 0;
335 
341  virtual Status adsd3500GetSensorTemperature(uint16_t &tmpValue) = 0;
342 
348  virtual Status adsd3500GetLaserTemperature(uint16_t &tmpValue) = 0;
349 
355  virtual Status adsd3500GetFirmwareVersion(std::string &fwVersion,
356  std::string &fwHash) = 0;
357 
363  virtual Status adsd3500SetMIPIOutputSpeed(uint16_t speed) = 0;
364 
370  virtual Status adsd3500GetMIPIOutputSpeed(uint16_t &speed) = 0;
371 
377  virtual Status adsd3500GetImagerErrorCode(uint16_t &errcode) = 0;
378 
384  virtual Status adsd3500SetVCSELDelay(uint16_t delay) = 0;
385 
391  virtual Status adsd3500GetVCSELDelay(uint16_t &delay) = 0;
392 
398  virtual Status adsd3500SetJBLFMaxEdgeThreshold(uint16_t threshold) = 0;
399 
405  virtual Status adsd3500SetJBLFABThreshold(uint16_t threshold) = 0;
406 
412  virtual Status adsd3500SetJBLFGaussianSigma(uint16_t value) = 0;
413 
419  virtual Status adsd3500GetJBLFGaussianSigma(uint16_t &value) = 0;
420 
426  virtual Status adsd3500SetJBLFExponentialTerm(uint16_t value) = 0;
427 
433  virtual Status adsd3500GetJBLFExponentialTerm(uint16_t &value) = 0;
434 
440  virtual Status adsd3500GetFrameRate(uint16_t &fps) = 0;
441 
447  virtual Status adsd3500SetFrameRate(uint16_t fps) = 0;
448 
454  virtual Status adsd3500SetEnableEdgeConfidence(uint16_t value) = 0;
455 
461  virtual Status
462  adsd3500GetTemperatureCompensationStatus(uint16_t &value) = 0;
463 
469  virtual Status adsd3500SetEnablePhaseInvalidation(uint16_t value) = 0;
470 
476  virtual Status adsd3500SetEnableTemperatureCompensation(uint16_t value) = 0;
477 
483  virtual aditof::Status adsd3500SetEnableMetadatainAB(uint16_t value) = 0;
484 
490  virtual aditof::Status adsd3500GetEnableMetadatainAB(uint16_t &value) = 0;
491 
498  virtual Status adsd3500SetGenericTemplate(uint16_t reg, uint16_t value) = 0;
499 
506  virtual Status adsd3500GetGenericTemplate(uint16_t reg,
507  uint16_t &value) = 0;
514  virtual Status adsd3500GetStatus(int &chipStatus, int &imagerStatus) = 0;
515 
524  virtual Status readSerialNumber(std::string &serialNumber,
525  bool useCacheValue = false) = 0;
526 
532  virtual Status getImagerType(ImagerType &imagerType) const = 0;
533 };
534 
535 } // namespace aditof
536 
537 #endif // CAMERA_H
Namespace aditof.
Definition: frame.h:44
Manipulates the underlying camera system.
Definition: camera.h:54
ImagerType
Types of imagers.
Frame of a camera.
Definition: frame.h:50
Status
Status of any operation that the TOF sdk performs.
Describes the properties of a camera.