Unverified Commit 997793a6 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #7325 from mavlink/videoReceiver

Make sure video streaming is running before accessing it.
parents 47d1f9f9 976d14bd
...@@ -364,10 +364,12 @@ QGCCameraControl::takePhoto() ...@@ -364,10 +364,12 @@ QGCCameraControl::takePhoto()
_setPhotoStatus(PHOTO_CAPTURE_IN_PROGRESS); _setPhotoStatus(PHOTO_CAPTURE_IN_PROGRESS);
_captureInfoRetries = 0; _captureInfoRetries = 0;
//-- Capture local image as well //-- Capture local image as well
if(qgcApp()->toolbox()->videoManager()->videoReceiver()) {
QString photoPath = qgcApp()->toolbox()->settingsManager()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo"); QString photoPath = qgcApp()->toolbox()->settingsManager()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo");
QDir().mkpath(photoPath); QDir().mkpath(photoPath);
photoPath += + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg"; photoPath += + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg";
qgcApp()->toolbox()->videoManager()->videoReceiver()->grabImage(photoPath); qgcApp()->toolbox()->videoManager()->videoReceiver()->grabImage(photoPath);
}
return true; return true;
} }
} }
...@@ -667,6 +669,9 @@ QGCCameraControl::_mavCommandResult(int vehicleId, int component, int command, i ...@@ -667,6 +669,9 @@ QGCCameraControl::_mavCommandResult(int vehicleId, int component, int command, i
case MAV_CMD_REQUEST_STORAGE_INFORMATION: case MAV_CMD_REQUEST_STORAGE_INFORMATION:
_storageInfoRetries = 0; _storageInfoRetries = 0;
break; break;
case MAV_CMD_IMAGE_START_CAPTURE:
_captureStatusTimer.start(1000);
break;
} }
} else { } else {
if(noReponseFromVehicle || result == MAV_RESULT_TEMPORARILY_REJECTED || result == MAV_RESULT_FAILED) { if(noReponseFromVehicle || result == MAV_RESULT_TEMPORARILY_REJECTED || result == MAV_RESULT_FAILED) {
...@@ -1471,11 +1476,13 @@ QGCCameraControl::handleCaptureStatus(const mavlink_camera_capture_status_t& cap ...@@ -1471,11 +1476,13 @@ QGCCameraControl::handleCaptureStatus(const mavlink_camera_capture_status_t& cap
//-- Time Lapse //-- Time Lapse
if(photoStatus() == PHOTO_CAPTURE_INTERVAL_IDLE || photoStatus() == PHOTO_CAPTURE_INTERVAL_IN_PROGRESS) { if(photoStatus() == PHOTO_CAPTURE_INTERVAL_IDLE || photoStatus() == PHOTO_CAPTURE_INTERVAL_IN_PROGRESS) {
//-- Capture local image as well //-- Capture local image as well
if(qgcApp()->toolbox()->videoManager()->videoReceiver()) {
QString photoPath = qgcApp()->toolbox()->settingsManager()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo"); QString photoPath = qgcApp()->toolbox()->settingsManager()->appSettings()->savePath()->rawValue().toString() + QStringLiteral("/Photo");
QDir().mkpath(photoPath); QDir().mkpath(photoPath);
photoPath += + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg"; photoPath += + "/" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz") + ".jpg";
qgcApp()->toolbox()->videoManager()->videoReceiver()->grabImage(photoPath); qgcApp()->toolbox()->videoManager()->videoReceiver()->grabImage(photoPath);
} }
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -1640,12 +1640,14 @@ void Vehicle::_updateArmed(bool armed) ...@@ -1640,12 +1640,14 @@ void Vehicle::_updateArmed(bool armed)
} else { } else {
_mapTrajectoryStop(); _mapTrajectoryStop();
// Also handle Video Streaming // Also handle Video Streaming
if(qgcApp()->toolbox()->videoManager()->videoReceiver()) {
if(_settingsManager->videoSettings()->disableWhenDisarmed()->rawValue().toBool()) { if(_settingsManager->videoSettings()->disableWhenDisarmed()->rawValue().toBool()) {
_settingsManager->videoSettings()->streamEnabled()->setRawValue(false); _settingsManager->videoSettings()->streamEnabled()->setRawValue(false);
qgcApp()->toolbox()->videoManager()->videoReceiver()->stop(); qgcApp()->toolbox()->videoManager()->videoReceiver()->stop();
} }
} }
} }
}
} }
void Vehicle::_handlePing(LinkInterface* link, mavlink_message_t& message) void Vehicle::_handlePing(LinkInterface* link, mavlink_message_t& message)
...@@ -1654,8 +1656,8 @@ void Vehicle::_handlePing(LinkInterface* link, mavlink_message_t& message) ...@@ -1654,8 +1656,8 @@ void Vehicle::_handlePing(LinkInterface* link, mavlink_message_t& message)
mavlink_message_t msg; mavlink_message_t msg;
mavlink_msg_ping_decode(&message, &ping); mavlink_msg_ping_decode(&message, &ping);
mavlink_msg_ping_pack_chan(_mavlink->getSystemId(), mavlink_msg_ping_pack_chan(static_cast<uint8_t>(_mavlink->getSystemId()),
_mavlink->getComponentId(), static_cast<uint8_t>(_mavlink->getComponentId()),
priorityLink()->mavlinkChannel(), priorityLink()->mavlinkChannel(),
&msg, &msg,
ping.time_usec, ping.time_usec,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment