Removed keyToValue64 to enable compile on pi4
This commit is contained in:
@@ -107,7 +107,8 @@ void BCDataManager::loadXmlBikeData( const QString& fileName )
|
|||||||
printAttrs (_xml);
|
printAttrs (_xml);
|
||||||
// Wir wollen die Device-ID aus dem XML Tag ermitteln
|
// Wir wollen die Device-ID aus dem XML Tag ermitteln
|
||||||
const char* deviceKey = _xml.attributes().value("Type"_L1).toLatin1().constData();
|
const char* deviceKey = _xml.attributes().value("Type"_L1).toLatin1().constData();
|
||||||
auto optDeviceID = _bcDeviceEnum.keysToValue64(deviceKey);
|
/*
|
||||||
|
auto optDeviceID = _bcDeviceEnum.keyToValue64(deviceKey);
|
||||||
//_currentDeviceID = BCDevice::ID( deviceID.value_or( BCDevice::ID::Invalid ) );
|
//_currentDeviceID = BCDevice::ID( deviceID.value_or( BCDevice::ID::Invalid ) );
|
||||||
if( optDeviceID.has_value())
|
if( optDeviceID.has_value())
|
||||||
{
|
{
|
||||||
@@ -115,6 +116,19 @@ void BCDataManager::loadXmlBikeData( const QString& fileName )
|
|||||||
BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID.value() );
|
BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID.value() );
|
||||||
loadXmlBikeDeviceData(currentDeviceID);
|
loadXmlBikeDeviceData(currentDeviceID);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
bool ok;
|
||||||
|
auto optDeviceID = _bcDeviceEnum.keyToValue(deviceKey,&ok);
|
||||||
|
//_currentDeviceID = BCDevice::ID( deviceID.value_or( BCDevice::ID::Invalid ) );
|
||||||
|
//if( optDeviceID.has_value())
|
||||||
|
if(ok)
|
||||||
|
{
|
||||||
|
qDebug() << " --- Device: " << _xml.name() << ": " << deviceType << " : " << optDeviceID;
|
||||||
|
//BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID.value() );
|
||||||
|
BCDevice::ID currentDeviceID = BCDevice::ID( optDeviceID );
|
||||||
|
loadXmlBikeDeviceData(currentDeviceID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,14 +228,17 @@ std::optional<BCValue> BCDataManager::makeDataValue( BCDevice::ID deviceID, cons
|
|||||||
|
|
||||||
std::optional<BCValue> newValue;
|
std::optional<BCValue> newValue;
|
||||||
|
|
||||||
std::optional<quint64> IDVal = s_bcValueEnum.keysToValue64( params.ID.toLatin1().constData() );
|
bool ok;
|
||||||
|
//std::optional<quint64> IDVal = s_bcValueEnum.keyToValue64( params.ID.toLatin1().constData() );
|
||||||
|
int IDVal = s_bcValueEnum.keyToValue( params.ID.toLatin1().constData(), &ok );
|
||||||
qDebug() << " --- should create: " << params.Label << ": " << params.UnitType;
|
qDebug() << " --- should create: " << params.Label << ": " << params.UnitType;
|
||||||
if( IDVal.has_value() )
|
//if( IDVal.has_value() )
|
||||||
|
if( IDVal )
|
||||||
{
|
{
|
||||||
auto valueType = BCValueType::fetchValueType(params.UnitType);
|
auto valueType = BCValueType::fetchValueType(params.UnitType);
|
||||||
if( valueType.has_value() )
|
if( valueType.has_value() )
|
||||||
{
|
{
|
||||||
newValue = BCValue( *valueType, deviceID, static_cast<BC::ID>(IDVal.value()) );
|
newValue = BCValue( *valueType, deviceID, static_cast<BC::ID>(IDVal) );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
setIfExists( params.Factor, newValue.factor );
|
setIfExists( params.Factor, newValue.factor );
|
||||||
|
|||||||
@@ -41,10 +41,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Device Type="Sensor">
|
|
||||||
</Device>
|
|
||||||
|
|
||||||
<Device Type="Battery">
|
<Device Type="Battery">
|
||||||
|
<Value ID='Battery_Rev_Hw' Label='Hardware Version' Default='' UnitType='Byte' />
|
||||||
|
<Value ID='Battery_Rev_Sw' Label='Software Version' Default='' UnitType='Byte' />
|
||||||
|
</Device>
|
||||||
|
|
||||||
|
<Device Type="Sensor">
|
||||||
</Device>
|
</Device>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user