LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
cameracontroller.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <mutex>
8
11
12#ifdef WIN32
13# ifdef COMPILING_DLL_SimulatedRealityCameras
14# define DIMENCOSR_API __declspec(dllexport)
15# else
16# define DIMENCOSR_API __declspec(dllimport)
17# endif
18#else
19# define DIMENCOSR_API
20#endif
21
22namespace SR {
23
32public:
38 CameraControllerUnavailableException(std::string identifier);
39};
40
41//forward declaration
43
48
56DIMENCOSR_API std::map<std::string, CameraControlFunction*>& cameraControlFunctions();
57
64public:
71 static void addImplementation(CameraControlFunction* controlFunction, std::string cameraType);
72
81
90 virtual void setShuttertime(float shutterTime) = 0;
91
100 virtual void setGain(float gain) = 0;
101
110 virtual float getShuttertime() = 0;
111
121 virtual float getGain() = 0;
122};
123
135#pragma warning(suppress: 4251)
136 static std::map<std::string, std::mutex> mutex;
137
138 Camera::Descriptor descriptor;
139 CameraController* controller;
140
141 UniqueCameraController(const UniqueCameraController&) = delete; // non construction-copyable
142 UniqueCameraController& operator=(const UniqueCameraController&) = delete; // non copyable
143
144public:
145 UniqueCameraController(UniqueCameraController && other) : descriptor(other.descriptor), controller(other.controller){};
147
152
159
164
165 // Inherited via CameraController
166 virtual void setShuttertime(float shutterTime);
167 virtual void setGain(float gain);
168 virtual float getShuttertime();
169 virtual float getGain();
170};
171
172}
173
174#undef DIMENCOSR_API
#define DIMENCOSR_API
Definition: cameracontroller.h:19
Class of Exception which indicates the CameraController can not be used at this point in time.
Definition: cameracontroller.h:31
CameraControllerUnavailableException(std::string identifier)
Construct a new CameraControllerUnavailableException.
Interface defining camera functions to control sensor parameters.
Definition: cameracontroller.h:63
virtual float getShuttertime()=0
Get current shutter / exposure time in seconds.
virtual float getGain()=0
Get current camera gain factor.
virtual void setShuttertime(float shutterTime)=0
Set camera shutter / exposure time in seconds.
static UniqueCameraController control(Camera *camera)
Attempt to gain control of camera sensor.
static void addImplementation(CameraControlFunction *controlFunction, std::string cameraType)
Static function to make a CameraController implementation available through the CameraController::con...
virtual void setGain(float gain)=0
Set camera gain.
Class describing a physical camera.
Definition: camera.h:72
Class of Sense dealing with video data.
Definition: camera.h:66
Class of exception which indicates a general SR logic error.
Definition: exception.h:35
Non-copyable class of CameraController interface that can only be constructed once per Camera (Camera...
Definition: cameracontroller.h:129
UniqueCameraController & operator=(UniqueCameraController &&other)
virtual void setGain(float gain)
Set camera gain.
UniqueCameraController(UniqueCameraController &&other)
Definition: cameracontroller.h:145
UniqueCameraController(Camera *camera, CameraController *controller)
Construct instance of UniqueCameraController of that can only be created for a specific Camera if ano...
virtual float getShuttertime()
Get current shutter / exposure time in seconds.
~UniqueCameraController()
Destructs UniqueCameraController instance and allow a new one to be acquired.
virtual void setShuttertime(float shutterTime)
Set camera shutter / exposure time in seconds.
virtual float getGain()
Get current camera gain factor.
UniqueCameraController()
Construct UniqueCameraController to reserve memory.
Namespace containing all C++ Simulated Reality classes.
Definition: srconfiguration.h:20
DIMENCOSR_API std::map< std::string, CameraControlFunction * > & cameraControlFunctions()
Map of camera type to functions to create cameras of that type.
UniqueCameraController() CameraControlFunction(Camera *)
Type of function used for gaining control of camera sensor parameters.
Definition: cameracontroller.h:47