Esempio n. 1
0
 // Token: 0x06001CDA RID: 7386 RVA: 0x00073814 File Offset: 0x00071A14
 private void HandleResults(SpeechRecognition helper)
 {
     lock (this.thisLock)
     {
         try
         {
             ExTraceGlobals.SpeechRecognitionTracer.TraceDebug((long)this.GetHashCode(), "Entering SpeechRecognitionScenariosBase.HandleResults");
             if (!this.resultsProcessed)
             {
                 if (helper.ResultsPriority == SpeechRecognitionResultsPriority.Immediate)
                 {
                     this.ProcessImmediatePriorityProcessor(helper);
                 }
                 else
                 {
                     this.ProcessWaitingPriorityProcessor(helper);
                 }
             }
         }
         catch (Exception e)
         {
             this.HandleUnexpectedException(e);
         }
     }
 }
Esempio n. 2
0
        protected void GetHighestConfidenceValueAndResultTypeFromResult(string results)
        {
            double highestConfidenceResult = 0.0;

            this.ResultType = SpeechRecognitionUtils.ParseMobileScenarioXML(results);
            if (this.ResultType != MobileSpeechRecoResultType.None)
            {
                highestConfidenceResult = SpeechRecognition.GetHighestConfidence(results);
            }
            this.HighestConfidenceResult = highestConfidenceResult;
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <MobileSpeechRecoRequestType, double, MobileSpeechRecoResultType>((long)this.GetHashCode(), "HighestConfidence value for Request Type:'{0}', HighestConfidence:'{1}', Result Type: '{2}'", this.RequestType, this.HighestConfidenceResult, this.ResultType);
        }
Esempio n. 3
0
        protected override SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetFormattedResultsForHighestConfidenceProcessor(SpeechRecognition recognitionWithHighestConfidence)
        {
            switch (recognitionWithHighestConfidence.RequestType)
            {
            case MobileSpeechRecoRequestType.FindInGAL:
            case MobileSpeechRecoRequestType.FindInPersonalContacts:
            {
                SpeechRecognition galRecoHelper = base.RecognitionHelpers[MobileSpeechRecoRequestType.FindInGAL];
                SpeechRecognition personalContactsRecoHelper = base.RecognitionHelpers[MobileSpeechRecoRequestType.FindInPersonalContacts];
                return(SpeechRecognitionUtils.GetCombinedPeopleSearchResult(galRecoHelper, personalContactsRecoHelper, recognitionWithHighestConfidence.ResultType));
            }

            default:
                throw new ArgumentOutOfRangeException("RequestType", recognitionWithHighestConfidence.RequestType, "Invalid parameter");
            }
        }
Esempio n. 4
0
 // Token: 0x06001CDB RID: 7387 RVA: 0x0007389C File Offset: 0x00071A9C
 private void ProcessImmediatePriorityProcessor(SpeechRecognition helper)
 {
     lock (this.thisLock)
     {
         if (helper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.Success && helper.HighestConfidenceResult > this.immediateThreshold)
         {
             ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "ProcessImediatePriorityProcessor Recognition: {0} was successful and will be processed immediately", helper.RequestType.ToString());
             this.resultsProcessed = true;
             this.InvokeHandlerCallbackAndDisposeHelpers(helper.Results);
         }
         else
         {
             ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string, string, double>((long)this.GetHashCode(), "ProcessImediatePriorityProcessor Recognition: {0} was Unsuccessful with error description:{1}, confidence value:{2}", helper.RequestType.ToString(), helper.Results.HttpStatus.StatusDescription, helper.HighestConfidenceResult);
             this.ProcessWaitingPriorityProcessor(helper);
         }
     }
 }
