private void btnConnect_Click(object sender, EventArgs e) { comboProfile.Enabled = false; btnManageProfiles.Enabled = false; btnConnect.Enabled = false; btnDisconnect.Enabled = true; picCheck1.Image = picBlankBox.Image; picCheck2.Image = picBlankBox.Image; picCheck3.Image = picBlankBox.Image; picCheck4.Image = picBlankBox.Image; m_OBDInterface.SaveActiveProfile((VehicleProfile)comboProfile.SelectedItem); m_OBDInterface.logItem("ProScan"); m_OBDInterface.logItem("Connection Procedure Initiated"); if (m_OBDInterface.CommSettings.AutoDetect) { m_OBDInterface.logItem(" Automatic Hardware Detection: ON"); } else { m_OBDInterface.logItem(" Automatic Hardware Detection: OFF"); } m_OBDInterface.logItem(string.Format(" Baud Rate: {0}", m_OBDInterface.CommSettings.BaudRate)); m_OBDInterface.logItem(string.Format(" Default Port: {0}", m_OBDInterface.CommSettings.ComPortName)); switch (m_OBDInterface.CommSettings.HardwareIndex) { case HardwareType.Automatic: m_OBDInterface.logItem(" Interface: Auto-Detect"); break; case HardwareType.ELM327: m_OBDInterface.logItem(" Interface: ELM327"); break; case HardwareType.ELM320: m_OBDInterface.logItem(" Interface: ELM320"); break; case HardwareType.ELM322: m_OBDInterface.logItem(" Interface: ELM322"); break; case HardwareType.ELM323: m_OBDInterface.logItem(" Interface: ELM323"); break; case HardwareType.CANtact: m_OBDInterface.logItem(" Interface: CANtact"); break; default: throw new Exception("Bad hardware type."); } m_OBDInterface.logItem(string.Format(" Protocol: {0}", m_OBDInterface.CommSettings.ProtocolName)); if (m_OBDInterface.CommSettings.DoInitialization) { m_OBDInterface.logItem(" Initialize: YES"); } else { m_OBDInterface.logItem(" Initialize: NO"); } ThreadPool.QueueUserWorkItem(new WaitCallback(ConnectThreadNew)); }
private void btnConnect_Click(object sender, EventArgs e) { comboProfile.Enabled = false; btnManageProfiles.Enabled = false; btnConnect.Enabled = false; btnDisconnect.Enabled = true; picCheck1.Image = picBlankBox.Image; picCheck2.Image = picBlankBox.Image; picCheck3.Image = picBlankBox.Image; picCheck4.Image = picBlankBox.Image; m_obdInterface.SaveActiveProfile((VehicleProfile)comboProfile.SelectedItem); m_obdInterface.logItem("ProScan v5.9"); m_obdInterface.logItem("Connection Procedure Initiated"); if (m_obdInterface.GetCommSettings().AutoDetect) { m_obdInterface.logItem(" Automatic Hardware Detection: ON"); } else { m_obdInterface.logItem(" Automatic Hardware Detection: OFF"); } int baudRate = m_obdInterface.GetCommSettings().BaudRate; string strMsg = string.Format(" Baud Rate: {0}", baudRate); m_obdInterface.logItem(strMsg); string str2 = string.Format(" Default Port: {0}", m_obdInterface.GetCommSettings().ComPortName); m_obdInterface.logItem(str2); switch (m_obdInterface.GetCommSettings().HardwareIndex) { case 0: m_obdInterface.logItem(" Interface: Auto-Detect"); break; case 1: m_obdInterface.logItem(" Interface: ELM327"); break; case 2: m_obdInterface.logItem(" Interface: ELM320"); break; case 3: m_obdInterface.logItem(" Interface: ELM322"); break; case 4: m_obdInterface.logItem(" Interface: ELM323"); break; } string[] strArray = new string[] { "Automatic", "SAE J1850 PWM (41.6 Kbaud)", "SAE J1850 VPW (10.4 Kbaud)", "ISO 9141-2 (5 baud init, 10.4 Kbaud)", "ISO 14230-4 KWP (5 baud init, 10.4 Kbaud)", "ISO 14230-4 KWP (fast init, 10.4 Kbaud)", "ISO 15765-4 CAN (11 bit ID, 500 Kbaud)", "ISO 15765-4 CAN (29 bit ID, 500 Kbaud)", "ISO 15765-4 CAN (11 bit ID, 250 Kbaud)", "ISO 15765-4 CAN (29 bit ID, 250 Kbaud)" }; int protocolIndex = m_obdInterface.GetCommSettings().ProtocolIndex; string str = string.Format(" Protocol: {0}", strArray[protocolIndex]); m_obdInterface.logItem(str); if (m_obdInterface.GetCommSettings().DoInitialization) { m_obdInterface.logItem(" Initialize: YES"); } else { m_obdInterface.logItem(" Initialize: NO"); } ThreadPool.QueueUserWorkItem(new WaitCallback(ConnectThreadNew)); }