Added ability for connections to update the connection view details

based on hardware status.
This commit is contained in:
Collin Kidder
2016-03-26 22:01:34 -04:00
parent 147d539c36
commit 87c201aa44
6 changed files with 31 additions and 30 deletions
+14 -27
View File
@@ -89,6 +89,7 @@ void ConnectionWindow::handleOKButton()
if (ui->rbGVRET->isChecked())
{
SerialWorker *serial = new SerialWorker(canModel, connModel->rowCount());
connect(serial, SIGNAL(busStatus(int,int,int)), this, SLOT(receiveBusStatus(int,int,int)));
connModel->addConnection(serial);
qDebug() << "Setup initial connection object";
@@ -136,40 +137,26 @@ void ConnectionWindow::handleOKButton()
}
}
}
/*
if (ui->rbGVRET->isChecked())
void ConnectionWindow::receiveBusStatus(int bus, int speed, int status)
{
qDebug() << "bus " << bus << " speed " << speed << " status " << status;
CAN_Bus *busRef = connModel->getBus(bus);
if (status & 40) busRef->setSpeed(speed);
if (status & 8) //update enabled status
{
conn = "GVRET";
connType = 0;
currentConnType = ConnectionType::GVRET_SERIAL;
busRef->setEnabled((status & 1)?true:false);
}
if (ui->rbKvaser->isChecked())
if (status & 0x10) //update single wire status
{
conn = "KVASER";
connType = 1;
currentConnType = ConnectionType::KVASER;
busRef->setSingleWire((status & 2)?true:false);
}
if (ui->rbSocketCAN->isChecked())
if (status & 0x20) //update listen only status
{
conn = "SOCKETCAN";
connType = 2;
currentConnType = ConnectionType::SOCKETCAN;
busRef->setListenOnly((status & 4)?true:false);
}
currentPortName = getPortName();
currentSpeed1 = getSpeed();
settings->setValue("Main/DefaultConnectionPort", currentPortName);
settings->setValue("Main/DefaultConnectionType", connType);
settings->setValue("Main/SingleWireMode", ui->ckSingleWire->isChecked());
emit updateConnectionSettings(conn, getPortName(), getSpeed());
this->close();
*/
connModel->refreshView();
}
void ConnectionWindow::handleConnSelectionChanged()