Files
giesCANne/connections/canconfactory.cpp
T
Collin Kidder 9ebbaca668 Add a new connection type - Lawicel. It works for some devices, not
all. More development needed but this is a start. Also added ability
to set serial speed and bus speed in the device setup which may be
useful for other connection devices too.
2022-10-04 19:48:11 -04:00

31 lines
897 B
C++

#include <QString>
#include "canconfactory.h"
#include "serialbusconnection.h"
#include "gvretserial.h"
#include "mqtt_bus.h"
#include "socketcand.h"
#include "lawicel_serial.h"
using namespace CANCon;
CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDriverName, int pSerialSpeed, int pBusSpeed)
{
switch(pType) {
case SERIALBUS:
return new SerialBusConnection(pPortName, pDriverName);
case GVRET_SERIAL:
return new GVRetSerial(pPortName, false);
case REMOTE:
return new GVRetSerial(pPortName, true); //it's a special case of GVRET connected over TCP/IP so it uses the same class
case LAWICEL:
return new LAWICELSerial(pPortName, pSerialSpeed, pBusSpeed);
case KAYAK:
return new SocketCANd(pPortName);
case MQTT:
return new MQTT_BUS(pPortName);
default: {}
}
return nullptr;
}