Rabbit Remote Control 0.0.37
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 "plugin_export.h"
13
14#define DEFAULT_TIMEOUT 500000
15
26class PLUGIN_EXPORT CChannel : public QIODevice
27{
28 Q_OBJECT
29
30public:
36 explicit CChannel(QTcpSocket* pSocket, QObject *parent = nullptr);
37 virtual ~CChannel();
38
44 virtual bool open(OpenMode mode) override;
45 virtual void close() override;
46
49 virtual QString GetDetails();
50
52 static int InitTranslation();
54 static int RemoveTranslation();
55
56 static QString GetSize(qint64 size);
57
58Q_SIGNALS:
66 void sigError(int nErr, const QString& szErr);
67
68private Q_SLOTS:
69 void slotError(QAbstractSocket::SocketError e);
70
71private:
72 QTcpSocket* m_pSocket;
73
74protected:
75 explicit CChannel(QObject *parent = nullptr);
76
77 // QIODevice interface
78protected:
79 virtual qint64 readData(char *data, qint64 maxlen) override;
80 virtual qint64 writeData(const char *data, qint64 len) override;
81 virtual bool isSequential() const override;
82};
83
84#endif // CDATACHANNEL_H
The channel interface class.
Definition Channel.h:27
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