GDMManager.h 597 B

123456789101112131415161718192021222324252627282930
  1. #ifndef GDMANNOUNCER_H
  2. #define GDMANNOUNCER_H
  3. #include <QObject>
  4. #include <QUdpSocket>
  5. #include <qbytearray.h>
  6. #include <qhostaddress.h>
  7. #include <qglobal.h>
  8. class GDMManager : public QObject
  9. {
  10. Q_OBJECT
  11. public:
  12. explicit GDMManager(QObject *parent = nullptr);
  13. ~GDMManager() override { stopAnnouncing(); }
  14. void startAnnouncing();
  15. void stopAnnouncing();
  16. private:
  17. void startListener();
  18. void parseData(const QByteArray& data, const QHostAddress& sender, quint16 port);
  19. void readData();
  20. QByteArray getPacket();
  21. QUdpSocket m_socket;
  22. qint32 m_port;
  23. };
  24. #endif // GDMANNOUNCER_H