30 using ProcessingCallback = std::function<void()>;
33 explicit GenericWhiteBalance(peak::afl::Manager& manager, ProcessingCallback callback)
34 : IController(manager)
36 , m_processingCallback{ std::move(callback) }
37 , m_skipFrames{ std::make_unique<features::SkipFrames>(m_controller) }
38 , m_roi{ std::make_unique<features::Roi>(m_controller) }
42 m_controller->RegisterFinishedCallback([
this]() { m_FinishedCallbackManager.TriggerCallbacks(); });
44 m_controller->RegisterProcessingCallback([
this](peak_afl_process_data* data) {
45 auto* whitebalance =
reinterpret_cast<peak_afl_process_data_whitebalance*
>(data);
51 if (m_processingCallback)
53 m_processingCallback();
58 PEAK_COMMON_NO_DISCARD std::string
GetName()
const override
60 return "GenericWhitebalance";
63 void Serialize(peak::common::serialization::IArchive& archive)
const override
65 for (
const auto& feature :
66 std::initializer_list<const peak::common::serialization::ISerializable*>{ m_skipFrames.get(), m_roi.get() })
68 feature->Serialize(archive);
74 void Deserialize(
const peak::common::serialization::IArchive& archive)
override
76 for (
const auto& feature :
77 std::initializer_list<peak::common::serialization::ISerializable*>{ m_skipFrames.get(), m_roi.get() })
79 feature->Deserialize(archive);
82 SetMode(detail::ToControllerMode(archive.
GetString(
"Mode")));
87 m_controller->SetMode(detail::ToCType(mode));
92 return detail::ToControllerMode(m_controller->GetMode());
95 PEAK_COMMON_NO_DISCARD
bool IsRunning()
const override
107 PEAK_COMMON_NO_DISCARD features::SkipFrames& SkipFrames()
const
109 return *m_skipFrames;
112 PEAK_COMMON_NO_DISCARD features::Roi& Roi()
const
124 return m_FinishedCallbackManager.RegisterCallback(callback);
129 m_FinishedCallbackManager.UnregisterCallback(callbackHandle);
133 std::shared_ptr<peak::afl::Controller> m_controller;
135 peak::core::TTriggerCallbackManager<IController::FinishedCallbackHandle, IController::FinishedCallback>
136 m_FinishedCallbackManager;
137 ProcessingCallback m_processingCallback{};
139 std::unique_ptr<features::SkipFrames> m_skipFrames{};
140 std::unique_ptr<features::Roi> m_roi{};
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:2299
virtual std::string GetString(const std::string &key) const =0
Retrieves a string value by key.
virtual void SetString(const std::string &key, const std::string &value)=0
Stores a UTF-8 string.
Abstract base interface for all automatic controllers.
Definition peak_afl_icontroller.hpp:223
std::function< void()> FinishedCallback
Callback function type for operation completion notifications.
Definition peak_afl_icontroller.hpp:229
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
virtual ControllerType GetType() const =0
Gets the type of this controller.
virtual ControllerMode GetMode() const =0
Gets the current operational mode of this controller.
virtual void ResetToDefault()=0
Resets the controller to its default configuration.
@ PEAK_AFL_CONTROLLER_TYPE_WHITE_BALANCE
Automatic white balance controller.
Definition peak_afl.h:515
@ PEAK_AFL_CONTROLLER_WHITEBALANCE_COMPONENT_HOST_GAIN
Host-based software white balance.
Definition peak_afl.h:1019
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
@ Off
Controller is disabled - no automatic processing.
Definition peak_afl_icontroller.hpp:57
@ WhiteBalance
Automatic white balance controller - manages color correction.
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:35
Interfaces and implementations for defining and controlling data processing pipelines.
Definition peak_afl_generic_auto_brightness.hpp:33