Esempio n. 5
0
 // Token: 0x06001CDC RID: 7388 RVA: 0x00073974 File Offset: 0x00071B74
 private void ProcessWaitingPriorityProcessor(SpeechRecognition helper)
 {
     lock (this.thisLock)
     {
         if (!this.resultsProcessed)
         {
             this.resultsProcessed = true;
             if (helper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.NoSpeechDetected)
             {
                 ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "ProcessWaitingPriorityProcessor: No Speech Detected from Speech Recognition:'{0}'", helper.RequestType.ToString());
                 this.InvokeHandlerCallbackAndDisposeHelpers(helper.Results);
             }
             else
             {
                 ExTraceGlobals.SpeechRecognitionTracer.TraceDebug((long)this.GetHashCode(), "ProcessWaitingPriorityProcessor: Final Results hasnt been processed yet. Initiate processing...");
                 SpeechRecognition speechRecognition = helper;
                 foreach (KeyValuePair <MobileSpeechRecoRequestType, SpeechRecognition> keyValuePair in this.RecognitionHelpers)
                 {
                     if (!keyValuePair.Value.ResultsReceived)
                     {
                         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <MobileSpeechRecoRequestType>((long)this.GetHashCode(), "ProcessWaitingPriorityProcessor Recognition: {0} result is not available yet and will be waited on", keyValuePair.Key);
                         this.resultsProcessed = false;
                         break;
                     }
                     if (speechRecognition.HighestConfidenceResult < keyValuePair.Value.HighestConfidenceResult)
                     {
                         speechRecognition = keyValuePair.Value;
                     }
                 }
                 if (this.resultsProcessed)
                 {
                     SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs formattedResultsForHighestConfidenceProcessor = this.GetFormattedResultsForHighestConfidenceProcessor(speechRecognition);
                     this.InvokeHandlerCallbackAndDisposeHelpers(formattedResultsForHighestConfidenceProcessor);
                 }
             }
         }
         else
         {
             ExTraceGlobals.SpeechRecognitionTracer.TraceDebug((long)this.GetHashCode(), "ProcessWaitingPriorityProcessor: Final Results already processed. Skip processing stage.");
         }
     }
 }
Esempio n. 6
0
        // Token: 0x06001D38 RID: 7480 RVA: 0x00074628 File Offset: 0x00072828
        internal static SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetCombinedPeopleSearchResult(SpeechRecognition galRecoHelper, SpeechRecognition personalContactsRecoHelper, MobileSpeechRecoResultType highestRecoResultType)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Gal Result response text:'{0}'", galRecoHelper.Results.ResponseText);
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Personal Contacts Result response text:'{0}'", personalContactsRecoHelper.Results.ResponseText);
            string galResults = string.Empty;
            string personalContactsResults = string.Empty;

            if (galRecoHelper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.Success && galRecoHelper.ResultType == highestRecoResultType)
            {
                galResults = galRecoHelper.Results.ResponseText;
            }
            if (personalContactsRecoHelper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.Success && personalContactsRecoHelper.ResultType == highestRecoResultType)
            {
                personalContactsResults = personalContactsRecoHelper.Results.ResponseText;
            }
            string text = SpeechRecognitionUtils.CombineGALandPersonalContactXMLResults(galResults, personalContactsResults, highestRecoResultType);

            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Response Text to send to ResultHandler:'{0}'", text);
            SpeechRecognitionProcessor.SpeechHttpStatus httpStatus = SpeechRecognitionProcessor.SpeechHttpStatus.Success;
            if (galRecoHelper.Results.HttpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success && personalContactsRecoHelper.Results.HttpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success)
            {
                httpStatus = personalContactsRecoHelper.Results.HttpStatus;
                text       = string.Empty;
            }
            return(new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(text, httpStatus));
        }
Esempio n. 7
0
 // Token: 0x06001CD9 RID: 7385
 protected abstract SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetFormattedResultsForHighestConfidenceProcessor(SpeechRecognition recognitionWithHighestConfidence);
 // Token: 0x06001CEE RID: 7406 RVA: 0x00073F4A File Offset: 0x0007214A
 protected override SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetFormattedResultsForHighestConfidenceProcessor(SpeechRecognition recognitionWithHighestConfidence)
 {
     return(recognitionWithHighestConfidence.Results);
 }
Esempio n. 9
0
 protected override SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetFormattedResultsForHighestConfidenceProcessor(SpeechRecognition recognitionWithHighestConfidence)
 {
     throw new NotSupportedException();
 }
Esempio n. 10
0
 // Token: 0x06001C76 RID: 7286 RVA: 0x00071D1D File Offset: 0x0006FF1D
 internal SpeechRecoContext(SpeechRecognition recognitionHelper)
 {
     this.recognitionHelper = recognitionHelper;
     this.Event             = new ManualResetEvent(false);
 }