Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqnxcamerahandle_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QQNXCAMERAHANDLE_P_H
4#define QQNXCAMERAHANDLE_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <camera/camera_api.h>
18
19#include <utility>
20
22{
23public:
24 QQnxCameraHandle() = default;
25
26 explicit QQnxCameraHandle(camera_handle_t h)
27 : m_handle (h) {}
28
35
37
39 {
40 m_handle = other.m_handle;
41 m_lastError = other.m_lastError;
42
44
45 return *this;
46 }
47
49 {
50 close();
51 }
52
53 bool open(camera_unit_t unit, uint32_t mode)
54 {
55 if (isOpen()) {
56 m_lastError = CAMERA_EALREADY;
57 return false;
58 }
59
60 return cacheError(camera_open, unit, mode, &m_handle);
61 }
62
63 bool close()
64 {
65 if (!isOpen())
66 return true;
67
68 const bool success = cacheError(camera_close, m_handle);
69 m_handle = CAMERA_HANDLE_INVALID;
70
71 return success;
72 }
73
75 {
76 return m_handle;
77 }
78
79 bool isOpen() const
80 {
81 return m_handle != CAMERA_HANDLE_INVALID;
82 }
83
85 {
86 return m_lastError;
87 }
88
89private:
90 template <typename Func, typename ...Args>
91 bool cacheError(Func f, Args &&...args)
92 {
93 m_lastError = f(std::forward<Args>(args)...);
94
95 return m_lastError == CAMERA_EOK;
96 }
97
98 camera_handle_t m_handle = CAMERA_HANDLE_INVALID;
99 camera_error_t m_lastError = CAMERA_EOK;
100};
101
102#endif
bool open(camera_unit_t unit, uint32_t mode)
QQnxCameraHandle(const QQnxCameraHandle &)=delete
camera_handle_t get() const
QQnxCameraHandle()=default
camera_error_t lastError() const
QQnxCameraHandle(QQnxCameraHandle &&other)
QQnxCameraHandle & operator=(QQnxCameraHandle &&other)
QQnxCameraHandle(camera_handle_t h)
QList< camera_vfmode_t > supportedVfModes() const
void setManualIsoSensitivity(uint32_t value)
void setCustomFocusPoint(const QPointF &point)
bool setCameraFormat(uint32_t width, uint32_t height, double frameRate)
camera_whitebalancemode_t whiteBalanceMode() const
void setEvOffset(float ev)
int maxFocusStep() const
void minimumZoomFactorChanged(double factor)
std::unique_ptr< QQnxCameraFrameBuffer > takeCurrentFrame()
camera_handle_t handle() const
QList< camera_frametype_t > supportedRecordingFrameTypes() const
QList< uint32_t > supportedWhiteBalanceValues() const
double zoomRatio(uint32_t zoomLevel) const
bool setZoomFactor(uint32_t factor)
bool isFocusModeSupported(camera_focusmode_t mode) const
void stopVideoRecording()
uint32_t manualIsoSensitivity() const
double manualExposureTime() const
QList< camera_focusmode_t > supportedFocusModes() const
void frameAvailable()
uint32_t maximumZoomLevel() const
QList< double > specifiedVfFrameRates(camera_frametype_t frameType, camera_res_t resolution) const
bool startVideoRecording(const QString &filename)
bool isValid() const
bool hasFeature(camera_feature_t feature) const
friend QDebug & operator<<(QDebug &, const VideoFormat &)
QList< camera_frametype_t > supportedVfFrameTypes() const
void setManualFocusStep(int step)
QSize viewFinderSize() const
bool isActive() const
bool isSmoothZoom() const
void setWhiteBalanceMode(camera_whitebalancemode_t mode)
QList< camera_res_t > supportedVfResolutions() const
void customFocusPointChanged(const QPointF &point)
uint32_t minimumZoomLevel() const
bool hasContinuousWhiteBalanceValues() const
camera_focusmode_t focusMode() const
void setManualWhiteBalance(uint32_t value)
uint32_t manualWhiteBalance() const
void setManualExposureTime(double seconds)
bool setFocusMode(camera_focusmode_t mode)
int manualFocusStep() const
camera_unit_t unit() const
double maximumZoomFactorChanged(double factor)
QString name() const
static QList< camera_unit_t > supportedUnits()
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2568
static QString statusToString(camera_devstatus_t status)