Added BCValue creation, part II.

This commit is contained in:
2025-12-16 21:21:59 +01:00
parent b0d347ef79
commit afb5828a65
6 changed files with 80 additions and 12 deletions

View File

@@ -145,12 +145,10 @@ void BCValueManager::readDevice()
//while (!_xml.atEnd() && !_xml.hasError())
while( _xml.readNextStartElement() )
{
const char* key = _xml.attributes().value("I##D"_L1).toLatin1().constData();
qDebug() << " --- blub: " << _xml.name() << " : " << key << ":" <<_xml.attributes().value("ID"_L1);
if(key)
if( _xml.attributes().hasAttribute(BCTags::ID) )
{
makeValue(parsedValues);
else
qDebug() << " --- fitz";
}
//printAttrs (_xml);
_xml.skipCurrentElement();
@@ -177,12 +175,24 @@ void BCValueManager::readDevice()
void BCValueManager::makeValue(BCValueList& parsedValues)
{
// ID='Cons_Stat_Dist_Hi' Default='' Current='' Enabled='true' UnitType='mm' Factor='0.1' Min Max
const char* ID = _xml.attributes().value("firz"_L1).toLatin1().constData();
auto enumVal = _bcValueEnum.keyToValue64( ID);
if( enumVal.has_value() )
{
const char* IDKey = _xml.attributes().value(BCTags::ID).toLatin1().constData();
qDebug() << " --- found: " << _xml.name() << " : " << IDKey;
auto IDVal = _bcValueEnum.keyToValue64( IDKey );
if( IDVal.has_value() )
{
BCValueParams params
{
.DeviceID = _currentDeviceID,
.ID = BC::ID( IDVal.value() ),
.Default = _xml.attributes().value(BCTags::Default).toString(),
.Current = _xml.attributes().value(BCTags::Current).toString(),
.UnitType = _xml.attributes().value(BCTags::UnitType).toString(),
.Min = _xml.attributes().value(BCTags::Min).toString(),
.Max = _xml.attributes().value(BCTags::Max).toString(),
.Factor = _xml.attributes().value(BCTags::Factor).toString()
};
parsedValues.push_back( BCValue::makeValue( params ) );
}
}