HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Redmine-4.x/redmine-4.2.9/files/2025/07/250731163113_mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTimer>
#include <QLineEdit>
#include <QPushButton>
#include <QTextEdit>
#include <QSpinBox>
#include <QCheckBox>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QGroupBox>
#include <QTableWidget>
#include <QHeaderView>
#include <QDateTimeEdit>
#include <QDateTime>

// Includes OPC UA
#include "OpenOpcUaSdkClient.h"

QT_BEGIN_NAMESPACE
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void connectToServer();
    void disconnectFromServer();
    void readHistoricalData();
    void clearResults();
    void onConnectionTimer();

private:
    // Interface utilisateur
    void setupUI();

    // Méthodes OPC UA
    bool initializeOpcUa();
    void cleanupOpcUa();
    OpcUa_StatusCode createSession(const QString& url, const QString& securityPolicy);
    OpcUa_StatusCode readOpcHistoricalData(int namespaceIndex, int nodeId,
                                           QDateTime startTime, QDateTime endTime,
                                           int maxValues, bool includeModified, bool includeBounds);

    // Utilitaires de conversion
    OpcUa_DateTime qDateTimeToOpcDateTime(const QDateTime& dt);
    QDateTime opcDateTimeToQDateTime(const OpcUa_DateTime& opcDt);

    // Variables OPC UA
    OpcUa_Handle m_hApplication;
    OpcUa_Handle m_hSession;
    bool m_isConnected;
    bool m_isInitialized;

    // Interface utilisateur
    QWidget *centralWidget;

    // Groupe Connexion
    QGroupBox *connectionGroup;
    QLineEdit *urlEdit;
    QLineEdit *securityEdit;
    QPushButton *connectButton;
    QPushButton *disconnectButton;
    QLabel *statusLabel;

    // Groupe Configuration historique
    QGroupBox *historyGroup;
    QSpinBox *namespaceSpinBox;
    QSpinBox *nodeIdSpinBox;
    QDateTimeEdit *startTimeEdit;
    QDateTimeEdit *endTimeEdit;
    QSpinBox *maxValuesSpinBox;
    QCheckBox *includeModifiedCheckBox;
    QCheckBox *includeBoundsCheckBox;
    QPushButton *readHistoryButton;

    // Groupe Résultats
    QGroupBox *resultsGroup;
    QTableWidget *resultsTable;
    QPushButton *clearResultsButton;
    QLabel *resultsCountLabel;

    // Journal des événements
    QTextEdit *logTextEdit;

    // Timer pour vérifier la connexion
    QTimer *connectionTimer;
};

#endif // MAINWINDOW_H