trikRuntime
|
General wrapper for other executors (such as Python, JavaScript) More...
#include <trikScriptRunner.h>
Public Slots | |
void | run (const QString &script, const QString &fileName="") override |
See corresponding TrikScriptRunnerInterface method. More... | |
void | runDirectCommand (const QString &command) override |
See corresponding TrikScriptRunnerInterface method. More... | |
void | abort () override |
See corresponding TrikScriptRunnerInterface method. More... | |
void | abortAll () |
Aborts all scripts from all engines. More... | |
void | brickBeep () override |
See corresponding TrikScriptRunnerInterface method. More... | |
Public Slots inherited from trikScriptRunner::TrikScriptRunnerInterface | |
virtual void | run (const QString &script, const QString &fileName="")=0 |
Executes given script asynchronously. More... | |
virtual void | runDirectCommand (const QString &command)=0 |
Executes given script as direct command, so it will use existing script execution environment (or create one if needed) and will not reset execution state before or after execution. More... | |
virtual void | abort ()=0 |
Aborts script execution. More... | |
virtual void | brickBeep ()=0 |
Plays "beep" sound. More... | |
Public Member Functions | |
TrikScriptRunner (trikControl::BrickInterface &brick, trikNetwork::MailboxInterface *mailbox) | |
Constructor. More... | |
~TrikScriptRunner () override | |
void | setDefaultRunner (ScriptType t) |
Choose default runner type (Python or JavaScript) More... | |
void | registerUserFunction (const QString &name, QScriptEngine::FunctionSignature function) override |
Registers given C++ function as callable from script, with given name. More... | |
void | addCustomEngineInitStep (const std::function< void(QScriptEngine *)> &step) override |
Adds custom initialization steps when creating script engine (useful when used from outside of the TrikRuntime). More... | |
bool | wasError () override |
Get status of last direct command/script. More... | |
QStringList | knownMethodNamesFor (ScriptType t) |
Create completion list for interpreted language. More... | |
QStringList | knownMethodNames () const override |
See corresponding TrikScriptRunnerInterface method. More... | |
void | run (const QString &script, ScriptType stype, const QString &fileName="") |
Execute script with a corresponding engine of specified type. More... | |
Additional Inherited Members | |
Signals inherited from trikScriptRunner::TrikScriptRunnerInterface | |
void | completed (const QString &error, int scriptId) |
Emitted when current script completes execution (for event-driven mode it means that script requested to quit or was aborted). More... | |
void | startedScript (const QString &fileName, int scriptId) |
Emitted when new script from file started. More... | |
void | startedDirectScript (int scriptId) |
Emitted when new direct script started. More... | |
void | sendMessage (const QString &text) |
Emitted when a message must be sent to a desktop. More... | |
General wrapper for other executors (such as Python, JavaScript)
TrikScriptRunner::TrikScriptRunner | ( | trikControl::BrickInterface & | brick, |
trikNetwork::MailboxInterface * | mailbox | ||
) |
Constructor.
brick | - reference to trikControl::Brick instance. |
mailbox | - mailbox object used to communicate with other robots. |
|
override |
|
overrideslot |
See corresponding TrikScriptRunnerInterface method.
|
slot |
Aborts all scripts from all engines.
|
overridevirtual |
Adds custom initialization steps when creating script engine (useful when used from outside of the TrikRuntime).
Implements trikScriptRunner::TrikScriptRunnerInterface.
|
overrideslot |
See corresponding TrikScriptRunnerInterface method.
|
overridevirtual |
See corresponding TrikScriptRunnerInterface method.
Implements trikScriptRunner::TrikScriptRunnerInterface.
QStringList TrikScriptRunner::knownMethodNamesFor | ( | ScriptType | t | ) |
Create completion list for interpreted language.
|
overridevirtual |
Registers given C++ function as callable from script, with given name.
Implements trikScriptRunner::TrikScriptRunnerInterface.
void TrikScriptRunner::run | ( | const QString & | script, |
ScriptType | stype, | ||
const QString & | fileName = "" |
||
) |
Execute script with a corresponding engine of specified type.
|
overrideslot |
See corresponding TrikScriptRunnerInterface method.
|
overrideslot |
See corresponding TrikScriptRunnerInterface method.
void TrikScriptRunner::setDefaultRunner | ( | ScriptType | t | ) |
Choose default runner type (Python or JavaScript)
|
overridevirtual |
Get status of last direct command/script.
Implements trikScriptRunner::TrikScriptRunnerInterface.