public static string[] GetAdapterNames(CANBusAdapter adapterType) { try { if (adapterType == CANBusAdapter.LAWICEL) { return(CANUSBDevice.GetAdapterNames()); } else if (adapterType == CANBusAdapter.ELM327) { return(CANELM327Device.GetAdapterNames()); } else if (adapterType == CANBusAdapter.JUST4TRIONIC) { return(Just4TrionicDevice.GetAdapterNames()); } else if (adapterType == CANBusAdapter.KVASER) { return(KvaserCANDevice.GetAdapterNames()); } else if (adapterType == CANBusAdapter.J2534) { return(J2534CANDevice.GetAdapterNames()); } } catch (Exception ex) { logger.Debug(ex, "Failed to get adapternames"); } return(new string[0]); }
override public void setCANDevice(CANBusAdapter adapterType) { if (adapterType == CANBusAdapter.LAWICEL) { canUsbDevice = new CANUSBDevice(); } else if (adapterType == CANBusAdapter.ELM327 && !m_ELM327Kline) { Sleeptime = SleepTime.ELM327; canUsbDevice = new CANELM327Device() { ForcedBaudrate = m_forcedBaudrate }; } else if (adapterType == CANBusAdapter.JUST4TRIONIC) { canUsbDevice = new Just4TrionicDevice() { ForcedBaudrate = m_forcedBaudrate }; } else if (adapterType == CANBusAdapter.COMBI) { canUsbDevice = new LPCCANDevice(); } else if (adapterType == CANBusAdapter.KVASER) { canUsbDevice = new KvaserCANDevice(); } else if (adapterType == CANBusAdapter.J2534) { canUsbDevice = new J2534CANDevice(); } if (canUsbDevice != null) { canUsbDevice.UseOnlyPBus = m_OnlyPBus; canUsbDevice.TrionicECU = ECU.TRIONIC7; canUsbDevice.bypassCANfilters = m_filterBypass; canUsbDevice.onReceivedAdditionalInformation += new ICANDevice.ReceivedAdditionalInformation(canUsbDevice_onReceivedAdditionalInformation); canUsbDevice.onReceivedAdditionalInformationFrame += new ICANDevice.ReceivedAdditionalInformationFrame(canUsbDevice_onReceivedAdditionalInformationFrame); canUsbDevice.AcceptOnlyMessageIds = FilterIdECU; } if (adapterType == CANBusAdapter.ELM327 && m_ELM327Kline) { kwpDevice = new ELM327Device() { ForcedBaudrate = m_forcedBaudrate }; setFlasher(); } else if (adapterType != CANBusAdapter.COMBI || !m_UseFlasherOnDevice) { kwpDevice = new KWPCANDevice() { Latency = m_Latency }; kwpDevice.setCANDevice(canUsbDevice); setFlasher(); } }