18 #include <type_traits> 19 #include <QtCore/QObject> 20 #include <QtCore/QScopedPointer> 21 #include <QtCore/QThread> 22 #include <QtScript/QScriptEngine> 24 #ifndef TRIKSCRIPTRUNNER_EXPORT 25 # if defined(TRIKSCRIPTRUNNER_LIBRARY) 26 # define TRIKSCRIPTRUNNER_EXPORT Q_DECL_EXPORT 28 # define TRIKSCRIPTRUNNER_EXPORT Q_DECL_IMPORT 54 #define REGISTER_METATYPE(TYPE) \ 55 qRegisterMetaType<TYPE*>(TYPE::staticMetaObject.className()); 62 #define REGISTER_DEVICES_WITH_TEMPLATE(TEMPLATE) \ 63 TEMPLATE(trikControl::BatteryInterface) \ 64 TEMPLATE(trikControl::ColorSensorInterface) \ 65 TEMPLATE(trikControl::FifoInterface) \ 66 TEMPLATE(trikControl::DisplayInterface) \ 67 TEMPLATE(trikControl::EncoderInterface) \ 68 TEMPLATE(trikControl::EventCodeInterface) \ 69 TEMPLATE(trikControl::EventDeviceInterface) \ 70 TEMPLATE(trikControl::EventInterface) \ 71 TEMPLATE(trikControl::GamepadInterface) \ 72 TEMPLATE(trikControl::GyroSensorInterface) \ 73 TEMPLATE(trikControl::I2cDeviceInterface) \ 74 TEMPLATE(trikControl::KeysInterface) \ 75 TEMPLATE(trikControl::LedInterface) \ 76 TEMPLATE(trikControl::LineSensorInterface) \ 77 TEMPLATE(trikControl::MarkerInterface) \ 78 TEMPLATE(trikControl::MotorInterface) \ 79 TEMPLATE(trikControl::ObjectSensorInterface) \ 80 TEMPLATE(trikControl::SoundSensorInterface) \ 81 TEMPLATE(trikControl::SensorInterface) \ 82 TEMPLATE(trikControl::VectorSensorInterface) \ 83 TEMPLATE(trikNetwork::MailboxInterface) \ 96 return static_cast<std::underlying_type<ScriptType>::type
>(t);
106 virtual void registerUserFunction(
const QString &name, QScriptEngine::FunctionSignature
function) = 0;
109 virtual void addCustomEngineInitStep(
const std::function<
void (QScriptEngine *)> &step) = 0;
113 virtual QStringList knownMethodNames()
const = 0;
120 static void collectMethodNames(QSet<QString> &result,
const QMetaObject *obj);
125 virtual bool wasError() = 0;
139 virtual void run(
const QString &
script,
const QString &fileName =
"") = 0;
147 virtual void runDirectCommand(
const QString &command) = 0;
152 virtual void abort() = 0;
155 virtual void brickBeep() = 0;
163 void completed(
const QString &error,
int scriptId);
168 void startedScript(
const QString &fileName,
int scriptId);
172 void startedDirectScript(
int scriptId);
175 void sendMessage(
const QString &text);
#define TRIKSCRIPTRUNNER_EXPORT
Definition: trikScriptRunnerInterface.h:28
Definition: trikCommunicator.h:23
Interface for all script executors.
Definition: trikScriptRunnerInterface.h:100
ScriptType
Definition: trikScriptRunnerInterface.h:87
static constexpr std::underlying_type< ScriptType >::type to_underlying(ScriptType t) noexcept
Definition: trikScriptRunnerInterface.h:94
Definition: trikScriptRunnerInterface.h:115
script
Definition: system.py:83