#ifndef DEVICEPANEL_H
#define DEVICEPANEL_H

#include "base/loqtreewidget.h"
#include <QLabel>
#include <QTimer>
#include <QPushButton>
#include <QUdpSocket>
#include <QCheckBox>
#include <QComboBox>
#include <QTextEdit>
#include <QSettings>
#include <QHBoxLayout>

class DeviceCtrlPanel;
class DevicePanel : public QWidget {
    Q_OBJECT
public:
    explicit DevicePanel(QSettings &, QWidget *parent = nullptr);
    ~DevicePanel();

    void sendGetInfo();

    QLabel *fdCardNumInfo;
    LoQTreeWidget *mDeviceTable;
    QUdpSocket mUdpSocket;
    QTimer mUdpTimer;
    QDialog *specifyIPDlg{0};
    QTextEdit *fdIP{0};
    int mainPanelIdx{0};
    DeviceCtrlPanel *mDeviceCtrlPanel{0};
    QLabel *label_3, *nDeviceNum;
    QComboBox *bnSpecifyIP;
    QPushButton *btnRefresh;
    QTreeWidgetItem *m_headerItem;
    QHBoxLayout *mHBox{0};
protected:
    void changeEvent(QEvent *) override;
    void transUi();
signals:
    void sigSelectedDeviceList();
};

struct UDPPacket {
    unsigned char SyncHead[3];
    unsigned char ucCommType;
    char serialCode[20];
    unsigned int iLength;
};
#endif // DEVICEPANEL_H