洞察探索open banking如何通过小程序容器技术助力金融企业实现数据安全和数字化转型
1399
2022-11-18
QGC -- 配置相机参数数据流说明(1)
一、相关配置文件及对应画面
1.界面GeneralSettings.qml
2.Video.SettingsGroup.json对应界面如下:
{ "name": "VideoSource", "shortDescription": "Video source", "longDescription": "Source for video. UDP, TCP, RTSP and UVC Cameras may be supported depending on Vehicle and ground station version.", "type": "string", "defaultValue": ""},{ "name": "VideoUDPPort", "shortDescription": "Video UDP Port", "longDescription": "UDP port to bind to for video stream.", "type": "uint16", "min": 1025, "defaultValue": 5600},
3.相机配置参数写到QGroundControl.ini配置文件
[General]AudioMuted=trueBaseDeviceFontPointSize=13DroneConnectionTimeout=5MaxDiskCache=1024MaxMemoryCache=128SavePath=/home/xt/\x6587\x6863/QGroundControlSettingsVersion=7StreamEnabled=trueVideoRTSPUrl=rtsp://127.0.0.1:8554/VideoSource=UDP Video StreamVideoUDPPort=5600VirtualTabletJoystick=falseVisibleWidgets=_geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\0\x41\0\0\0\x34\0\0\x4@\0\0\x2\x8b\0\0\0\x41\0\0\0P\0\0\x4@\0\0\x2\x8b\0\0\0\0\0\0\0\0\x6\x8e)
二、程序片段说明 GeneralSettings.qml
Row { spacing: ScreenTools.defaultFontPixelWidth visible: QGroundControl.settingsManager.videoSettings.videoSource.visible QGCLabel { text: qsTr("Video Source:") width: _labelWidth anchors.verticalCenter: parent.verticalCenter } FactComboBox { id: videoSource width: _editFieldWidth indexModel: false fact: QGroundControl.settingsManager.videoSettings.videoSource anchors.verticalCenter: parent.verticalCenter } } Row { spacing: ScreenTools.defaultFontPixelWidth visible: QGroundControl.settingsManager.videoSettings.udpPort.visible && QGroundControl.videoManager.isGStreamer && videoSource.currentIndex === 1 QGCLabel { text: qsTr("UDP Port:") width: _labelWidth anchors.verticalCenter: parent.verticalCenter } FactTextField { width: _editFieldWidth fact: QGroundControl.settingsManager.videoSettings.udpPort anchors.verticalCenter: parent.verticalCenter } }
对QGroundControl.settingsManager.videoSettings.videoSource说明
Fact* VideoSettings::videoSource(void){ if (!_videoSourceFact) { _videoSourceFact = _createSettingsFact(videoSourceName); connect(_videoSourceFact, &Fact::valueChanged, this, &VideoSettings::_configChanged); } return _videoSourceFact;}
const char* VideoSettings::videoSourceName = "VideoSource";
SettingsGroup::SettingsGroup(const QString& name, const QString& settingsGroup, QObject* parent) : QObject(parent) , _name(name) , _settingsGroup(settingsGroup) , _visible(qgcApp()->toolbox()->corePlugin()->overrideSettingsGroupVisibility(name)){ QString jsonNameFormat(":/json/%1.SettingsGroup.json"); ///home/xt/GDU/protocol3/qgroundcontrol/src/Settings 根据传进来值创建json _nameToMetaDataMap = FactMetaData::createMapFromJsonFile(jsonNameFormat.arg(name), this);//读取json文件--》json对象---》createFromJsonObject}SettingsFact* SettingsGroup::_createSettingsFact(const QString& name){ return new SettingsFact(_settingsGroup, _nameToMetaDataMap[name], this);}
VideoSettings::VideoSettings(QObject* parent) : SettingsGroup(videoSettingsGroupName, QString() /* root settings group */, parent)
const char* VideoSettings::videoSettingsGroupName = "Video";
SettingsFact::SettingsFact(QString settingGroup, FactMetaData* metaData, QObject* parent) : Fact(0, metaData->name(), metaData->type(), parent) , _settingGroup(settingGroup) , _visible(true){ QSettings settings; if (!_settingGroup.isEmpty()) { settings.beginGroup(_settingGroup); } // Allow core plugin a chance to override the default value _visible = qgcApp()->toolbox()->corePlugin()->adjustSettingMetaData(*metaData); setMetaData(metaData); QVariant rawDefaultValue = metaData->rawDefaultValue(); if (_visible) { QVariant typedValue; QString errorString; metaData->convertAndValidateRaw(settings.value(_name, rawDefaultValue), true /* conertOnly */, typedValue, errorString); _rawValue = typedValue; } else { // Setting is not visible, force to default value always settings.setValue(_name, rawDefaultValue); _rawValue = rawDefaultValue; } connect(this, &Fact::rawValueChanged, this, &SettingsFact::_rawValueChanged);}
const char* FactMetaData::_decimalPlacesJsonKey = "decimalPlaces";const char* FactMetaData::_nameJsonKey = "name";const char* FactMetaData::_typeJsonKey = "type";const char* FactMetaData::_shortDescriptionJsonKey = "shortDescription";const char* FactMetaData::_longDescriptionJsonKey = "longDescription";const char* FactMetaData::_unitsJsonKey = "units";const char* FactMetaData::_defaultValueJsonKey = "defaultValue";const char* FactMetaData::_mobileDefaultValueJsonKey = "mobileDefaultValue";const char* FactMetaData::_minJsonKey = "min";const char* FactMetaData::_maxJsonKey = "max";const char* FactMetaData::_hasControlJsonKey = "control";
三、ParameterEditorDialog.qml对话框
accept() { if (bitmaskColumn.visible && !manualEntry.checked) { fact.value = bitmaskValue(); fact.valueChanged(fact.value) hideDialog(); } else if (factCombo.visible && !manualEntry.checked) { fact.enumIndex = factCombo.currentIndex hideDialog() } else { var errorString = fact.validate(valueField.text, forceSave.checked) if (errorString === "") { fact.value = valueField.text fact.valueChanged(fact.value) hideDialog() } else { validationError.text = errorString if (_allowForceSave) { forceSave.visible = true } } } } function reject() { fact.valueChanged(fact.value) hideDialog(); }
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~