diff --git a/src/Vehicle/CompInfoGeneral.cc b/src/Vehicle/CompInfoGeneral.cc index 2d2f9f9..7a297e2 100644 --- a/src/Vehicle/CompInfoGeneral.cc +++ b/src/Vehicle/CompInfoGeneral.cc @@ -76,7 +76,7 @@ void CompInfoGeneral::setJson(const QString& metadataJsonFileName, const QString continue; Uris uris; uris.uriMetaData = typeValue["uri"].toString(); - uris.crcMetaData = typeValue["fileCrc"].toVariant().toLongLong(); // Note: can't use toInt() + uris.crcMetaData = typeValue["fileCrc"].toVariant().toLongLong(); // Note: can't use toInt(), as it returns 0 when exceeding 2^31 uris.crcMetaDataValid = typeValue.toObject().contains("fileCrc"); uris.uriMetaDataFallback = typeValue["uriFallback"].toString(); uris.crcMetaDataFallback = typeValue["fileCrcFallback"].toVariant().toLongLong(); @@ -87,6 +87,13 @@ void CompInfoGeneral::setJson(const QString& metadataJsonFileName, const QString uris.uriTranslationFallback = typeValue["translationUriFallback"].toString(); uris.crcTranslationFallback = typeValue["translationFileCrcFallback"].toVariant().toLongLong(); uris.crcTranslationFallbackValid = typeValue.toObject().contains("translationFileCrcFallback"); + + if (uris.uriMetaData.isEmpty() || !uris.crcMetaDataValid) { + qCWarning(CompInfoGeneralLog) << "Metadata missing required fields: type:uri:crcValid" << type << + uris.uriMetaData << uris.crcMetaDataValid; + continue; + } + _supportedTypes[(COMP_METADATA_TYPE)type] = uris; qCDebug(CompInfoGeneralLog) << "Metadata type : uri : crc" << type << uris.uriMetaData << uris.crcMetaData; } diff --git a/src/comm/MockLink.cc b/src/comm/MockLink.cc index 3c7d47b..b36c1f2 100644 --- a/src/comm/MockLink.cc +++ b/src/comm/MockLink.cc @@ -1576,7 +1576,7 @@ bool MockLink::_handleRequestMessage(const mavlink_command_long_t& request, bool switch ((int)request.param1) { case MAVLINK_MSG_ID_COMPONENT_INFORMATION: if (_firmwareType == MAV_AUTOPILOT_PX4) { - _sendVersionMetaData(); + _sendGeneralMetaData(); return true; } break; @@ -1609,7 +1609,7 @@ bool MockLink::_handleRequestMessage(const mavlink_command_long_t& request, bool return false; } -void MockLink::_sendVersionMetaData(void) +void MockLink::_sendGeneralMetaData(void) { mavlink_message_t responseMsg; #if 1 @@ -1617,7 +1617,7 @@ void MockLink::_sendVersionMetaData(void) #else char metaDataURI[MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_GENERAL_METADATA_URI_LEN] = "https://bit.ly/31nm0fs"; #endif - char peripheralsMetaDataURI[MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_PERIPHERALS_METADATA_URI_LEN] = "https://bit.ly/31nm0fs"; + char peripheralsMetaDataURI[MAVLINK_MSG_COMPONENT_INFORMATION_FIELD_PERIPHERALS_METADATA_URI_LEN] = ""; mavlink_msg_component_information_pack_chan(_vehicleSystemId, _vehicleComponentId, diff --git a/src/comm/MockLink.h b/src/comm/MockLink.h index f9310ef..aad8d2f 100644 --- a/src/comm/MockLink.h +++ b/src/comm/MockLink.h @@ -227,7 +227,7 @@ private: void _logDownloadWorker (void); void _sendADSBVehicles (void); void _moveADSBVehicle (void); - void _sendVersionMetaData (void); + void _sendGeneralMetaData (void); static MockLink* _startMockLinkWorker(QString configName, MAV_AUTOPILOT firmwareType, MAV_TYPE vehicleType, bool sendStatusText, MockConfiguration::FailureMode_t failureMode); static MockLink* _startMockLink(MockConfiguration* mockConfig);