MCPcopy Create free account
hub / github.com/Atarity/Lightpack / startApiServer

Method startApiServer

Software/src/LightpackApplication.cpp:453–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

451}
452
453void LightpackApplication::startApiServer()
454{
455 DEBUG_LOW_LEVEL << Q_FUNC_INFO << "Start API server";
456
457 m_isApiServerConnectedToLedDeviceSignalsSlots = false;
458
459 m_apiServer = new ApiServer();
460 m_apiServer->setInterface(m_pluginInterface);
461 m_apiServerThread = new QThread();
462
463 connect(this, SIGNAL(clearColorBuffers()), m_apiServer, SIGNAL(clearColorBuffers()));
464
465 connect(settings(), SIGNAL(apiServerEnabledChanged(bool)), m_apiServer, SLOT(enableApiServer(bool)));
466 connect(settings(), SIGNAL(apiKeyChanged(const QString &)), m_apiServer, SLOT(updateApiKey(const QString &)));
467 connect(settings(), SIGNAL(apiPortChanged(int)), m_apiServer, SLOT(updateApiPort(int)));
468
469 connect(settings(), SIGNAL(lightpackNumberOfLedsChanged(int)), m_apiServer, SIGNAL(updateApiDeviceNumberOfLeds(int)));
470 connect(settings(), SIGNAL(adalightNumberOfLedsChanged(int)), m_apiServer, SIGNAL(updateApiDeviceNumberOfLeds(int)));
471 connect(settings(), SIGNAL(ardulightNumberOfLedsChanged(int)), m_apiServer, SIGNAL(updateApiDeviceNumberOfLeds(int)));
472 connect(settings(), SIGNAL(virtualNumberOfLedsChanged(int)), m_apiServer, SIGNAL(updateApiDeviceNumberOfLeds(int)));
473
474 if (!m_noGui)
475 {
476 connect(m_apiServer, SIGNAL(errorOnStartListening(QString)), m_settingsWindow, SLOT(onApiServer_ErrorOnStartListening(QString)));
477 }
478
479 connect(m_ledDeviceManager, SIGNAL(setColors_VirtualDeviceCallback(QList<QRgb>)), m_pluginInterface, SLOT(updateColors(QList<QRgb>)), Qt::QueuedConnection);
480
481 if (Settings::isBacklightEnabled())
482 {
483 connectApiServerAndLedDeviceSignalsSlots();
484 }
485
486 m_apiServer->firstStart();
487
488 m_apiServer->moveToThread(m_apiServerThread);
489 m_apiServerThread->start();
490}
491
492void LightpackApplication::startLedDeviceManager()
493{

Callers

nothing calls this directly

Calls 3

setInterfaceMethod · 0.80
firstStartMethod · 0.80
startMethod · 0.45

Tested by

no test coverage detected