|
- #pragma once
-
- #include "domain/runtime_state.h"
- #include "services/plc_communication_gateway.h"
- #include "services/software_logic_executor.h"
-
- #include <QWidget>
-
- #include <memory>
- #include <string>
-
- namespace Ui {
- class RuntimeMonitorWidget;
- }
-
- class FreeMonitorWidget;
- class HmiEditorService;
- class HmiEditorWidget;
- class HmiRuntimeService;
- class AlarmService;
- class HmiNavigationService;
- class LogicEditorService;
- class LogicEditorWidget;
- class RegisterMonitorService;
- class ProjectService;
-
- class RuntimeMonitorWidget final : public QWidget
- {
- Q_OBJECT
-
- public:
- RuntimeMonitorWidget(
- HmiEditorService &hmi_editor_service,
- HmiRuntimeService &hmi_runtime_service,
- LogicEditorService &logic_editor_service,
- ProjectService &project_service,
- HmiNavigationService &hmi_navigation_service,
- AlarmService &alarm_service,
- RegisterMonitorService ®ister_monitor_service,
- QWidget *parent = nullptr);
- ~RuntimeMonitorWidget() override;
-
- void setProjectObjects(const std::string &page_id, const std::string &logic_id);
- void setRuntimePage(const std::string &page_id);
- void setMode(ApplicationMode mode, PlcConnectionState plc_state);
- void refreshValues(ApplicationMode mode, PlcConnectionState plc_state);
- void setHmiWriteEnabled(bool enabled);
- void setFreeMonitorWriteEnabled(bool enabled);
- void setLogicTrace(const LogicTraceSnapshot &trace, const std::string &fault_node_id = {});
- FreeMonitorWidget *freeMonitorWidget() const;
- std::string selectedLogicId() const;
-
- signals:
- void navigationFailed(const QString &message);
- void runtimePageChanged(const QString &page_id);
-
- private:
- void showRuntimePage(const std::string &page_id);
- void selectRuntimeLogic(const std::string &logic_id);
-
- std::unique_ptr<Ui::RuntimeMonitorWidget> ui_;
- ProjectService &project_service_;
- HmiNavigationService &hmi_navigation_service_;
- HmiEditorWidget *hmi_view_ = nullptr;
- LogicEditorWidget *logic_view_ = nullptr;
- FreeMonitorWidget *free_monitor_widget_ = nullptr;
- std::string selected_logic_id_;
- LogicTraceSnapshot latest_trace_;
- std::string latest_fault_node_id_;
- bool has_logic_trace_ = false;
- };
|