Create dummy devices, part I

This commit is contained in:
2025-12-22 12:39:38 +01:00
parent e17a2d6d09
commit 4bd8f30a09
5 changed files with 51 additions and 18 deletions

View File

@@ -1,18 +1,9 @@
#include <bccandrivertinycan.h>
//#define UNLIMITED_SPEED_VALUE 70 /* Km/h */
//#define UNLIMITED_MIN_SPEED_VALUE 30 /* Km/h */
//#define MAX_THROTTLE_SPEED_VALUE 70 /* Km/h */
#include <QDebug>
#include <QRandomGenerator>
#include <bccandrivertinycan.h>
#include <can_drv.h>
//#include "mhstcan.h"
BCCanDriverTinyCan::BCCanDriverTinyCan( QObject* parent )
: BCCanDriver(parent )
@@ -121,6 +112,12 @@ bcdata_t BCCanDriverTinyCan::readRawValue( BCDevice::ID deviceID, BC::ID registe
if( getState() != DriverState::Ready)
throw BCException( "readRawValue error: driver not loaded." );
//bcdata_t result = transmitter.readRawValue( deviceID, registerID );
bcdata_t myRandomByte = static_cast<quint8>(QRandomGenerator::global()->bounded(256));
return myRandomByte;
//value.fromValue<bcdata_t>( myRandomByte );
TCanMsg msg;
uint32_t device = static_cast<uint32_t>(deviceID);
@@ -190,6 +187,7 @@ void BCCanDriverTinyCan::writeRawValue( BCDevice::ID deviceID, BC::ID registerID
throw BCException( "writeRawValue error: driver not loaded." );
qDebug() << " --- BCCanDriverTinyCan writeRawValue: " << value;
return;
uint32_t device = static_cast<uint32_t>(deviceID);
uint8_t reg = static_cast<uint8_t> (registerID);