5import QGroundControl.Controls
10 property var rtcmMavlink: null
12 property var _ntripMgr: QGroundControl.ntripManager
13 readonly property int _status: root._ntripMgr ? root._ntripMgr.connectionStatus : NTRIPManager.Disconnected
14 readonly property var _stats: root._ntripMgr ? root._ntripMgr.connectionStats : null
15 readonly property bool _connected: root._status === NTRIPManager.Connected
16 property bool _dataStale: root._stats ? root._stats.dataStale : false
17 property string _valueNA: qsTr("-.--")
19 readonly property real _dataWarningLimitBytes: 50 * 1024 * 1024 // 50 MB
21 function _formatDataSize(bytes) {
22 if (bytes < 1024) return bytes + " B"
23 if (bytes < 1048576) return (bytes / 1024).toFixed(1) + " KB"
24 return (bytes / 1048576).toFixed(1) + " MB"
27 function _formatDataRate(bytesPerSec) {
28 if (bytesPerSec < 1024) return bytesPerSec.toFixed(0) + " B/s"
29 return (bytesPerSec / 1024).toFixed(1) + " KB/s"
32 spacing: ScreenTools.defaultFontPixelHeight / 2
33 visible: root._status !== NTRIPManager.Disconnected
35 QGCPalette { id: qgcPal }
38 text: qsTr("Connected but no data received recently")
39 color: qgcPal.colorOrange
40 wrapMode: Text.WordWrap
41 font.pointSize: ScreenTools.smallFontPointSize
42 visible: root._dataStale && root._connected
43 Layout.fillWidth: true
47 label: qsTr("Mountpoint")
48 labelText: QGroundControl.settingsManager.ntripSettings.ntripMountpoint.valueString
49 visible: QGroundControl.settingsManager.ntripSettings.ntripMountpoint.valueString !== ""
54 label: qsTr("Messages")
55 labelText: root._stats ? root._stats.messagesReceived : ""
56 visible: root._connected
57 && root._stats && root._stats.messagesReceived > 0
61 Layout.fillWidth: true
62 spacing: ScreenTools.defaultFontPixelHeight / 4
63 visible: root._connected
64 && root._stats && root._stats.messageCountsById.length > 0
67 text: qsTr("Message Types")
68 font.pointSize: ScreenTools.smallFontPointSize
69 color: qgcPal.colorGrey
73 Layout.fillWidth: true
74 spacing: ScreenTools.defaultFontPixelWidth / 2
77 model: root._stats ? root._stats.messageCountsById : []
81 required property var modelData
83 readonly property string _idLabel: chip.modelData[0] === 0
85 : chip.modelData[0].toString()
87 implicitWidth: chipLabel.implicitWidth + ScreenTools.defaultFontPixelWidth * 1.2
88 implicitHeight: chipLabel.implicitHeight + ScreenTools.defaultFontPixelHeight * 0.3
89 radius: implicitHeight / 2
90 color: qgcPal.windowShade
91 border.color: qgcPal.groupBorder
96 anchors.centerIn: parent
97 text: qsTr("%1 × %2").arg(chip._idLabel).arg(chip.modelData[1])
98 font.pointSize: ScreenTools.smallFontPointSize
106 label: qsTr("Data Received")
107 labelText: root._stats ? (root._formatDataSize(root._stats.bytesReceived) + " ("
108 + root._formatDataRate(root._stats.dataRateBytesPerSec) + ")") : root._valueNA
109 visible: root._connected
110 && root._stats && root._stats.bytesReceived > 0
114 text: qsTr("Warning: Data usage: %1 — consider connection costs").arg(root._stats ? root._formatDataSize(root._stats.bytesReceived) : "")
115 wrapMode: Text.WordWrap
116 color: qgcPal.warningText
117 font.pointSize: ScreenTools.smallFontPointSize
118 visible: root._connected
119 && root._stats && root._stats.bytesReceived > root._dataWarningLimitBytes
120 Layout.fillWidth: true
124 label: qsTr("To Vehicle")
125 labelText: root.rtcmMavlink ? (root._formatDataSize(root.rtcmMavlink.totalBytesSent) + " ("
126 + root.rtcmMavlink.bandwidthKBps.toFixed(1) + " KB/s)") : root._valueNA
127 visible: root._connected
128 && root.rtcmMavlink && root.rtcmMavlink.totalBytesSent > 0
132 label: qsTr("GGA Source")
133 labelText: (root._ntripMgr ? root._ntripMgr.ggaSource : "")
134 visible: root._connected
135 && (root._ntripMgr ? root._ntripMgr.ggaSource : "")
139 text: root._ntripMgr ? root._ntripMgr.securityWarning : ""
140 wrapMode: Text.WordWrap
141 color: qgcPal.colorOrange
142 font.pointSize: ScreenTools.smallFontPointSize
143 visible: root._connected
145 && root._ntripMgr.securityWarning !== ""
146 Layout.fillWidth: true
150 text: (root._ntripMgr ? root._ntripMgr.statusMessage : "")
151 wrapMode: Text.WordWrap
152 color: qgcPal.colorRed
153 font.pointSize: ScreenTools.smallFontPointSize
154 visible: root._status === NTRIPManager.Error
155 && (root._ntripMgr ? root._ntripMgr.statusMessage : "") !== ""
156 Layout.fillWidth: true