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