Merge branch 'WIP2' of github.com:collin80/SavvyCAN into WIP2

Conflicts:
	connectionwindow.cpp
This commit is contained in:
Collin Kidder
2016-05-06 14:49:54 -04:00
5 changed files with 70 additions and 24 deletions
+45 -2
View File
@@ -83,6 +83,16 @@ void ConnectionWindow::handleNewConn()
handleConnSelectionChanged();
}
void ConnectionWindow::handleEnableAll()
{
}
void ConnectionWindow::handleDisableAll()
{
}
void ConnectionWindow::handleConnTypeChanged()
{
if (ui->rbGVRET->isChecked()) getSerialPorts();
@@ -90,6 +100,38 @@ void ConnectionWindow::handleConnTypeChanged()
if (ui->rbSocketCAN->isChecked()) getSocketcanPorts();
}
void ConnectionWindow::connectionSuccess(CANConnection *conn)
{
CAN_Bus bus;
bus.active = true;
bus.busNum = conn->getBusBase();
bus.connection = conn;
bus.listenOnly = ui->ckListenOnly->isChecked();
bus.singleWire = ui->ckSingleWire->isChecked();
if (ui->cbSpeed->currentIndex() < 1) bus.speed = 0; //default speed
else if (ui->cbSpeed->currentIndex() == 1)
{
bus.speed = 0;
bus.active = false;
}
else bus.speed = ui->cbSpeed->currentText().toInt();
connModel->addBus(bus);
int numBuses = conn->getNumBuses();
for (int i = 1; i < numBuses; i++)
{
bus.active = false;
bus.listenOnly = false;
bus.singleWire = false;
bus.speed = 250000;
bus.busNum = conn->getBusBase() + i;
bus.connection = conn;
connModel->addBus(bus);
qDebug() << "Added bus " << bus.busNum;
}
}
void ConnectionWindow::handleOKButton()
{
QString conn;
@@ -113,11 +155,12 @@ void ConnectionWindow::handleOKButton()
else if (ui->cbSpeed->currentIndex() > 1)
{
bus->setSpeed(ui->cbSpeed->currentText().toInt());
}
}
//call through signal/slot interface without using connect
QMetaObject::invokeMethod(bus->connection, "updateBusSettings",
Qt::QueuedConnection,
Q_ARG(CAN_Bus *, bus));
connModel->refreshView();
}
else //new connection
{
@@ -125,6 +168,7 @@ void ConnectionWindow::handleOKButton()
{
SerialWorker *serial = new SerialWorker(canModel, connModel->rowCount());
connect(serial, SIGNAL(busStatus(int,int,int)), this, SLOT(receiveBusStatus(int,int,int)));
connect(serial, SIGNAL(connectionSuccess(CANConnection*)), this, SLOT(connectionSuccess(CANConnection*)));
connModel->addConnection(serial);
qDebug() << "Setup initial connection object";
@@ -226,7 +270,6 @@ void ConnectionWindow::handleConnSelectionChanged()
ui->ckEnabled->setChecked(bus->isActive());
int speed = bus->getSpeed();
setSpeed(speed);
//connModel->refreshView();
}
}