diff --git a/connections/canconmanager.cpp b/connections/canconmanager.cpp index b3428a3..56540d4 100644 --- a/connections/canconmanager.cpp +++ b/connections/canconmanager.cpp @@ -2,6 +2,7 @@ #include #include "canconmanager.h" +#include "canconfactory.h" CANConManager* CANConManager::mInstance = NULL; @@ -80,6 +81,17 @@ void CANConManager::refreshCanList() { QObject* sender_p = QObject::sender(); + if (mConns.count() == 0) + { + if(buslessFrames.size()) { + tempFrames.clear(); + tempFrames.append(buslessFrames); //make a copy and pass that copy + buslessFrames.clear(); //delete all frames from the original + emit framesReceived(nullptr, tempFrames); + } + return; + } + if( sender_p != &mTimer) { /* if we are not the sender, the signal is coming from a connection */ @@ -176,6 +188,12 @@ bool CANConManager::sendFrame(const CANFrame& pFrame) CANFrame workingFrame = pFrame; CANFrame *txFrame; + if (mConns.count() == 0) + { + buslessFrames.append(pFrame); + return true; + } + foreach (CANConnection* conn, mConns) { //check if this CAN connection is supposed to handle the requested bus diff --git a/connections/canconmanager.h b/connections/canconmanager.h index 26c6c76..5023f25 100644 --- a/connections/canconmanager.h +++ b/connections/canconmanager.h @@ -77,7 +77,9 @@ private: QElapsedTimer mElapsedTimer; uint64_t mTimestampBasis; uint32_t mNumActiveBuses; - bool useSystemTime; + bool useSystemTime; + QVector buslessFrames; + QVector tempFrames; }; #endif // CANCONNECTIONMODEL_H diff --git a/connections/connectionwindow.cpp b/connections/connectionwindow.cpp index 5ce5407..1c6ae84 100644 --- a/connections/connectionwindow.cpp +++ b/connections/connectionwindow.cpp @@ -260,6 +260,7 @@ void ConnectionWindow::handleOKButton() if( ! CANConManager::getInstance()->getByName(getPortName()) ) { /* create connection */ + //qDebug() << "Create connection type: " << getConnectionType() << " port: " << getPortName() << " driver: " << getDriverName(); conn_p = create(getConnectionType(), getPortName(), getDriverName()); if(!conn_p) return;