IDS peak AFL v2.0.2
Loading...
Searching...
No Matches
peak_afl_icontroller.hpp
Go to the documentation of this file.
1
10
11#pragma once
12
13#include <peak_afl/peak_afl.h>
15
20
21namespace peak
22{
23namespace pipeline
24{
25namespace modules
26{
27namespace autofeature
28{
48
67
78PEAK_COMMON_NO_DISCARD inline std::string ToString(ControllerType mode)
79{
80 if (mode == ControllerType::Focus)
81 {
82 return "Focus";
83 }
85 {
86 return "Brightness";
87 }
89 {
90 return "WhiteBalance";
91 }
92 throw peak::afl::error::InvalidParameterException("The given controller type is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
93}
94
95inline std::ostream& operator<<(std::ostream& os, ControllerType mode)
96{
97 return os << ToString(mode);
98}
99
110PEAK_COMMON_NO_DISCARD inline std::string ToString(ControllerMode mode)
111{
112 if (mode == ControllerMode::Off)
113 {
114 return "Off";
115 }
116 if (mode == ControllerMode::Continuous)
117 {
118 return "Continuous";
119 }
120 if (mode == ControllerMode::Once)
121 {
122 return "Once";
123 }
124 throw peak::afl::error::InvalidParameterException("The given controller mode is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
125}
126
127inline std::ostream& operator<<(std::ostream& os, ControllerMode mode)
128{
129 return os << ToString(mode);
130}
131
132namespace detail
133{
134PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(const std::string& mode)
135{
136 if (mode == "Off")
137 {
138 return ControllerMode::Off;
139 }
140 if (mode == "Continuous")
141 {
143 }
144 if (mode == "Once")
145 {
147 }
148 throw peak::afl::error::InvalidParameterException(
149 "The given controller mode " + mode + " is unknown!", PEAK_AFL_STATUS_INVALID_PARAMETER);
150}
151
152PEAK_COMMON_NO_DISCARD inline peak_afl_controller_automode ToCType(ControllerMode controllerMode)
153{
154 switch (controllerMode)
155 {
162 }
163
164 throw peak::afl::error::InvalidParameterException("Unknown controller mode type", PEAK_AFL_STATUS_INVALID_PARAMETER);
165}
166
167PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(peak_afl_controller_automode controllerMode)
168{
169 switch (controllerMode)
170 {
172 return ControllerMode::Off;
177 }
178
179 throw peak::afl::error::InvalidParameterException("Unknown controller mode type", PEAK_AFL_STATUS_INVALID_PARAMETER);
180}
181
182PEAK_COMMON_NO_DISCARD inline peak_afl_controllerType ToCType(ControllerType controllerType)
183{
184 switch (controllerType)
185 {
192 }
193
194 throw peak::afl::error::InvalidParameterException("Unknown controller type", PEAK_AFL_STATUS_INVALID_PARAMETER);
195}
196
227{
228public:
233 using FinishedCallback = std::function<void()>;
239
240 explicit IController(peak::afl::Manager& manager)
241 : m_manager{ manager }
242 {}
243
249 virtual ~IController() = default;
250
255 IController(const IController&) = delete;
260 IController& operator=(const IController&) = delete;
261
266 IController(IController&&) = delete;
271 IController& operator=(IController&&) = delete;
272
284 PEAK_COMMON_NO_DISCARD virtual std::string GetName() const = 0;
285
297 PEAK_COMMON_NO_DISCARD virtual ControllerType GetType() const = 0;
298
315 virtual void SetMode(ControllerMode mode) = 0;
316
330 PEAK_COMMON_NO_DISCARD virtual ControllerMode GetMode() const = 0;
331
342 PEAK_COMMON_NO_DISCARD virtual bool IsRunning() const = 0;
343
355 virtual void ResetToDefault() = 0;
356
357protected:
368 PEAK_COMMON_NO_DISCARD peak::afl::Manager& GetManager()
369 {
370 return m_manager;
371 }
372
373private:
381 peak::afl::Manager& m_manager;
382};
383} // namespace detail
384} // namespace autofeature
385} // namespace modules
386} // namespace pipeline
387} // namespace peak
Central coordination object for automatic camera feature control.
Definition peak_afl.hpp:663
The exception thrown for passing an invalid parameter to a function.
Definition peak_afl.hpp:391
Interface for objects that can be serialized to and deserialized from an archive.
Definition peak_common_iserializable.hpp:31
std::function< void()> FinishedCallback
Callback function type for operation completion notifications.
Definition peak_afl_icontroller.hpp:233
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:368
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:238
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:489
@ PEAK_AFL_CONTROLLER_TYPE_WHITE_BALANCE
Automatic white balance controller.
Definition peak_afl.h:518
@ PEAK_AFL_CONTROLLER_TYPE_AUTOFOCUS
Automatic focus controller.
Definition peak_afl.h:529
@ PEAK_AFL_CONTROLLER_TYPE_BRIGHTNESS
Automatic brightness exposure/gain controller.
Definition peak_afl.h:507
peak_afl_controller_automode
Auto feature controller operation modes.
Definition peak_afl.h:543
@ PEAK_AFL_CONTROLLER_AUTOMODE_CONTINUOUS
Continuous automatic adjustment.
Definition peak_afl.h:562
@ PEAK_AFL_CONTROLLER_AUTOMODE_OFF
Auto feature disabled.
Definition peak_afl.h:551
@ PEAK_AFL_CONTROLLER_AUTOMODE_ONCE
Single adjustment operation.
Definition peak_afl.h:573
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid parameter provided.
Definition peak_afl.h:419
ControllerMode
Controller operation mode enumeration.
Definition peak_afl_icontroller.hpp:59
ControllerType
Controller type enumeration.
Definition peak_afl_icontroller.hpp:40
std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:78
@ Continuous
Continuous operation - automatic processing on every frame.
Definition peak_afl_icontroller.hpp:63
@ Off
Controller is disabled - no automatic processing.
Definition peak_afl_icontroller.hpp:61
@ Once
Single operation - automatic processing triggered once.
Definition peak_afl_icontroller.hpp:65
@ WhiteBalance
Automatic white balance controller - manages color correction.
Definition peak_afl_icontroller.hpp:46
@ Brightness
Automatic brightness controller - manages exposure and gain.
Definition peak_afl_icontroller.hpp:44
@ Focus
Automatic focus controller - manages lens focus positioning.
Definition peak_afl_icontroller.hpp:42
Interface definitions and implementations for individual module types used within a pipeline.
Definition peak_afl_generic_auto_brightness.hpp:39
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:37
C API interface for automatic camera feature control.