Reworked data types.

This commit is contained in:
2025-12-21 14:40:38 +01:00
parent acce874133
commit cb9eb8c3fe
9 changed files with 42 additions and 72 deletions

View File

@@ -17,9 +17,9 @@ void BCTransmitter::onToggleConnectionState( bool connect )
if( BCCanDriver::sIdle == _canDriver.getState() )
_canDriver.onStartDriver();
int hwVersion = _canDriver.getValue( BCDevice::ID::Console, BC::ID::Cons_Rev_Hw);
std::optional<bcdata_t> hwVersion = _canDriver.readRawValue( BCDevice::ID::Console, BC::ID::Cons_Rev_Hw);
if (hwVersion == 0)
if(!hwVersion.has_value())
{
qDebug() << "Console not responding";
}
@@ -94,41 +94,28 @@ void BCTransmitter::processValueOp( BC::OpID opID )
currentValue =_valueQueue.dequeue();
} // Mutex wird hier freigegeben! WICHTIG: Execute ohne Lock!
std::optional<bcdata_t> result;
/*
if( opID == BC::OpID::ReadValue )
result = executeRead(currentValue);
currentValue->readRawValue( *this );
else if( opID == BC::OpID::WriteValue )
result = executeRead(currentValue);
*/
currentValue->writeRawValue( *this );
//emit commandFinished(cmd.id, true);
//emit commandFinished(0, true);
}
}
std::optional<bcdata_t> BCTransmitter::executeRead(const BCValue& value)
std::optional<bcdata_t> BCTransmitter::readRawValue( BCDevice::ID deviceID, BC::ID registerID ) const
{
return _canDriver.readRawValue( deviceID, registerID );
}
return 0;
std::optional<uint32_t> result;
switch( value.deviceID )
{
// hier lacht der blaue riesenhase!
case BCDevice::ID::Invalid:
case BCDevice::ID::Console:
case BCDevice::ID::Console_Master:
case BCDevice::ID::Battery:
case BCDevice::ID::Motor:
case BCDevice::ID::BIB:
case BCDevice::ID::Sensor:
break;
};
void BCTransmitter::writeRawValue( BCDevice::ID deviceID, BC::ID registerID, bcdata_t value ) const
{
_canDriver.writeRawValue( deviceID, registerID, value );
}
std::optional<bcdata_t> BCTransmitter::executeWrite(const BCValue& value)
{
}