34 using ProcessingCallback = std::function<void()>;
37 explicit GenericWhiteBalance(peak::afl::Manager& manager, ProcessingCallback callback)
38 : IController(manager)
40 , m_processingCallback{ std::move(callback) }
41 , m_skipFrames{ std::make_unique<features::SkipFrames>(m_controller) }
42 , m_roi{ std::make_unique<features::Roi>(m_controller) }
46 m_controller->RegisterFinishedCallback([
this]() { m_FinishedCallbackManager.TriggerCallbacks(); });
48 m_controller->RegisterProcessingCallback([
this](peak_afl_process_data* data) {
49 auto* whitebalance =
reinterpret_cast<peak_afl_process_data_whitebalance*
>(data);
55 if (m_processingCallback)
57 m_processingCallback();
62 PEAK_COMMON_NO_DISCARD std::string
GetName()
const override
64 return "GenericWhitebalance";
67 void Serialize(peak::common::serialization::IArchive& archive)
const override
69 for (
const auto& feature :
70 std::initializer_list<const peak::common::serialization::ISerializable*>{ m_skipFrames.get(), m_roi.get() })
72 feature->Serialize(archive);
78 void Deserialize(
const peak::common::serialization::IArchive& archive)
override
80 for (
const auto& feature :
81 std::initializer_list<peak::common::serialization::ISerializable*>{ m_skipFrames.get(), m_roi.get() })
83 feature->Deserialize(archive);
86 SetMode(detail::ToControllerMode(archive.
GetString(
"Mode")));
91 m_controller->SetMode(detail::ToCType(mode));
96 return detail::ToControllerMode(m_controller->GetMode());
99 PEAK_COMMON_NO_DISCARD
bool IsRunning()
const override
111 PEAK_COMMON_NO_DISCARD features::SkipFrames& SkipFrames()
const
113 return *m_skipFrames;
116 PEAK_COMMON_NO_DISCARD features::Roi& Roi()
const
128 return m_FinishedCallbackManager.RegisterCallback(callback);
133 m_FinishedCallbackManager.UnregisterCallback(callbackHandle);
137 std::shared_ptr<peak::afl::Controller> m_controller;
139 peak::core::TTriggerCallbackManager<IController::FinishedCallbackHandle, IController::FinishedCallback>
140 m_FinishedCallbackManager;
141 ProcessingCallback m_processingCallback{};
143 std::unique_ptr<features::SkipFrames> m_skipFrames{};
144 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:2252
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:227
std::function< void()> FinishedCallback
Callback function type for operation completion notifications.
Definition peak_afl_icontroller.hpp:233
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
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:518
@ PEAK_AFL_CONTROLLER_WHITEBALANCE_COMPONENT_HOST_GAIN
Host-based software white balance.
Definition peak_afl.h:1022
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
@ Off
Controller is disabled - no automatic processing.
Definition peak_afl_icontroller.hpp:61
@ WhiteBalance
Automatic white balance controller - manages color correction.
Definition peak_afl_icontroller.hpp:46
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