예제 #1
0
        /// <summary>
        /// Invoked by the SsmInterface when the ECU identifier has been received
        /// </summary>
        private void GetEcuIdentifierCallback(IAsyncResult asyncResult)
        {
            Trace.WriteLine("SsmBasicLogger.GetEcuIdentifierCallback");
            ConnectAsyncResult internalState = (ConnectAsyncResult)asyncResult.AsyncState;

            try
            {
                this.ecu.EndGetEcuIdentifier(asyncResult);

                Trace.WriteLine("SsmBasicLogger.GetEcuIdentifierCallback: creating database");

                // TODO: remove ParameterDatabase from SsmBasicLogger, pass ParameterSource to GetEcuIdentifier callback
                internalState.ParameterSource = SsmParameterSource.GetInstance(
                    configurationDirectory,
                    this.ecu.EcuIdentifier,
                    this.ecu.CompatibilityMap);
            }
            catch (UnauthorizedAccessException ex)
            {
                internalState.Exception = ex;
            }
            catch (IOException ex)
            {
                internalState.Exception = ex;
            }
            catch (System.Security.SecurityException ex)
            {
                internalState.Exception = ex;
            }
            internalState.Completed();
        }
예제 #2
0
        /// <summary>
        /// Begins an asyncrhonous operation to connect to the ECU, get the
        /// ECU ID, and load the supported parameters from the database.
        /// </summary>
        public IAsyncResult BeginConnect(AsyncCallback callback, object asyncState)
        {
            Trace.WriteLine("SsmBasicLogger.BeginConnect");
            ConnectAsyncResult asyncResult = new ConnectAsyncResult(callback, asyncState);

            this.ecu.BeginGetEcuIdentifier(GetEcuIdentifierCallback, asyncResult);
            return(asyncResult);
        }
예제 #3
0
        public ParameterSource EndConnect(IAsyncResult asyncResult)
        {
            Trace.WriteLine("SsmBasicLogger.EndConnect");
            ConnectAsyncResult internalState = (ConnectAsyncResult)asyncResult;

            if (internalState.Exception != null)
            {
                throw internalState.Exception;
            }

            return(internalState.ParameterSource);
        }