Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
ConnectThreadTerminal.cpp
1// Author: Kang Lin <kl222@126.com>
2
3#include "ConnectThreadTerminal.h"
4#include <QLoggingCategory>
5
6Q_DECLARE_LOGGING_CATEGORY(Terminal)
7
8CConnectThreadTerminal::CConnectThreadTerminal(CConnecterTerminal *pConnecter)
9 : QThread(),
10 m_pConnecter(pConnecter)
11{}
12
13void CConnectThreadTerminal::run()
14{
15 int nRet = 0;
16 CConnect* pConnect = m_pConnecter->InstanceConnect();
17 if(!pConnect) return;
18
19 /*
20 nRet < 0 : error
21 nRet = 0 : emit sigConnected
22 nRet = 1 : emit sigConnected in CConnect
23 */
24 nRet = pConnect->Connect();
25 if(nRet < 0) return;
26 if(0 == nRet) emit m_pConnecter->sigConnected();
27
28 exec();
29
30 pConnect->Disconnect();
31
32 pConnect->deleteLater();
33
34 qDebug(Terminal) << "Run end";
35}
Connect interface.
Definition Connect.h:45
virtual int Disconnect()
Disconnect.
Definition Connect.cpp:89
virtual int Connect()
Start connect.
Definition Connect.cpp:77
void sigConnected()
Successful connection signal.