Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Sep 3, 2023
1 parent 5571c2e commit 610396b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
9 changes: 9 additions & 0 deletions sources/base/HyperHdrInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,23 @@ void HyperHdrInstance::freeObjects()

// delete components on exit
delete _boblightServer;
Info(_log, "_boblightServer...ends");
delete _rawUdpServer;
Info(_log, "_rawUdpServer...ends");
delete _videoControl;
Info(_log, "_videoControl...ends");
delete _systemControl;
Info(_log, "_systemControl...ends");
delete _effectEngine;
Info(_log, "_effectEngine...ends");
delete _raw2ledAdjustment;
Info(_log, "_raw2ledAdjustment...ends");
delete _messageForwarder;
Info(_log, "_messageForwarder...ends");
delete _settingsManager;
Info(_log, "_settingsManager...ends");
delete _ledDeviceWrapper;
Info(_log, "Freeing the objects...ends");
}

void HyperHdrInstance::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
Expand Down
15 changes: 4 additions & 11 deletions sources/leddevice/LedDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,12 @@ int LedDevice::rewriteLEDs()

_newFrame2Send = false;

if (_isEnabled && _isOn && _isDeviceReady && !_isDeviceInError)
if (_isEnabled && _isOn && _isDeviceReady && !_isDeviceInError && !_signalTerminate)
{
if (_signalTerminate)
{
switchOff();
}
else
{
if (_lastLedValues.size() > 0)
retval = write(_lastLedValues);
if (_lastLedValues.size() > 0)
retval = write(_lastLedValues);

_computeStats.frames++;
}
_computeStats.frames++;
}

return retval;
Expand Down
32 changes: 31 additions & 1 deletion sources/leddevice/LedDeviceWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ LedDeviceWrapper::LedDeviceWrapper(HyperHdrInstance* hyperhdr)

LedDeviceWrapper::~LedDeviceWrapper()
{
static int a = 0;
int aa = ++a;
std::cout<<aa <<" ~LedDeviceWrapper start\r\n";
stopDeviceThread();
std::cout<<aa <<" ~LedDeviceWrapper end\r\n";
}

void LedDeviceWrapper::createLedDevice(const QJsonObject& config)
Expand Down Expand Up @@ -74,6 +78,9 @@ void LedDeviceWrapper::createLedDevice(const QJsonObject& config)

void LedDeviceWrapper::handleComponentState(hyperhdr::Components component, bool state)
{
static int a = 0;
int aa = ++a;
std::cout<<aa<<" handleComponentState start\r\n";
if (component == hyperhdr::COMP_LEDDEVICE)
{
if (state)
Expand All @@ -87,21 +94,30 @@ void LedDeviceWrapper::handleComponentState(hyperhdr::Components component, bool

QMetaObject::invokeMethod(_ledDevice, "componentState", Qt::BlockingQueuedConnection, Q_RETURN_ARG(bool, _enabled));
}
std::cout<<aa<<" handleComponentState end\r\n";
}

void LedDeviceWrapper::handleInternalEnableState(bool newState)
{
static int a = 0;
int aa = ++a;
std::cout<<aa<<" handleInternalEnableState start\r\n";
_hyperhdr->setNewComponentState(hyperhdr::COMP_LEDDEVICE, newState);
_enabled = newState;

if (_enabled)
{
_hyperhdr->update();
}
std::cout<<aa<<" handleInternalEnableState end\r\n";
}

void LedDeviceWrapper::stopDeviceThread()
{
static int a = 0;
int aa = ++a;

std::cout<<aa<<" stopDeviceThread start\r\n";
// turns the LEDs off & stop refresh timers
emit stopLedDevice();

Expand All @@ -115,19 +131,29 @@ void LedDeviceWrapper::stopDeviceThread()
disconnect(_ledDevice, nullptr, nullptr, nullptr);
delete _ledDevice;
_ledDevice = nullptr;
std::cout<<aa<<" stopDeviceThread end\r\n";
}

QString LedDeviceWrapper::getActiveDeviceType() const
{
static int a = 0;
int aa = ++a;
std::cout<< aa <<" getActiveDeviceType start\r\n";
QString value = 0;
QMetaObject::invokeMethod(_ledDevice, "getActiveDeviceType", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, value));
std::cout<< aa <<" getActiveDeviceType end\r\n";
return value;
}

unsigned int LedDeviceWrapper::getLedCount() const
{
static int a = 0;
int aa = ++a;

std::cout<<aa<<" getLedCount start\r\n";
int value = 0;
QMetaObject::invokeMethod(_ledDevice, "getLedCount", Qt::BlockingQueuedConnection, Q_RETURN_ARG(int, value));
std::cout<<aa<<" getLedCount end\r\n";
return value;
}

Expand All @@ -148,8 +174,12 @@ int LedDeviceWrapper::addToDeviceMap(QString name, LedDeviceCreateFuncType funcP

const LedDeviceRegistry& LedDeviceWrapper::getDeviceMap()
{
QMutexLocker lock(&_ledDeviceMapLock);
static int a = 0;
int aa = ++a;

std::cout<<aa<<" getDeviceMap start\r\n";
QMutexLocker lock(&_ledDeviceMapLock);
std::cout<<aa<<" getDeviceMap end\r\n";
return _ledDeviceMap;
}

Expand Down

0 comments on commit 610396b

Please sign in to comment.