private void comboInterface_SelectedIndexChanged(object sender, EventArgs e) { switch (comboInterface.SelectedIndex) { case 0: // useLawicel device = new T5CANLib.CAN.CANUSBDevice(); this.Text = "Trionic 5 CAN Flasher v" + Application.ProductVersion.ToString() + " [Lawicel Adapter]"; break; case 1: // useCombiadapter device = new T5CANLib.CAN.LPCCANDevice_T5(); this.Text = "Trionic 5 CAN Flasher v" + Application.ProductVersion.ToString() + " [Combi Adapter]"; break; case 2: // useDIYadapter device = new T5CANLib.CAN.MctCanDevice(); this.Text = "Trionic 5 CAN Flasher v" + Application.ProductVersion.ToString() + " [DIY Adapter]"; break; case 3: // useJust4Trionic device = new T5CANLib.CAN.Just4TrionicDevice(); this.Text = "Trionic 5 CAN Flasher v" + Application.ProductVersion.ToString() + " [Just4Trionic Adapter]"; break; default: device = null; this.Text = "Trionic 5 CAN Flasher v" + Application.ProductVersion.ToString() + " [!!! No Adapter Selected !!!]"; break; } //Connect(); }
public void OpenECUConnection() { if (m_RunInEmulationMode) { m_Engine.InitializeEngine(); m_Engine.StartEngine(); _opened = true; } if (!_opened) { _opened = true; //if (_sramDumpFile == string.Empty) //{ if (_tcan == null) { _tcan = new T5CANLib.T5CAN(); if (_canusbDevice == "Multiadapter" || _canusbDevice == "CombiAdapter") { _usbcandevice = new T5CANLib.CAN.LPCCANDevice_T5(); } else if (_canusbDevice == "DIY") { _usbcandevice = new T5CANLib.CAN.MctCanDevice(); } else if (_canusbDevice == "Just4Trionic") { _usbcandevice = new T5CANLib.CAN.Just4TrionicDevice(); } else if (_canusbDevice == "Kvaser") { _usbcandevice = new T5CANLib.CAN.KvaserCANDevice(); } else // default = Lawicel { _usbcandevice = new T5CANLib.CAN.CANUSBDevice(); } _tcan.onWriteProgress += new T5CANLib.T5CAN.WriteProgress(OnWriteProgress); _tcan.onCanInfo += new T5CANLib.T5CAN.CanInfo(_tcan_onCanInfo); _tcan.onReadProgress += new T5CANLib.T5CAN.ReadProgress(_tcan_onReadProgress); _tcan.setCANDevice(_usbcandevice); } if (!_tcan.openDevice(out _swversion)) { _opened = false; } /*if (_opened) // if can adapter opened successfully, try to contact the ECU * { * byte[] testbyte = _tcan.readRAM(0x1000, 2); * if (testbyte.Length != 2) _opened = false; * Console.WriteLine(testbyte.Length.ToString() + " as result"); * }*/ Console.WriteLine("OpenECUConnection: " + _swversion); //} } _stallReading = false; }
public void OpenECUConnection() { if (m_RunInEmulationMode) { m_Engine.InitializeEngine(); m_Engine.StartEngine(); _opened = true; } if (!_opened) { _opened = true; //if (_sramDumpFile == string.Empty) //{ if (_tcan == null) { _tcan = new T5CANLib.T5CAN(); if (_canusbDevice == "Multiadapter" || _canusbDevice == "CombiAdapter") { _usbcandevice = new T5CANLib.CAN.LPCCANDevice_T5(); } else if (_canusbDevice == "DIY") { _usbcandevice = new T5CANLib.CAN.MctCanDevice(); } else if (_canusbDevice == "Just4Trionic") { _usbcandevice = new T5CANLib.CAN.Just4TrionicDevice(); } else // default = Lawicel { _usbcandevice = new T5CANLib.CAN.CANUSBDevice(); } _tcan.onWriteProgress += new T5CANLib.T5CAN.WriteProgress(OnWriteProgress); _tcan.onCanInfo += new T5CANLib.T5CAN.CanInfo(_tcan_onCanInfo); _tcan.onReadProgress +=new T5CANLib.T5CAN.ReadProgress(_tcan_onReadProgress); _tcan.setCANDevice(_usbcandevice); } if (!_tcan.openDevice(out _swversion)) { _opened = false; } /*if (_opened) // if can adapter opened successfully, try to contact the ECU { byte[] testbyte = _tcan.readRAM(0x1000, 2); if (testbyte.Length != 2) _opened = false; Console.WriteLine(testbyte.Length.ToString() + " as result"); }*/ Console.WriteLine("OpenECUConnection: " + _swversion); //} } _stallReading = false; }