ZED Open Capture  v0.6.0
Low level camera driver for the ZED stereo camera family
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
defines.hpp
Go to the documentation of this file.
1 //
3 // Copyright (c) 2021, STEREOLABS.
4 //
5 // All rights reserved.
6 //
7 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
8 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
10 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
11 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
12 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
13 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
15 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
16 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 //
20 
21 #ifndef DEFINES_HPP
22 #define DEFINES_HPP
23 
24 #include <stdint.h>
25 #include <string>
26 #include <string.h>
27 #include <cxxabi.h>
28 #include <iostream>
29 #include <vector>
30 #include <chrono>
31 
32 #if defined _WIN32
33 #if defined(SL_OC_COMPIL)
34 #define SL_OC_EXPORT __declspec(dllexport)
35 #else
36 #define SL_OC_EXPORT __declspec(dllimport)
37 #endif
38 #elif __GNUC__
39 #define SL_OC_EXPORT __attribute__((visibility("default")))
40 #if defined(__arm__) || defined(__aarch64__)
41 #define _SL_JETSON_
42 #endif
43 #endif
44 
46 #define ZED_OC_MAJOR_VERSION 0
47 #define ZED_OC_MINOR_VERSION 6
48 #define ZED_OC_PATCH_VERSION 0
49 
50 #define ZED_OC_VERSION_ATTRIBUTE private: uint32_t mMajorVer = ZED_OC_MAJOR_VERSION, mMinorVer = ZED_OC_MINOR_VERSION, mPatchVer = ZED_OC_PATCH_VERSION
51 
52 // Debug output
53 #define INFO_OUT(lvl,msg) { int status_dem_0; if (lvl>=3) std::cout << "[" << abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status_dem_0) << "] INFO: " << msg << std::endl; }
54 #define WARNING_OUT(lvl,msg) { int status_dem_0; if (lvl>=2) std::cerr << "[" << abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status_dem_0) << "] WARNING: " << msg << std::endl; }
55 #define ERROR_OUT(lvl,msg) { int status_dem_0; if (lvl>=1) std::cerr << "[" << abi::__cxa_demangle(typeid(*this).name(), 0, 0, &status_dem_0) << "] ERROR: " << msg << std::endl; }
56 
57 
58 
63 inline uint64_t getSteadyTimestamp() {return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();}
64 
69 inline uint64_t getWallTimestamp() {return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::system_clock::now().time_since_epoch()).count();}
70 
71 namespace sl_oc {
72 
73 static const uint16_t SL_USB_VENDOR = 0x2b03;
74 
75 static const uint16_t SL_USB_PROD_ZED_REVA = 0xf580;
76 static const uint16_t SL_USB_PROD_ZED_M_REVA = 0xf680;
77 static const uint16_t SL_USB_PROD_ZED_REVB = 0xf582;
78 static const uint16_t SL_USB_PROD_ZED_M_REVB = 0xf682;
79 static const uint16_t SL_USB_PROD_ZED_2_REVB = 0xf780;
80 static const uint16_t SL_USB_PROD_ZED_2i = 0xf880;
81 static const uint16_t SL_USB_PROD_MCU_ZEDM_REVA= 0xf681;
82 static const uint16_t SL_USB_PROD_MCU_ZED2_REVA = 0xf781;
83 static const uint16_t SL_USB_PROD_MCU_ZED2i_REVA = 0xf881;
84 
85 enum VERBOSITY {
86  NONE = 0,
87  ERROR = 1,
88  WARNING = 2,
89  INFO = 3
90 };
91 
92 }
93 
94 #endif //DEFINES_HPP
uint64_t getSteadyTimestamp()
Get the current system clock as steady clock, so with no jumps even if the system time changes.
Definition: defines.hpp:63
uint64_t getWallTimestamp()
Get the current system clock as wall clock (it can have jumps if the system clock is updated by a syn...
Definition: defines.hpp:69
VERBOSITY
Definition: defines.hpp:85
@ NONE
Definition: defines.hpp:86
@ INFO
Definition: defines.hpp:89
@ ERROR
Definition: defines.hpp:87
@ WARNING
Definition: defines.hpp:88