Development technology set (including Qt practical technology, raspberry PI, 3D, OpenCV, OpenGL, FFMPEG, OSG, SCM, soft and hard combination, etc.) continue to update… (Click on the portal)

Cooperation case column: Case sharing (experience Demo can be downloaded, customized only)


demand

A sound brand needs a complete set of protocol debugging tools, to provide research and development personnel, channel business, customers, field personnel use: 1. Use SQlite3 database storage protocol, 2. Search host, operate host; 3. Detect cloud API and debug API; 4. Instructions include TCP, UDP, and UDP multicast; 5. Open the PDF to view the usage instructions and protocols. 6. Hidden function, the administrator can call out the “Control” menu, add, change and delete instructions; 7. Support Windows system;


Demo: a complete series of agreements for a product line

  Equipment control instructions, as follows:

  

  Obtain cloud music (a large factory) by operating the equipment, and test whether the supplier interfaces of this series are normal:   Obtain language programs by operating the equipment to test whether the series of cloud supplier interfaces are normal:Directly search the host, or search the number of channels and the corresponding number of the specified host:Administrators can use special operations to bring up the “Control” menu, as shown below:Selection instructions can be added, deleted, or modified, as shown below:         


Header source

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "DbServer.h"

#define PDF_EXE     "SumatraPDF.exe"

class UdpTransfer;
class QThread;
class QTcpSocket;
class QUdpSocket;
class QLabel;
class QModelIndex;
class QTreeWidgetItem;
class QTimer;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
public:
    struct ChannelInfo{
        ChannelInfo(){}
        QString roomId;
        QString roomName;
        QString devStat;
    };

    struct HostInfo{
        HostInfo(){}
        QString ip;
        QString deviceId;
        QString deviceName;
        QString deviceType;
        QList<ChannelInfo> listChannelInfo;
    };

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

public:
    void init();
    void sendUdpData(QByteArray);
    void sendTcpData(QByteArray byteArray, QString ip, quint16 port);

public slots:
    void connected();
    void disconnected();

private slots:
    void btn_clicked_FaSongZhiLing();
    void lvw_clicked_ZhiLingJi();
    void ckb_clicked_XianShiZuiXin();
    void btn_clicked_ZengJiaZhiLing();
    void btn_clicked_XiuGaiZhiLing();
    void btn_clicked_ShanChuZhiLing();
    void trw_clicked_ZhuJiLieBiao(QTreeWidgetItem* item ,int index);
    void btn_clicked_SouSuoZHuJi();
    void btn_clicked_HuoDeZhuJiTongDao();
    void cmb_changed_ZhiLingLeiXing(QString typeString);
    void tim_timeout();

private slots:
    void recvUdpData();
    void recvTcpData();
    void recvUdpNotify(QByteArray,QString,quint16);

private slots:
    void on_btn_DaKaiXieYi_clicked();
    void on_act_SouSuoZhuJi_triggered();
    void on_act_Exit_triggered();
    void on_act_HuoQuZhuJiTongDao_triggered();
    void on_act_DaKaiXieYi_triggered();
    void on_act_About_triggered();
    void on_act_AboutQT_triggered();
    void on_btn_QingKongUdp_clicked();
    void on_btn_QingKongTcp_clicked();
    void on_btn_QingKongUdpNotify_clicked();

private:
    void updateZhiLingJi();
    void showList();
    void updateHost();

private:
    QString ByteArrayToPlain(QByteArray byteArray);
    QString JsonToPlain(QJsonObject & jsonObject);
    QByteArray PlainToByteArray(QString str);

protected:
    void keyPressEvent(QKeyEvent * event);
    void keyReleaseEvent(QKeyEvent * event);

private:
    Ui::MainWindow *ui;
    UdpTransfer *_pUdpTransfer;
    QThread *_pUdpTransferThread;
    QHash<QString, DbServer::ZhiLingJi> _hashZhiLingJi;
    QString _content;
    QTcpSocket *_pTcpSocket;
    QUdpSocket *_pUdpSocket;
    QByteArray _tcpByteArray;
    QStatusBar *_pStatusBar;
    QLabel * _pStatusLabel1;
    QLabel * _pStatusLabel2;
    QHash<QString, HostInfo> _hashHostInfo;
    DbServer::ZHILINGJI_API_TYPE _type;
    bool _ctrl;
    QProcess *_pDdf;
    QTimer *_pTimer;
};
#endif // MAINWINDOW_H
Copy the code