コード例 #1
0
        static void ManualLoggingTest(Stream ecuStream, SerialPort port)
        {
            SsmLogger    logger      = SsmLogger.GetInstance(Environment.CurrentDirectory, ecuStream);
            IAsyncResult asyncResult = logger.BeginConnect(ConnectCallback, logger);

            asyncResult.AsyncWaitHandle.WaitOne();

            LogProfile profile = LogProfile.GetInstance();

            foreach (SsmParameter parameter in logger.Database.Parameters)
            {
                switch (parameter.Name)
                {
                case "Engine Load":
                case "Manifold Relative Pressure":
                case "Engine Speed":
                    profile.Add(parameter, parameter.Conversions[0]);
                    break;
                }
            }

            logger.SetProfile(profile);
            logger.LogStart += LogStart;
            logger.LogEntry += LogEntry;
            logger.LogStop  += LogEnd;
            logger.StartLogging();
            for (int i = 0; i < 100000 && !Console.KeyAvailable; i++)
            {
                Thread.Sleep(1);
            }
            logger.StopLogging();
            Thread.Sleep(500);
        }