Files
GUI/src/device/DmsAsyncAction.h

47 lines
897 B
C
Raw Normal View History

2023-08-21 14:22:41 +08:00
#ifndef DMSASYNCACTION_H
#define DMSASYNCACTION_H
#include <QObject>
class QEventLoop;
class QTimer;
struct DmsAsyncActionResult
{
DmsAsyncActionResult(bool aIsSucessful = false, const QString& aData = "")
{
mIsSucessful = aIsSucessful;
mData = aData;
}
bool mIsSucessful;
QString mData;
};
class DmsAsyncAction : public QObject
{
Q_OBJECT
public:
DmsAsyncAction(int aServerId, int aActionId, QObject* aObject, const QString& aResponseSignal, QObject* aParent = nullptr);
~DmsAsyncAction();
bool execute();
void setSendData(const QString& aData);
2023-09-11 16:29:30 +08:00
void setTimeoutInterval(int aMsec);
2023-08-21 14:22:41 +08:00
signals:
void timeout();
private slots:
void sendTimeoutSignal();
private:
int mServerId;
int mActionId;
QTimer* mTimer;
QObject* mObject;
QString mResponseSignal;
QString mSendData;
};
#endif // DMSASYNCACTION_H