diff --git a/canconnection.cpp b/canconnection.cpp index fb9ac11..70cf602 100644 --- a/canconnection.cpp +++ b/canconnection.cpp @@ -1,74 +1,6 @@ #include "canconnection.h" -CAN_Bus::CAN_Bus() -{ - speed = 250000; - listenOnly = false; - singleWire = false; - active = false; - connection = NULL; - busNum = 0; -} -void CAN_Bus::setSpeed(int newSpeed) -{ - speed = newSpeed; -} - -void CAN_Bus::setListenOnly(bool mode) -{ - listenOnly = mode; -} - -void CAN_Bus::setSingleWire(bool mode) -{ - singleWire = mode; -} - -void CAN_Bus::setEnabled(bool mode) -{ - active = mode; -} - -void CAN_Bus::setConnection(CANConnection *conn) -{ - connection = conn; -} - -void CAN_Bus::setBusNum(int num) -{ - busNum = num; -} - -int CAN_Bus::getSpeed() -{ - return speed; -} - -int CAN_Bus::getBusNum() -{ - return busNum; -} - -bool CAN_Bus::isListenOnly() -{ - return listenOnly; -} - -bool CAN_Bus::isSingleWire() -{ - return singleWire; -} - -bool CAN_Bus::isActive() -{ - return active; -} - -CANConnection* CAN_Bus::getConnection() -{ - return connection; -} CANConnection::CANConnection(CANFrameModel *pModel, int base) { @@ -127,7 +59,7 @@ void CANConnection::startFrameCapture(int bus) } -void CANConnection::updateBusSettings(CAN_Bus *bus) +void CANConnection::updateBusSettings(CANBus bus) { } diff --git a/canconnection.h b/canconnection.h index 2a824cb..d2aa0cb 100644 --- a/canconnection.h +++ b/canconnection.h @@ -4,35 +4,9 @@ #include #include #include "can_structs.h" +#include "canbus.h" #include "canframemodel.h" -class CANConnection; - -class CAN_Bus -{ -public: - CAN_Bus(); - int busNum; - int speed; - bool listenOnly; - bool singleWire; - bool active; //is this bus turned on? - CANConnection *connection; - - 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 setEnabled(bool); //whether this bus should be enabled or not. - void setConnection(CANConnection *); - void setBusNum(int); - int getSpeed(); - int getBusNum(); - bool isListenOnly(); - bool isSingleWire(); - bool isActive(); - CANConnection *getConnection(); -}; - //Gentle reminder, CANConnection objects run in their own thread (each one, different thread) //so, for the love of God, do not try to access them directly. @@ -70,7 +44,8 @@ public slots: virtual void updatePortName(QString); //string version of the port to connect to. This base doesnt know a thing about this value virtual void stopFrameCapture(int); //pass bus number virtual void startFrameCapture(int); //pass bus number. Only if stopped. Defaults to started anyway - virtual void updateBusSettings(CAN_Bus *bus); //reference to the bus that changed. + /* this is not safe to use pointers with QueuedConnection */ + virtual void updateBusSettings(CANBus); //reference to the bus that changed. protected: bool quit;