7import QGroundControl.FactControls
8import QGroundControl.Controls
13 property real _margins: ScreenTools.defaultFontPixelWidth
14 property real _labelWidth: ScreenTools.defaultFontPixelWidth * 28
15 property real _valueWidth: ScreenTools.defaultFontPixelWidth * 24
16 property real _columnSpacing: ScreenTools.defaultFontPixelHeight * 0.25
17 property real _comboFieldWidth: ScreenTools.defaultFontPixelWidth * 30
18 property real _valueFieldWidth: ScreenTools.defaultFontPixelWidth * 10
19 property int _borderWidth: 3
20 // Flags visual properties
21 property real flagsWidth: ScreenTools.defaultFontPixelWidth * 15
22 property real flagsHeight: ScreenTools.defaultFontPixelWidth * 7
23 property int radiusFlags: 5
25 // Flag to get active vehicle and active RID
26 property var _activeRID: _activeVehicle && _activeVehicle.remoteIDManager ? _activeVehicle.remoteIDManager : null
28 // Healthy connection with RID device
29 property bool commsGood: _activeVehicle && _activeVehicle.remoteIDManager ? _activeVehicle.remoteIDManager.commsGood : false
32 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
33 property var _offlineVehicle: QGroundControl.multiVehicleManager.offlineEditingVehicle
34 property int _regionOperation: QGroundControl.settingsManager.remoteIDSettings.region.value
35 property int _locationType: QGroundControl.settingsManager.remoteIDSettings.locationType.value
36 property int _classificationType: QGroundControl.settingsManager.remoteIDSettings.classificationType.value
37 property var _remoteIDManager: _activeVehicle ? _activeVehicle.remoteIDManager : null
40 property var remoteIDSettings:QGroundControl.settingsManager.remoteIDSettings
41 property Fact regionFact: remoteIDSettings.region
42 property Fact sendOperatorIdFact: remoteIDSettings.sendOperatorID
43 property Fact locationTypeFact: remoteIDSettings.locationType
44 property Fact operatorIDFact: remoteIDSettings.operatorID
45 property bool isEURegion: regionFact.rawValue === RemoteIDSettings.RegionOperation.EU
46 property bool isFAARegion: regionFact.rawValue === RemoteIDSettings.RegionOperation.FAA
47 property real textFieldWidth: ScreenTools.defaultFontPixelWidth * 24
48 property real textLabelWidth: ScreenTools.defaultFontPixelWidth * 30
51 property var gcsPosition: QGroundControl.qgcPositionManger.gcsPosition
52 property real gcsHeading: QGroundControl.qgcPositionManger.gcsHeading
53 property real gcsHDOP: QGroundControl.qgcPositionManger.gcsPositionHorizontalAccuracy
54 property string gpsDisabled: "Disabled"
55 property string gpsUdpPort: "UDP Port"
57 QGCPalette { id: qgcPal }
59 // Function to get the corresponding Self ID label depending on the Self ID Type selected
60 function getSelfIdLabelText() {
61 switch (selfIDComboBox.currentIndex) {
63 return QGroundControl.settingsManager.remoteIDSettings.selfIDFree.shortDescription
66 return QGroundControl.settingsManager.remoteIDSettings.selfIDEmergency.shortDescription
69 return QGroundControl.settingsManager.remoteIDSettings.selfIDExtended.shortDescription
72 return QGroundControl.settingsManager.remoteIDSettings.selfIDFree.shortDescription
76 // Function to get the corresponding Self ID fact depending on the Self ID Type selected
77 function getSelfIDFact() {
78 switch (selfIDComboBox.currentIndex) {
80 return QGroundControl.settingsManager.remoteIDSettings.selfIDFree
83 return QGroundControl.settingsManager.remoteIDSettings.selfIDEmergency
86 return QGroundControl.settingsManager.remoteIDSettings.selfIDExtended
89 return QGroundControl.settingsManager.remoteIDSettings.selfIDFree
97 height: flagsColumn.height
98 Layout.alignment: Qt.AlignHCenter
102 anchors.horizontalCenter: parent.horizontalCenter
105 // ---------------------------------------- STATUS -----------------------------------------
106 // Status flags. Visual representation for the state of all necesary information for remoteID
110 Layout.preferredHeight: statusGrid.height + (_margins * 2)
111 Layout.preferredWidth: statusGrid.width + (_margins * 2)
112 color: qgcPal.windowShade
113 visible: _activeVehicle
114 Layout.fillWidth: true
118 anchors.margins: _margins
119 anchors.top: parent.top
120 anchors.horizontalCenter: parent.horizontalCenter
122 rowSpacing: _margins * 3
123 columnSpacing: _margins * 2
127 Layout.preferredHeight: flagsHeight
128 Layout.preferredWidth: flagsWidth
129 color: _activeRID ? (_remoteIDManager.armStatusGood ? qgcPal.colorGreen : qgcPal.colorRed) : qgcPal.colorGrey
135 text: qsTr("ARM STATUS")
136 wrapMode: Text.WordWrap
137 horizontalAlignment: Text.AlignHCenter
138 verticalAlignment: Text.AlignVCenter
145 Layout.preferredHeight: flagsHeight
146 Layout.preferredWidth: flagsWidth
147 color: _activeRID ? (_remoteIDManager.commsGood ? qgcPal.colorGreen : qgcPal.colorRed) : qgcPal.colorGrey
152 text: _activeRID && _remoteIDManager.commsGood ? qsTr("RID COMMS") : qsTr("NOT CONNECTED")
153 wrapMode: Text.WordWrap
154 horizontalAlignment: Text.AlignHCenter
155 verticalAlignment: Text.AlignVCenter
162 Layout.preferredHeight: flagsHeight
163 Layout.preferredWidth: flagsWidth
164 color: _activeRID ? (_remoteIDManager.gcsGPSGood ? qgcPal.colorGreen : qgcPal.colorRed) : qgcPal.colorGrey
170 text: qsTr("GCS GPS")
171 wrapMode: Text.WordWrap
172 horizontalAlignment: Text.AlignHCenter
173 verticalAlignment: Text.AlignVCenter
180 Layout.preferredHeight: flagsHeight
181 Layout.preferredWidth: flagsWidth
182 color: _activeRID ? (_remoteIDManager.basicIDGood ? qgcPal.colorGreen : qgcPal.colorRed) : qgcPal.colorGrey
188 text: qsTr("BASIC ID")
189 wrapMode: Text.WordWrap
190 horizontalAlignment: Text.AlignHCenter
191 verticalAlignment: Text.AlignVCenter
198 Layout.preferredHeight: flagsHeight
199 Layout.preferredWidth: flagsWidth
200 color: _activeRID ? (_remoteIDManager.operatorIDGood ? qgcPal.colorGreen : qgcPal.colorRed) : qgcPal.colorGrey
202 visible: commsGood && _activeRID ? (QGroundControl.settingsManager.remoteIDSettings.sendOperatorID.value || _regionOperation == RemoteIDSettings.RegionOperation.EU) : false
206 text: qsTr("OPERATOR ID")
207 wrapMode: Text.WordWrap
208 horizontalAlignment: Text.AlignHCenter
209 verticalAlignment: Text.AlignVCenter
219 spacing: ScreenTools.defaultFontPixelWidth
223 function onRawValueChanged(value) {
224 if (value === RemoteIDSettings.RegionOperation.EU) {
225 sendOperatorIdFact.rawValue = true
226 } else if (value === RemoteIDSettings.RegionOperation.FAA) {
227 locationTypeFact.value = RemoteIDSettings.LocationType.LIVE
233 spacing: ScreenTools.defaultFontPixelHeight / 2
234 Layout.alignment: Qt.AlignTop
236 SettingsGroupLayout {
237 Layout.fillWidth: true
239 LabelledFactComboBox {
240 label: fact.shortDescription
241 fact: QGroundControl.settingsManager.remoteIDSettings.region
242 visible: QGroundControl.settingsManager.remoteIDSettings.region.visible
243 Layout.fillWidth: true
246 SettingsGroupLayout {
247 outerBorderColor: _activeRID ? (_remoteIDManager.armStatusGood ? defaultBorderColor : qgcPal.colorRed) : defaultBorderColor
248 visible: armStatusLabel.labelText !== ""
251 label: qsTr("Arm Status Error")
252 labelText: _remoteIDManager?_remoteIDManager.armStatusError:"Vehicle Not Connected"
253 visible: labelText !== ""
254 Layout.fillWidth: true
258 SettingsGroupLayout {
259 heading: qsTr("Basic ID")
260 headingDescription: qsTr("If Basic ID is already set on the RID device, this will be registered as Basic ID 2")
261 Layout.fillWidth: true
262 Layout.preferredWidth: textLabelWidth
263 outerBorderColor: _activeRID ? (_remoteIDManager.basicIDGood ? defaultBorderColor : qgcPal.colorRed) : defaultBorderColor
267 id: sendBasicIDSlider
268 text: qsTr("Broadcast")
270 visible: _fact.visible
271 Layout.fillWidth: true
273 property Fact _fact: remoteIDSettings.sendBasicID
276 LabelledFactComboBox {
278 label: _fact.shortDescription
281 visible: _fact.visible
282 enabled: sendBasicIDSlider._fact.rawValue
283 Layout.fillWidth: true
285 property Fact _fact: remoteIDSettings.basicIDType
288 LabelledFactComboBox {
289 label: _fact.shortDescription
292 visible: _fact.visible
293 enabled: sendBasicIDSlider._fact.rawValue
294 Layout.fillWidth: true
296 property Fact _fact: remoteIDSettings.basicIDUaType
299 LabelledFactTextField {
300 label: _fact.shortDescription
302 visible: _fact.visible
303 enabled: sendBasicIDSlider._fact.rawValue
304 textField.maximumLength: 20
305 Layout.fillWidth: true
306 textFieldPreferredWidth: textFieldWidth
308 property Fact _fact: remoteIDSettings.basicID
312 SettingsGroupLayout {
313 heading: qsTr("Operator ID")
314 Layout.fillWidth: true
317 text: qsTr("Broadcast%1").arg(isEURegion ? " (EU Required)" : "")
318 fact: sendOperatorIdFact
319 visible: sendOperatorIdFact.visible
321 Layout.fillWidth: true
323 property Fact _fact: remoteIDSettings.sendOperatorID
326 LabelledFactComboBox {
327 id: regionOperationCombo
328 label: _fact.shortDescription
331 visible: _fact.visible && (_fact.enumValues.length > 1)
332 Layout.fillWidth: true
334 property Fact _fact: remoteIDSettings.operatorIDType
338 spacing: ScreenTools.defaultFontPixelWidth * 2
341 Layout.fillWidth: true
342 text: operatorIDFact.shortDescription + (regionOperationCombo.visible ? "" : qsTr(" (%1)").arg(regionOperationCombo.comboBox.currentText))
346 id: operatorIDTextField
347 Layout.preferredWidth: textFieldWidth
348 Layout.fillWidth: true
349 text: operatorIDFact.valueString
350 visible: operatorIDFact.visible
351 maximumLength: 20 // Maximum defined by Mavlink definition of OPEN_DRONE_ID_OPERATOR_ID message
353 property bool operatorIDInvalid: ((_regionOperation === RemoteIDSettings.RegionOperation.EU || remoteIDSettings.sendOperatorID.value) &&
354 _activeRID && !_remoteIDManager.operatorIDGood)
356 onOperatorIDInvalidChanged: {
357 if (operatorIDInvalid) {
358 operatorIDTextField.showValidationError(qsTr("Invalid Operator ID"), operatorIDFact.valueString, false /* preventViewSwitch */)
360 operatorIDTextField.clearValidationError(false /* preventViewSwitch */)
365 if (_activeVehicle) {
366 _remoteIDManager.checkOperatorID(text)
368 _offlineVehicle.remoteIDManager.checkOperatorID(text)
370 operatorIDFact.value = text
374 if (_activeVehicle) {
375 _remoteIDManager.setOperatorID()
377 _offlineVehicle.remoteIDManager.setOperatorID()
384 SettingsGroupLayout {
385 heading: qsTr("Self ID")
386 headingDescription: qsTr("If an emergency is declared, Emergency Text will be broadcast even if Broadcast setting is not enabled.")
387 Layout.fillWidth: true
388 Layout.preferredWidth: textLabelWidth
392 text: qsTr("Broadcast")
394 visible: _fact.visible
395 Layout.fillWidth: true
397 property Fact _fact: remoteIDSettings.sendSelfID
400 LabelledFactComboBox {
402 label: qsTr("Broadcast Message")
405 visible: _fact.visible
406 enabled: sendSelfIDSlider._fact.rawValue
407 Layout.fillWidth: true
409 property Fact _fact: remoteIDSettings.selfIDType
412 LabelledFactTextField {
413 label: _fact.shortDescription
415 visible: _fact.visible
416 enabled: sendSelfIDSlider._fact.rawValue
417 textField.maximumLength: 23
418 Layout.fillWidth: true
419 textFieldPreferredWidth: textFieldWidth
421 property Fact _fact: remoteIDSettings.selfIDFree
424 LabelledFactTextField {
425 label: _fact.shortDescription
427 visible: _fact.visible
428 enabled: sendSelfIDSlider._fact.rawValue
429 textField.maximumLength: 23
430 Layout.fillWidth: true
431 textFieldPreferredWidth: textFieldWidth
433 property Fact _fact: remoteIDSettings.selfIDExtended
436 LabelledFactTextField {
437 label: _fact.shortDescription
439 visible: _fact.visible
440 textField.maximumLength: 23
441 Layout.fillWidth: true
442 textFieldPreferredWidth: textFieldWidth
444 property Fact _fact: remoteIDSettings.selfIDEmergency
450 spacing: ScreenTools.defaultFontPixelHeight / 2
451 Layout.alignment: Qt.AlignTop
452 SettingsGroupLayout {
453 heading: qsTr("GroundStation Location")
454 Layout.fillWidth: true
455 outerBorderColor : _activeRID ? (_remoteIDManager.gcsGPSGood ? defaultBorderColor : qgcPal.colorRed) : defaultBorderColor
456 LabelledFactComboBox {
457 label: locationTypeFact.shortDescription
458 fact: locationTypeFact
460 Layout.fillWidth: true
463 LabelledFactTextField {
464 label: _fact.shortDescription
466 textField.maximumLength: 20
467 enabled: locationTypeFact.rawValue === RemoteIDSettings.LocationType.FIXED
468 Layout.fillWidth: true
469 textFieldPreferredWidth: textFieldWidth
471 property Fact _fact: remoteIDSettings.latitudeFixed
474 LabelledFactTextField {
475 label: _fact.shortDescription
477 textField.maximumLength: 20
478 enabled: locationTypeFact.rawValue === RemoteIDSettings.LocationType.FIXED
479 Layout.fillWidth: true
480 textFieldPreferredWidth: textFieldWidth
482 property Fact _fact: remoteIDSettings.longitudeFixed
485 LabelledFactTextField {
486 label: _fact.shortDescription
488 textField.maximumLength: 20
489 enabled: locationTypeFact.rawValue === RemoteIDSettings.LocationType.FIXED
490 Layout.fillWidth: true
491 textFieldPreferredWidth: textFieldWidth
493 property Fact _fact: remoteIDSettings.altitudeFixed
498 visible: !ScreenTools.isMobile
499 && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.visible
500 && QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.visible
501 && _locationType !== RemoteIDSettings.LocationType.TAKEOFF
502 anchors.margins: _margins
503 rowSpacing: _margins * 3
505 columnSpacing: _margins * 2
506 Layout.alignment: Qt.AlignHCenter
509 text: qsTr("NMEA External GPS Device")
513 Layout.preferredWidth: _comboFieldWidth
518 onActivated: (index) => {
520 QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.value = textAt(index);
523 Component.onCompleted: {
524 model.append({text: gpsDisabled})
525 model.append({text: gpsUdpPort})
527 for (var i in QGroundControl.linkManager.serialPorts) {
528 nmeaPortCombo.model.append({text:QGroundControl.linkManager.serialPorts[i]})
530 var index = nmeaPortCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaPort.valueString);
531 nmeaPortCombo.currentIndex = index;
532 if (QGroundControl.linkManager.serialPorts.length === 0) {
533 nmeaPortCombo.model.append({text: "Serial <none available>"})
539 visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
540 text: qsTr("NMEA GPS Baudrate")
543 visible: nmeaPortCombo.currentText !== gpsUdpPort && nmeaPortCombo.currentText !== gpsDisabled
545 Layout.preferredWidth: _comboFieldWidth
546 model: [1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600]
548 onActivated: (index) => {
550 QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.value = textAt(index);
553 Component.onCompleted: {
554 var index = nmeaBaudCombo.find(QGroundControl.settingsManager.autoConnectSettings.autoConnectNmeaBaud.valueString);
555 nmeaBaudCombo.currentIndex = index;
560 text: qsTr("NMEA stream UDP port")
561 visible: nmeaPortCombo.currentText === gpsUdpPort
564 visible: nmeaPortCombo.currentText === gpsUdpPort
565 Layout.preferredWidth: _valueFieldWidth
566 fact: QGroundControl.settingsManager.autoConnectSettings.nmeaUdpPort
572 SettingsGroupLayout {
573 heading: qsTr("EU Vehicle Info")
575 Layout.fillWidth: true
578 id: euProvideInfoSlider
579 text: qsTr("Provide Information")
580 checked: _fact.rawValue === RemoteIDSettings.ClassificationType.EU
581 visible: _fact.visible
582 Layout.fillWidth: true
583 onClicked: _fact.rawValue = !_fact.rawValue
585 property Fact _fact: remoteIDSettings.classificationType
588 LabelledFactComboBox {
590 label: _fact.shortDescription
593 visible: _fact.visible
594 enabled: euProvideInfoSlider.checked
595 Layout.fillWidth: true
597 property Fact _fact: remoteIDSettings.categoryEU
600 LabelledFactComboBox {
601 label: _fact.shortDescription
604 visible: _fact.visible
605 enabled: euCategoryCombo.enabled
606 Layout.fillWidth: true
608 property Fact _fact: remoteIDSettings.classEU