public frmMain() { InitializeComponent(); eng = new OBDIIEngine("COM3"); eng.OnGetSpeedDone += new OBDIIEngine.Initialized(eng_OnGetSpeedDone); eng.OnGetFuelPressureDone += new OBDIIEngine.Initialized(eng_OnGetFuelPressureDone); eng.OnGetEngineRpmDone += new OBDIIEngine.Initialized(eng_OnGetEngineRpmDone); }
static void Main(string[] args) { OBDIIEngine eng = new OBDIIEngine("COM3"); eng.OnOpenPortInit += new OBDIIEngine.Initializing(eng_OnPortOpening); eng.OnOpenPortDone += new OBDIIEngine.Initialized(eng_OnPortOpen); //eng.PortStatusAutoCheck = false; //FOR MANUAL OPENING COM PORT //eng.OpenPort(); eng.OnGetSpeedInit += new OBDIIEngine.Initializing(eng_OnGetSpeedInit); eng.OnGetSpeedDone += new OBDIIEngine.Initialized(eng_OnGetSpeedDone); eng.GetSpeedKmh(); //Console.WriteLine("{0} Km/h",eng.GetSpeedKmh().ToString()); eng.OnGetEngineTempInit += new OBDIIEngine.Initializing(eng_OnGetEngineTempInit); eng.OnGetEngineTempDone += new OBDIIEngine.Initialized(eng_OnGetEngineTempDone); eng.GetEngineTemp(); //Console.WriteLine("{0} °C", eng.GetEngineTemp().ToString()); eng.OnGetEngineRpmInit += new OBDIIEngine.Initializing(eng_OnGetEngineRpmInit); eng.OnGetEngineRpmDone += new OBDIIEngine.Initialized(eng_OnGetEngineRpmDone); eng.GetEngineRpm(); //Console.WriteLine("{0} rpm", eng.GetEngineRpm().ToString()); eng.OnGetThrottlePositionInit += new OBDIIEngine.Initializing(eng_OnGetThrottlePositionInit); eng.OnGetThrottlePositionDone += new OBDIIEngine.Initialized(eng_OnGetThrottlePositionDone); eng.GetThrottlePosition(); //Console.WriteLine("{0} %", eng.GetThrottlePosition().ToString()); eng.OnGetCalculatedEngineLoadValueInit += new OBDIIEngine.Initializing(eng_OnGetCalculatedEngineLoadValueInit); eng.OnGetCalculatedEngineLoadValueDone += new OBDIIEngine.Initialized(eng_OnGetCalculatedEngineLoadValueDone); eng.GetCalculatedEngineLoadValue(); //Console.WriteLine("{0} %", eng.GetCalculatedEngineLoadValue().ToString()); eng.OnGetFuelPressureInit += new OBDIIEngine.Initializing(eng_OnGetFuelPressureInit); eng.OnGetFuelPressureDone += new OBDIIEngine.Initialized(eng_OnGetFuelPressureDone); eng.GetFuelPressure(); //Console.WriteLine("{0} kPa", eng.GetFuelPressure().ToString()); eng.OnClosePortInit += new OBDIIEngine.Initializing(eng_OnClosePortInit); eng.OnClosePortDone += new OBDIIEngine.Initialized(eng_OnClosePortDone); eng.ClosePort(); Console.ReadLine(); }