22 lines
800 B
C
22 lines
800 B
C
|
|
#pragma once
|
||
|
|
#include <QJsonObject>
|
||
|
|
#include <QJsonArray>
|
||
|
|
#include <QVariantList>
|
||
|
|
#include <QMutex>
|
||
|
|
#include <QHash>
|
||
|
|
// Shared by the UI RPC runner and the legacy worker; never opens a connection.
|
||
|
|
class DemoSimulator {
|
||
|
|
public:
|
||
|
|
struct Reply {bool ok=false;QJsonObject response;int delayMs=30;};
|
||
|
|
static DemoSimulator& instance();
|
||
|
|
void reset();
|
||
|
|
Reply call(const QString& service,const QString& method,const QJsonObject& request);
|
||
|
|
QJsonObject sample(const QString& id);
|
||
|
|
void stop(const QString& id);
|
||
|
|
private:
|
||
|
|
struct Device {QJsonArray from,target;QJsonObject pose,poseFrom;QJsonObject settings;QJsonArray coordinates;QString activeCoordinate;qint64 started=0;int duration=0;};
|
||
|
|
QJsonObject sampleLocked(Device&);
|
||
|
|
QMutex m_mutex;
|
||
|
|
QHash<QString,Device> m_devices;
|
||
|
|
};
|