IDS peak AFL v1.8.0
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{
29
49
68
80{
81 if (mode == ControllerType::Focus)
82 {
83 return "Focus";
84 }
86 {
87 return "Brightness";
88 }
90 {
91 return "WhiteBalance";
92 }
93 throw peak::common::InvalidParameterException("The given controller type is unknown!");
94}
95
96inline std::ostream& operator<<(std::ostream& os, ControllerType mode)
97{
98 return os << ToString(mode);
99}
100
112{
113 if (mode == ControllerMode::Off)
114 {
115 return "Off";
116 }
117 if (mode == ControllerMode::Continuous)
118 {
119 return "Continuous";
120 }
121 if (mode == ControllerMode::Once)
122 {
123 return "Once";
124 }
125 throw peak::common::InvalidParameterException("The given controller mode is unknown!");
126}
127
128inline std::ostream& operator<<(std::ostream& os, ControllerMode mode)
129{
130 return os << ToString(mode);
131}
132
133namespace detail
134{
135
136PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(const std::string& mode)
137{
138 if (mode == "Off")
139 {
140 return ControllerMode::Off;
141 }
142 if (mode == "Continuous")
143 {
145 }
146 if (mode == "Once")
147 {
149 }
150 throw peak::common::InvalidParameterException("The given controller mode " + mode + " is unknown!");
151}
152
154{
155 switch (controllerMode)
156 {
163 default:
164 throw peak::common::InvalidParameterException("Unknown controller mode type");
165 }
166}
167
168PEAK_COMMON_NO_DISCARD inline ControllerMode ToControllerMode(peak_afl_controller_automode controllerMode)
169{
170 switch (controllerMode)
171 {
173 return ControllerMode::Off;
178 default:
179 throw peak::common::InvalidParameterException("Unknown controller mode type");
180 }
181}
182
184{
185 switch (controllerType)
186 {
193 default:
194 throw peak::common::InvalidParameterException("Unknown controller type");
195 }
196}
197
228{
229public:
234 using FinishedCallback = std::function<void()>;
240
241 explicit IController(peak::afl::Manager& manager)
242 : m_manager{ manager }
243 {}
244
250 virtual ~IController() = default;
251
256 IController(const IController&) = delete;
261 IController& operator=(const IController&) = delete;
262
267 IController(IController&&) = delete;
272 IController& operator=(IController&&) = delete;
273
285 PEAK_COMMON_NO_DISCARD virtual std::string GetName() const = 0;
286
299
316 virtual void SetMode(ControllerMode mode) = 0;
317
332
343 PEAK_COMMON_NO_DISCARD virtual bool IsRunning() const = 0;
344
356 virtual void ResetToDefault() = 0;
357
358protected:
370 {
371 return m_manager;
372 }
373
374private:
382 peak::afl::Manager& m_manager;
383};
384
385} // namespace detail
386} // namespace autofeature
387} // namespace modules
388} // namespace pipeline
389} // namespace peak
The autofeature manager.
Definition peak_afl.hpp:306
Thrown when a function receives an invalid parameter.
Definition peak_common_exceptions.hpp:50
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:234
virtual PEAK_COMMON_NO_DISCARD ControllerType GetType() const =0
Gets the type of this controller.
virtual ~IController()=default
Virtual destructor for proper cleanup of derived classes.
virtual PEAK_COMMON_NO_DISCARD bool IsRunning() const =0
Checks if the controller is currently running.
PEAK_COMMON_NO_DISCARD peak::afl::Manager & GetManager()
Gets a reference to the API manager.
Definition peak_afl_icontroller.hpp:369
FinishedCallback * FinishedCallbackHandle
Handle type for managing callback registrations.
Definition peak_afl_icontroller.hpp:239
IController(const IController &)=delete
Copy constructor deleted to prevent copying.
virtual PEAK_COMMON_NO_DISCARD std::string GetName() const =0
Gets the unique name 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.
virtual PEAK_COMMON_NO_DISCARD ControllerMode GetMode() const =0
Gets the current operational mode of this controller.
peak_afl_controllerType
Auto feature controller types.
Definition peak_afl.h:223
@ PEAK_AFL_CONTROLLER_TYPE_WHITE_BALANCE
Automatic white balance controller.
Definition peak_afl.h:252
@ PEAK_AFL_CONTROLLER_TYPE_AUTOFOCUS
Automatic focus controller.
Definition peak_afl.h:263
@ PEAK_AFL_CONTROLLER_TYPE_BRIGHTNESS
Automatic brightness exposure/gain controller.
Definition peak_afl.h:241
ControllerMode
Controller operation mode enumeration.
Definition peak_afl_icontroller.hpp:60
PEAK_COMMON_NO_DISCARD std::string ToString(ControllerType mode)
Converts ControllerType enumeration to string representation.
Definition peak_afl_icontroller.hpp:79
ControllerType
Controller type enumeration.
Definition peak_afl_icontroller.hpp:41
@ Continuous
Continuous operation - automatic processing on every frame.
Definition peak_afl_icontroller.hpp:64
@ Off
Controller is disabled - no automatic processing.
Definition peak_afl_icontroller.hpp:62
@ Once
Single operation - automatic processing triggered once.
Definition peak_afl_icontroller.hpp:66
@ WhiteBalance
Automatic white balance controller - manages color correction.
Definition peak_afl_icontroller.hpp:47
@ Brightness
Automatic brightness controller - manages exposure and gain.
Definition peak_afl_icontroller.hpp:45
@ Focus
Automatic focus controller - manages lens focus positioning.
Definition peak_afl_icontroller.hpp:43
#define PEAK_COMMON_NO_DISCARD
Compatability macro for the nodiscard attribute.
Definition peak_common_defines.hpp:91
peak_afl_controller_automode
Auto feature controller operation modes.
Definition peak_afl.h:277
@ PEAK_AFL_CONTROLLER_AUTOMODE_CONTINUOUS
Continuous automatic adjustment.
Definition peak_afl.h:296
@ PEAK_AFL_CONTROLLER_AUTOMODE_OFF
Auto feature disabled.
Definition peak_afl.h:285
@ PEAK_AFL_CONTROLLER_AUTOMODE_ONCE
Single adjustment operation.
Definition peak_afl.h:307
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.