Rabbit Remote Control 0.0.36
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
47 virtual QString GetDetails();
48
50 static int InitTranslation();
52 static int RemoveTranslation();
53
54Q_SIGNALS:
62 void sigError(int nErr, const QString& szErr);
63
64private Q_SLOTS:
65 void slotError(QAbstractSocket::SocketError e);
66
67private:
68 QTcpSocket* m_pSocket;
69
70protected:
71 explicit CChannel(QObject *parent = nullptr);
72
73 // QIODevice interface
74protected:
75 virtual qint64 readData(char *data, qint64 maxlen) override;
76 virtual qint64 writeData(const char *data, qint64 len) override;
77 virtual bool isSequential() const override;
78};
79
80#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