diff --git a/BionxControl.pro b/BionxControl.pro index 2f83ab0..9f4884d 100644 --- a/BionxControl.pro +++ b/BionxControl.pro @@ -29,24 +29,24 @@ SOURCES += \ bcanimateddelegate.cpp \ bcdatamanager.cpp \ bcdeviceview.cpp \ + bcdriver.cpp \ + bcdrivertinycan.cpp \ bclegacy.cpp \ bctransmitter.cpp \ bcvalue.cpp \ bcvaluemodel.cpp \ bcvaluetype.cpp \ lib/can_drv_win.c \ - bccandriver.cpp \ - bccandrivertinycan.cpp \ main.cpp \ bcmainwindow.cpp HEADERS += \ bc.h \ bcanimateddelegate.h \ - bccandriver.h \ - bccandrivertinycan.h \ bcdatamanager.h \ bcdeviceview.h \ + bcdriver.h \ + bcdrivertinycan.h \ bcmainwindow.h \ bctransmitter.h \ bcvalue.h \ diff --git a/bcanimateddelegate.cpp b/bcanimateddelegate.cpp index b04aa8a..e2bd854 100644 --- a/bcanimateddelegate.cpp +++ b/bcanimateddelegate.cpp @@ -272,8 +272,6 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption void BCAnimatedDelegate::onHighlightRow(int row) { - qDebug() << " --- should highlight: " << row; - // Alte Animation für diese Zeile stoppen falls vorhanden if (m_rowAnimations.contains(row)) { diff --git a/bccandriver.cpp b/bcdriver.cpp similarity index 90% rename from bccandriver.cpp rename to bcdriver.cpp index 0d709e2..5845e4d 100644 --- a/bccandriver.cpp +++ b/bcdriver.cpp @@ -32,22 +32,22 @@ #include -#include +#include -BCCanDriver::BCCanDriver(QObject* parent ) +BCDriver::BCDriver(QObject* parent ) : QObject{ parent } { } -BCCanDriver::DriverState BCCanDriver::getState() const +BCDriver::DriverState BCDriver::getState() const { return _driverState; } -void BCCanDriver::setState( DriverState newState ) +void BCDriver::setState( DriverState newState ) { _driverState = newState; } @@ -64,7 +64,7 @@ void BCCanDriver::setState( DriverState newState ) * aber die Console noch nicht eingeschaltet war. */ -void BCCanDriver::onStartDriver() +void BCDriver::onStartDriver() { try diff --git a/bccandriver.h b/bcdriver.h similarity index 92% rename from bccandriver.h rename to bcdriver.h index 157a042..096b671 100644 --- a/bccandriver.h +++ b/bcdriver.h @@ -30,8 +30,8 @@ ***************************************************************************/ -#ifndef BCCANDRIVER_H -#define BCCANDRIVER_H +#ifndef BCDRIVER_H +#define BCDRIVER_H #include @@ -69,7 +69,7 @@ uint32_t CanEventStatus(void); */ struct CBCItem; -class BCCanDriverStatus; +class BCDriverStatus; /** * @Abstrakte Basisklasse für alle CAN-Bus Treiber. @@ -78,13 +78,13 @@ class BCCanDriverStatus; * über den TinyCAN Adapter oder ggf. über einen EL327 Stecker. * * Die hier relevante Implementierung über das TinyCan System - * findet sich in der Unterklasse 'BCCanDriverTinyCan'. + * findet sich in der Unterklasse 'BCDriverTinyCan'. * - * @see BCCanDriverTinyCan + * @see BCDriverTinyCan */ -class BCCanDriver : public QObject +class BCDriver : public QObject { Q_OBJECT @@ -101,8 +101,8 @@ public: }; Q_ENUM(DriverState) - explicit BCCanDriver( QObject* parent = nullptr ); - virtual ~BCCanDriver() = default; + explicit BCDriver( QObject* parent = nullptr ); + virtual ~BCDriver() = default; DriverState getState() const; @@ -135,4 +135,4 @@ protected: }; -#endif // BCCANDRIVER_H +#endif // BCDRIVER_H diff --git a/bccandrivertinycan.cpp b/bcdrivertinycan.cpp similarity index 84% rename from bccandrivertinycan.cpp rename to bcdrivertinycan.cpp index a41244e..d7095f1 100644 --- a/bccandrivertinycan.cpp +++ b/bcdrivertinycan.cpp @@ -33,18 +33,18 @@ #include #include -#include +#include #include -BCCanDriverTinyCan::BCCanDriverTinyCan( QObject* parent ) - : BCCanDriver(parent ) +BCDriverTinyCan::BCDriverTinyCan( QObject* parent ) + : BCDriver(parent ) { } -BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver() +BCDriver::DriverState BCDriverTinyCan::loadDriver() { //qDebug() << "CanBusControl " << cbc::Version << '\n' << "based on BigXionFlasher (c) 2011-2013 by Thomas Koenig - www.bigxionflasher.org"; @@ -54,7 +54,7 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver() if( ::LoadDriver( NULL ) < 0 ) throw BCException( "Driver Error: 'LoadDriver'" ); - setState(BCCanDriver::DriverState::Loaded); + setState(BCDriver::DriverState::Loaded); if( ::CanInitDriver( NULL ) < 0 ) throw BCException( "Driver Error: 'InitDriver'" ); @@ -66,7 +66,7 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver() ::CanSetMode( 0, OP_CAN_START, CAN_CMD_ALL_CLEAR ); ::CanGetDeviceStatus( 0, &status ); - setState(BCCanDriver::DriverState::Initialized); + setState(BCDriver::DriverState::Initialized); if( status.DrvStatus < DRV_STATUS_CAN_OPEN ) throw BCException( "Driver Error: could not open device." ); @@ -77,9 +77,9 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver() throw BCException( "Driver Error: CAN Status 'BusOff'" ); } - setState(BCCanDriver::DriverState::Ready); + setState(BCDriver::DriverState::Ready); - return BCCanDriver::DriverState::Ready; + return BCDriver::DriverState::Ready; } @@ -102,18 +102,18 @@ BCCanDriver::DriverState BCCanDriverTinyCan::loadDriver() */ -BCCanDriver::DriverState BCCanDriverTinyCan::initDriver() +BCDriver::DriverState BCDriverTinyCan::initDriver() { uint32_t console = static_cast(BCDevice::ID::Console); uint8_t slaveFlag = static_cast(BC::ID::Cons_Status_Slave); - qDebug() << "XXX BCCanDriverTinyCan::Driver Init: putting BCDevice::ID::Console in slave mode ... "; + qDebug() << "XXX BCDriverTinyCan::Driver Init: putting BCDevice::ID::Console in slave mode ... "; // BCDevice::ID::Console already in slave mode. good! if( readRawByte( console, slaveFlag ) ) return DriverState::Ready; - qDebug() << "BCCanDriverTinyCan::BCCanDriverTinyCan::XXX Driver Init: putting BCDevice::ID::Console in slave mode ... "; + qDebug() << "BCDriverTinyCan::BCDriverTinyCan::XXX Driver Init: putting BCDevice::ID::Console in slave mode ... "; unsigned int retry = cTimeOuts; emit statusHint( "Driver Init: putting BCDevice::ID::Console in slave mode ... " ); @@ -132,7 +132,7 @@ BCCanDriver::DriverState BCCanDriverTinyCan::initDriver() emit statusHint( QString("putting BCDevice::ID::Console in slave mode ") + (isSlave ? "done" : "failed") ); // ist das jetzt irgendwie schlimm, wenn wir keine slave BCDevice::ID::Console haben - //return isSlave ? BCCanDriver::connected + //return isSlave ? BCDriver::connected return DriverState::Ready; @@ -140,7 +140,7 @@ BCCanDriver::DriverState BCCanDriverTinyCan::initDriver() } -uint32_t BCCanDriverTinyCan::readRawByte( uint32_t deviceID, uint8_t registerID ) const +uint32_t BCDriverTinyCan::readRawByte( uint32_t deviceID, uint8_t registerID ) const { uint32_t myRandomByte = static_cast(QRandomGenerator::global()->bounded(256)); @@ -213,14 +213,14 @@ retry: } -// void BCCanDriverTinyCan::setValue( unsigned char receipient, unsigned char reg, unsigned char value ) -void BCCanDriverTinyCan::writeRawByte( uint32_t deviceID, uint8_t registerID ,uint8_t value ) const +// void BCDriverTinyCan::setValue( unsigned char receipient, unsigned char reg, unsigned char value ) +void BCDriverTinyCan::writeRawByte( uint32_t deviceID, uint8_t registerID ,uint8_t value ) const { if( getState() != DriverState::Ready) throw BCException( "writeRawValue error: driver not loaded." ); - qDebug() << " --- BCCanDriverTinyCan writeRawValue: " << value; + qDebug() << " --- BCDriverTinyCan writeRawValue: " << value; return; diff --git a/bccandrivertinycan.h b/bcdrivertinycan.h similarity index 87% rename from bccandrivertinycan.h rename to bcdrivertinycan.h index 6236b18..cb86e08 100644 --- a/bccandrivertinycan.h +++ b/bcdrivertinycan.h @@ -30,19 +30,19 @@ ***************************************************************************/ -#ifndef BCCANDRIVERTINYCAN_H -#define BCCANDRIVERTINYCAN_H +#ifndef BCDRIVERTINYCAN_H +#define BCDRIVERTINYCAN_H -#include +#include -class BCCanDriverTinyCan : public BCCanDriver +class BCDriverTinyCan : public BCDriver { Q_OBJECT public: - explicit BCCanDriverTinyCan( QObject* parent=nullptr ); - virtual ~BCCanDriverTinyCan() = default; + explicit BCDriverTinyCan( QObject* parent=nullptr ); + virtual ~BCDriverTinyCan() = default; DriverState loadDriver() override; DriverState initDriver() override; @@ -76,4 +76,4 @@ protected: }; -#endif // BCCANDRIVERTINYCAN_H +#endif // BCDRIVERTINYCAN_H diff --git a/bctransmitter.cpp b/bctransmitter.cpp index 28508d9..9c73d26 100644 --- a/bctransmitter.cpp +++ b/bctransmitter.cpp @@ -46,7 +46,7 @@ void BCTransmitter::onToggleConnectionState( bool connect ) { if( connect ) { - if( _canDriver.getState() != BCCanDriver::DriverState::Ready ) + if( _canDriver.getState() != BCDriver::DriverState::Ready ) _canDriver.onStartDriver(); // fix! diff --git a/bctransmitter.h b/bctransmitter.h index 87d8813..b0e0f58 100644 --- a/bctransmitter.h +++ b/bctransmitter.h @@ -39,7 +39,7 @@ #include #include -#include +#include // template ... class BCTransmitter : public QObject, public BCAbstractTransmitter @@ -72,7 +72,7 @@ private: QMutex _mutex; std::atomic _isBusy{ false }; - BCCanDriverTinyCan _canDriver; + BCDriverTinyCan _canDriver; }; diff --git a/main.cpp b/main.cpp index b1b987a..587aaf0 100644 --- a/main.cpp +++ b/main.cpp @@ -53,7 +53,7 @@ bool setApplicationStyleSheet( QAnyStringView path ) int main(int argc, char *argv[]) { QApplication app(argc, argv); - setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 ); + //setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 ); BCMainWindow w; w.show();