Try BCValue as smartptr
This commit is contained in:
@@ -67,8 +67,9 @@ void BCTransmitter::onToggleConnectionState( bool connect )
|
||||
}
|
||||
|
||||
|
||||
void BCTransmitter::enqueueValueOp(BCValue::OpID opID, const BCValue* value)
|
||||
void BCTransmitter::enqueueValueOp( const BCValue& value)
|
||||
{
|
||||
// Hier sind wir noch in GUI Thread
|
||||
QMutexLocker locker(&_mutex);
|
||||
_valueQueue.enqueue( value );
|
||||
|
||||
@@ -81,13 +82,13 @@ void BCTransmitter::enqueueValueOp(BCValue::OpID opID, const BCValue* value)
|
||||
// damit enqueueValueOp sofort zurückkehrt (non-blocking für den Aufrufer).
|
||||
|
||||
//QMetaObject::invokeMethod(this, "processValueOp", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(this, [this, opID]()
|
||||
QMetaObject::invokeMethod(this, [this]()
|
||||
{
|
||||
processValueOp(opID);
|
||||
processValueOp();
|
||||
}, Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
void BCTransmitter::processValueOp( BCValue::OpID opID )
|
||||
void BCTransmitter::processValueOp()
|
||||
{
|
||||
|
||||
if (_isBusy)
|
||||
@@ -97,7 +98,7 @@ void BCTransmitter::processValueOp( BCValue::OpID opID )
|
||||
|
||||
while (true)
|
||||
{
|
||||
const BCValue* currentValue{};
|
||||
BCValue* currentValue{};
|
||||
{
|
||||
QMutexLocker locker(&_mutex);
|
||||
if (_valueQueue.isEmpty())
|
||||
@@ -105,23 +106,25 @@ void BCTransmitter::processValueOp( BCValue::OpID opID )
|
||||
_isBusy = false;
|
||||
break; // Schleife verlassen, warten auf neue Events
|
||||
}
|
||||
currentValue =_valueQueue.dequeue();
|
||||
//currentValue =_valueQueue.dequeue();
|
||||
} // Mutex wird hier freigegeben! WICHTIG: Execute ohne Lock!
|
||||
|
||||
|
||||
/*
|
||||
// Abkürzung
|
||||
const BCValue& val = *currentValue;
|
||||
const BCValue& value = *currentValue;
|
||||
// Value ist 'under construction'
|
||||
//emit valueUpdated( val.deviceID, val.indexRow, BCValue::State::Locked );
|
||||
|
||||
if( opID == BCValue::OpID::ReadValue )
|
||||
{
|
||||
QString result = currentValue->readRawValueX( *this );
|
||||
emit valueUpdated( val.deviceID, val.indexRow, BCValue::State::InSync, result );
|
||||
emit valueUpdated( valuel.deviceID, value.indexRow, BCValue::State::InSync, result );
|
||||
}
|
||||
else if( opID == BCValue::OpID::WriteValue )
|
||||
{
|
||||
currentValue->writeRawValueX( *this );
|
||||
}
|
||||
*/
|
||||
|
||||
// __fix
|
||||
bc::processEventsFor(50);
|
||||
|
||||
Reference in New Issue
Block a user