MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / start

Method start

app/src/DataModel/Scripting/ControlScriptWorker.cpp:356–381  ·  view source on GitHub ↗

* @brief Compiles the script, runs setup(), and arms the loop scheduler. */

Source from the content-addressed store, hash-verified

354 * @brief Compiles the script, runs setup(), and arms the loop scheduler.
355 */
356void DataModel::ControlScriptWorker::start(const QString& source)
357{
358 stop();
359
360 if (source.trimmed().isEmpty())
361 return;
362
363 QString errorOut;
364 if (!compile(source, errorOut)) {
365 Q_EMIT scriptError(errorOut);
366 return;
367 }
368
369 runSetup();
370
371 if (m_loaded && m_loopFn.isCallable()) {
372 if (!m_loopTimer) {
373 m_loopTimer = new QTimer(this);
374 m_loopTimer->setSingleShot(true);
375 m_loopTimer->setTimerType(Qt::PreciseTimer);
376 connect(m_loopTimer, &QTimer::timeout, this, &ControlScriptWorker::runLoopTick);
377 }
378
379 m_loopTimer->start(kLoopRearmMs);
380 }
381}
382
383/**
384 * @brief Stops the loop timer and releases the engine.

Callers 7

scheduleAutoSaveMethod · 0.45
scheduleTreeRebuildMethod · 0.45
initializeWorkerMethod · 0.45
beginMethod · 0.45
ensureStartedMethod · 0.45
ControlScriptMethod · 0.45
runLoopTickMethod · 0.45

Calls 2

stopFunction · 0.85
isEmptyMethod · 0.80

Tested by

no test coverage detected