public Monitor(ElmDriver elmDriver, Func<string, string, dynamic> parseFunction, double frequency, params OBDPid[] pids) { guid = Guid.NewGuid(); driver = elmDriver; ParseResponseFunction = parseFunction; Pids = pids; Frequency = frequency; timer.Elapsed += timer_Elapsed; timeoutTimer.Elapsed += timeoutTimer_Elapsed; }
static void Main(string[] args) { Console.Write("Enter COM Port: "); var port = Console.ReadLine(); driver = new ElmDriver(port, 115200); InitializeMonitors(); monitors = new List<Monitor>() { Speed, RPM };//, MAFRate, IntakeAirTemp }; monitors.ForEach(m => m.PropertyChanged += m_PropertyChanged); socket.Opened += socket_Opened; socket.Message += socket_Message; socket.HeartBeatTimerEvent += socket_HeartBeatTimerEvent; socket.ConnectionRetryAttempt += socket_ConnectionRetryAttempt; socket.Error += socket_Error; socket.SocketConnectionClosed += socket_SocketConnectionClosed; socket.Connect(); Console.Read(); monitors.ForEach(m => m.Stop()); }
static void Main(string[] args) { ElmDriver driver = new ElmDriver("COM7", 115200); Console.Read(); }