#ifndef __BROADCAST_H__ #define __BROADCAST_H__ #include #include #include #include #include class Broadcast : public QObject { Q_OBJECT public: explicit Broadcast(const int port, QObject *parent = nullptr); ~Broadcast(); int write(const QJsonObject &json); protected: bool init(const int port); private: int sockfd; struct sockaddr_in broadcast_addr; int broadcast_enable = 1; }; #endif // BROADCAST_H