IDS peak AFL v1.6.0
Loading...
Searching...
No Matches
peak_afl.hpp
Go to the documentation of this file.
1
11#pragma once
12
13
14#ifdef PEAK_AFL_DYNAMIC_LOADING
15# define PEAK_AFL_C_ABI_PREFIX peak::afl::dynamic::DynamicLoader::
16#else
17# define PEAK_AFL_C_ABI_PREFIX // we could also set ::
18#endif
19
20#include "peak_afl/peak_afl.h"
21#include "peak_ipl/types/peak_ipl_image.hpp"
22#include "peak_ipl/algorithm/peak_ipl_gain.hpp"
23#include "peak/node_map/peak_node_map.hpp"
24
25#include <type_traits>
26#include <cstdint>
27#include <exception>
28#include <string>
29#include <tuple>
30#include <utility>
31#include <vector>
32#include <memory>
33#include <functional>
34
35#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
36# define PEAK_AFL_NO_DISCARD [[nodiscard]]
37# define PEAK_AFL_MAYBE_UNUSED [[maybe_unused]]
38#else
39# ifdef _MSC_VER
40# define PEAK_AFL_NO_DISCARD _Check_return_
41# define PEAK_AFL_MAYBE_UNUSED
42# elif defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
43# define PEAK_AFL_NO_DISCARD __attribute__((warn_unused_result))
44# define PEAK_AFL_MAYBE_UNUSED __attribute__((unused))
45# else
46# define PEAK_AFL_NO_DISCARD
47# define PEAK_AFL_MAYBE_UNUSED
48# endif
49#endif
50
63namespace peak
64{
65namespace afl
66{
67namespace library
68{
69
75{
76 std::uint32_t major;
77 std::uint32_t minor;
78 std::uint32_t subminor;
79 std::uint32_t patch;
80
85 PEAK_AFL_NO_DISCARD std::string ToString() const
86 {
87 return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(subminor) + "."
88 + std::to_string(patch);
89 }
90
96 PEAK_AFL_NO_DISCARD uint32_t Major() const
97 {
98 return major;
99 }
100
106 PEAK_AFL_NO_DISCARD uint32_t Minor() const
107 {
108 return minor;
109 }
115 PEAK_AFL_NO_DISCARD uint32_t Subminor() const
116 {
117 return subminor;
118 }
119
125 PEAK_AFL_NO_DISCARD uint32_t Patch() const
126 {
127 return patch;
128 }
129};
130
144inline void Init();
145
159inline void Exit();
160
168PEAK_AFL_NO_DISCARD inline std::string GetLastError();
169
182PEAK_AFL_NO_DISCARD inline Version_t Version();
183} // namespace library
184
185namespace error
186{
187
188
193class Exception : public std::exception
194{
195public:
196 explicit Exception(peak_afl_status code, bool get_text=true)
197 : m_code(code)
198 {
199 if (get_text)
200 {
201 m_text = library::GetLastError();
202 }
203 }
204
210 PEAK_AFL_NO_DISCARD peak_afl_status code() const
211 {
212 return m_code;
213 }
214
220 PEAK_AFL_NO_DISCARD const char* what() const noexcept override
221 {
222 if(m_text.empty())
223 {
224 return "-";
225 }
226 else
227 {
228 return m_text.c_str();
229 }
230 }
231
239 PEAK_AFL_NO_DISCARD static std::string translateCode(peak_afl_status status)
240 {
241 switch(status)
242 {
244 return "PEAK_AFL_STATUS_SUCCESS";
245
247 return "PEAK_AFL_STATUS_ERROR";
248
250 return "PEAK_AFL_STATUS_NOT_INITIALIZED";
251
253 return "PEAK_AFL_STATUS_INVALID_PARAMETER";
254
256 return "PEAK_AFL_STATUS_ACCESS_DENIED";
257
259 return "PEAK_AFL_STATUS_BUSY";
260
262 return "PEAK_AFL_STATUS_BUFFER_TOO_SMALL";
263
265 return "PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT";
266
268 return "PEAK_AFL_STATUS_NOT_SUPPORTED";
269
270 case PEAK_AFL_STATUS_VALUE_ADJUSTED:
271 return "PEAK_AFL_STATUS_VALUE_ADJUSTED";
272
273 default:
274 return "Unknown Status code";
275 }
276 }
277
278private:
279 peak_afl_status m_code{};
280 std::string m_text{};
281};
282} // namespace error
283
284class Controller;
285
291{
292public:
302 inline explicit Manager(const std::shared_ptr<peak::core::NodeMap>& node_map);
303
307 inline ~Manager();
308
309 Manager(const Manager&) = delete;
310 inline Manager(Manager&&) noexcept;
311
312 Manager& operator=(const Manager&) noexcept = delete;
313 inline Manager& operator=(Manager&&) noexcept;
314
325 inline void AddController(const std::shared_ptr<Controller>& controller);
326
337 inline void RemoveController(const std::shared_ptr<Controller>& controller);
338
348 inline void Process(const peak::ipl::Image& image) const;
349
362 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> CreateController(peak_afl_controllerType type);
363
371 inline void DestroyAllController();
372
382 inline void DestroyController(const std::shared_ptr<Controller>& controller);
383
391 inline void SetGainIPL(const peak::ipl::Gain& gain);
392
402 PEAK_AFL_NO_DISCARD inline bool Status() const;
403
409 PEAK_AFL_NO_DISCARD inline std::vector<std::shared_ptr<Controller>> ControllerList() const;
410
416 PEAK_AFL_NO_DISCARD inline size_t ControllerCount() const;
417
427 PEAK_AFL_NO_DISCARD inline std::shared_ptr<Controller> GetController(peak_afl_controllerType type) const;
428
429private:
430 std::vector<std::shared_ptr<Controller>> m_controllerList;
431 mutable std::mutex m_mutex{};
432 peak_afl_manager_handle m_handle{};
433};
434
444template<typename... ControllerTypes>
445std::tuple<Manager, std::vector<std::shared_ptr<Controller>>>
446CreateManager(const std::shared_ptr<peak::core::NodeMap>& node_map, ControllerTypes... types)
447{
448 constexpr int size = sizeof...(types);
449 constexpr std::array<peak_afl_controllerType, size> controller_types{types...};
450 std::vector<std::shared_ptr<Controller>> controller{};
451 Manager manager{node_map};
452 controller.reserve(size);
453
454 std::for_each(controller_types.cbegin(), controller_types.cend(), [&manager, &controller](peak_afl_controllerType type) {
455 controller.emplace_back(std::move(manager.CreateController(type)));
456 });
457
458 return { std::move(manager), std::move(controller) };
459}
460
461
466template <typename T, typename std::enable_if_t<std::is_arithmetic<T>::value, int> = 0>
467struct Range
468{
469 T min;
470 T max;
471 T inc;
472};
473
474namespace callback
475{
476using FinishedCallback = std::function<void(void)>;
477using DataProcessingCallback = std::function<void(int, int)>;
478using ComponentCallback = std::function<void(void)>;
479
480using RegisterFunction = std::function<PEAK_AFL_API_STATUS(void*, void*)>;
481using UnRegisterFunction = std::function<void()>;
482}
483
488class Controller : public std::enable_shared_from_this<Controller>
489{
490 friend class Manager;
491
492 template<class T>
493 class Callback
494 {
495#ifndef SWIG
496 public:
497 template<typename R, typename ...Args>
498 Callback(const std::shared_ptr<peak::afl::Controller>& controller, callback::RegisterFunction register_function,
499 callback::UnRegisterFunction unregister_function, std::function<R(Args...)> callback) :
500 m_unregister_function(std::move(unregister_function)),
501 m_callback(std::move(callback))
502 {
503 const auto ret = register_function(reinterpret_cast<void*>(&Callback::Func<Args...>), this);
504 if (ret != PEAK_AFL_STATUS_SUCCESS)
505 {
506 throw error::Exception(ret);
507 }
508 m_controller = controller;
509 }
510
511 virtual ~Callback()
512 {
513 if (auto controller = m_controller.lock())
514 {
515 m_unregister_function();
516 }
517 }
518
519 private:
520 template<typename ...Args>
521 static void Func(Args... args, void* ptr)
522 {
523 static_cast<Callback *>(ptr)->m_callback(args...);
524 };
525#endif
526
527 std::weak_ptr<peak::afl::Controller> m_controller{};
528 callback::UnRegisterFunction m_unregister_function{};
529 T m_callback{};
530 };
531
532
540 inline explicit Controller(peak_afl_controller_handle handle)
541 : m_handle(handle) {};
542
543public:
547 inline ~Controller();
548
549 Controller(const Controller&) = delete;
550 Controller(Controller&&) = delete;
551 Controller& operator=(const Controller&) = delete;
552 Controller& operator=(Controller&&) = delete;
553
563 PEAK_AFL_NO_DISCARD inline static std::shared_ptr<Controller> Create(peak_afl_controllerType type);
564
572 PEAK_AFL_NO_DISCARD inline bool IsSkipFramesSupported() const;
573
583 inline void SetSkipFrames(std::uint32_t count);
584
594 PEAK_AFL_NO_DISCARD inline std::uint32_t GetSkipFrames() const;
595
603 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetSkipFramesRange() const;
604
614 PEAK_AFL_NO_DISCARD inline bool IsROISupported() const;
615
625 inline void SetROI(peak_afl_rectangle rect);
626
636 PEAK_AFL_NO_DISCARD inline peak_afl_rectangle GetROI() const;
637
647 PEAK_AFL_NO_DISCARD inline bool IsROIPresetSupported() const;
648
658 inline void SetROIPreset(peak_afl_roi_preset preset);
659
669 PEAK_AFL_NO_DISCARD inline bool IsModeSupported() const;
670
680 inline void SetMode(peak_afl_controller_automode mode);
681
689 PEAK_AFL_NO_DISCARD inline peak_afl_controller_automode GetMode() const;
690
700 PEAK_AFL_NO_DISCARD bool IsBrightnessAlgorithmSupported() const;
701
712
721
731 PEAK_AFL_NO_DISCARD inline peak_afl_controller_status Status() const;
732
742 PEAK_AFL_NO_DISCARD inline std::uint8_t GetLastAutoAverage() const;
743
753 PEAK_AFL_NO_DISCARD inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> GetLastAutoAverages() const;
754
764 PEAK_AFL_NO_DISCARD inline bool IsAutoTargetSupported() const;
765
776 inline void SetAutoTarget(uint32_t target);
777
785 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTarget() const;
786
797 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoTargetRange() const;
798
808 PEAK_AFL_NO_DISCARD inline bool IsAutoToleranceSupported() const;
809
819 inline void SetAutoTolerance(std::uint32_t tolerance);
820
828 PEAK_AFL_NO_DISCARD inline std::uint32_t GetAutoTolerance() const;
829
840 PEAK_AFL_NO_DISCARD inline Range<std::uint32_t> GetAutoToleranceRange() const;
841
851 PEAK_AFL_NO_DISCARD inline bool IsAutoPercentileSupported() const;
852
863 inline void SetAutoPercentile(double percentile);
864
872 PEAK_AFL_NO_DISCARD inline double GetAutoPercentile() const;
873
884 PEAK_AFL_NO_DISCARD inline Range<double> GetAutoPercentileRange() const;
885
895 PEAK_AFL_NO_DISCARD inline peak_afl_controllerType Type() const;
896
908 PEAK_AFL_NO_DISCARD inline bool IsAlgorithmSupported() const;
909
919 inline void SetAlgorithm(peak_afl_controller_algorithm algorithm);
920
927 PEAK_AFL_NO_DISCARD inline peak_afl_controller_algorithm GetAlgorithm() const;
928
938 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_algorithm> GetAlgorithmList() const;
939
951 PEAK_AFL_NO_DISCARD inline bool IsSharpnessAlgorithmSupported() const;
952
963
971 PEAK_AFL_NO_DISCARD inline peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const;
972
982 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_controller_sharpness_algorithm> GetSharpnessAlgorithmList() const;
983
987 inline void RegisterFinishedCallback(const callback::FinishedCallback& callback);
988
992 inline void UnRegisterFinishedCallback();
993
997 inline void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback);
998
1003
1008 inline void RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback);
1009
1014
1024 PEAK_AFL_NO_DISCARD inline bool IsWeightedROISupported() const;
1025
1035 inline void SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list);
1036
1046 inline void SetWeightedROI(const peak_afl_weighted_rectangle& rect);
1047
1055 PEAK_AFL_NO_DISCARD inline peak_afl_size GetWeightedROIMinSize() const;
1056
1064 PEAK_AFL_NO_DISCARD inline std::vector<peak_afl_weighted_rectangle> GetWeightedROIs() const;
1065
1075 PEAK_AFL_NO_DISCARD inline bool IsLimitSupported() const;
1076
1086 inline void SetLimit(peak_afl_controller_limit limit);
1087
1095 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetLimit() const;
1096
1104 PEAK_AFL_NO_DISCARD inline peak_afl_controller_limit GetDefaultLimit() const;
1105
1115 PEAK_AFL_NO_DISCARD inline bool IsHysteresisSupported() const;
1116
1126 inline void SetHysteresis(std::uint8_t hysteresis);
1127
1135 PEAK_AFL_NO_DISCARD inline std::uint8_t GetHysteresis() const;
1136
1144 PEAK_AFL_NO_DISCARD inline std::uint8_t GetDefaultHysteresis() const;
1145
1153 PEAK_AFL_NO_DISCARD inline Range<std::uint8_t> GetHysteresisRange() const;
1154
1164 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentModeSupported() const;
1165
1176 PEAK_AFL_NO_DISCARD inline bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const;
1177
1189
1199
1211
1219 PEAK_AFL_NO_DISCARD inline bool IsGainLimitSupported() const;
1220
1235 inline void SetGainLimit(peak_afl_double_limit limit);
1236
1244 inline peak_afl_double_limit GetGainLimit() const;
1245
1254
1268 inline void SetGainAnalogLimit(peak_afl_double_limit limit);
1269
1278
1287
1301 inline void SetGainDigitalLimit(peak_afl_double_limit limit);
1302
1311
1320
1335
1344
1353
1367 inline void SetGainHostLimit(peak_afl_double_limit limit);
1368
1377
1386
1394 inline void SetExposureLimit(peak_afl_double_limit limit);
1395
1404
1405
1406private:
1407 using FinishedCallbackType = Callback<callback::FinishedCallback>;
1408 using DataProcessingCallbackType = Callback<callback::DataProcessingCallback>;
1409 using ComponentCallbackType = Callback<callback::ComponentCallback>;
1410
1411 peak_afl_controller_handle m_handle{};
1412 std::unique_ptr<FinishedCallbackType> m_finishedCallback{};
1413 std::unique_ptr<DataProcessingCallbackType> m_dataProcessingCallback{};
1414 std::unique_ptr<ComponentCallbackType> m_finishedExposureCallback{};
1415 std::unique_ptr<ComponentCallbackType> m_finishedGainCallback{};
1416};
1417
1418namespace library
1419{
1420inline void Init()
1421{
1422 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Init();
1423 if (ret != PEAK_AFL_STATUS_SUCCESS)
1424
1425 {
1426 throw error::Exception(ret, false);
1427 }
1428}
1429
1430inline void Exit()
1431{
1432 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_Exit();
1433 if (ret != PEAK_AFL_STATUS_SUCCESS)
1434 {
1435 throw error::Exception(ret, false);
1436 }
1437}
1438
1440{
1441 Version_t version{};
1442
1443 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetVersion(&version.major, &version.minor, &version.subminor, &version.patch);
1444 if (ret != PEAK_AFL_STATUS_SUCCESS)
1445 {
1446 throw error::Exception(ret, false);
1447 }
1448
1449 return version;
1450}
1451
1452inline std::string GetLastError()
1453{
1454 std::size_t lastErrorMessageSize;
1455 peak_afl_status code;
1456
1457 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, nullptr, &lastErrorMessageSize);
1458 if (ret != PEAK_AFL_STATUS_SUCCESS)
1459 {
1460 return "Cannot get last error!";
1461 }
1462
1463 std::vector<char> text;
1464 text.resize(lastErrorMessageSize);
1465
1466 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_GetLastError(&code, text.data(), &lastErrorMessageSize);
1467 if (ret != PEAK_AFL_STATUS_SUCCESS)
1468 {
1469 return "Cannot get last error!";
1470 }
1471
1472 return { text.begin(), text.end() };
1473}
1474} // namespace library
1475
1476inline Manager::Manager(const std::shared_ptr<peak::core::NodeMap>& node_map)
1477{
1478 if(!node_map)
1479 {
1480 throw std::runtime_error("Invalid node map handle!");
1481 }
1482
1483 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Create(&m_handle, node_map->Handle());
1484 if (ret != PEAK_AFL_STATUS_SUCCESS)
1485 {
1486 throw error::Exception(ret);
1487 }
1488}
1489
1491{
1492 if (m_handle != nullptr)
1493 {
1494 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
1495
1496 {
1497 std::lock_guard<std::mutex> lck(m_mutex);
1498 for (auto& c : m_controllerList)
1499 {
1500 c->m_handle = nullptr;
1501 }
1502 }
1503
1504 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Destroy(m_handle);
1505 m_handle = nullptr;
1506 }
1507}
1508
1509inline Manager::Manager(Manager&& other) noexcept {
1510 m_handle = other.m_handle;
1511 other.m_handle = nullptr;
1512
1513 std::lock_guard<std::mutex> lck(other.m_mutex);
1514 m_controllerList = std::move(other.m_controllerList);
1515}
1516
1517inline Manager& Manager::operator=(Manager&& other) noexcept
1518{
1519 m_handle = other.m_handle;
1520 other.m_handle = nullptr;
1521
1522 std::lock_guard<std::mutex> lck(other.m_mutex);
1523 m_controllerList = std::move(other.m_controllerList);
1524
1525 return *this;
1526}
1527
1528inline void Manager::AddController(const std::shared_ptr<Controller>& controller)
1529{
1530 std::lock_guard<std::mutex> lck(m_mutex);
1531
1532 auto cnt = std::any_of(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1533 return c == controller;
1534 });
1535
1536 if(cnt)
1537 {
1538 return;
1539 }
1540
1541 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_AddController(m_handle, controller->m_handle);
1542 if (ret != PEAK_AFL_STATUS_SUCCESS)
1543 {
1544 throw error::Exception(ret);
1545 }
1546
1547 m_controllerList.emplace_back(controller);
1548}
1549
1550inline void Manager::RemoveController(const std::shared_ptr<Controller>& controller)
1551{
1552 std::lock_guard<std::mutex> lck(m_mutex);
1553
1554 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_RemoveController(m_handle, controller->m_handle);
1555 if (ret != PEAK_AFL_STATUS_SUCCESS)
1556 {
1557 throw error::Exception(ret);
1558 }
1559
1560 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1561 return c == controller;
1562 });
1563
1564 m_controllerList.erase(it, m_controllerList.end());
1565}
1566
1567inline void Manager::Process(const peak::ipl::Image& image) const
1568{
1569 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Process(m_handle, ImageBackendAccessor::BackendHandle(image));
1570 if (ret != PEAK_AFL_STATUS_SUCCESS)
1571 {
1572 throw error::Exception(ret);
1573 }
1574}
1575
1576inline std::shared_ptr<Controller> Manager::CreateController(peak_afl_controllerType type)
1577{
1578 std::lock_guard<std::mutex> lck(m_mutex);
1579
1581 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_CreateController(m_handle, &handle, type);
1582 if (ret != PEAK_AFL_STATUS_SUCCESS)
1583 {
1584 throw error::Exception(ret);
1585 }
1586
1587 auto shared = std::shared_ptr<Controller>(new Controller(handle));
1588 m_controllerList.emplace_back(shared);
1589
1590 return shared;
1591}
1592
1594{
1595 std::lock_guard<std::mutex> lck(m_mutex);
1596
1597 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyAllController(m_handle);
1598 if (ret != PEAK_AFL_STATUS_SUCCESS)
1599 {
1600 throw error::Exception(ret);
1601 }
1602
1603 for(auto& c : m_controllerList)
1604 {
1605 c->m_handle = nullptr;
1606 }
1607
1608 m_controllerList.clear();
1609}
1610
1611inline void Manager::DestroyController(const std::shared_ptr<Controller>& controller)
1612{
1613 std::lock_guard<std::mutex> lck(m_mutex);
1614
1615 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_DestroyController(m_handle, controller->m_handle);
1616 if (ret != PEAK_AFL_STATUS_SUCCESS)
1617 {
1618 throw error::Exception(ret);
1619 }
1620
1621 auto it = std::remove_if(m_controllerList.begin(), m_controllerList.end(), [controller](const std::shared_ptr<Controller>& c) {
1622 return c == controller;
1623 });
1624
1625 m_controllerList.erase(it, m_controllerList.end());
1626
1627 controller->m_handle = nullptr;
1628}
1629
1630inline void Manager::SetGainIPL(const peak::ipl::Gain& gain)
1631{
1632 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_SetGainIPL(m_handle, GainBackendAccessor::BackendHandle(gain));
1633 if (ret != PEAK_AFL_STATUS_SUCCESS)
1634 {
1635 throw error::Exception(ret);
1636 }
1637}
1638
1639inline bool Manager::Status() const
1640{
1641 std::uint8_t status;
1642 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoFeatureManager_Status(m_handle, &status);
1643 if (ret != PEAK_AFL_STATUS_SUCCESS)
1644 {
1645 throw error::Exception(ret);
1646 }
1647
1648 return status;
1649}
1650
1651inline std::vector<std::shared_ptr<Controller>> Manager::ControllerList() const
1652{
1653 std::lock_guard<std::mutex> lck(m_mutex);
1654
1655 std::vector<std::shared_ptr<Controller>> controller{};
1656
1657 std::copy(m_controllerList.begin(), m_controllerList.end(), std::back_inserter(controller));
1658
1659 return controller;
1660}
1661
1662inline size_t Manager::ControllerCount() const
1663{
1664 return m_controllerList.size();
1665}
1666
1667inline std::shared_ptr<Controller> Manager::GetController(peak_afl_controllerType type) const
1668{
1669 std::lock_guard<std::mutex> lck(m_mutex);
1670
1671 auto it = std::find_if(m_controllerList.cbegin(), m_controllerList.cend(), [=](const std::shared_ptr<Controller>& controller) {
1672 return type == controller->Type();
1673 });
1674
1675 if(it != m_controllerList.cend())
1676 {
1677 return *it;
1678 }
1679 else
1680 {
1682 }
1683}
1684
1685inline std::shared_ptr<Controller> Controller::Create(peak_afl_controllerType type)
1686{
1688 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Create(&handle, type);
1689 if (ret != PEAK_AFL_STATUS_SUCCESS)
1690 {
1691 throw error::Exception(ret);
1692 }
1693
1694 return std::shared_ptr<Controller>(new Controller(handle));
1695}
1696
1698{
1699 if (m_handle != nullptr)
1700 {
1701 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Destroy(m_handle);
1702 m_handle = nullptr;
1703 }
1704}
1705
1707{
1708 peak_afl_BOOL8 supported{};
1709 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_IsSupported(m_handle, &supported);
1710 if (ret != PEAK_AFL_STATUS_SUCCESS)
1711 {
1712 throw error::Exception(ret);
1713 }
1714
1715 return supported;
1716}
1717
1718inline void Controller::SetSkipFrames(std::uint32_t count)
1719{
1720 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Set(m_handle, count);
1721 if (ret != PEAK_AFL_STATUS_SUCCESS)
1722 {
1723 throw error::Exception(ret);
1724 }
1725}
1726
1727inline std::uint32_t Controller::GetSkipFrames() const
1728{
1729 std::uint32_t count{};
1730 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_Get(m_handle, &count);
1731 if (ret != PEAK_AFL_STATUS_SUCCESS)
1732 {
1733 throw error::Exception(ret);
1734 }
1735
1736 return count;
1737}
1738
1740{
1741 Range<std::uint32_t> range{};
1742 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SkipFrames_GetRange(m_handle, &range.min, &range.max, &range.inc);
1743 if (ret != PEAK_AFL_STATUS_SUCCESS)
1744 {
1745 throw error::Exception(ret);
1746 }
1747
1748 return range;
1749}
1750
1752{
1753 peak_afl_BOOL8 supported{};
1754 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_IsSupported(m_handle, &supported);
1755 if (ret != PEAK_AFL_STATUS_SUCCESS)
1756 {
1757 throw error::Exception(ret);
1758 }
1759
1760 return supported;
1761}
1762
1764{
1765 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Set(m_handle, rect);
1766 if (ret != PEAK_AFL_STATUS_SUCCESS)
1767 {
1768 throw error::Exception(ret);
1769 }
1770}
1771
1773{
1774 peak_afl_rectangle rect{};
1775 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Get(m_handle, &rect);
1776 if (ret != PEAK_AFL_STATUS_SUCCESS)
1777 {
1778 throw error::Exception(ret);
1779 }
1780 return rect;
1781}
1782
1784{
1785 peak_afl_BOOL8 supported{};
1786 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_IsSupported(m_handle, &supported);
1787 if (ret != PEAK_AFL_STATUS_SUCCESS)
1788 {
1789 throw error::Exception(ret);
1790 }
1791
1792 return supported;
1793}
1794
1796{
1797 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ROI_Preset_Set(m_handle, preset);
1798 if (ret != PEAK_AFL_STATUS_SUCCESS)
1799 {
1800 throw error::Exception(ret);
1801 }
1802}
1803
1805{
1806 peak_afl_BOOL8 supported{};
1807 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_IsSupported(m_handle, &supported);
1808 if (ret != PEAK_AFL_STATUS_SUCCESS)
1809 {
1810 throw error::Exception(ret);
1811 }
1812
1813 return supported;
1814}
1815
1817{
1818 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Set(m_handle, mode);
1819 if (ret != PEAK_AFL_STATUS_SUCCESS)
1820 {
1821 throw error::Exception(ret);
1822 }
1823}
1824
1826{
1828 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Mode_Get(m_handle, &mode);
1829 if (ret != PEAK_AFL_STATUS_SUCCESS)
1830 {
1831 throw error::Exception(ret);
1832 }
1833 return mode;
1834}
1835
1837{
1838 peak_afl_BOOL8 supported{};
1839 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_IsSupported(m_handle, &supported);
1840 if (ret != PEAK_AFL_STATUS_SUCCESS)
1841 {
1842 throw error::Exception(ret);
1843 }
1844
1845 return supported;
1846}
1847
1849{
1850 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Set(m_handle, algorithm);
1851 if (ret != PEAK_AFL_STATUS_SUCCESS)
1852 {
1853 throw error::Exception(ret);
1854 }
1855}
1856
1858{
1860 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessAlgorithm_Get(m_handle, &algorithm);
1861 if (ret != PEAK_AFL_STATUS_SUCCESS)
1862 {
1863 throw error::Exception(ret);
1864 }
1865 return algorithm;
1866}
1867
1869{
1871 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Status(m_handle, &status);
1872 if (ret != PEAK_AFL_STATUS_SUCCESS)
1873 {
1874 throw error::Exception(ret);
1875 }
1876 return status;
1877}
1878
1879
1880inline std::uint8_t Controller::GetLastAutoAverage() const
1881{
1882 std::uint8_t average{};
1883 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverage(m_handle, &average);
1884 if (ret != PEAK_AFL_STATUS_SUCCESS)
1885 {
1886 throw error::Exception(ret);
1887 }
1888 return average;
1889}
1890
1891inline std::tuple<std::uint8_t, std::uint8_t, std::uint8_t> Controller::GetLastAutoAverages() const
1892{
1893 std::uint8_t averageRed{}, averageGreen{}, averageBlue{};
1894 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GetLastAutoAverages(m_handle, &averageRed, &averageGreen, &averageBlue);
1895 if (ret != PEAK_AFL_STATUS_SUCCESS)
1896 {
1897 throw error::Exception(ret);
1898 }
1899 return { averageRed, averageGreen, averageBlue };
1900}
1901
1903{
1904 peak_afl_BOOL8 supported{};
1905 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_IsSupported(m_handle, &supported);
1906 if (ret != PEAK_AFL_STATUS_SUCCESS)
1907 {
1908 throw error::Exception(ret);
1909 }
1910
1911 return supported;
1912}
1913
1914inline void Controller::SetAutoTarget(std::uint32_t target)
1915{
1916 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Set(m_handle, target);
1917 if (ret != PEAK_AFL_STATUS_SUCCESS)
1918 {
1919 throw error::Exception(ret);
1920 }
1921}
1922
1923inline std::uint32_t Controller::GetAutoTarget() const
1924{
1925 std::uint32_t target{};
1926 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_Get(m_handle, &target);
1927 if (ret != PEAK_AFL_STATUS_SUCCESS)
1928 {
1929 throw error::Exception(ret);
1930 }
1931 return target;
1932}
1933
1935{
1936 Range<std::uint32_t> range{};
1937 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTarget_GetRange(m_handle, &range.min, &range.max, &range.inc);
1938 if (ret != PEAK_AFL_STATUS_SUCCESS)
1939 {
1940 throw error::Exception(ret);
1941 }
1942 return range;
1943}
1944
1946{
1947 peak_afl_BOOL8 supported{};
1948 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_IsSupported(m_handle, &supported);
1949 if (ret != PEAK_AFL_STATUS_SUCCESS)
1950 {
1951 throw error::Exception(ret);
1952 }
1953
1954 return supported;
1955}
1956
1957inline void Controller::SetAutoTolerance(uint32_t tolerance)
1958{
1959 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Set(m_handle, tolerance);
1960 if (ret != PEAK_AFL_STATUS_SUCCESS)
1961 {
1962 throw error::Exception(ret);
1963 }
1964}
1965
1966inline uint32_t Controller::GetAutoTolerance() const
1967{
1968 std::uint32_t tolerance;
1969 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_Get(m_handle, &tolerance);
1970 if (ret != PEAK_AFL_STATUS_SUCCESS)
1971 {
1972 throw error::Exception(ret);
1973 }
1974 return tolerance;
1975}
1976
1978{
1979 Range<uint32_t> range{};
1980 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoTolerance_GetRange(m_handle, &range.min, &range.max, &range.inc);
1981 if (ret != PEAK_AFL_STATUS_SUCCESS)
1982 {
1983 throw error::Exception(ret);
1984 }
1985 return range;
1986}
1987
1989{
1990 peak_afl_BOOL8 supported{};
1991 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_IsSupported(m_handle, &supported);
1992 if (ret != PEAK_AFL_STATUS_SUCCESS)
1993 {
1994 throw error::Exception(ret);
1995 }
1996
1997 return supported;
1998}
1999
2000inline void Controller::SetAutoPercentile(double percentile)
2001{
2002 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Set(m_handle, percentile);
2003 if (ret != PEAK_AFL_STATUS_SUCCESS)
2004 {
2005 throw error::Exception(ret);
2006 }
2007}
2008
2010{
2011 double percentile;
2012 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_Get(m_handle, &percentile);
2013 if (ret != PEAK_AFL_STATUS_SUCCESS)
2014 {
2015 throw error::Exception(ret);
2016 }
2017 return percentile;
2018}
2019
2021{
2022 Range<double> range{};
2023 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_AutoPercentile_GetRange(m_handle, &range.min, &range.max, &range.inc);
2024 if (ret != PEAK_AFL_STATUS_SUCCESS)
2025 {
2026 throw error::Exception(ret);
2027 }
2028 return range;
2029}
2030
2032{
2034 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Type_Get(m_handle, &type);
2035 if (ret != PEAK_AFL_STATUS_SUCCESS)
2036 {
2037 throw error::Exception(ret);
2038 }
2039 return type;
2040}
2041
2043{
2044 peak_afl_BOOL8 supported{};
2045 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_IsSupported(m_handle, &supported);
2046 if (ret != PEAK_AFL_STATUS_SUCCESS)
2047 {
2048 throw error::Exception(ret);
2049 }
2050
2051 return supported;
2052}
2053
2055{
2056 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Set(m_handle, alg);
2057 if (ret != PEAK_AFL_STATUS_SUCCESS)
2058 {
2059 throw error::Exception(ret);
2060 }
2061}
2062
2064{
2066 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_Get(m_handle, &alg);
2067 if (ret != PEAK_AFL_STATUS_SUCCESS)
2068 {
2069 throw error::Exception(ret);
2070 }
2071
2072 return alg;
2073}
2074
2075inline std::vector<peak_afl_controller_algorithm> Controller::GetAlgorithmList() const
2076{
2077 std::vector<peak_afl_controller_algorithm> algList{};
2078 std::uint32_t listSize{};
2079
2080 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, nullptr, &listSize);
2081 if (ret != PEAK_AFL_STATUS_SUCCESS)
2082 {
2083 throw error::Exception(ret);
2084 }
2085
2086 algList.resize(listSize);
2087
2088 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Algorithm_GetList(m_handle, algList.data(), &listSize);
2089 if (ret != PEAK_AFL_STATUS_SUCCESS)
2090 {
2091 throw error::Exception(ret);
2092 }
2093
2094 return algList;
2095}
2096
2098{
2099 peak_afl_BOOL8 supported{};
2100 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_IsSupported(m_handle, &supported);
2101 if (ret != PEAK_AFL_STATUS_SUCCESS)
2102 {
2103 throw error::Exception(ret);
2104 }
2105
2106 return supported;
2107}
2108
2110{
2111 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Set(m_handle, alg);
2112 if (ret != PEAK_AFL_STATUS_SUCCESS)
2113 {
2114 throw error::Exception(ret);
2115 }
2116}
2117
2119{
2121 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_Get(m_handle, &alg);
2122 if (ret != PEAK_AFL_STATUS_SUCCESS)
2123 {
2124 throw error::Exception(ret);
2125 }
2126
2127 return alg;
2128}
2129
2130inline std::vector<peak_afl_controller_sharpness_algorithm> Controller::GetSharpnessAlgorithmList() const
2131{
2132 std::vector<peak_afl_controller_sharpness_algorithm> algList{};
2133 std::uint32_t listSize{};
2134
2135 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, nullptr, &listSize);
2136 if (ret != PEAK_AFL_STATUS_SUCCESS)
2137 {
2138 throw error::Exception(ret);
2139 }
2140
2141 algList.resize(listSize);
2142
2143 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_SharpnessAlgorithm_GetList(m_handle, algList.data(), &listSize);
2144 if (ret != PEAK_AFL_STATUS_SUCCESS)
2145 {
2146 throw error::Exception(ret);
2147 }
2148
2149 return algList;
2150}
2151
2152inline void Controller::RegisterFinishedCallback(const callback::FinishedCallback& callback)
2153{
2154 m_finishedCallback = std::make_unique<FinishedCallbackType>(shared_from_this(),
2155 [handle = m_handle](void* ptr, void* ctx) {
2156 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, ptr, ctx); },
2157 [handle = m_handle] {
2158 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_FINISHED, nullptr, nullptr); },
2159 callback);
2160}
2161
2163{
2164 m_finishedCallback.reset();
2165}
2166
2167inline void Controller::RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback& callback)
2168{
2170 {
2172 }
2173
2175 {
2176 m_finishedExposureCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
2177 [handle = m_handle, component](void* ptr, void* ctx) {
2179 ptr, ctx); },
2180 [handle = m_handle, component] {
2182 nullptr, nullptr); },
2183 callback);
2184 }
2186 {
2187 m_finishedGainCallback = std::make_unique<ComponentCallbackType>(shared_from_this(),
2188 [handle = m_handle, component](void* ptr, void* ctx) {
2190 ptr, ctx); },
2191 [handle = m_handle, component] {
2193 nullptr, nullptr); },
2194 callback);
2195 }
2196 else
2197 {
2199 }
2200}
2201
2203{
2205 {
2206 m_finishedExposureCallback.reset();
2207 }
2209 {
2210 m_finishedGainCallback.reset();
2211 }
2212 else
2213 {
2215 }
2216}
2217
2218inline void Controller::RegisterDataProcessingCallback(const callback::DataProcessingCallback& callback)
2219{
2220 m_dataProcessingCallback = std::make_unique<DataProcessingCallbackType>(shared_from_this(),
2221 [handle = m_handle](void* ptr, void* ctx) {
2222 return PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, ptr, ctx); },
2223 [handle = m_handle] {
2224 PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Callback_Set(handle, PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA, nullptr, nullptr);},
2225 callback);
2226}
2227
2229{
2230 m_dataProcessingCallback.reset();
2231}
2232
2234{
2235 peak_afl_BOOL8 supported{};
2236 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_IsSupported(m_handle, &supported);
2237 if (ret != PEAK_AFL_STATUS_SUCCESS)
2238 {
2239 throw error::Exception(ret);
2240 }
2241
2242 return supported;
2243}
2244
2245inline void Controller::SetWeightedROIs(const std::vector<peak_afl_weighted_rectangle>& list)
2246{
2247 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, list.data(), static_cast<uint32_t>(list.size()));
2248 if (ret != PEAK_AFL_STATUS_SUCCESS)
2249 {
2250 throw error::Exception(ret);
2251 }
2252}
2253
2255{
2256 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Set(m_handle, &rect, 1);
2257 if (ret != PEAK_AFL_STATUS_SUCCESS)
2258 {
2259 throw error::Exception(ret);
2260 }
2261}
2262
2264{
2265 peak_afl_size minSize{};
2266 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Min_Size(m_handle, &minSize);
2267 if (ret != PEAK_AFL_STATUS_SUCCESS)
2268 {
2269 throw error::Exception(ret);
2270 }
2271 return minSize;
2272}
2273
2274inline std::vector<peak_afl_weighted_rectangle> Controller::GetWeightedROIs() const
2275{
2276 std::vector<peak_afl_weighted_rectangle> list;
2277 std::uint32_t listSize{};
2278
2279 auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, nullptr, &listSize);
2280 if (ret != PEAK_AFL_STATUS_SUCCESS)
2281 {
2282 throw error::Exception(ret);
2283 }
2284
2285 list.resize(listSize);
2286
2287 ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Weighted_ROI_Get(m_handle, list.data(), &listSize);
2288 if (ret != PEAK_AFL_STATUS_SUCCESS)
2289 {
2290 throw error::Exception(ret);
2291 }
2292
2293 return list;
2294}
2295
2297{
2298 peak_afl_BOOL8 supported{};
2299 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_IsSupported(m_handle, &supported);
2300 if (ret != PEAK_AFL_STATUS_SUCCESS)
2301 {
2302 throw error::Exception(ret);
2303 }
2304
2305 return supported;
2306}
2307
2309{
2310 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Set(m_handle, limit);
2311 if (ret != PEAK_AFL_STATUS_SUCCESS)
2312 {
2313 throw error::Exception(ret);
2314 }
2315}
2316
2318{
2320 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Get(m_handle, &limit);
2321 if (ret != PEAK_AFL_STATUS_SUCCESS)
2322 {
2323 throw error::Exception(ret);
2324 }
2325 return limit;
2326}
2327
2329{
2331 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Limit_Default(m_handle, &limit);
2332 if (ret != PEAK_AFL_STATUS_SUCCESS)
2333 {
2334 throw error::Exception(ret);
2335 }
2336 return limit;
2337}
2338
2340{
2341 peak_afl_BOOL8 supported{};
2342 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_IsSupported(m_handle, &supported);
2343 if (ret != PEAK_AFL_STATUS_SUCCESS)
2344 {
2345 throw error::Exception(ret);
2346 }
2347
2348 return supported;
2349}
2350
2351inline void Controller::SetHysteresis(std::uint8_t hysteresis)
2352{
2353 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Set(m_handle, hysteresis);
2354 if (ret != PEAK_AFL_STATUS_SUCCESS)
2355 {
2356 throw error::Exception(ret);
2357 }
2358}
2359
2360inline std::uint8_t Controller::GetHysteresis() const
2361{
2362 std::uint8_t hysteresis{};
2363 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Get(m_handle, &hysteresis);
2364 if (ret != PEAK_AFL_STATUS_SUCCESS)
2365 {
2366 throw error::Exception(ret);
2367 }
2368
2369 return hysteresis;
2370}
2371
2372inline std::uint8_t Controller::GetDefaultHysteresis() const
2373{
2374 std::uint8_t hysteresis{};
2375 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_Default(m_handle, &hysteresis);
2376 if (ret != PEAK_AFL_STATUS_SUCCESS)
2377 {
2378 throw error::Exception(ret);
2379 }
2380
2381 return hysteresis;
2382}
2383
2385{
2386 Range<std::uint8_t> hysteresis{};
2387 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_Hysteresis_GetRange(
2388 m_handle, &hysteresis.min, &hysteresis.max, &hysteresis.inc);
2389 if (ret != PEAK_AFL_STATUS_SUCCESS)
2390 {
2391 throw error::Exception(ret);
2392 }
2393
2394 return hysteresis;
2395}
2396
2397PEAK_AFL_NO_DISCARD inline bool Controller::IsBrightnessComponentModeSupported() const
2398{
2399 peak_afl_BOOL8 supported{};
2400 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(m_handle, &supported);
2401 if (ret != PEAK_AFL_STATUS_SUCCESS)
2402 {
2403 throw error::Exception(ret);
2404 }
2405
2406 return supported;
2407}
2408
2410{
2411 peak_afl_BOOL8 supported{};
2412 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(m_handle, component, &supported);
2413 if (ret != PEAK_AFL_STATUS_SUCCESS)
2414 {
2415 throw error::Exception(ret);
2416 }
2417
2418 return supported;
2419}
2420
2423{
2424 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Set(m_handle, component, mode);
2425 if (ret != PEAK_AFL_STATUS_SUCCESS)
2426 {
2427 throw error::Exception(ret);
2428 }
2429}
2430
2433{
2435 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Mode_Get(m_handle, component, &mode);
2436 if (ret != PEAK_AFL_STATUS_SUCCESS)
2437 {
2438 throw error::Exception(ret);
2439 }
2440 return mode;
2441}
2442
2445{
2447 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_BrightnessComponent_Status(m_handle, component, &status);
2448 if (ret != PEAK_AFL_STATUS_SUCCESS)
2449 {
2450 throw error::Exception(ret);
2451 }
2452 return status;
2453}
2454
2456{
2457 peak_afl_BOOL8 supported{};
2458 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_IsSupported(m_handle, &supported);
2459 if (ret != PEAK_AFL_STATUS_SUCCESS)
2460 {
2461 throw error::Exception(ret);
2462 }
2463
2464 return supported;
2465}
2466
2468{
2469 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Set(m_handle, limit);
2470 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2471 {
2472 // Do nothing. Not an error.
2473 }
2474 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2475 {
2476 throw error::Exception(ret);
2477 }
2478}
2479
2481{
2482 peak_afl_double_limit limit{};
2483 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_Get(m_handle, &limit);
2484 if (ret != PEAK_AFL_STATUS_SUCCESS)
2485 {
2486 throw error::Exception(ret);
2487 }
2488
2489 return limit;
2490}
2491
2493{
2494 peak_afl_double_limit limit{};
2495 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainLimit_GetRange(m_handle, &limit);
2496 if (ret != PEAK_AFL_STATUS_SUCCESS)
2497 {
2498 throw error::Exception(ret);
2499 }
2500
2501 return limit;
2502}
2503
2505{
2506 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Set(m_handle, limit);
2507 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2508 {
2509 // Do nothing. Not an error.
2510 }
2511 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2512 {
2513 throw error::Exception(ret);
2514 }
2515}
2516
2518{
2519 peak_afl_double_limit limit{};
2520 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_Get(m_handle, &limit);
2521 if (ret != PEAK_AFL_STATUS_SUCCESS)
2522 {
2523 throw error::Exception(ret);
2524 }
2525
2526 return limit;
2527}
2528
2530{
2531 peak_afl_double_limit limit{};
2532 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainAnalogLimit_GetRange(m_handle, &limit);
2533 if (ret != PEAK_AFL_STATUS_SUCCESS)
2534 {
2535 throw error::Exception(ret);
2536 }
2537
2538 return limit;
2539}
2540
2542{
2543 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Set(m_handle, limit);
2544 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2545 {
2546 // Do nothing. Not an error.
2547 }
2548 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2549 {
2550 throw error::Exception(ret);
2551 }
2552}
2553
2555{
2556 peak_afl_double_limit limit{};
2557 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_Get(m_handle, &limit);
2558 if (ret != PEAK_AFL_STATUS_SUCCESS)
2559 {
2560 throw error::Exception(ret);
2561 }
2562
2563 return limit;
2564}
2565
2567{
2568 peak_afl_double_limit limit{};
2569 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainDigitalLimit_GetRange(m_handle, &limit);
2570 if (ret != PEAK_AFL_STATUS_SUCCESS)
2571 {
2572 throw error::Exception(ret);
2573 }
2574
2575 return limit;
2576}
2577
2579{
2580 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Set(m_handle, limit);
2581 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2582 {
2583 // Do nothing. Not an error.
2584 }
2585 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2586 {
2587 throw error::Exception(ret);
2588 }
2589}
2590
2592{
2593 peak_afl_double_limit limit{};
2594 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_Get(m_handle, &limit);
2595 if (ret != PEAK_AFL_STATUS_SUCCESS)
2596 {
2597 throw error::Exception(ret);
2598 }
2599
2600 return limit;
2601}
2602
2604{
2605 peak_afl_double_limit limit{};
2606 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainCombinedLimit_GetRange(m_handle, &limit);
2607 if (ret != PEAK_AFL_STATUS_SUCCESS)
2608 {
2609 throw error::Exception(ret);
2610 }
2611
2612 return limit;
2613}
2614
2616{
2617 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Set(m_handle, limit);
2618 if (ret == PEAK_AFL_STATUS_VALUE_ADJUSTED)
2619 {
2620 // Do nothing. Not an error.
2621 }
2622 else if (ret != PEAK_AFL_STATUS_SUCCESS)
2623 {
2624 throw error::Exception(ret);
2625 }
2626}
2627
2629{
2630 peak_afl_double_limit limit{};
2631 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_Get(m_handle, &limit);
2632 if (ret != PEAK_AFL_STATUS_SUCCESS)
2633 {
2634 throw error::Exception(ret);
2635 }
2636
2637 return limit;
2638}
2639
2641{
2642 peak_afl_double_limit limit{};
2643 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_GainHostLimit_GetRange(m_handle, &limit);
2644 if (ret != PEAK_AFL_STATUS_SUCCESS)
2645 {
2646 throw error::Exception(ret);
2647 }
2648
2649 return limit;
2650}
2651
2653{
2654 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Set(m_handle, limit);
2655 if (ret != PEAK_AFL_STATUS_SUCCESS)
2656 {
2657 throw error::Exception(ret);
2658 }
2659}
2660
2662{
2663 peak_afl_double_limit limit{};
2664 const auto ret = PEAK_AFL_C_ABI_PREFIX peak_afl_AutoController_ExposureLimit_Get(m_handle, &limit);
2665 if (ret != PEAK_AFL_STATUS_SUCCESS)
2666 {
2667 throw error::Exception(ret);
2668 }
2669
2670 return limit;
2671}
2672
2673} /* namespace afl */
2674} /* namespace peak */
Definition peak_afl.hpp:489
PEAK_AFL_NO_DISCARD peak_afl_controllerType Type() const
Get the controller type.
Definition peak_afl.hpp:2031
void SetROIPreset(peak_afl_roi_preset preset)
Set the autofeature region of interest preset for a controller.
Definition peak_afl.hpp:1795
void SetBrightnessAlgorithm(peak_afl_controller_brightness_algorithm algorithm)
Set the autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:1848
PEAK_AFL_NO_DISCARD bool IsAutoPercentileSupported() const
check if auto percentile is supported for a controller.
Definition peak_afl.hpp:1988
PEAK_AFL_NO_DISCARD bool IsAutoToleranceSupported() const
check if auto tolerance is supported for a controller.
Definition peak_afl.hpp:1945
peak_afl_double_limit GetGainLimit() const
Get autofeature gain limit for a controller.
Definition peak_afl.hpp:2480
void SetGainLimit(peak_afl_double_limit limit)
Set the gain limit for a controller.
Definition peak_afl.hpp:2467
PEAK_AFL_NO_DISCARD std::uint8_t GetDefaultHysteresis() const
Get the autofeature hysteresis default.
Definition peak_afl.hpp:2372
PEAK_AFL_NO_DISCARD std::uint8_t GetHysteresis() const
Get the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2360
void SetGainCombinedLimit(peak_afl_double_limit limit)
Set the combined gain limit for a controller.
Definition peak_afl.hpp:2578
void SetMode(peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
Definition peak_afl.hpp:1816
PEAK_AFL_NO_DISCARD bool IsROISupported() const
Check if setting a region of interest is supported for a controller.
Definition peak_afl.hpp:1751
void SetGainHostLimit(peak_afl_double_limit limit)
Set the host gain limit for a controller.
Definition peak_afl.hpp:2615
void SetWeightedROIs(const std::vector< peak_afl_weighted_rectangle > &list)
Set the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2245
void UnRegisterFinishedCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2162
peak_afl_double_limit GetGainDigitalLimit() const
Get autofeature digital gain limit for a controller.
Definition peak_afl.hpp:2554
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetSkipFramesRange() const
Get range for frames skipped for a controller.
Definition peak_afl.hpp:1739
PEAK_AFL_NO_DISCARD bool IsROIPresetSupported() const
Check if ROI preset is supported for a controller.
Definition peak_afl.hpp:1783
void BrightnessComponentSetMode(peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2421
PEAK_AFL_NO_DISCARD std::uint8_t GetLastAutoAverage() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1880
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetLimit() const
Get the autofeature limit for a controller.
Definition peak_afl.hpp:2317
void SetHysteresis(std::uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
Definition peak_afl.hpp:2351
void SetExposureLimit(peak_afl_double_limit limit)
Set the exposure limit for a controller.
Definition peak_afl.hpp:2652
void SetSkipFrames(std::uint32_t count)
Set number of frames skipped for a controller.
Definition peak_afl.hpp:1718
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_sharpness_algorithm > GetSharpnessAlgorithmList() const
Get the list of supported sharpness algorithms for a controller.
Definition peak_afl.hpp:2130
PEAK_AFL_NO_DISCARD peak_afl_controller_automode BrightnessComponentGetMode(peak_afl_controller_brightness_component component) const
Get the current autofeature mode for a brightness controller component.
Definition peak_afl.hpp:2431
PEAK_AFL_NO_DISCARD bool IsModeSupported() const
Check if auto mode is supported for a controller.
Definition peak_afl.hpp:1804
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoToleranceRange() const
Get the auto tolerance range for a controller.
Definition peak_afl.hpp:1977
void SetGainAnalogLimit(peak_afl_double_limit limit)
Set the analog gain limit for a controller.
Definition peak_afl.hpp:2504
void SetAutoPercentile(double percentile)
Set the auto percentile for a controller.
Definition peak_afl.hpp:2000
PEAK_AFL_NO_DISCARD peak_afl_rectangle GetROI() const
Get the autofeature region of interest for a controller.
Definition peak_afl.hpp:1772
peak_afl_double_limit GetExposureLimit() const
Get autofeature exposure limit for a controller.
Definition peak_afl.hpp:2661
void UnRegisterDataProcessingCallback()
Reset the finished callback for a controller.
Definition peak_afl.hpp:2228
peak_afl_double_limit GetGainCombinedLimitRange() const
Get autofeature combined gain limit range for a controller.
Definition peak_afl.hpp:2603
PEAK_AFL_NO_DISCARD std::vector< peak_afl_controller_algorithm > GetAlgorithmList() const
Get the list of supported algorithms for a controller.
Definition peak_afl.hpp:2075
~Controller()
Definition peak_afl.hpp:1697
void RegisterDataProcessingCallback(const callback::DataProcessingCallback &callback)
Set the data callback for a controller.
Definition peak_afl.hpp:2218
PEAK_AFL_NO_DISCARD bool IsSharpnessAlgorithmSupported() const
check setting a sharpness algorithm is supported by a controller.
Definition peak_afl.hpp:2097
PEAK_AFL_NO_DISCARD peak_afl_controller_status BrightnessComponentStatus(peak_afl_controller_brightness_component component) const
Get the status for a brightness controller component.
Definition peak_afl.hpp:2443
void UnRegisterComponentCallback(peak_afl_controller_brightness_component component)
Reset the component callback for a controller.
Definition peak_afl.hpp:2202
PEAK_AFL_NO_DISCARD std::tuple< std::uint8_t, std::uint8_t, std::uint8_t > GetLastAutoAverages() const
Get the last auto average for a controller.
Definition peak_afl.hpp:1891
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTolerance() const
Get the current auto tolerance for a controller.
Definition peak_afl.hpp:1966
void SetAlgorithm(peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
Definition peak_afl.hpp:2054
peak_afl_double_limit GetGainDigitalLimitRange() const
Get autofeature digital gain limit range for a controller.
Definition peak_afl.hpp:2566
void SetROI(peak_afl_rectangle rect)
Set the autofeature region of interest for a controller.
Definition peak_afl.hpp:1763
peak_afl_double_limit GetGainAnalogLimitRange() const
Get autofeature analog gain limit range for a controller.
Definition peak_afl.hpp:2529
PEAK_AFL_NO_DISCARD bool IsSkipFramesSupported() const
Check if skip frames is supported for a controller.
Definition peak_afl.hpp:1706
PEAK_AFL_NO_DISCARD peak_afl_controller_limit GetDefaultLimit() const
Get the autofeature default limit.
Definition peak_afl.hpp:2328
PEAK_AFL_NO_DISCARD bool IsLimitSupported() const
Check if limit is supported for a controller.
Definition peak_afl.hpp:2296
PEAK_AFL_NO_DISCARD peak_afl_size GetWeightedROIMinSize() const
Get the autofeature minimum size of weighted region of interest for a controller.
Definition peak_afl.hpp:2263
PEAK_AFL_NO_DISCARD peak_afl_controller_automode GetMode() const
Get the current autofeature mode for a controller.
Definition peak_afl.hpp:1825
static PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > Create(peak_afl_controllerType type)
Create a new controller.
Definition peak_afl.hpp:1685
void RegisterFinishedCallback(const callback::FinishedCallback &callback)
Set finished callback for a controller.
Definition peak_afl.hpp:2152
PEAK_AFL_NO_DISCARD peak_afl_controller_algorithm GetAlgorithm() const
Get the used algorithm for a controller.
Definition peak_afl.hpp:2063
PEAK_AFL_NO_DISCARD bool IsBrightnessAlgorithmSupported() const
Check if auto brightness algorithm is supported for a controller.
Definition peak_afl.hpp:1836
peak_afl_double_limit GetGainCombinedLimit() const
Get autofeature combined gain limit for a controller.
Definition peak_afl.hpp:2591
PEAK_AFL_NO_DISCARD bool IsGainLimitSupported() const
Check if auto gain limit is supported for a controller.
Definition peak_afl.hpp:2455
peak_afl_double_limit GetGainLimitRange() const
Get autofeature gain limit range for a controller.
Definition peak_afl.hpp:2492
void SetWeightedROI(const peak_afl_weighted_rectangle &rect)
Set single autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2254
PEAK_AFL_NO_DISCARD std::uint32_t GetSkipFrames() const
Get number of frames skipped for a controller.
Definition peak_afl.hpp:1727
PEAK_AFL_NO_DISCARD peak_afl_controller_sharpness_algorithm GetSharpnessAlgorithm() const
Get the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2118
PEAK_AFL_NO_DISCARD peak_afl_controller_status Status() const
Get the status for a controller.
Definition peak_afl.hpp:1868
PEAK_AFL_NO_DISCARD bool IsBrightnessComponentUnitSupported(peak_afl_controller_brightness_component component) const
Check if a specific unit is supported for a brightness controller component.
Definition peak_afl.hpp:2409
void SetGainDigitalLimit(peak_afl_double_limit limit)
Set the digital gain limit for a controller.
Definition peak_afl.hpp:2541
PEAK_AFL_NO_DISCARD bool IsAlgorithmSupported() const
check if setting an algorithm is supported for a controller.
Definition peak_afl.hpp:2042
PEAK_AFL_NO_DISCARD Range< double > GetAutoPercentileRange() const
Get the auto percentile range for a controller.
Definition peak_afl.hpp:2020
PEAK_AFL_NO_DISCARD double GetAutoPercentile() const
Get the auto percentile for a controller.
Definition peak_afl.hpp:2009
PEAK_AFL_NO_DISCARD peak_afl_controller_brightness_algorithm GetBrightnessAlgorithm() const
Get the current autofeature brightness algorithm for a controller.
Definition peak_afl.hpp:1857
peak_afl_double_limit GetGainAnalogLimit() const
Get autofeature analog gain limit for a controller.
Definition peak_afl.hpp:2517
void SetAutoTarget(uint32_t target)
Set the auto target for a controller.
Definition peak_afl.hpp:1914
PEAK_AFL_NO_DISCARD bool IsBrightnessComponentModeSupported() const
Check if auto mode is supported for a brightness controller component.
Definition peak_afl.hpp:2397
peak_afl_double_limit GetGainHostLimit() const
Get autofeature host gain limit for a controller.
Definition peak_afl.hpp:2628
void SetAutoTolerance(std::uint32_t tolerance)
Set the auto tolerance for a controller.
Definition peak_afl.hpp:1957
PEAK_AFL_NO_DISCARD std::uint32_t GetAutoTarget() const
Get the currently set auto target for a controller.
Definition peak_afl.hpp:1923
PEAK_AFL_NO_DISCARD Range< std::uint32_t > GetAutoTargetRange() const
Get the auto target range for a controller.
Definition peak_afl.hpp:1934
PEAK_AFL_NO_DISCARD Range< std::uint8_t > GetHysteresisRange() const
Get autofeature hysteresis range for a controller.
Definition peak_afl.hpp:2384
void SetLimit(peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
Definition peak_afl.hpp:2308
PEAK_AFL_NO_DISCARD bool IsWeightedROISupported() const
Check if weighted region of interest is supported for a controller.
Definition peak_afl.hpp:2233
PEAK_AFL_NO_DISCARD bool IsHysteresisSupported() const
Check if hysteresis is supported for a controller.
Definition peak_afl.hpp:2339
void RegisterComponentCallback(peak_afl_controller_brightness_component component, const callback::FinishedCallback &callback)
Set component callback for a controller.
Definition peak_afl.hpp:2167
void SetSharpnessAlgorithm(peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
Definition peak_afl.hpp:2109
peak_afl_double_limit GetGainHostLimitRange() const
Get autofeature host gain limit range for a controller.
Definition peak_afl.hpp:2640
PEAK_AFL_NO_DISCARD bool IsAutoTargetSupported() const
check if auto target is supported for a controller.
Definition peak_afl.hpp:1902
PEAK_AFL_NO_DISCARD std::vector< peak_afl_weighted_rectangle > GetWeightedROIs() const
Get the autofeature weighted region of interest for a controller.
Definition peak_afl.hpp:2274
Definition peak_afl.hpp:291
Manager(const std::shared_ptr< peak::core::NodeMap > &node_map)
Create an automanager instance.
Definition peak_afl.hpp:1476
void RemoveController(const std::shared_ptr< Controller > &controller)
Remove a controller from an automanager.
Definition peak_afl.hpp:1550
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > GetController(peak_afl_controllerType type) const
Get the controller for a type.
Definition peak_afl.hpp:1667
void DestroyAllController()
Destroy all controllers for a manager.
Definition peak_afl.hpp:1593
void DestroyController(const std::shared_ptr< Controller > &controller)
Destroy a controller.
Definition peak_afl.hpp:1611
PEAK_AFL_NO_DISCARD std::shared_ptr< Controller > CreateController(peak_afl_controllerType type)
Create a controller and append it to Manager.
Definition peak_afl.hpp:1576
PEAK_AFL_NO_DISCARD size_t ControllerCount() const
Get the list count of the controller associated with the manager.
Definition peak_afl.hpp:1662
PEAK_AFL_NO_DISCARD bool Status() const
Get the status of a manager.
Definition peak_afl.hpp:1639
~Manager()
Destructor of an automanager instance.
Definition peak_afl.hpp:1490
void SetGainIPL(const peak::ipl::Gain &gain)
Sets the ipl gain.
Definition peak_afl.hpp:1630
PEAK_AFL_NO_DISCARD std::vector< std::shared_ptr< Controller > > ControllerList() const
Get the list of the controller associated with the manager.
Definition peak_afl.hpp:1651
void AddController(const std::shared_ptr< Controller > &controller)
Add a controller to an automanager.
Definition peak_afl.hpp:1528
void Process(const peak::ipl::Image &image) const
Process an image.
Definition peak_afl.hpp:1567
Definition peak_afl.hpp:194
PEAK_AFL_NO_DISCARD const char * what() const noexcept override
Get the string representation for the exception.
Definition peak_afl.hpp:220
static PEAK_AFL_NO_DISCARD std::string translateCode(peak_afl_status status)
Get a string representation for an error code.
Definition peak_afl.hpp:239
PEAK_AFL_NO_DISCARD peak_afl_status code() const
Get the return code for the failure.
Definition peak_afl.hpp:210
PEAK_AFL_API_STATUS peak_afl_AutoController_GainAnalogLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature analog gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto target range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Default(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature default limit.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_GetRange(peak_afl_controller_handle controller, double *min, double *max, double *inc)
Get the auto percentile range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainAnalogLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature analog gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Callback_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get range for frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Default(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis default.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_automode *mode)
Get the current autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto percentile is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature combined gain limit for a controller.
peak_afl_controllerType
controller types
Definition peak_afl.h:125
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Status(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_status *status)
Get the status for a controller component.
peak_afl_controller_brightness_component
controller brightness component
Definition peak_afl.h:245
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_algorithm algorithm)
Set the brightness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_algorithm *algorithm)
Get the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Get(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode *mode)
Get the current brightness component mode for a controller.
peak_afl_controller_automode
controller automode
Definition peak_afl.h:144
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto target is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Get(peak_afl_controller_handle controller, peak_afl_controller_limit *limit)
Get the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Status(peak_afl_controller_handle controller, peak_afl_controller_status *status)
Get the status for a controller.
peak_afl_roi_preset
controller roi preset
Definition peak_afl.h:312
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Get(peak_afl_controller_handle controller, uint32_t *target)
Get the currently set auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *typeList, uint32_t *listSize)
Get the list of supported sharpness algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Set(peak_afl_controller_handle controller, uint32_t count)
Set number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature host gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_Get(peak_afl_controller_handle controller, uint32_t *count)
Get number of frames skipped for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Set(peak_afl_controller_handle controller, uint32_t tolerance)
Set the auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Set(peak_afl_controller_handle controller, const peak_afl_weighted_rectangle *weightedRoiList, uint32_t listSize)
Set the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_Set(peak_afl_controller_handle controller, peak_afl_roi_preset roiPreset)
Set the autofeature region of interest preset for a controller.
peak_afl_controller_brightness_algorithm
brightness calculation algorithm
Definition peak_afl.h:210
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Set(peak_afl_controller_handle controller, uint8_t hysteresis)
Set the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Get(peak_afl_controller_handle controller, peak_afl_weighted_rectangle *weightedRoiList, uint32_t *listSize)
Get the autofeature weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if auto mode is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SkipFrames_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if skip frames is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_automode mode)
Set the autofeature mode for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Get(peak_afl_controller_handle controller, peak_afl_rectangle *roi)
Get the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Callback_Set(peak_afl_controller_handle controller, peak_afl_callback_type type, void *funcPtr, void *context)
Set a callback for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_Get(peak_afl_controller_handle controller, uint8_t *hysteresis)
Get the autofeature hysteresis for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if hysteresis is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Preset_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if ROI preset is supported for a controller.
peak_afl_controller_status
controller status
Definition peak_afl.h:160
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if auto tolerance is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ExposureLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature exposure limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Create(peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a new controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_Set(peak_afl_controller_handle controller, peak_afl_controller_brightness_component component, peak_afl_controller_automode mode)
Set the autofeature mode for a brightness component.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm algorithm)
Set the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_brightness_algorithm *algorithm)
Get the current brightness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_Min_Size(peak_afl_controller_handle controller, peak_afl_size *size)
Get the autofeature minimum size for the weighted region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Weighted_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if weighted region of interest is supported for a controller.
peak_afl_controller_algorithm
controller algorithm
Definition peak_afl.h:188
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Set(peak_afl_controller_handle controller, double percentile)
Set the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check if setting an algorithm is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if limit is supported for a controller.
peak_afl_controller_sharpness_algorithm
controller sharpness algorithm (focus)
Definition peak_afl.h:223
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverage(peak_afl_controller_handle controller, uint8_t *average)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Unit_IsSupported(peak_afl_controller_handle controller, peak_afl_controller_brightness_component unit, peak_afl_BOOL8 *supported)
Check if a specific unit is supported for a brightness controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature digital gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GetLastAutoAverages(peak_afl_controller_handle controller, uint8_t *averageRed, uint8_t *averageGreen, uint8_t *averageBlue)
Get the last auto average for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTarget_Set(peak_afl_controller_handle controller, uint32_t target)
Set the auto target for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_Set(peak_afl_controller_handle controller, peak_afl_rectangle roi)
Set the autofeature region of interest for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Type_Get(peak_afl_controller_handle controller, peak_afl_controllerType *type)
Get the controller type.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainAnalogLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature analog gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Hysteresis_GetRange(peak_afl_controller_handle controller, uint8_t *min, uint8_t *max, uint8_t *inc)
Get autofeature hysteresis range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Destroy(peak_afl_controller_handle controller)
Destroy a controller. Will fail if it is queued inside a manager.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_GetRange(peak_afl_controller_handle controller, uint32_t *min, uint32_t *max, uint32_t *inc)
Get the auto tolerance range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_GetList(peak_afl_controller_handle controller, peak_afl_controller_algorithm *typeList, uint32_t *listSize)
Get the list of supported algorithms for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoTolerance_Get(peak_afl_controller_handle controller, uint32_t *tolerance)
Get the current auto tolerance for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_AutoPercentile_Get(peak_afl_controller_handle controller, double *percentile)
Get the auto percentile for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_Get(peak_afl_controller_handle controller, peak_afl_controller_sharpness_algorithm *algorithm)
Get the used sharpness algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature combined gain limit range for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature digital gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_ROI_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if setting a region of interest is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness algorithm is supported for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainDigitalLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature digital gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_BrightnessComponent_Mode_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if brightness component mode is supported for a controller component.
PEAK_AFL_API_STATUS peak_afl_AutoController_Algorithm_Set(peak_afl_controller_handle controller, peak_afl_controller_algorithm algorithm)
Set the used algorithm for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_SharpnessAlgorithm_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
check setting a sharpness algorithm is supported by a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_Limit_Set(peak_afl_controller_handle controller, peak_afl_controller_limit limit)
Set the autofeature limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainCombinedLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature combined gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_IsSupported(peak_afl_controller_handle controller, peak_afl_BOOL8 *supported)
Check if gain limit is supported for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainLimit_Get(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_Set(peak_afl_controller_handle controller, peak_afl_double_limit limit)
Set autofeature host gain limit for a controller.
PEAK_AFL_API_STATUS peak_afl_AutoController_GainHostLimit_GetRange(peak_afl_controller_handle controller, peak_afl_double_limit *limit)
Get autofeature host gain limit range for a controller.
@ PEAK_AFL_CONTROLLER_CALLBACK_FINISHED
Controller callback type finished.
Definition peak_afl.h:289
@ PEAK_AFL_CONTROLLER_CALLBACK_PROCESSING_DATA
Controller callback type processing data.
Definition peak_afl.h:292
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_GAIN
gain
Definition peak_afl.h:250
@ PEAK_AFL_CONTROLLER_BRIGHTNESS_COMPONENT_EXPOSURE
exposure
Definition peak_afl.h:247
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Create(peak_afl_manager_handle *handle, PEAK_NODE_MAP_HANDLE nodeMapHandle)
Create an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_CreateController(peak_afl_manager_handle handle, peak_afl_controller_handle *controller, peak_afl_controllerType controllerType)
Create a controller and append it to Manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Process(peak_afl_manager_handle handle, PEAK_IPL_IMAGE_HANDLE imageHandle)
Process an image.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyController(peak_afl_manager_handle handle, peak_afl_controller_handle controller)
Destroy a controller.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Status(peak_afl_manager_handle handle, peak_afl_BOOL8 *running)
Get the status of a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_Destroy(peak_afl_manager_handle handle)
Destroy an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_DestroyAllController(peak_afl_manager_handle handle)
Destroy all controllers for a manager.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_AddController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Add a controller to an auto manager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_RemoveController(peak_afl_manager_handle handle, peak_afl_manager_handle controller)
Remove a controller to an automanager instance.
PEAK_AFL_API_STATUS peak_afl_AutoFeatureManager_SetGainIPL(peak_afl_manager_handle handle, PEAK_IPL_GAIN_HANDLE gainHandle)
Set the IPL Gain.
void Exit()
Exit the peak_afl auto feature library.
Definition peak_afl.hpp:1430
void Init()
Init the peak_afl auto feature library.
Definition peak_afl.hpp:1420
PEAK_AFL_NO_DISCARD std::string GetLastError()
Get the last error message.
Definition peak_afl.hpp:1452
PEAK_AFL_NO_DISCARD Version_t Version()
Query the library version.
Definition peak_afl.hpp:1439
std::tuple< Manager, std::vector< std::shared_ptr< Controller > > > CreateManager(const std::shared_ptr< peak::core::NodeMap > &node_map, ControllerTypes... types)
Convenience function to create a manager with the supplied controllers.
Definition peak_afl.hpp:446
PEAK_AFL_API_STATUS peak_afl_Init(void)
Init the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_Exit(void)
Exit the peak_afl auto feature library.
PEAK_AFL_API_STATUS peak_afl_GetVersion(uint32_t *majorVersion, uint32_t *minorVersion, uint32_t *subminorVersion, uint32_t *patchVersion)
Query the library version.
PEAK_AFL_API_STATUS peak_afl_GetLastError(peak_afl_status *lastErrorCode, char *lastErrorMessage, size_t *lastErrorMessageSize)
Get the last error message.
peak_afl_status
peak_afl Status codes
Definition peak_afl.h:88
@ PEAK_AFL_STATUS_SUCCESS
Success.
Definition peak_afl.h:90
@ PEAK_AFL_STATUS_INVALID_IMAGE_FORMAT
Invalid image format.
Definition peak_afl.h:111
@ PEAK_AFL_STATUS_ACCESS_DENIED
Access Denied.
Definition peak_afl.h:102
@ PEAK_AFL_STATUS_BUSY
Busy.
Definition peak_afl.h:105
@ PEAK_AFL_STATUS_NOT_SUPPORTED
Not supported.
Definition peak_afl.h:114
@ PEAK_AFL_STATUS_INVALID_PARAMETER
Invalid Parameter.
Definition peak_afl.h:99
@ PEAK_AFL_STATUS_BUFFER_TOO_SMALL
Buffer too small.
Definition peak_afl.h:108
@ PEAK_AFL_STATUS_NOT_INITIALIZED
Library not initialized.
Definition peak_afl.h:96
@ PEAK_AFL_STATUS_ERROR
Error.
Definition peak_afl.h:93
void * peak_afl_controller_handle
opaque controller handle type
Definition peak_afl.h:49
void * peak_afl_manager_handle
opaque manager handle type
Definition peak_afl.h:51
uint8_t peak_afl_BOOL8
custom boolean type
Definition peak_afl.h:422
Definition peak_afl.hpp:468
Definition peak_afl.hpp:75
PEAK_AFL_NO_DISCARD uint32_t Minor() const
Returns the minor part of the version which is the second part of the version scheme separated by dot...
Definition peak_afl.hpp:106
std::uint32_t minor
Major.
Definition peak_afl.hpp:77
std::uint32_t subminor
Minor.
Definition peak_afl.hpp:78
PEAK_AFL_NO_DISCARD std::string ToString() const
Patch.
Definition peak_afl.hpp:85
PEAK_AFL_NO_DISCARD uint32_t Subminor() const
Returns the subminor part of the version which is the third part of the version scheme separated by d...
Definition peak_afl.hpp:115
PEAK_AFL_NO_DISCARD uint32_t Major() const
Returns the major part of the version which is the first part of the version scheme separated by dots...
Definition peak_afl.hpp:96
std::uint32_t patch
Subminor.
Definition peak_afl.hpp:79
PEAK_AFL_NO_DISCARD uint32_t Patch() const
Returns the patch part of the version which is the fourth part of the version scheme separated by dot...
Definition peak_afl.hpp:125
peak_afl Focus Limit
Definition peak_afl.h:398
peak_afl Double Limit
Definition peak_afl.h:414
peak_afl Rectangle (2D)
Definition peak_afl.h:360
peak_afl Size (2D)
Definition peak_afl.h:326
peak_afl Focus Rectangle
Definition peak_afl.h:382