QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GPSReceiverStatus.qml
Go to the documentation of this file.
1pragma ComponentBehavior: Bound
2
3import QtQuick
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.FactControls
9import QGroundControl.GPS
10
11/// Live GNSS receiver status, shared by the GPS indicator and the receiver settings page.
12SettingsGroupLayout {
13 id: root
14
15 property GPSReceiver receiver: QGroundControl.gpsManager.receiver
16 /// The receiver's status Facts.
17 property GPSReceiverFactGroup facts: root.receiver.facts
18 /// Keep the group visible without a receiver, showing disconnectedText.
19 property bool showWhenDisconnected: false
20 property string disconnectedText: qsTr("No GNSS receiver connected.")
21
22 readonly property bool _connected: root.facts.telemetryAvailable
23 readonly property gpsReceiverPresentation _presentation: root.receiver.activePresentation
24 readonly property bool _surveyConnected: root.receiver.activeBaseMode === BaseModeDefinition.BaseSurveyIn
25 // A finished survey is the moment to keep its position, so the next connection can start as a fixed base.
26 readonly property bool _surveyComplete: root._connected && root._surveyConnected && !root.facts.active.value
27 && root.facts.canSaveCurrentBasePosition
28 readonly property bool _surveySaved: root.facts.currentBasePositionSaved
29
30 heading: qsTr("GNSS Receiver Status")
31 visible: root._connected || root.receiver.hasReceiver || root.receiver.reconnecting || root.showWhenDisconnected
32
33 /// A status Fact, labelled with its description.
34 component FactRow: LabelledLabel {
35 required property Fact fact
36 label: fact.shortDescription
37 labelText: fact.enumOrValueString
38 }
39
40 /// A label and a value reported from outside, such as a long endpoint, which wraps instead of widening the panel.
41 component WrappingRow: RowLayout {
42 property alias label: rowLabel.text
43 property alias labelText: rowValue.text
44
45 spacing: ScreenTools.defaultFontPixelWidth * 2
46
47 QGCLabel { id: rowLabel }
48 GPSNoteLabel {
49 id: rowValue
50 horizontalAlignment: Text.AlignRight
51 wrapMode: Text.WrapAnywhere
52 }
53 }
54
55 GPSNoteLabel {
56 objectName: "rtkReceiverStatus"
57 text: root.receiver.statusText || root.disconnectedText
58 }
59
60 LabelledLabel {
61 objectName: "rtkDetectedReceiver"
62 visible: root.receiver.hasReceiver && root.receiver.detectedReceiver.length > 0
63 label: qsTr("Detected")
64 labelText: root.receiver.detectedReceiver
65 labelTextFormat: Text.PlainText
66 }
67
68 WrappingRow {
69 objectName: "rtkReceiverIdentity"
70 visible: root._connected && root.receiver.receiverIdentity.length > 0
71 label: qsTr("Receiver")
72 labelText: root.receiver.receiverIdentity
73 }
74
75 WrappingRow {
76 objectName: "rtkReceiverEndpoint"
77 visible: root.receiver.hasReceiver && root.receiver.activeEndpoint.length > 0
78 label: qsTr("Connection")
79 labelText: root.receiver.activeEndpoint
80 }
81
82 // Values the receiver does not report are not shown. Each row appears with its value, at the Facts' update rate.
83 FactRow {
84 objectName: "rtkFixType"
85 fact: root.facts.fixType
86 visible: root._connected && root.facts.fixType.value !== GPSFixQuality.Unknown
87 }
88
89 FactRow {
90 objectName: "rtkSatellitesInView"
91 fact: root.facts.numSatellites
92 visible: root._connected && root.facts.numSatellites.value >= 0
93 }
94
95 FactRow {
96 objectName: "rtkSatellitesUsed"
97 fact: root.facts.numSatellitesUsed
98 visible: root._connected && root.facts.numSatellitesUsed.value >= 0
99 }
100
101 FactRow {
102 objectName: "rtkJamming"
103 fact: root.facts.jammingState
104 visible: root._connected && root.facts.jammingState.rawValue > 0
105 }
106
107 FactRow {
108 objectName: "rtkSpoofing"
109 fact: root.facts.spoofingState
110 visible: root._connected && root.facts.spoofingState.rawValue > 0
111 }
112
113 FactRow {
114 objectName: "rtkAntenna"
115 fact: root.facts.antennaState
116 visible: root._connected && root.facts.antennaState.rawValue > 0
117 }
118
119 LabelledFactLabel {
120 objectName: "rtkSurveyDuration"
121 label: root._presentation.acceptedObservationTime ? qsTr("Accepted observation time") : qsTr("Duration")
122 fact: root.facts.currentDuration
123 visible: root._connected && root._presentation.reportsSurveyDuration && root._surveyConnected
124 }
125
126 LabelledFactLabel {
127 objectName: "rtkSurveyAccuracy"
128 label: root.facts.valid.value ? qsTr("Accuracy") : qsTr("Current Accuracy")
129 fact: root.facts.currentAccuracy
130 visible: root._connected && root._surveyConnected && root.facts.currentAccuracy.value > 0
131 }
132
133 GPSNoteLabel {
134 objectName: "rtkSurveyCompletePrompt"
135 visible: root._surveyComplete
136 text: root._surveySaved
137 ? qsTr("Survey position saved. Select Fixed position to start from it next time.")
138 : qsTr("Survey complete. Save this position to start the base from it next time.")
139 }
140
141 QGCButton {
142 objectName: "rtkSurveySaveButton"
143 Layout.fillWidth: true
144 Layout.minimumWidth: 0
145 wrapMode: Text.Wrap
146 visible: root._surveyComplete && !root._surveySaved
147 text: qsTr("Save Survey Position")
148 onClicked: QGroundControl.gpsManager.saveCurrentBasePosition()
149 }
150}