51 lines
1002 B
C++
51 lines
1002 B
C++
#ifndef DMSSYNCACTION_H
|
|
#define DMSSYNCACTION_H
|
|
|
|
#include <QObject>
|
|
|
|
class QEventLoop;
|
|
class QTimer;
|
|
|
|
struct DmsSyncActionResult
|
|
{
|
|
DmsSyncActionResult(bool aIsSucessful = false, const QString& aData = "")
|
|
{
|
|
mIsSucessful = aIsSucessful;
|
|
mData = aData;
|
|
}
|
|
bool mIsSucessful;
|
|
QString mData;
|
|
};
|
|
|
|
class DmsSyncAction : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
DmsSyncAction(int aServerId, int aActionId, QObject* aObject, const QString& aSignal, QObject* aParent = nullptr);
|
|
~DmsSyncAction();
|
|
|
|
DmsSyncActionResult execute();
|
|
void setSendData(const QString& aData);
|
|
void responsed();
|
|
|
|
private slots:
|
|
void saveActionResult(const QString& aResult);
|
|
|
|
private:
|
|
bool waitUntilSignalReceived();
|
|
|
|
private:
|
|
int mServerId;
|
|
int mActionId;
|
|
QEventLoop* mLoop;
|
|
QTimer* mTimer;
|
|
QObject* mObject;
|
|
QString mSignal;
|
|
int mTimeoutMsec;
|
|
QString mSendData;
|
|
QString mActionResult;
|
|
bool mIsResponsed;
|
|
};
|
|
|
|
#endif // DMSSYNCACTION_H
|