You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.5 KiB
C++
74 lines
1.5 KiB
C++
#ifndef APPINSTANCE_H__
|
|
#define APPINSTANCE_H__
|
|
|
|
#include <QtCore>
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QLocalServer>
|
|
#include <QLocalSocket>
|
|
#include <QMutex>
|
|
|
|
#include "MultiBase.h"
|
|
#include "tpProtocol.h"
|
|
#include "GlobalFunction.h"
|
|
#include "tpProcess.h"
|
|
#include "CmdProcess.h"
|
|
|
|
class CAppInstance : public QObject, public CMultiBase < CAppInstance >
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
CAppInstance(const QString& strAppName);
|
|
virtual ~CAppInstance(void);
|
|
virtual void close();
|
|
|
|
void init(TPA_APP_OPTION& appopt);
|
|
|
|
void sendPackage(TP_PROTOCOL_MESSAGE& msg);
|
|
|
|
qint64 getLastHeartBeat();
|
|
void sendCloseMsg();
|
|
|
|
TPSYS_PROCESS_INFO getProcessInfo() const { return m_procInfo; }
|
|
TPA_APP_OPTION getProcessOpt() const { return m_AppOpt; }
|
|
private slots:
|
|
void slotNewConnection();
|
|
|
|
void slotDisconnected();
|
|
void slotErrorHandler(QLocalSocket::LocalSocketError err);
|
|
void slotDataReceived();
|
|
|
|
void slotAppStatusRefresh();
|
|
|
|
void slotCompressFinished(const QString&, const QString&, int, bool);
|
|
|
|
private:
|
|
void parserMsg(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
|
|
void initLogger();
|
|
void logmsg(emTPALogLevel level, const QString& msg);
|
|
|
|
void handleDiskCheckCmd(QSharedPointer<TP_PROTOCOL_MESSAGE> pmsg);
|
|
private:
|
|
QMutex m_mutex;
|
|
|
|
bool m_bInited;
|
|
bool m_bClosed;
|
|
|
|
QLocalServer m_server;
|
|
QLocalSocket* m_pSocket;
|
|
TpProtocolDeCode mDecoder;
|
|
|
|
qint64 m_lastHeartBeat;
|
|
QString m_sAppName;
|
|
TPA_APP_OPTION m_AppOpt;
|
|
|
|
QSharedPointer<CTpProcess> m_ptpProc;
|
|
TPSYS_PROCESS_INFO m_procInfo;
|
|
|
|
QTimer mTimerAppStatusRefresh;
|
|
};
|
|
|
|
#endif //APPINSTANCE_H__
|
|
|
|
|