Beispiel #1
0
        /// <summary>
        /// Start connection to ECU
        /// </summary>
        /// <param name="portName">Name of port (starting with COM)</param>
        /// <param name="Language">Language enumerator</param>
        /// <param name="LocalTime">Flag if time displayed local (or UTC)</param>
        /// <returns>True if connection is established</returns>
        public bool Connect(string portName, byte Language, bool LocalTime)
        {
            mLocalTime    = LocalTime;
            mECU.PortName = portName;
            mECU.Language = (HJS.ECU.Protocol.ProtocolBase.LanguageId)Language;
            mECU.ChangeServerIdentifier((HJS.ECU.Port.Comm.ServerByte)Properties.Settings.Default.ServerId);
            bool ret = mECU.Connect(HJS.ECU.Port.Comm.PortType.Direct, LocalTime);

            if (ret)
            {
                tellStatus(String.Format("Connected on {0} (V{1})", portName, mECU.ProtocolVersion));
                //mRawFileName = String.Format("{0}_{1}", mECU.SerialNumber, DateTime.Now.ToShortDateString());
                mRawFileName = String.Format("{0}_{1}", mECU.SerialNumber, DateTime.Now.ToString("yyyy-MM-dd"));
            }
            else
            {
                tellStatus(String.Format("Could not connect on {0} ({1})", portName, mECU.LastReturnValue));
                mRawFileName = "";
            }
            return(ret);
        }