3#include "ServiceThread.h"
4#include <QLoggingCategory>
6Q_DECLARE_LOGGING_CATEGORY(Service)
8CServiceThread::CServiceThread(
CPluginService *pPlugin, QObject *parent)
14CServiceThread::~CServiceThread()
16 qDebug(Service) <<
"CServiceThread::~CServiceThread()";
19void CServiceThread::run()
24 qCritical(Service) <<
"GetService fail";
27 qInfo(Service) <<
"The service" << m_pPlugin->
Name() <<
"is start";
29 int nRet = pService->
Init();
32 qWarning(Service) <<
"The service" << m_pPlugin->
Name() <<
"initial fail";
38 qInfo(Service) <<
"The service" << m_pPlugin->
Name() <<
"is stop";
41 pService->deleteLater();
virtual CService * NewService()=0
New service
virtual const QString Name() const =0
插件名,这个名一定要与工程名(${PROJECT_NAME})相同。 翻译文件(${PROJECT_NAME}_*.ts))名与其相关。
服务接口。由具体的协议实现。此接口仅由插件实现。 支持非Qt事件循环。详见: Init() 、 slotProcess() 如果不启用非Qt事件循环。则 OnInit() 返回 > 0
virtual int Init()
加载参数,支持非Qt事件循环