QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SimulatedCameraControl.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QElapsedTimer>
4#include <QtCore/QTimer>
5
7
9class Vehicle;
10
16{
17 Q_OBJECT
18
19public:
20 explicit SimulatedCameraControl(Vehicle *vehicle, QObject *parent = nullptr);
21 ~SimulatedCameraControl() override;
22
23 void setCameraModeVideo() override;
24 void setCameraModePhoto() override;
25 void toggleCameraMode() override;
26 bool takePhoto() override;
27 bool startVideoRecording() override;
28 bool stopVideoRecording() override;
29 bool toggleVideoRecording() override;
30 void resetSettings() override {}
31 void formatCard(int id = 1) override { Q_UNUSED(id);}
32 void stepZoom(int /*direction*/) override {}
33 void startZoom(int /*direction*/) override {}
34 void stopZoom() override {}
35 void stopStream() override {}
36 bool stopTakePhoto() override { return false;}
37 void resumeStream() override {}
38 void startTracking(QRectF /*rec*/) override {}
39 void startTracking(QPointF /*point*/, double /*radius*/) override {}
40 void stopTracking() override {}
41
42 int version() const override { return 0; }
43 QString modelName() const override { return QStringLiteral("Simulated Camera"); }
44 QString vendor() const override { return QStringLiteral("QGroundControl"); }
45 QString firmwareVersion() const override { return QStringLiteral("1.0"); }
46 qreal focalLength() const override { return qQNaN(); }
47 QSizeF sensorSize() const override { return QSizeF(qQNaN(), qQNaN()); }
48 QSize resolution() const override { return QSize(0, 0); }
49 bool capturesVideo() const override;
50 bool capturesPhotos() const override;
51 bool hasModes() const override;
52 bool hasZoom() const override { return false; }
53 bool hasFocus() const override { return false; }
54 bool hasTracking() const override { return false; }
55 bool hasVideoStream() const override;
56 bool photosInVideoMode() const override { return true; }
57 bool videoInPhotoMode() const override { return false; }
58 CaptureVideoState captureVideoState() const override;
60
61 int compID() const override { return 0; }
62 bool isBasic() const override { return true; }
64 QStringList activeSettings() const override { return QStringList(); }
65 quint32 storageFree() const override { return 0; }
66 QString storageFreeStr() const override { return QString(); }
67 quint32 storageTotal() const override { return 0; }
68 int batteryRemaining() const override { return -1;}
69 QString batteryRemainingStr() const override { return QString(); }
70 bool paramComplete() const override { return true; }
71 qreal zoomLevel() const override { return 1.0; }
72 qreal focusLevel() const override { return 1.0; }
73
74 QmlObjectListModel *streams() override { return nullptr; }
75 QGCVideoStreamInfo *currentStreamInstance() override { return nullptr; }
76 QGCVideoStreamInfo *thermalStreamInstance() override { return nullptr; }
77 int currentStream() const override { return 0; }
78 void setCurrentStream(int /*stream*/) override {}
79 bool autoStream() const override { return false; }
80 quint32 recordTime() const override;
81 QString recordTimeStr() const override;
82
83 Fact *exposureMode() override { return nullptr; }
84 Fact *ev() override { return nullptr; }
85 Fact *iso() override { return nullptr; }
86 Fact *shutterSpeed() override { return nullptr; }
87 Fact *aperture() override { return nullptr; }
88 Fact *wb() override { return nullptr; }
89 Fact *mode() override { return nullptr; }
90
91 QStringList streamLabels() const override { return QStringList(); }
92
93 ThermalViewMode thermalMode() const override { return THERMAL_OFF; }
94 void setThermalMode(ThermalViewMode /*mode*/) override {}
95 double thermalOpacity() const override { return 0.0; }
96 void setThermalOpacity(double /*val*/) override {}
97
98 void setZoomLevel(qreal /*level*/) override {}
99 void setFocusLevel(qreal /*level*/) override {}
100 void setCameraMode(CameraMode cameraMode) override;
102 void setPhotoLapse(qreal /*interval*/) override {}
103 void setPhotoLapseCount(int /*count*/) override {}
104
105 bool trackingEnabled() const override { return false; }
106 void setTrackingEnabled(bool /*set*/) override {}
107
108 TrackingStatus trackingStatus() const override { return TRACKING_UNKNOWN; }
109
110 bool trackingImageStatus() const override { return false; }
111 QRectF trackingImageRect() const override { return QRectF(); }
112
113 void factChanged(Fact* /*pFact*/) override {};
114 bool incomingParameter(Fact* /*pFact*/, QVariant& /*newValue*/) override { return false; }
115 bool validateParameter(Fact* /*pFact*/, QVariant& /*newValue*/) override { return false; }
116
117 void handleBatteryStatus(const mavlink_battery_status_t& /*bs*/) override {}
118 void handleCameraCaptureStatus(const mavlink_camera_capture_status_t& /*cameraCaptureStatus*/) override {}
119 void handleParamExtAck(const mavlink_param_ext_ack_t& /*paramExtAck*/) override {}
120 void handleParamExtValue(const mavlink_param_ext_value_t& /*paramExtValue*/) override {}
121 void handleCameraSettings(const mavlink_camera_settings_t& /*settings*/) override {}
122 void handleStorageInformation(const mavlink_storage_information_t& /*storageInformation*/) override {}
123 void handleTrackingImageStatus(const mavlink_camera_tracking_image_status_t& /*trackingImageStatus*/) override {}
124 void handleVideoStreamInformation(const mavlink_video_stream_information_t& /*videoStreamInformation*/) override {}
125 void handleVideoStreamStatus(const mavlink_video_stream_status_t& /*videoStreamStatus*/) override {}
126
127protected slots:
128 void _paramDone() override {};
129
130private:
131 void _setCameraMode(CameraMode mode);
132
133 QElapsedTimer _videoRecordTimeElapsedTimer;
134};
A Fact is used to hold a single value within the system.
Definition Fact.h:19
Abstract base class for all camera controls: real and simulated.
virtual CameraMode cameraMode() const
Encapsulates the contents of a VIDEO_STREAM_INFORMATION message.
QRectF trackingImageRect() const override
QGCVideoStreamInfo * thermalStreamInstance() override
QString storageFreeStr() const override
void handleVideoStreamInformation(const mavlink_video_stream_information_t &) override
QGCVideoStreamInfo * currentStreamInstance() override
qreal focalLength() const override
quint32 storageTotal() const override
void setCameraMode(CameraMode cameraMode) override
qreal focusLevel() const override
bool capturesPhotos() const override
bool validateParameter(Fact *, QVariant &) override
Allow controller to modify or invalidate parameter change.
void handleVideoStreamStatus(const mavlink_video_stream_status_t &) override
void setZoomLevel(qreal) override
CapturePhotosState capturePhotosState() const override
QmlObjectListModel * streams() override
QString batteryRemainingStr() const override
void handleParamExtAck(const mavlink_param_ext_ack_t &) override
void setPhotoCaptureMode(PhotoCaptureMode mode) override
void startTracking(QRectF) override
bool hasFocus() const override
bool trackingImageStatus() const override
qreal zoomLevel() const override
bool paramComplete() const override
void factChanged(Fact *) override
Notify controller a parameter has changed.
QString recordTimeStr() const override
void formatCard(int id=1) override
bool photosInVideoMode() const override
ThermalViewMode thermalMode() const override
quint32 storageFree() const override
void setTrackingEnabled(bool) override
void setPhotoLapse(qreal) override
QSizeF sensorSize() const override
void setThermalOpacity(double) override
QString modelName() const override
void handleBatteryStatus(const mavlink_battery_status_t &) override
bool trackingEnabled() const override
QSize resolution() const override
QStringList streamLabels() const override
Stream names to show the user (for selection)
bool autoStream() const override
int currentStream() const override
QString firmwareVersion() const override
int compID() const override
double thermalOpacity() const override
QStringList activeSettings() const override
void handleParamExtValue(const mavlink_param_ext_value_t &) override
bool videoInPhotoMode() const override
void setCurrentStream(int) override
bool hasVideoStream() const override
void handleStorageInformation(const mavlink_storage_information_t &) override
QString vendor() const override
void handleCameraCaptureStatus(const mavlink_camera_capture_status_t &) override
void setFocusLevel(qreal) override
bool hasZoom() const override
TrackingStatus trackingStatus() const override
CaptureVideoState captureVideoState() const override
int batteryRemaining() const override
int version() const override
quint32 recordTime() const override
void handleCameraSettings(const mavlink_camera_settings_t &) override
void handleTrackingImageStatus(const mavlink_camera_tracking_image_status_t &) override
void setPhotoLapseCount(int) override
bool incomingParameter(Fact *, QVariant &) override
Allow controller to modify or invalidate incoming parameter.
void startTracking(QPointF, double) override
bool isBasic() const override
StorageStatus storageStatus() const override
bool capturesVideo() const override
bool hasModes() const override
void setThermalMode(ThermalViewMode) override
bool hasTracking() const override