Commit 61e24c4a authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #5743 from mavlink/cameraManagement

Properly handle camera info request and response.
parents 72367459 a9d5a133
...@@ -78,7 +78,7 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message) ...@@ -78,7 +78,7 @@ QGCCameraManager::_handleHeartbeat(const mavlink_message_t &message)
mavlink_msg_heartbeat_decode(&message, &heartbeat); mavlink_msg_heartbeat_decode(&message, &heartbeat);
//-- If this heartbeat is from a different node within the vehicle //-- If this heartbeat is from a different node within the vehicle
if(_vehicleReadyState && _vehicle->id() == message.sysid && _vehicle->defaultComponentId() != message.compid) { if(_vehicleReadyState && _vehicle->id() == message.sysid && _vehicle->defaultComponentId() != message.compid) {
if(!_cameraInfoRequested[message.compid]) { if(!_cameraInfoRequested.contains(message.compid)) {
_cameraInfoRequested[message.compid] = true; _cameraInfoRequested[message.compid] = true;
//-- Request camera info //-- Request camera info
_requestCameraInfo(message.compid); _requestCameraInfo(message.compid);
...@@ -110,6 +110,10 @@ QGCCameraManager::_findCamera(int id) ...@@ -110,6 +110,10 @@ QGCCameraManager::_findCamera(int id)
void void
QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message) QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message)
{ {
//-- Have we requested it?
if(_cameraInfoRequested.contains(message.compid) && _cameraInfoRequested[message.compid]) {
//-- Flag it as done
_cameraInfoRequested[message.compid] = false;
mavlink_camera_information_t info; mavlink_camera_information_t info;
mavlink_msg_camera_information_decode(&message, &info); mavlink_msg_camera_information_decode(&message, &info);
qCDebug(CameraManagerLog) << "_handleCameraInfo:" << (const char*)(void*)&info.model_name[0] << (const char*)(void*)&info.vendor_name[0] << "Comp ID:" << message.compid; qCDebug(CameraManagerLog) << "_handleCameraInfo:" << (const char*)(void*)&info.model_name[0] << (const char*)(void*)&info.vendor_name[0] << "Comp ID:" << message.compid;
...@@ -119,6 +123,7 @@ QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message) ...@@ -119,6 +123,7 @@ QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message)
_cameras.append(pCamera); _cameras.append(pCamera);
emit camerasChanged(); emit camerasChanged();
} }
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
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