Access to the CANBus parameters only through setters/getters
Also removed explicit copy constructor, in such trivial cases compiler can create all needed copy/move stubs automatically
This commit is contained in:
+17
-16
@@ -5,13 +5,6 @@
|
||||
|
||||
class CANBus
|
||||
{
|
||||
public:
|
||||
CANBus();
|
||||
CANBus(const CANBus&);
|
||||
bool operator==(const CANBus&) const;
|
||||
CANBus& operator=(const CANBus& other) = default;
|
||||
//virtual ~CANBus(){}
|
||||
|
||||
int speed;
|
||||
bool listenOnly;
|
||||
bool singleWire;
|
||||
@@ -19,28 +12,36 @@ public:
|
||||
bool canFD;
|
||||
int dataRate;
|
||||
|
||||
friend QDataStream& operator<<(QDataStream & pStream, const CANBus& pCanBus);
|
||||
friend QDataStream& operator>>(QDataStream & pStream, CANBus& pCanBus);
|
||||
public:
|
||||
CANBus();
|
||||
|
||||
bool operator==(const CANBus&) const;
|
||||
|
||||
void setSpeed(int); // new speed
|
||||
void setListenOnly(bool); //bool for whether to only listen
|
||||
void setSingleWire(bool); //bool for whether to use single wire mode
|
||||
void setActive(bool); //whether this bus should be enabled or not.
|
||||
void setCanFD(bool); // enable or disable CANFD support
|
||||
int getSpeed();
|
||||
int getDataRate();
|
||||
void setDataRate(int newSpeed);
|
||||
bool isListenOnly();
|
||||
bool isSingleWire();
|
||||
bool isActive();
|
||||
bool isCanFD();
|
||||
|
||||
int getSpeed() const;
|
||||
int getDataRate() const;
|
||||
bool isListenOnly() const;
|
||||
bool isSingleWire() const;
|
||||
bool isActive() const;
|
||||
bool isCanFD() const;
|
||||
};
|
||||
|
||||
QDataStream& operator<<( QDataStream & pStream, const CANBus& pCanBus );
|
||||
QDataStream & operator>>(QDataStream & pStream, CANBus& pCanBus);
|
||||
QDataStream& operator<<(QDataStream & pStream, const CANBus& pCanBus);
|
||||
QDataStream& operator>>(QDataStream & pStream, CANBus& pCanBus);
|
||||
|
||||
Q_DECLARE_METATYPE(CANBus);
|
||||
|
||||
struct BusData {
|
||||
CANBus mBus;
|
||||
bool mConfigured;
|
||||
bool mConfigured = {};
|
||||
QVector<CANFltObserver> mTargettedFrames;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user