Files
giesCANne/connections/canconfactory.cpp
T
Ahmed Sheimy 1c87008970 Update canconfactory.cpp
restore network connection was not working because it was detected as serial by this modification it is working
2022-08-05 18:32:45 +04:00

31 lines
846 B
C++

#include <QString>
#include "canconfactory.h"
#include "serialbusconnection.h"
#include "gvretserial.h"
#include "mqtt_bus.h"
#include "socketcand.h"
using namespace CANCon;
CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDriverName)
{
switch(pType) {
case SERIALBUS:
return new SerialBusConnection(pPortName, pDriverName);
case GVRET_SERIAL:
if(pPortName.contains("."))
return new GVRetSerial(pPortName, true);
else
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 KAYAK:
return new SocketCANd(pPortName);
case MQTT:
return new MQTT_BUS(pPortName);
default: {}
}
return nullptr;
}