IDS peak AFL v2.1.0
Loading...
Searching...
No Matches
peak_afl_icontroller.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <peak_afl/peak_afl.h>
11
16
17namespace peak
18{
19namespace pipeline
20{
21namespace modules
22{
23namespace autofeature
24{
44
63
74PEAK_COMMON_NO_DISCARD inline std::string ToString(ControllerType mode)
75{
76 if (mode == ControllerType::Focus)
77 {
78 return "Focus";
79 }
81 {
82 return "Brightness";
83 }
85 {
86 return "WhiteBalance";
87 }
88 throw peak::afl::error::InvalidParameterException("The given controller type is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
89}
90
91inline std::ostream& operator<<(std::ostream& os, ControllerType mode)
92{
93 return os << ToString(mode);
94}
95
106PEAK_COMMON_NO_DISCARD inline std::string ToString(ControllerMode mode)
107{
108 if (mode == ControllerMode::Off)
109 {
110 return "Off";
111 }
112 if (mode == ControllerMode::Continuous)
113 {
114 return "Continuous";
115 }
116 if (mode == ControllerMode::Once)
117 {
118 return "Once";
119 }
120 throw peak::afl::error::InvalidParameterException("The given controller mode is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
121}
122
123inline std::ostream& operator<<(std::ostream& os, ControllerMode mode)
124{
125 return os << ToString(mode);
126}
127
128namespace detail
129{
130PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(const std::string& mode)
131{
132 if (mode == "Off")
133 {
134 return ControllerMode::Off;
135 }
136 if (mode == "Continuous")
137 {
139 }
140 if (mode == "Once")
141 {
143 }
144 throw peak::afl::error::InvalidParameterException(
145 "The given controller mode " + mode + " is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
146}
147
148PEAK_COMMON_NO_DISCARD inline peak_afl_controller_automode ToCType(ControllerMode controllerMode)
149{
150 switch (controllerMode)
151 {
158 }
159
160 throw peak::afl::error::InvalidParameterException("Unknown controller mode type", PEAK_AFL_STATUS_INVALID_PARAMETER);
161}
162
163PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(peak_afl_controller_automode controllerMode)
164{
165 switch (controllerMode)
166 {
168 return ControllerMode::Off;
173 }
174
175 throw peak::afl::error::InvalidParameterException("Unknown controller mode type", PEAK_AFL_STATUS_INVALID_PARAMETER);
176}
177
178PEAK_COMMON_NO_DISCARD inline peak_afl_controllerType ToCType(ControllerType controllerType)
179{
180 switch (controllerType)
181 {
188 }
189
190 throw peak::afl::error::InvalidParameterException("Unknown controller type", PEAK_AFL_STATUS_INVALID_PARAMETER);
191}
192
223{
224public:
229 using FinishedCallback = std::function<void()>;
235
236 explicit IController(peak::afl::Manager& manager)
237 : m_manager{ manager }
238 {}
239
245 virtual ~IController() = default;
246
251 IController(const IController&) = delete;
256 IController& operator=(const IController&) = delete;
257
262 IController(IController&&) = delete;
267 IController& operator=(IController&&) = delete;
268
280 PEAK_COMMON_NO_DISCARD virtual std::string GetName() const = 0;
281
293 PEAK_COMMON_NO_DISCARD virtual ControllerType GetType() const = 0;
294
311 virtual void SetMode(ControllerMode mode) = 0;
312
326 PEAK_COMMON_NO_DISCARD virtual ControllerMode GetMode() const = 0;
327
338 PEAK_COMMON_NO_DISCARD virtual bool IsRunning() const = 0;
339
351 virtual void ResetToDefault() = 0;
352
353protected:
364 PEAK_COMMON_NO_DISCARD peak::afl::Manager& GetManager()
365 {
366 return m_manager;
367 }
368
369private:
377 peak::afl::Manager& m_manager;
378};
379} // namespace detail
380} // namespace autofeature
381} // namespace modules
382} // namespace pipeline
383} // namespace peak
Central coordination object for automatic camera feature control.
Definition peak_afl.hpp:708
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:436
Interface for objects that can be serialized to and deserialized from an archive.
Definition peak_common_iserializable.hpp:26
std::function< void()> FinishedCallback
Callback function type for operation completion notifications.
Definition peak_afl_icontroller.hpp:229
virtual ~IController()=default
Virtual destructor for proper cleanup of derived classes.
virtual std::string GetName() const =0
Gets the unique name of this controller.
peak::afl::Manager & GetManager()
Gets a reference to the API manager.
Definition peak_afl_icontroller.hpp:364
virtual bool IsRunning() const =0
Checks if the controller is currently running.
FinishedCallback * FinishedCallbackHandle
Handle type for managing callback registrations.
Definition peak_afl_icontroller.hpp:234
IController(const IController &)=delete
Copy constructor deleted to prevent copying.
virtual ControllerType GetType() const =0
Gets the type of this controller.
virtual ControllerMode GetMode() const =0
Gets the current operational mode of this controller.
IController(IController &&)=delete
Move constructor deleted to prevent moving.
virtual void SetMode(ControllerMode mode)=0
Sets the operational mode for this controller.
virtual void ResetToDefault()=0
Resets the controller to its default configuration.
IController & operator=(IController &&)=delete
Move assignment deleted to prevent moving.
IController & operator=(const IController &)=delete
Copy assignment deleted to prevent copying.
peak_afl_controllerType
Auto feature controller types.
Definition peak_afl.h:486
@ PEAK_AFL_CONTROLLER_TYPE_WHITE_BALANCE
Automatic white balance controller.
Definition peak_afl.h:515
@ PEAK_AFL_CONTROLLER_TYPE_AUTOFOCUS
Automatic focus controller.
Definition peak_afl.h:526
@ PEAK_AFL_CONTROLLER_TYPE_BRIGHTNESS
Automatic brightness exposure/gain controller.
Definition peak_afl.h:504
peak_afl_controller_automode
Auto feature controller operation modes.
Definition peak_afl.h:540
@ PEAK_AFL_CONTROLLER_AUTOMODE_CONTINUOUS
Continuous automatic adjustment.
Definition peak_afl.h:559
@ PEAK_AFL_CONTROLLER_AUTOMODE_OFF
Auto feature disabled.
Definition peak_afl.h:548
@ PEAK_AFL_CONTROLLER_AUTOMODE_ONCE
Single adjustment operation.
Definition peak_afl.h:570
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:416
ControllerMode
Controller operation mode enumeration.
Definition peak_afl_icontroller.hpp:55
ControllerType
Controller type enumeration.
Definition peak_afl_icontroller.hpp:36
std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:74
@ Continuous
Continuous operation - automatic processing on every frame.
Definition peak_afl_icontroller.hpp:59
@ Off
Controller is disabled - no automatic processing.
Definition peak_afl_icontroller.hpp:57
@ Once
Single operation - automatic processing triggered once.
Definition peak_afl_icontroller.hpp:61
@ WhiteBalance
Automatic white balance controller - manages color correction.
Definition peak_afl_icontroller.hpp:42
@ Brightness
Automatic brightness controller - manages exposure and gain.
Definition peak_afl_icontroller.hpp:40
@ Focus
Automatic focus controller - manages lens focus positioning.
Definition peak_afl_icontroller.hpp:38
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:35
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:33
C API interface for automatic camera feature control.