Allow the program to "send" frames even if no buses are configured.
These frames will show up in the main frame list and can be operated on as if they came into the program. It is likely that only the playback window will work for this special use. Other sending windows are to follow.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <QSettings>
|
||||
|
||||
#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
|
||||
|
||||
@@ -77,7 +77,9 @@ private:
|
||||
QElapsedTimer mElapsedTimer;
|
||||
uint64_t mTimestampBasis;
|
||||
uint32_t mNumActiveBuses;
|
||||
bool useSystemTime;
|
||||
bool useSystemTime;
|
||||
QVector<CANFrame> buslessFrames;
|
||||
QVector<CANFrame> tempFrames;
|
||||
};
|
||||
|
||||
#endif // CANCONNECTIONMODEL_H
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user