DvsenseDriver  1.0.3
The SDK for dvsense products.
Loading...
Searching...
No Matches
DvsCamera.hpp
1#ifndef DVSCAMERA_HPP
2#define DVSCAMERA_HPP
3
4#include "DvsenseBase/EventBase/EventTypes.hpp"
5#include "DvsenseHal/camera/DvsCameraUtils.hpp"
6#include "DvsenseHal/EventStream/RawEventStreamFormat.hpp"
7#include "DvsenseHal/camera/tools/CameraTool.h"
8
9#ifdef _WIN32
10#ifdef DVSENSE_EXPORTS
11 #define DVSENSE_API __declspec(dllexport)
12 #else
13 #define DVSENSE_API __declspec(dllimport)
14 #endif
15#else
16#define DVSENSE_API
17#endif // _WIN32
18
19namespace dvsense
20{
21
22 class DvsCameraManager;
23
28 #ifdef _WIN32
29 enum DVSENSE_API CameraStatus
30 #else
32 #endif // _WIN32
33 {
35 STARTED = 1
36 };
37
43 class DVSENSE_API DvsCamera
44 {
45 private:
46 friend DvsCameraManager;
47
48 public:
55 DvsCamera(CameraDescription cameraDesc);
56
63 virtual const bool isConnected() = 0;
64
71 const CameraDescription getDvsDesc()
72 {
73 return cameraDesc_;
74 }
75
84 virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb) = 0;
85
96 virtual bool removeEventsStreamHandleCallback(uint32_t callback_id) = 0;
97
106 virtual uint32_t addTriggerInCallback(DvsTriggerInCallback cb) = 0;
107
118 virtual bool removeTriggerInCallback(uint32_t callback_id) = 0;
119
135 virtual bool getNextBatch(Event2DVector& event_batch) = 0;
136
143 virtual void setBatchEventsNum(uint64_t n) = 0;
144
151 virtual void setBatchEventsTime(TimeStamp n) = 0;
152
159 virtual int start() = 0;
160
167 virtual int stop() = 0;
168
177 virtual int startRecording(std::string file_path) = 0;
178
179 virtual void setFileCacheTime(uint16_t sec) {};
180
187 virtual int stopRecording() = 0;
188
195 virtual uint16_t getWidth() = 0;
196
203 virtual uint16_t getHeight() = 0;
204
211 virtual void setStatisticInfoCallback(DsStatisticInfoCallback cb) = 0;
212
219 const std::vector<ToolInfo> getAllToolsInfo();
220
229 const ToolInfo getToolInfo(ToolType type);
230
239 const std::shared_ptr<CameraTool> getTool(ToolType type);
240
241 protected:
248 CameraDescription cameraDesc_;
249
256 virtual int init() = 0;
257
258 // tools
259 std::map<ToolType, std::shared_ptr<CameraTool>> tools_;
260 };
261
262} // namespace dvsense
263
264#endif // DVSCAMERA_HPP
Interface class for DVS cameras.
Definition DvsCamera.hpp:44
virtual void setStatisticInfoCallback(DsStatisticInfoCallback cb)=0
set the callback function to get the statistic information
virtual void setBatchEventsTime(TimeStamp n)=0
Set the time interval at which events are fetched.
virtual int startRecording(std::string file_path)=0
Start recording events.
std::map< ToolType, std::shared_ptr< CameraTool > > tools_
Definition DvsCamera.hpp:259
virtual int start()=0
Start the camera.
DvsCamera(CameraDescription cameraDesc)
Constructor.
const ToolInfo getToolInfo(ToolType type)
Get the tool information.
virtual bool removeTriggerInCallback(uint32_t callback_id)=0
Remove a callback function by id.
const CameraDescription getDvsDesc()
Get camera description.
Definition DvsCamera.hpp:71
CameraDescription cameraDesc_
Get the camera description.
Definition DvsCamera.hpp:248
virtual int init()=0
When a camera is opened, it should be initialized.
const std::shared_ptr< CameraTool > getTool(ToolType type)
Get the tool.
virtual bool removeEventsStreamHandleCallback(uint32_t callback_id)=0
Remove a callback function by id.
virtual int stopRecording()=0
Stop recording events.
virtual uint32_t addTriggerInCallback(DvsTriggerInCallback cb)=0
Add a callback function to handle events.
virtual int stop()=0
Stop the camera.
virtual uint16_t getWidth()=0
Get the Width of the camera sensor.
virtual const bool isConnected()=0
Check if the camera is connected.
virtual void setBatchEventsNum(uint64_t n)=0
Set the number of events to be fetched.
virtual void setFileCacheTime(uint16_t sec)
Definition DvsCamera.hpp:179
virtual uint16_t getHeight()=0
Get the Height of the camera sensor.
const std::vector< ToolInfo > getAllToolsInfo()
Get all the tools information.
virtual bool getNextBatch(Event2DVector &event_batch)=0
Get the next batch of events Before using the getNextBatch function, you need to use setBatchEventNum...
virtual uint32_t addEventsStreamHandleCallback(EventsStreamHandleCallback cb)=0
Add a callback function to handle events.
Camera Manager class.
Definition DvsCameraManager.hpp:35
Definition TypeUtils.hpp:7
CameraStatus
Camera status, STOPPED or STARTED.
Definition DvsCamera.hpp:33
@ STOPPED
Definition DvsCamera.hpp:34
@ STARTED
Definition DvsCamera.hpp:35
uint64_t TimeStamp
Definition TypeUtils.hpp:8
The information of the tool, including the type, the parameter names and the description.
Definition ToolInfo.h:45