/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ */ #pragma once #include "pws_rfb_protocol.h" #include #include #include #include #include #include namespace ProjectionWorkstation { class PWSCOMMON_EXPORT VncHandler : public QObject { Q_OBJECT public: VncHandler(const QHostAddress &host, quint16 port, QObject *parent = nullptr); void setNextExpectedMessageType(RfbProtocol::STC::Type type) { m_nextType = type; } void connectToHost(); void connectToHost(const QHostAddress &host, quint16 port); void writeData(const QByteArray &data); signals: void connected(); void disconnected(); void frameBufferUpdateReceived(const QVector &rectangles); void beepReceived(); void cutTextReceived(const QString &txt); private slots: void onReadyRead(); void slotOnDisconnected(); void error(); private: bool handleData(QDataStream &stream); bool handleFrameBufferUpdate(QDataStream &stream); bool handleSetColormap(QDataStream &stream); bool handleRingBell(QDataStream &stream); bool handleServerCuttext(QDataStream &stream); void resetHandler(); bool handleVersion(const RfbProtocol::STC::RfbVersion &version); bool handleSupportedSecurityTypes(const RfbProtocol::STC::RfbSupportedSecurityTypes &supportedTypes); bool handleVncAuthentication(const RfbProtocol::STC::RfbVncAuthentication &authentication); static quint64 convertPassword(const char *password); static quint8 reverseByte(quint8 b); bool handleSecurityResult(const RfbProtocol::STC::RfbSecurityResult &result); bool handleServerInit(const RfbProtocol::STC::RfbServerInit &serverInit); LtsProjectionWorkstation::LOGGER_T m_logger; RfbProtocol::STC::Type m_nextType; RfbProtocol::STC::RfbServerInit m_serverInit; QTcpSocket *m_socket; QByteArray m_buffer; QHostAddress m_host; quint16 m_port; }; } // ProjectionWorkstation