diff --git a/.github/workflows/ied-simulator-qt.yml b/.github/workflows/ied-simulator-qt.yml index d632d7bac..dbe621bb7 100644 --- a/.github/workflows/ied-simulator-qt.yml +++ b/.github/workflows/ied-simulator-qt.yml @@ -342,6 +342,24 @@ jobs: if-no-files-found: error retention-days: 14 + - name: Capture Browser Reports inspector visual evidence + env: + QT_QPA_PLATFORM: offscreen + run: | + ./build-ied-simulator-qt/arstack_ied_simulator \ + --browser-model ./tests/fixtures/scl/minimal-station-brcb.scd \ + --browser-section 2 \ + --screenshot ./ied-browser-reports.png + test -s ./ied-browser-reports.png + + - name: Upload Browser Reports visual evidence + uses: actions/upload-artifact@v4 + with: + name: ied-browser-reports-m2a + path: ied-browser-reports.png + if-no-files-found: error + retention-days: 14 + - name: Prove GUI value is visible through MMS run: >- python3 apps/ied_simulator/test_gui_live_value.py diff --git a/apps/ied_simulator/CMakeLists.txt b/apps/ied_simulator/CMakeLists.txt index 5de941830..a9a9372b3 100644 --- a/apps/ied_simulator/CMakeLists.txt +++ b/apps/ied_simulator/CMakeLists.txt @@ -104,6 +104,7 @@ qt_add_qml_module(arstack_ied_simulator qml/BrowserStatusConsole.qml qml/BrowserDataModelPane.qml qml/BrowserDataSetPane.qml + qml/BrowserReportPane.qml qml/BrowserGoosePane.qml qml/BrowserGlobalDataPane.qml qml/FleetGlobalDataPane.qml diff --git a/apps/ied_simulator/qml/BrowserReportPane.qml b/apps/ied_simulator/qml/BrowserReportPane.qml new file mode 100644 index 000000000..da5a1e12d --- /dev/null +++ b/apps/ied_simulator/qml/BrowserReportPane.qml @@ -0,0 +1,448 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +// Browser-only presentation of the existing MMS report service. +// Engineering inventory is not proof of a successful live read or report. +Rectangle { + id: root + required property var theme + required property var reports + + readonly property var rcb: reports.selectedRcb + readonly property bool hasSelection: reports.selectedRcbIndex >= 0 + readonly property var latestReport: newestMatchingReport() + readonly property bool hasLastReport: latestReport.reportId !== undefined + readonly property var configuredMembers: membersForSelectedRcb() + property bool attributesExpanded: true + property bool informationExpanded: true + property bool dataExpanded: true + color: theme.background + + function asText(value) { + return value === null || value === undefined || String(value).length === 0 + ? "—" : String(value) + } + + function rcbName() { + return rcb.name || (rcb.reference ? String(rcb.reference).split(".").pop() : "Report control block") + } + + function newestMatchingReport() { + // A DataSet can be shared by multiple RCBs. Never attribute a received + // frame to an RCB using only its DataSet or its list position. + if (!hasSelection || !rcb.reportId || !reports.receivedReports) + return ({}) + const wanted = String(rcb.reportId) + for (let index = 0; index < reports.receivedReports.length; ++index) { + const frame = reports.receivedReports[index] + if (frame.reportId && String(frame.reportId) === wanted) + return frame + } + return ({}) + } + + function membersForSelectedRcb() { + // Resolve through the canonical C++ DataSet matcher, never by a + // potentially unrelated user-selected DataSet index. + return root.hasSelection && root.rcb.dataSet + ? reports.selectedRcbDataSetMembers : [] + } + + function memberName(raw) { + const text = String(raw) + const at = text.indexOf(" = ") + return at >= 0 ? text.slice(0, at) : text + } + + function memberValue(raw) { + const text = String(raw) + const at = text.indexOf(" = ") + return at >= 0 ? text.slice(at + 3) : "—" + } + + readonly property var attributeLabels: [ + "Enabled", "Reserved", "Control Block Reference", "Report ID", + "DataSet Reference", "Trigger Options", "Buffer Time (ms)", + "Configuration Revision", "Integrity Period (ms)", "Sequence Number", + "Reservation Time (s)", "Owner" + ] + readonly property var informationLabels: [ + "Report ID", "Sequence Number", "Subsequence Number", + "Configuration Revision", "Entry ID", "Decoder" + ] + + function attributeValue(index) { + switch (index) { + case 0: return rcb.enabled + case 1: return rcb.reserved + case 2: return rcb.reference + case 3: return rcb.reportId + case 4: return rcb.dataSet + case 5: return rcb.triggerOptions + case 6: return rcb.bufTm + case 7: return rcb.confRev + case 8: return rcb.intgPd + case 9: return rcb.sqNum + case 10: return rcb.resvTms + case 11: return rcb.owner + default: return undefined + } + } + + function informationValue(index) { + if (!hasLastReport) return undefined + switch (index) { + case 0: return latestReport.reportId + case 1: return latestReport.sequence + case 2: return latestReport.subSequence + case 3: return latestReport.confRev + case 4: return latestReport.entryId + case 5: return latestReport.decoderMode + default: return undefined + } + } + + component PropertyRow: Rectangle { + id: propertyRow + // Repeater supplies these model roles explicitly; lexical 'index' + // in an inline component otherwise resolves to row zero. + required property int index + property bool lastReportSection: false + readonly property string title: lastReportSection + ? root.informationLabels[index] : root.attributeLabels[index] + readonly property var rawValue: lastReportSection + ? root.informationValue(index) : root.attributeValue(index) + readonly property int stripe: index + implicitHeight: 25 + Layout.fillWidth: true + color: stripe % 2 ? root.theme.surfaceSoft : root.theme.surface + Rectangle { + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + width: Math.min(228, Math.max(136, parent.width * 0.34)) + color: root.theme.chrome + opacity: 0.4 + } + Rectangle { + x: Math.min(228, Math.max(136, parent.width * 0.34)) + width: 1 + height: parent.height + color: root.theme.lineSoft + } + Label { + width: Math.min(228, Math.max(136, parent.width * 0.34)) - 10 + height: parent.height + x: 7 + verticalAlignment: Text.AlignVCenter + text: propertyRow.title + color: root.theme.textSoft + font.pixelSize: 10 + elide: Text.ElideRight + ToolTip.visible: titleMouse.containsMouse && truncated + ToolTip.text: title + MouseArea { id: titleMouse; anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton } + } + Label { + x: Math.min(228, Math.max(136, parent.width * 0.34)) + 8 + width: Math.max(0, parent.width - x - 9) + height: parent.height + verticalAlignment: Text.AlignVCenter + text: root.asText(rawValue) + color: root.theme.text + font.pixelSize: 10 + elide: Text.ElideMiddle + ToolTip.visible: valueMouse.containsMouse && truncated + ToolTip.text: text + MouseArea { id: valueMouse; anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton } + } + Rectangle { anchors.bottom: parent.bottom; width: parent.width; height: 1; color: root.theme.lineSoft } + } + + component SectionHeading: Rectangle { + required property string heading + property string evidence: "" + property bool opened: true + signal toggleRequested() + Layout.fillWidth: true + implicitHeight: 26 + color: root.theme.surfaceRaised + Rectangle { anchors.bottom: parent.bottom; width: parent.width; height: 1; color: root.theme.line } + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 8 + spacing: 7 + Label { + text: opened ? "▾" : "▸" + font.pixelSize: 10 + color: root.theme.textSoft + } + Label { + text: heading + font.pixelSize: 10 + color: root.theme.text + font.weight: Font.DemiBold + Layout.fillWidth: true + } + Label { + visible: evidence.length > 0 + text: evidence + font.pixelSize: 9 + color: root.theme.muted + } + } + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: toggleRequested() + } + } + + component DataRow: Rectangle { + id: dataRow + required property int index + required property var modelData + property bool received: false + readonly property string reference: received + ? root.memberName(modelData) : String(modelData) + readonly property string displayValue: received + ? root.memberValue(modelData) : "—" + readonly property int stripe: index + Layout.fillWidth: true + implicitHeight: 25 + color: stripe % 2 ? root.theme.surfaceSoft : root.theme.surface + RowLayout { + anchors.fill: parent + anchors.leftMargin: 9 + anchors.rightMargin: 7 + spacing: 0 + Label { + text: "DA" + Layout.preferredWidth: 25 + color: root.theme.accent + font.pixelSize: 9 + font.weight: Font.DemiBold + } + Label { + text: dataRow.reference + Layout.preferredWidth: Math.max(100, parent.width * 0.55 - 28) + color: root.theme.text + font.pixelSize: 10 + elide: Text.ElideMiddle + ToolTip.visible: dataNameMouse.containsMouse && truncated + ToolTip.text: text + MouseArea { id: dataNameMouse; anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton } + } + Rectangle { Layout.preferredWidth: 1; Layout.fillHeight: true; color: root.theme.lineSoft } + Label { + Layout.fillWidth: true + leftPadding: 8 + text: dataRow.displayValue + color: root.theme.text + font.pixelSize: 10 + elide: Text.ElideMiddle + ToolTip.visible: dataValueMouse.containsMouse && truncated + ToolTip.text: text + MouseArea { id: dataValueMouse; anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton } + } + } + Rectangle { anchors.bottom: parent.bottom; width: parent.width; height: 1; color: root.theme.lineSoft } + } + + ColumnLayout { + anchors.fill: parent + spacing: 0 + + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 29 + color: theme.surface + border.width: 1 + border.color: theme.lineSoft + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 8 + spacing: 7 + Rectangle { + implicitWidth: 20; implicitHeight: 17; radius: 2 + color: theme.accent + Label { anchors.centerIn: parent; text: "R"; color: "#ffffff"; font.pixelSize: 10; font.weight: Font.DemiBold } + } + Label { + Layout.fillWidth: true + text: root.hasSelection ? root.rcbName() : "Reports" + color: theme.text + font.pixelSize: 11 + font.weight: Font.DemiBold + elide: Text.ElideMiddle + } + Label { + text: !root.hasSelection ? reports.reportControls.length + " RCB(s)" + : reports.cleanupRequired ? "CLEANUP REQUIRED" + : reports.active ? "SUBSCRIBED" + : root.rcb.probeOk === true ? "VERIFIED" : "ENGINEERING" + color: reports.cleanupRequired ? theme.red + : reports.active ? theme.green : theme.muted + font.pixelSize: 9 + } + } + } + + ListView { + objectName: "browserReportsOverview" + visible: !root.hasSelection + Layout.fillWidth: true + Layout.fillHeight: true + clip: true + reuseItems: true + model: reports.reportControls + ScrollBar.vertical: ScrollBar {} + delegate: Rectangle { + required property int index + required property var modelData + width: ListView.view.width + height: 25 + color: reportMouse.containsMouse ? theme.accentSoft + : index % 2 ? theme.surfaceSoft : theme.surface + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 8 + spacing: 8 + Label { text: modelData.buffered ? "BR" : "UR"; color: theme.accent; font.pixelSize: 9; Layout.preferredWidth: 22 } + Label { text: modelData.name || modelData.reference || "RCB"; Layout.fillWidth: true; font.pixelSize: 10; color: theme.text; elide: Text.ElideMiddle } + Label { text: modelData.logicalNode || "LLN0"; font.pixelSize: 9; color: theme.muted } + } + MouseArea { id: reportMouse; anchors.fill: parent; hoverEnabled: true; onClicked: reports.selectRcb(index) } + } + } + + ScrollView { + id: detailScroll + objectName: "browserReportUnifiedInspector" + visible: root.hasSelection + Layout.fillWidth: true + Layout.fillHeight: true + clip: true + contentWidth: availableWidth + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ColumnLayout { + width: Math.max(0, detailScroll.availableWidth) + spacing: 0 + + SectionHeading { + heading: "Control Block Attributes" + evidence: root.rcb.probeOk === true ? "IED verified" : "Engineering model" + opened: root.attributesExpanded + onToggleRequested: root.attributesExpanded = !root.attributesExpanded + } + ColumnLayout { + visible: root.attributesExpanded + Layout.fillWidth: true + spacing: 0 + Repeater { + model: root.attributeLabels.length + delegate: PropertyRow { lastReportSection: false } + } + } + + SectionHeading { + heading: "Information Received in Last Report" + evidence: root.hasLastReport ? "Received" : "Not received" + opened: root.informationExpanded + onToggleRequested: root.informationExpanded = !root.informationExpanded + } + ColumnLayout { + visible: root.informationExpanded + Layout.fillWidth: true + spacing: 0 + Repeater { + model: root.informationLabels.length + delegate: PropertyRow { lastReportSection: true } + } + } + + SectionHeading { + heading: "Data" + evidence: root.hasLastReport + ? root.latestReport.valueCount + " received value(s)" + : root.configuredMembers.length + " configured member(s)" + opened: root.dataExpanded + onToggleRequested: root.dataExpanded = !root.dataExpanded + } + ColumnLayout { + visible: root.dataExpanded + Layout.fillWidth: true + spacing: 0 + Rectangle { + Layout.fillWidth: true + implicitHeight: 25 + color: theme.chrome + RowLayout { + anchors.fill: parent + anchors.leftMargin: 8 + anchors.rightMargin: 8 + Label { text: "Name"; Layout.preferredWidth: Math.max(100, parent.width * 0.55 - 1); color: theme.textSoft; font.pixelSize: 10; font.weight: Font.DemiBold } + Label { text: "Value"; Layout.fillWidth: true; color: theme.textSoft; font.pixelSize: 10; font.weight: Font.DemiBold } + } + } + Repeater { + model: root.hasLastReport && root.latestReport.values + ? root.latestReport.values.slice(0, 256) : [] + delegate: DataRow { received: true } + } + Repeater { + model: !root.hasLastReport ? root.configuredMembers.slice(0, 256) : [] + delegate: DataRow { received: false } + } + Label { + visible: root.hasLastReport ? !root.latestReport.values || root.latestReport.values.length === 0 + : root.configuredMembers.length === 0 + Layout.fillWidth: true + Layout.preferredHeight: 36 + leftPadding: 10 + verticalAlignment: Text.AlignVCenter + text: root.hasLastReport + ? "The report contains no exposed member values." + : !root.rcb.dataSet + ? "No bound DataSet reference is available for this RCB." + : "The configured DataSet has no exposed members. Offline values are not fabricated." + color: theme.muted + font.pixelSize: 10 + } + Label { + visible: root.hasLastReport ? root.latestReport.values.length > 256 + : root.configuredMembers.length > 256 + Layout.fillWidth: true + leftPadding: 10 + text: "Showing first 256 members. Narrow the context for more." + color: theme.muted + font.pixelSize: 9 + } + } + + Rectangle { + visible: reports.cleanupRequired || (reports.lastError && reports.lastError.length > 0) + Layout.fillWidth: true + implicitHeight: issueLabel.implicitHeight + 16 + color: theme.redSoft + Label { + id: issueLabel + anchors.fill: parent + anchors.margins: 8 + font.pixelSize: 10 + wrapMode: Text.WordWrap + color: theme.red + text: reports.cleanupRequired + ? "RCB cleanup is unconfirmed. Verify ownership before retrying." + : reports.lastError + } + } + } + } + } +} diff --git a/apps/ied_simulator/qml/IedBrowserNavigation.qml b/apps/ied_simulator/qml/IedBrowserNavigation.qml index f7dc2d707..ab8750cf0 100644 --- a/apps/ied_simulator/qml/IedBrowserNavigation.qml +++ b/apps/ied_simulator/qml/IedBrowserNavigation.qml @@ -265,51 +265,74 @@ Rectangle { spacing: 0 Repeater { model: reports.reportControls - delegate: Rectangle { + delegate: ColumnLayout { + id: reportEntry required property int index required property var modelData + readonly property var preceding: index > 0 ? reports.reportControls[index - 1] : ({}) + readonly property bool newGroup: index === 0 + || modelData.domain !== preceding.domain + || modelData.logicalNode !== preceding.logicalNode Layout.fillWidth: true - implicitHeight: 34 - color: reports.selectedRcbIndex === index - ? "#324842" : reportMouse.containsMouse ? "#263833" : "transparent" - RowLayout { - anchors.fill: parent - anchors.leftMargin: 28 - anchors.rightMargin: 8 - spacing: 5 + spacing: 0 + Rectangle { + visible: reportEntry.newGroup + Layout.fillWidth: true + implicitHeight: visible ? 22 : 0 + color: root.theme.navigation Label { - text: modelData.buffered ? "B" : "U" - color: modelData.buffered ? "#f4c96b" : "#69d5cb" - font.pixelSize: 7 - font.weight: Font.Bold + anchors.fill: parent + leftPadding: 28 + verticalAlignment: Text.AlignVCenter + text: "LD " + (reportEntry.modelData.domain || "IED") + + " › LN " + (reportEntry.modelData.logicalNode || "LLN0") + font.pixelSize: 9 + font.weight: Font.DemiBold + color: root.theme.navigationMuted + elide: Text.ElideMiddle } - ColumnLayout { - Layout.fillWidth: true - spacing: 0 + } + Rectangle { + Layout.fillWidth: true + implicitHeight: 25 + color: reports.selectedRcbIndex === reportEntry.index + ? "#324842" : reportMouse.containsMouse ? "#263833" : "transparent" + Rectangle { + visible: reports.selectedRcbIndex === reportEntry.index + width: 2 + height: parent.height + color: root.theme.accent + } + RowLayout { + anchors.fill: parent + anchors.leftMargin: 42 + anchors.rightMargin: 8 + spacing: 7 Label { - Layout.fillWidth: true - text: modelData.name || modelData.reference || "Report" - color: root.theme.navigationText - font.pixelSize: 8 - elide: Text.ElideMiddle + text: reportEntry.modelData.buffered ? "BR" : "UR" + color: reportEntry.modelData.buffered ? "#f4c96b" : "#69d5cb" + font.pixelSize: 9 + font.weight: Font.DemiBold + Layout.preferredWidth: 18 } Label { Layout.fillWidth: true - text: (modelData.domain || "") - + (modelData.logicalNode ? " · " + modelData.logicalNode : "") - color: root.theme.navigationMuted - font.pixelSize: 7 + text: reportEntry.modelData.name || reportEntry.modelData.reference || "Report" + color: root.theme.navigationText + font.pixelSize: 10 elide: Text.ElideMiddle } } - } - MouseArea { - id: reportMouse - anchors.fill: parent - hoverEnabled: true - onClicked: { - reports.selectRcb(index) - root.choose(2, "Reports") + MouseArea { + id: reportMouse + anchors.fill: parent + hoverEnabled: true + onClicked: { + reports.selectRcb(reportEntry.index) + root.choose(2, "Reports") + } + ToolTip.visible: containsMouse + ToolTip.text: String(reportEntry.modelData.reference || "") } } } diff --git a/apps/ied_simulator/qml/IedBrowserWorkspace.qml b/apps/ied_simulator/qml/IedBrowserWorkspace.qml index f84408de5..226ca85b1 100644 --- a/apps/ied_simulator/qml/IedBrowserWorkspace.qml +++ b/apps/ied_simulator/qml/IedBrowserWorkspace.qml @@ -771,11 +771,9 @@ Item { modelProvider: root.context } - ReportsWorkspace { + BrowserReportPane { theme: root.theme reports: root.reports - showConnectionHeader: false - showInventoryPanel: false } SettingsWorkspace { diff --git a/apps/ied_simulator/src/MmsReportController.cpp b/apps/ied_simulator/src/MmsReportController.cpp index e1a8bc238..41843f1ed 100644 --- a/apps/ied_simulator/src/MmsReportController.cpp +++ b/apps/ied_simulator/src/MmsReportController.cpp @@ -9,6 +9,7 @@ #include "ariec61850/mms/static_report_session.hpp" #include +#include #include #include @@ -616,6 +617,7 @@ void MmsReportController::clearInventory() { selectedDataSetIndex_ = -1; selectedRcb_.clear(); selectedDataSetMembers_.clear(); + selectedRcbDataSetMembers_.clear(); receivedReports_.clear(); events_.clear(); receivedReportCount_ = 0; @@ -632,10 +634,32 @@ void MmsReportController::adoptEngineeringInventory() { return; } - const auto seed = buildContextDiscoverySeed(*engineeringContext_->modelSnapshot()); + const auto* const canonical = engineeringContext_->modelSnapshot(); + const auto seed = buildContextDiscoverySeed(*canonical); const auto ui = buildDiscoveryUi(seed, QString{}); dataSets_ = ui.dataSets; reportControls_ = ui.reportControls; + + // SCL contains configured RCB bindings even without live attribute reads. + // Carry only engineering metadata; never synthesize active state or values. + QHash byReference; + byReference.reserve(static_cast(canonical->report_controls.size())); + for (const auto& control : canonical->report_controls) + byReference.insert(QString::fromStdString(control.reference), &control); + for (auto& row : reportControls_) { + auto map = row.toMap(); + const auto* control = byReference.value( + map.value(QStringLiteral("reference")).toString(), nullptr); + if (!control) continue; + map.insert(QStringLiteral("dataSet"), QString::fromStdString(control->data_set_reference)); + map.insert(QStringLiteral("canonicalDataSet"), QString::fromStdString(control->data_set_reference)); + map.insert(QStringLiteral("dataSetBindingStatus"), QString::fromStdString(control->data_set_binding_status)); + map.insert(QStringLiteral("reportId"), QString::fromStdString(control->report_id)); + map.insert(QStringLiteral("confRev"), QString::fromStdString(control->configuration_revision)); + map.insert(QStringLiteral("bufTm"), QString::fromStdString(control->buffer_time_ms)); + map.insert(QStringLiteral("intgPd"), QString::fromStdString(control->integrity_period_ms)); + row = map; + } staticCandidates_.clear(); dynamicCandidates_.clear(); associationProfile_.clear(); @@ -841,6 +865,7 @@ bool MmsReportController::reconnect() { void MmsReportController::refreshSelection() { selectedRcb_.clear(); selectedDataSetMembers_.clear(); + selectedRcbDataSetMembers_.clear(); if (selectedRcbIndex_ >= 0 && selectedRcbIndex_ < reportControls_.size()) { selectedRcb_ = reportControls_.at(selectedRcbIndex_).toMap(); const auto bound = selectedRcb_.value(QStringLiteral("dataSet")).toString(); @@ -850,6 +875,7 @@ void MmsReportController::refreshSelection() { if (!sameDataSetReference(bound, map.value(QStringLiteral("reference")).toString())) continue; selectedDataSetIndex_ = row; selectedDataSetMembers_ = map.value(QStringLiteral("members")).toStringList(); + selectedRcbDataSetMembers_ = selectedDataSetMembers_; break; } } diff --git a/apps/ied_simulator/src/MmsReportController.hpp b/apps/ied_simulator/src/MmsReportController.hpp index a7a03cfe9..601f6f3ad 100644 --- a/apps/ied_simulator/src/MmsReportController.hpp +++ b/apps/ied_simulator/src/MmsReportController.hpp @@ -36,6 +36,7 @@ class MmsReportController : public QObject { Q_PROPERTY(int selectedDataSetIndex READ selectedDataSetIndex NOTIFY selectionChanged) Q_PROPERTY(QVariantMap selectedRcb READ selectedRcb NOTIFY selectionChanged) Q_PROPERTY(QStringList selectedDataSetMembers READ selectedDataSetMembers NOTIFY selectionChanged) + Q_PROPERTY(QStringList selectedRcbDataSetMembers READ selectedRcbDataSetMembers NOTIFY selectionChanged) Q_PROPERTY(QVariantList receivedReports READ receivedReports NOTIFY reportsChanged) Q_PROPERTY(QStringList events READ events NOTIFY reportsChanged) Q_PROPERTY(qulonglong receivedReportCount READ receivedReportCount NOTIFY reportsChanged) @@ -68,6 +69,7 @@ class MmsReportController : public QObject { [[nodiscard]] int selectedDataSetIndex() const noexcept { return selectedDataSetIndex_; } [[nodiscard]] QVariantMap selectedRcb() const { return selectedRcb_; } [[nodiscard]] QStringList selectedDataSetMembers() const { return selectedDataSetMembers_; } + [[nodiscard]] QStringList selectedRcbDataSetMembers() const { return selectedRcbDataSetMembers_; } [[nodiscard]] QVariantList receivedReports() const { return receivedReports_; } [[nodiscard]] QStringList events() const { return events_; } [[nodiscard]] qulonglong receivedReportCount() const noexcept { return receivedReportCount_; } @@ -142,6 +144,7 @@ class MmsReportController : public QObject { int selectedDataSetIndex_{-1}; QVariantMap selectedRcb_; QStringList selectedDataSetMembers_; + QStringList selectedRcbDataSetMembers_; QVariantList receivedReports_; QStringList events_; QStringList diagnostics_; diff --git a/apps/ied_simulator/src/ied_browser_session_qa.cpp b/apps/ied_simulator/src/ied_browser_session_qa.cpp index 268c8ca24..c64c9be49 100644 --- a/apps/ied_simulator/src/ied_browser_session_qa.cpp +++ b/apps/ied_simulator/src/ied_browser_session_qa.cpp @@ -134,6 +134,29 @@ int main(int argc, char** argv) { return 10; } + // Opening an SCL must preserve configured RCB -> DataSet membership + // without pretending that any RCB has been enabled or read over MMS. + const auto offlineRcb = reports.selectedRcb(); + if (offlineRcb.value(QStringLiteral("reportId")).toString() != + QStringLiteral("BROWSERIED/Status") || + offlineRcb.value(QStringLiteral("dataSet")).toString() != + QStringLiteral("BROWSERIEDLD0/LLN0.Status") || + reports.selectedRcbDataSetMembers().size() != 1 || + offlineRcb.contains(QStringLiteral("enabled")) || + offlineRcb.contains(QStringLiteral("reserved")) || + offlineRcb.value(QStringLiteral("probeOk")).toBool() || + !reports.receivedReports().isEmpty()) { + std::cerr << "BROWSER_REPORT_OFFLINE_BINDING_FAIL configured_values_not_retained_or_fabricated\n"; + return 21; + } + if (!reports.selectRcb(1) || reports.selectedRcbDataSetMembers().size() != 1 || + reports.selectedRcb().value(QStringLiteral("dataSet")).toString() != + QStringLiteral("BROWSERIEDLD0/LLN0.Status")) { + std::cerr << "BROWSER_REPORT_OFFLINE_BINDING_FAIL indexed_rcb_mismatch\n"; + return 22; + } + reports.selectRcb(0); + const auto gooseProjection = engineeringContext.gooseStreams(); if (gooseProjection.constFirst().toMap() .value(QStringLiteral("destinationMac")).toString() != diff --git a/apps/ied_simulator/test_browser_convergence.py b/apps/ied_simulator/test_browser_convergence.py index dfa09d550..455e6f582 100644 --- a/apps/ied_simulator/test_browser_convergence.py +++ b/apps/ied_simulator/test_browser_convergence.py @@ -5,7 +5,9 @@ if len(sys.argv) != 5: raise SystemExit("usage: test_browser_convergence.py IedBrowserWorkspace.qml IedBrowserNavigation.qml BrowserStatusConsole.qml BrowserDataModelPane.qml") -workspace = Path(sys.argv[1]).read_text(encoding="utf-8") +workspace_path = Path(sys.argv[1]) +workspace = workspace_path.read_text(encoding="utf-8") +report_inspector = (workspace_path.parent / "BrowserReportPane.qml").read_text(encoding="utf-8") navigation = Path(sys.argv[2]).read_text(encoding="utf-8") status = Path(sys.argv[3]).read_text(encoding="utf-8") data_model = Path(sys.argv[4]).read_text(encoding="utf-8") @@ -20,6 +22,7 @@ 'client.readEngineeringSelected()', 'BrowserStatusConsole {', 'modelProvider: root.context', + 'BrowserReportPane {', ] navigation_required = [ 'color: theme.navigation', @@ -62,6 +65,34 @@ if missing: raise SystemExit("BROWSER_CONVERGENCE_FAIL " + label + " missing=" + ",".join(missing)) +report_required = [ + 'objectName: "browserReportUnifiedInspector"', + 'Control Block Attributes', + 'Information Received in Last Report', + 'heading: "Data"', + 'newestMatchingReport()', + 'root.attributeLabels[index]', + 'root.informationLabels[index]', + 'required property int index', + 'required property var modelData', + 'text: dataRow.reference', + 'text: dataRow.displayValue', + 'delegate: PropertyRow { lastReportSection: true }', + 'delegate: DataRow { received: false }', + 'reports.selectedRcbDataSetMembers', + 'String(frame.reportId) === wanted', + 'Offline values are not fabricated.', +] +missing_report = [term for term in report_required if term not in report_inspector] +if missing_report: + raise SystemExit("BROWSER_REPORT_INSPECTOR_FAIL missing=" + ",".join(missing_report)) +if 'title: modelData[0]' in report_inspector or 'rawValue: modelData[1]' in report_inspector: + raise SystemExit("BROWSER_REPORT_INSPECTOR_FAIL nested-array attribute labels") +if "ReportsWorkspace {" in workspace: + raise SystemExit("BROWSER_REPORT_INSPECTOR_FAIL legacy three-panel report view") +if 'implicitHeight: 25' not in navigation or "readonly property bool newGroup:" not in navigation: + raise SystemExit("BROWSER_REPORT_INSPECTOR_FAIL navigation is not grouped and compact") + if "client.treeModel" in navigation: raise SystemExit("BROWSER_CONVERGENCE_FAIL navigation regressed to session-owned model") if "Timer {" in status: