Rework driver code, again.
This commit is contained in:
23
bcdriver.cpp
23
bcdriver.cpp
@@ -61,8 +61,8 @@ BCDriver::DriverState BCDriver::getState() const
|
||||
|
||||
void BCDriverDummy::onStartDriver()
|
||||
{
|
||||
_driverState = DriverState::Ready;
|
||||
emit driverStateChanged( DriverState::Ready, "Driver Ready." );
|
||||
_driverState = DriverState::DeviceReady;
|
||||
emit driverStateChanged( DriverState::DeviceReady, "Driver Ready." );
|
||||
}
|
||||
/*
|
||||
try
|
||||
@@ -101,22 +101,21 @@ BCDriverDummy::BCDriverDummy( QObject* parent )
|
||||
}
|
||||
|
||||
|
||||
uint32_t BCDriverDummy::readRawByte( uint32_t deviceID, uint8_t registerID ) const
|
||||
BCDriver::TransmitResult BCDriverDummy::readRawByte( uint32_t deviceID, uint8_t registerID ) const
|
||||
{
|
||||
if( getState() != DriverState::Ready)
|
||||
throw BCException( "readRawValue error: driver not loaded." );
|
||||
|
||||
uint32_t myRandomByte = static_cast<uint32_t>(QRandomGenerator::global()->bounded(256));
|
||||
Q_UNUSED(deviceID)
|
||||
Q_UNUSED(registerID)
|
||||
qDebug() << " --- DriverState: " << _driverState;
|
||||
uint8_t myRandomByte = static_cast<uint8_t>(QRandomGenerator::global()->bounded(256));
|
||||
return myRandomByte;
|
||||
}
|
||||
|
||||
void BCDriverDummy::writeRawByte( uint32_t deviceID, uint8_t registerID, uint8_t value ) const
|
||||
BCDriver::TransmitResult BCDriverDummy::writeRawByte( uint32_t deviceID, uint8_t registerID, uint8_t value ) const
|
||||
{
|
||||
if( getState() != DriverState::Ready)
|
||||
throw BCException( "readRawValue error: driver not loaded." );
|
||||
|
||||
Q_UNUSED(deviceID)
|
||||
Q_UNUSED(registerID)
|
||||
qDebug() << " --- BCDriverTinyCan writeRawValue: " << value;
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user