The radio button was only disabled elsewhere, which advertised a connection type that platform can never offer. Hide it instead, and guard the gs_usb.h include so nothing outside Windows reaches for it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZnuZJ7zc3e8hk6C8bGDZN
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
#include <QString>
|
|
#include "canconfactory.h"
|
|
#include "serialbusconnection.h"
|
|
#include "gvretserial.h"
|
|
#include "mqtt_bus.h"
|
|
#include "socketcand.h"
|
|
#include "lawicel_serial.h"
|
|
#include "canserver.h"
|
|
#include "canlogserver.h"
|
|
#ifdef Q_OS_WIN
|
|
#include "gs_usb.h"
|
|
#endif
|
|
|
|
using namespace CANCon;
|
|
|
|
CANConnection* CanConFactory::create(type pType, QString pPortName, QString pDriverName, int pSerialSpeed, int pBusSpeed, bool pCanFd, int pDataRate)
|
|
{
|
|
switch(pType) {
|
|
case SERIALBUS:
|
|
return new SerialBusConnection(pPortName, pDriverName, pBusSpeed, pDataRate, pCanFd);
|
|
case GVRET_SERIAL:
|
|
if(pPortName.contains(".") && !pPortName.contains("tty") && !pPortName.contains("serial"))
|
|
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 LAWICEL:
|
|
return new LAWICELSerial(pPortName, pSerialSpeed, pBusSpeed, pCanFd, pDataRate);
|
|
case KAYAK:
|
|
return new SocketCANd(pPortName);
|
|
case MQTT:
|
|
return new MQTT_BUS(pPortName);
|
|
case CANSERVER:
|
|
return new CANserver(pPortName);
|
|
case CANLOGSERVER:
|
|
return new CanLogServer(pPortName);
|
|
case GS_USB:
|
|
#ifdef Q_OS_WIN
|
|
return new GSUSBConnection(pPortName, pBusSpeed, pCanFd, pDataRate);
|
|
#else
|
|
//everywhere else gs_usb devices are handled by the kernel driver and show up as SocketCAN
|
|
return nullptr;
|
|
#endif
|
|
default: {}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|