Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
Channel.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CDATACHANNEL_H
4#define CDATACHANNEL_H
5
6#pragma once
7
8#include <QIODevice>
9#include <QTcpSocket>
10#include <QMessageBox>
11#include <QMutex>
12#include "channel_export.h"
13
24class CHANNEL_EXPORT CChannel : public QIODevice
25{
26 Q_OBJECT
27
28public:
34 explicit CChannel(QTcpSocket* pSocket, QObject *parent = nullptr);
35 virtual ~CChannel();
36
42 virtual bool open(OpenMode mode) override;
43 virtual void close() override;
44
45 virtual QString GetDetails();
46
47 static int InitTranslation();
48 static int RemoveTranslation();
49
50Q_SIGNALS:
58 void sigError(int nErr, const QString& szErr);
59
60private Q_SLOTS:
61 void slotError(QAbstractSocket::SocketError e);
62
63private:
64 QTcpSocket* m_pSocket;
65
66protected:
67 explicit CChannel(QObject *parent = nullptr);
68
69 // QIODevice interface
70protected:
71 virtual qint64 readData(char *data, qint64 maxlen) override;
72 virtual qint64 writeData(const char *data, qint64 len) override;
73 virtual bool isSequential() const override;
74};
75
76#endif // CDATACHANNEL_H
The channel interface class.
Definition Channel.h:25
void sigConnected()
emit when the channel is connected.
void sigDisconnected()
emit when the channel is disconnected
void sigError(int nErr, const QString &szErr)
emit when the channel is error