Add fault handling code mostly used to detect when the serial port disappears while a GVRET style device is connected. Beginnings of code to add a reconnect button.

This commit is contained in:
Collin Kidder
2017-11-20 22:07:13 -05:00
parent 6ef26de4f7
commit 1ea9ea4fac
5 changed files with 105 additions and 8 deletions
+14
View File
@@ -56,6 +56,7 @@ ConnectionWindow::ConnectionWindow(QWidget *parent) :
connect(ui->tableConnections->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &ConnectionWindow::currentRowChanged);
connect(ui->btnActivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleEnableAll);
connect(ui->btnDeactivateAll, &QPushButton::clicked, this, &ConnectionWindow::handleDisableAll);
connect(ui->btnReconnect, &QPushButton::clicked, this, &ConnectionWindow::handleReconnect);
connect(ui->btnRemoveBus, &QPushButton::clicked, this, &ConnectionWindow::handleRemoveConn);
connect(ui->btnClearDebug, &QPushButton::clicked, this, &ConnectionWindow::handleClearDebugText);
connect(ui->btnSendHex, &QPushButton::clicked, this, &ConnectionWindow::handleSendHex);
@@ -149,6 +150,19 @@ void ConnectionWindow::setActiveAll(bool pActive)
connModel->refresh();
}
void ConnectionWindow::handleReconnect()
{
int selIdx = ui->tableConnections->selectionModel()->currentIndex().row();
if (selIdx <0) return;
int busId;
CANConnection* conn_p = connModel->getAtIdx(selIdx, busId);
if(!conn_p) return;
conn_p->stop();
conn_p->start();
}
void ConnectionWindow::consoleEnableChanged(bool checked) {
int busId;