Newer
Older
QGCCameraControl::_paramDone()
{
for(const QString& param: _paramIO.keys()) {
if(!_paramIO[param]->paramDone()) {
return;
}
}
//-- All parameters loaded (or timed out)
//-- Check for video streaming
_checkForVideoStreams();
}
//-----------------------------------------------------------------------------
void
QGCCameraControl::_checkForVideoStreams()
{
if(_info.flags & CAMERA_CAP_FLAGS_HAS_VIDEO_STREAM) {
//-- Skip it if using Taisync as it has its own video settings
if(!qgcApp()->toolbox()->videoManager()->isTaisync()) {
connect(&_streamInfoTimer, &QTimer::timeout, this, &QGCCameraControl::_streamTimeout);
_streamInfoTimer.setSingleShot(false);
connect(&_streamStatusTimer, &QTimer::timeout, this, &QGCCameraControl::_streamStatusTimeout);
_streamStatusTimer.setSingleShot(true);
//-- Request all streams
_requestStreamInfo(0);
_streamInfoTimer.start(2000);
}
//-----------------------------------------------------------------------------
bool
QGCCameraControl::incomingParameter(Fact* pFact, QVariant& newValue)
{
Q_UNUSED(pFact);
Q_UNUSED(newValue);
return true;
}
//-----------------------------------------------------------------------------
bool
QGCCameraControl::validateParameter(Fact* pFact, QVariant& newValue)
{
Q_UNUSED(pFact);
Q_UNUSED(newValue);
return true;
}
//-----------------------------------------------------------------------------
QStringList
QGCCameraControl::activeSettings()
{
qCDebug(CameraControlLog) << "Active:" << _activeSettings;
return _activeSettings;
}
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::exposureMode()
{
return (_paramComplete && _activeSettings.contains(kCAM_EXPMODE)) ? getFact(kCAM_EXPMODE) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::ev()
{
return (_paramComplete && _activeSettings.contains(kCAM_EV)) ? getFact(kCAM_EV) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::iso()
{
return (_paramComplete && _activeSettings.contains(kCAM_ISO)) ? getFact(kCAM_ISO) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
return (_paramComplete && _activeSettings.contains(kCAM_SHUTTERSPD)) ? getFact(kCAM_SHUTTERSPD) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::aperture()
{
return (_paramComplete && _activeSettings.contains(kCAM_APERTURE)) ? getFact(kCAM_APERTURE) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::wb()
{
return (_paramComplete && _activeSettings.contains(kCAM_WBMODE)) ? getFact(kCAM_WBMODE) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::mode()
{
return _paramComplete ? getFact(kCAM_MODE) : nullptr;
}
Matej Frančeškin
committed
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::bitRate()
{
return _paramComplete ? getFact(kCAM_BITRATE) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::frameRate()
{
return _paramComplete ? getFact(kCAM_FPS) : nullptr;
}
//-----------------------------------------------------------------------------
Fact*
QGCCameraControl::videoEncoding()
{
return _paramComplete ? getFact(kCAM_ENC) : nullptr;
}
//-----------------------------------------------------------------------------
QGCVideoStreamInfo::QGCVideoStreamInfo(QObject* parent, const mavlink_video_stream_information_t *si)
: QObject(parent)
{
memcpy(&_streamInfo, si, sizeof(mavlink_video_stream_information_t));
}
//-----------------------------------------------------------------------------
qreal
QGCVideoStreamInfo::aspectRatio()
{
if(_streamInfo.resolution_h && _streamInfo.resolution_v) {
ar = static_cast<double>(_streamInfo.resolution_h) / static_cast<double>(_streamInfo.resolution_v);
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
}
//-----------------------------------------------------------------------------
bool
QGCVideoStreamInfo::update(const mavlink_video_stream_status_t* vs)
{
bool changed = false;
if(_streamInfo.hfov != vs->hfov) {
changed = true;
_streamInfo.hfov = vs->hfov;
}
if(_streamInfo.flags != vs->flags) {
changed = true;
_streamInfo.flags = vs->flags;
}
if(_streamInfo.bitrate != vs->bitrate) {
changed = true;
_streamInfo.bitrate = vs->bitrate;
}
if(_streamInfo.rotation != vs->rotation) {
changed = true;
_streamInfo.rotation = vs->rotation;
}
if(_streamInfo.framerate != vs->framerate) {
changed = true;
_streamInfo.framerate = vs->framerate;
}
if(_streamInfo.resolution_h != vs->resolution_h) {
changed = true;
_streamInfo.resolution_h = vs->resolution_h;
}
if(_streamInfo.resolution_v != vs->resolution_v) {
changed = true;
_streamInfo.resolution_v = vs->resolution_v;
}
if(changed) {
emit infoChanged();
}
return changed;
}