DvsenseDriver  1.0.3
The SDK for dvsense products.
ToolInfo.h
1 #ifndef __TOOLINFO_H__
2 #define __TOOLINFO_H__
3 
4 #include <vector>
5 #include <string>
6 #include <functional>
7 
8 #ifdef _WIN32
9  #ifdef DVSENSE_HAL_EXPORTS
10  #define DVSENSE_API __declspec(dllexport)
11  #else
12  #define DVSENSE_API __declspec(dllimport)
13  #endif
14 #else
15 #define DVSENSE_API
16 #endif // _WIN32
17 
18 
19 namespace dvsense
20 {
26  enum class DVSENSE_API ToolType
27  {
28  TOOL_BIAS,
29  TOOL_TRIGGER_IN,
30  TOOL_SYNC,
31  TOOL_ANTI_FLICKER,
32  TOOL_EVENT_TRAIL_FILTER,
33  TOOL_EVENT_RATE_CONTROL,
34  TOOL_ROI,
35  TOOL_APS_CTRL
36  };
37 
38  std::string DVSENSE_API to_string(ToolType type);
39 
44  struct DVSENSE_API ToolInfo
45  {
46  ToolType tool_type;
47  std::vector<std::string> parameter_names;
48  std::string description;
49  };
50 
55  enum class DVSENSE_API ToolParameterType
56  {
57  INT,
58  FLOAT,
59  BOOL,
60  STRING,
61  ENUM
62  };
63 
73  std::string DVSENSE_API ToolParameterTypeToString(ToolParameterType type);
74 
82  struct DVSENSE_API BasicParameterInfo {
83  std::string name;
84  std::string description;
85  ToolParameterType type;
86  std::string toString() {
87  return "Name: " + name + " Description: " + description + " Type: " + ToolParameterTypeToString(type);
88  }
89  };
90 
96  struct DVSENSE_API IntParameterInfo {
97  int min;
98  int max;
100  std::string unit;
101  std::function<bool(int&)> readValue;
102  std::function<bool(int)> writeValue;
103  std::string toString() {
104  return "Min: " + std::to_string(min) + " Max: " + std::to_string(max) + " Default: " + std::to_string(default_value) + " Unit: " + unit;
105  }
106  int constraintValue(int value) {
107  if (value < min) {
108  return min;
109  }
110  if (value > max) {
111  return max;
112  }
113  return value;
114  }
115  };
116 
122  struct DVSENSE_API FloatParameterInfo {
123  float min;
124  float max;
126  std::string unit;
127  std::function<bool(float&)> readValue;
128  std::function<bool(float)> writeValue;
129  std::string toString() {
130  return "Min: " + std::to_string(min) + " Max: " + std::to_string(max) + " Default: " + std::to_string(default_value) + " Unit: " + unit;
131  }
132  float constraintValue(float value) {
133  if (value < min) {
134  return min;
135  }
136  if (value > max) {
137  return max;
138  }
139  return value;
140  }
141  };
142 
148  struct DVSENSE_API BoolParameterInfo {
150  std::function<bool(bool&)> readValue;
151  std::function<bool(bool)> writeValue;
152  std::string toString() {
153  return "Default: " + std::to_string(default_value);
154  }
155  };
156 
162  struct DVSENSE_API EnumParameterInfo {
163  std::vector<std::string> options;
164  std::string default_value;
165  std::function<bool(std::string&)> readValue;
166  std::function<bool(std::string)> writeValue;
167  std::string toString() {
168  return "Options: " + std::to_string(options.size()) + " Default: " + default_value;
169  }
170  };
171 
172 } // namespace dvsense
173 
174 
175 #endif
Definition: TypeUtils.hpp:7
std::string description
Definition: ToolInfo.h:48
std::string DVSENSE_API to_string(ToolType type)
ToolType tool_type
Definition: ToolInfo.h:46
std::vector< std::string > parameter_names
Definition: ToolInfo.h:47
std::string DVSENSE_API ToolParameterTypeToString(ToolParameterType type)
将 ToolParameterType 转换为字符串。
工具的信息,包括类型、可以更改的参数名称和描述。
Definition: ToolInfo.h:45
参数的基本信息,包括名称、描述和类型。\ 要获取详细信息,请参考 CameraTool::getParamInfo 。
Definition: ToolInfo.h:82
ToolParameterType type
Definition: ToolInfo.h:85
std::string toString()
Definition: ToolInfo.h:86
std::string name
Definition: ToolInfo.h:83
std::string description
Definition: ToolInfo.h:84
布尔参数的详细信息。
Definition: ToolInfo.h:148
std::string toString()
Definition: ToolInfo.h:152
std::function< bool(bool &)> readValue
Definition: ToolInfo.h:150
bool default_value
Definition: ToolInfo.h:149
std::function< bool(bool)> writeValue
Definition: ToolInfo.h:151
枚举参数的详细信息。
Definition: ToolInfo.h:162
std::string toString()
Definition: ToolInfo.h:167
std::vector< std::string > options
Definition: ToolInfo.h:163
std::function< bool(std::string &)> readValue
Definition: ToolInfo.h:165
std::function< bool(std::string)> writeValue
Definition: ToolInfo.h:166
std::string default_value
Definition: ToolInfo.h:164
浮点数参数的详细信息。
Definition: ToolInfo.h:122
std::string unit
Definition: ToolInfo.h:126
float default_value
Definition: ToolInfo.h:125
std::string toString()
Definition: ToolInfo.h:129
std::function< bool(float)> writeValue
Definition: ToolInfo.h:128
std::function< bool(float &)> readValue
Definition: ToolInfo.h:127
float max
Definition: ToolInfo.h:124
float min
Definition: ToolInfo.h:123
float constraintValue(float value)
Definition: ToolInfo.h:132
整数参数的详细信息。
Definition: ToolInfo.h:96
std::function< bool(int)> writeValue
Definition: ToolInfo.h:102
int max
Definition: ToolInfo.h:98
std::string toString()
Definition: ToolInfo.h:103
std::function< bool(int &)> readValue
Definition: ToolInfo.h:101
int min
Definition: ToolInfo.h:97
std::string unit
Definition: ToolInfo.h:100
int constraintValue(int value)
Definition: ToolInfo.h:106
int default_value
Definition: ToolInfo.h:99