mainwindow.h 880 Bytes
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QUdpSocket>

#include "../../app-prime-modbus/include/all_share.h"

namespace Ui {
class MainWindow;
}

typedef struct {
    int header;
    char body[];
} STRUCT_PACK packet_t;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    QUdpSocket *sock;
    oven_control_t control;
    oven_state_t state;

private slots:
    void readPendingDatagrams();
    void processDatagram(QByteArray &datagram);
    void processControl(oven_control_t *control);
    void processState(oven_state_t *state);
    void updateControl(oven_control_t *control);
    void updateState(oven_state_t *state);
    void on_pushControlButton_clicked();
    void on_pushStateButton_clicked();
};

#endif // MAINWINDOW_H