#ifndef COMMUNICATIONS_H #define COMMUNICATIONS_H #include #include #include #include #include #include #include #include #define QDEBUG(x) (qDebug() <<__FUNCTION__ < forwardByteArrayList; QList uploadByteArrayList; }; class CommunicationSerialPort : public CommunicationBase { Q_OBJECT public: explicit CommunicationSerialPort(const QString &name, QSerialPort::BaudRate baud =QSerialPort::Baud115200, QObject *parent = 0); ~CommunicationSerialPort(); virtual bool open(); virtual void close(); virtual bool send(const QByteArray&); void modify(const QString &name, QSerialPort::BaudRate baud); QSerialPort *getSerialPort(); signals: public slots: QByteArray readAll(); private: QString portName; QSerialPort::BaudRate m_baud; QSerialPort* m_serialPort; }; class CommunicationTcpSocket : public CommunicationBase { Q_OBJECT public: explicit CommunicationTcpSocket(const QString &hostIpAddress, quint16 port, QObject *parent = 0); ~CommunicationTcpSocket(); virtual bool open(); virtual void close(); virtual bool send(const QByteArray&); void modify(const QString &hostIpAddress, quint16 port); signals: public slots: virtual void received(); void disconnected(); private: QTcpSocket* m_tcpSocket; QHostAddress peekAddress; quint16 peekPort; }; class CommunicationUdpSocket : public CommunicationBase { Q_OBJECT public: explicit CommunicationUdpSocket(const QString &hostIpAddress, quint16 port, QObject *parent = 0); ~CommunicationUdpSocket(); virtual bool open(); virtual void close(); virtual bool send(const QByteArray&); void modify(const QString &hostIpAddress, quint16 port); signals: public slots: private: QUdpSocket* m_udpSocket; QHostAddress peekAddress; quint16 peekPort; }; #endif // COMMUNICATIONS_H