玉兔远程控制 0.1.0-bate10
载入中...
搜索中...
未找到
BackendServer.cpp
1#include <QLoggingCategory>
2#include "FrmViewServer.h"
3#include "OperateServer.h"
4#include "BackendServer.h"
5
6static Q_LOGGING_CATEGORY(log, "Backend.Server")
7CBackendServer::CBackendServer(COperateServer *pOperate, bool bStopSignal)
8 : CBackend(pOperate, bStopSignal)
9{
10 qDebug(log) << Q_FUNC_INFO;
11 SetConnect(pOperate);
12}
13
14CBackendServer::~CBackendServer()
15{
16 qDebug(log) << Q_FUNC_INFO;
17}
18
19int CBackendServer::SetConnect(COperateServer* pOperate)
20{
21 int nRet = 0;
22 Q_ASSERT(pOperate);
23 auto *pView = qobject_cast<CFrmViewServer*>(pOperate->GetViewer());
24 Q_ASSERT(pView);
25 bool check = connect(this, SIGNAL(sigConnected(QString,quint16)),
26 pView, SLOT(slotConnected(QString,quint16)));
27 Q_ASSERT(check);
28 check = connect(this, SIGNAL(sigDisconnected(QString,quint16)),
29 pView, SLOT(slotDisconnected(QString,quint16)));
30 Q_ASSERT(check);
31 check = connect(pView, SIGNAL(sigDisconnect(QString,quint16)),
32 this, SLOT(slotDisconnect(QString,quint16)));
33 Q_ASSERT(check);
34
35 return nRet;
36}
服务接口。它由协议插件实现。
virtual void slotDisconnect(const QString &szIp, const quint16 port)=0
Disconnect client
void sigConnected(const QString &szIp, const quint16 port)
emit when new client connected
void sigDisconnected(const QString &szIp, const quint16 port)
emit when the client disconnected
后端接口。它由协议插件实现。 它默认启动一个定时器来开启一个非 Qt 事件循环(就是普通的循环处理)。 详见: Start()、 slotTimeOut()、 OnProcess() 。 当然,它仍然支...
Definition Backend.h:42
服务操作接口
virtual QWidget * GetViewer() override
得到显示视图