Ejemplo n.º 1
0
 private void HandleTimeoutAndAsyncRecoComplete(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback, string asyncRecoType)
 {
     lock (this.thisLock)
     {
         if (this.recoContext.Event == null)
         {
             ExTraceGlobals.SpeechRecognitionTracer.TraceWarning <string>(0L, "The RecoContext for RecoType:'{0}' has already been disposed of, sending internal error to complete the reco request loop", asyncRecoType);
             callback(new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(string.Empty, SpeechRecognitionProcessor.SpeechHttpStatus.InternalServerError));
         }
         else
         {
             ThreadPool.RegisterWaitForSingleObject(this.recoContext.Event, delegate(object state, bool timedOut)
             {
                 SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs args;
                 if (timedOut)
                 {
                     ExTraceGlobals.SpeechRecognitionTracer.TraceError <string, string>(0L, "The Async call:'{0}' for Recognition:'{1}' Timed out", asyncRecoType, this.RequestType.ToString());
                     UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_MobileSpeechRecoClientAsyncCallTimedOut, null, new object[]
                     {
                         this.RequestId,
                         asyncRecoType,
                         this.RequestType.ToString()
                     });
                     args = new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(string.Empty, SpeechRecognitionProcessor.SpeechHttpStatus.InternalServerError);
                 }
                 else
                 {
                     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string, string>(0L, "The {0} for Recognition:{1} did not time out", asyncRecoType, this.RequestType.ToString());
                     args = new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(this.recoContext.Results, this.recoContext.Status);
                 }
                 callback(args);
             }, null, TimeSpan.FromMilliseconds(30000.0), true);
         }
     }
 }
Ejemplo n.º 2
0
 // Token: 0x06001CD5 RID: 7381 RVA: 0x0007368C File Offset: 0x0007188C
 internal virtual void StartRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug((long)this.GetHashCode(), "Entering SpeechRecognitionScenariosBase.StartRecoRequestAsync");
     this.resultHandlerCallback = callback;
     foreach (SpeechRecognition speechRecognition in this.RecognitionHelpers.Values)
     {
         speechRecognition.StartRecoRequestAsync(new SpeechRecognitionProcessor.SpeechProcessorResultsCompletedDelegate(this.HandleResults));
     }
 }
Ejemplo n.º 3
0
 // Token: 0x06001C74 RID: 7284 RVA: 0x00071C18 File Offset: 0x0006FE18
 private void HandleException(Exception e, int errorCode, SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ExTraceGlobals.SpeechRecognitionTracer.TraceError <Exception, int>((long)this.GetHashCode(), "LocalSpeechRecognition - Exception='{0}', Error Code='{1}'", e, errorCode);
     UmGlobals.ExEvent.LogEvent(UMEventLogConstants.Tuple_SpeechRecoRequestFailed, null, new object[]
     {
         base.RequestId,
         base.Parameters.UserObjectGuid,
         base.Parameters.TenantGuid,
         CommonUtil.ToEventLogString(e)
     });
     SpeechRecognitionProcessor.SpeechHttpStatus httpStatus = LocalSpeechRecognition.MapRpcErrorCodeToHttpErrorCode(errorCode);
     callback(new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(string.Empty, httpStatus));
 }
Ejemplo n.º 4
0
 // Token: 0x06001C6F RID: 7279 RVA: 0x00071990 File Offset: 0x0006FB90
 public override void RecognizeAsync(byte[] audioBytes, SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ValidateArgument.NotNull(audioBytes, "audioBytes");
     ValidateArgument.NotNull(callback, "callback");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, MobileSpeechRecoRequestType, string>((long)this.GetHashCode(), "LocalSpeechRecognition.RecognizeAsync - Request Id='{0}', Request Type='{1}', UM server FQDN for RPC='{2}'", base.Parameters.RequestId, base.Parameters.RequestType, this.rpcServerFqdn);
     base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.Recognize, audioBytes.Length);
     try
     {
         MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = new MobileSpeechRecoRpcClient(base.Parameters.RequestId, this.rpcServerFqdn, callback);
         mobileSpeechRecoRpcClient.BeginRecognize(audioBytes, new AsyncCallback(this.OnRecognizeCompleted), mobileSpeechRecoRpcClient);
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalSpeechRecognition.RecognizeAsync - Request Id='{0}', Called BeginRecognize", base.Parameters.RequestId);
     }
     catch (Exception e)
     {
         this.HandleUnexpectedException(e, callback);
     }
 }
Ejemplo n.º 5
0
        // Token: 0x06001C72 RID: 7282 RVA: 0x00071B3C File Offset: 0x0006FD3C
        private void OnRecognizeCompleted(IAsyncResult asyncResult)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.OnRecognizeCompleted - RequestId='{0}' RequestType='{1}'", base.Parameters.RequestId, base.Parameters.RequestType.ToString());
            base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.RecognizeCompleted, -1);
            MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = (MobileSpeechRecoRpcClient)asyncResult.AsyncState;

            SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate speechProcessorAsyncCompletedDelegate = mobileSpeechRecoRpcClient.State as SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate;
            try
            {
                MobileRecoRPCAsyncCompletedArgs             mobileRecoRPCAsyncCompletedArgs = mobileSpeechRecoRpcClient.EndRecognize(asyncResult);
                SpeechRecognitionProcessor.SpeechHttpStatus httpStatus            = LocalSpeechRecognition.MapRpcErrorCodeToHttpErrorCode(mobileRecoRPCAsyncCompletedArgs.ErrorCode);
                SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs args = new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(mobileRecoRPCAsyncCompletedArgs.Result, httpStatus);
                speechProcessorAsyncCompletedDelegate(args);
            }
            catch (Exception e)
            {
                this.HandleUnexpectedException(e, speechProcessorAsyncCompletedDelegate);
            }
        }
 // Token: 0x06001C58 RID: 7256 RVA: 0x00070CDC File Offset: 0x0006EEDC
 public override void AddRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     FindInGALSpeechRecognition.< > c__DisplayClass14 CS$ < > 8__locals1 = new FindInGALSpeechRecognition.< > c__DisplayClass14();
     CS$ < > 8__locals1.callback    = callback;
     CS$ < > 8__locals1.< > 4__this = this;
     ValidateArgument.NotNull(CS$ < > 8__locals1.callback, "callback");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid>((long)this.GetHashCode(), "FindInGALSpeechRecognition.AddRecoRequestAsync - RequestId='{0}'", base.Parameters.RequestId);
     base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.AddRecoRequest, -1);
     try
     {
         FindInGALSpeechRecognition.< > c__DisplayClass16 CS$ < > 8__locals2 = new FindInGALSpeechRecognition.< > c__DisplayClass16();
         CS$ < > 8__locals2.CS$ < > 8__locals15 = CS$ < > 8__locals1;
         CS$ < > 8__locals2.orgMbox             = null;
         this.LogMethodCallStatistics("FindInGALSpeechRecognition.AddRecoRequesetAsync - GetOrgMailbox", delegate
         {
             CS$ < > 8__locals2.orgMbox = CS$ < > 8__locals2.CS$ < > 8__locals15.< > 4__this.GetOrgMailbox(CS$ < > 8__locals2.CS$ < > 8__locals15.< > 4__this.Parameters.OrgId);
         });
         CS$ < > 8__locals2.orgMailboxExchangePrincipal = null;
         this.LogMethodCallStatistics("FindInGALSpeechRecognition.AddRecoRequesetAsync - ExchangePrincipal.FromADUser", delegate
         {
             CS$ < > 8__locals2.orgMailboxExchangePrincipal = ExchangePrincipal.FromADUser(CS$ < > 8__locals2.orgMbox, null);
         });
Ejemplo n.º 7
0
 // Token: 0x06001C6E RID: 7278 RVA: 0x00071838 File Offset: 0x0006FA38
 public override void AddRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ValidateArgument.NotNull(callback, "callback");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - RequestId='{0}' RequestType='{1}'", base.Parameters.RequestId, base.Parameters.RequestType.ToString());
     base.CollectAndLogStatisticsInformation(MobileSpeechRecoRequestStepLogId.AddRecoRequest, -1);
     try
     {
         ADTopologyLookup adtopologyLookup = ADTopologyLookup.CreateLocalResourceForestLookup();
         Server           localServer      = adtopologyLookup.GetLocalServer();
         this.rpcServerFqdn = localServer.Fqdn;
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, string>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - Request Id='{0}', UM server FQDN for RPC='{1}'", base.Parameters.RequestId, this.rpcServerFqdn);
         MobileSpeechRecoRpcClient mobileSpeechRecoRpcClient = new MobileSpeechRecoRpcClient(base.Parameters.RequestId, this.rpcServerFqdn, callback);
         mobileSpeechRecoRpcClient.BeginAddRecoRequest(base.Parameters.RequestType, base.Parameters.UserObjectGuid, base.Parameters.TenantGuid, base.Parameters.Culture, base.Parameters.TimeZone, new AsyncCallback(this.OnAddRecoRequestCompleted), mobileSpeechRecoRpcClient);
         ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalSpeechRecognition.AddRecoRequestAsync - Request Id='{0}', Called BeginAddRecoRequest", base.Parameters.RequestId);
     }
     catch (ArgumentOutOfRangeException e)
     {
         this.HandleException(e, -2147466750, callback);
     }
     catch (Exception e2)
     {
         this.HandleUnexpectedException(e2, callback);
     }
 }
Ejemplo n.º 8
0
 // Token: 0x06001C73 RID: 7283 RVA: 0x00071BE8 File Offset: 0x0006FDE8
 private void HandleUnexpectedException(Exception e, SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ExTraceGlobals.SpeechRecognitionTracer.TraceError <Exception>((long)this.GetHashCode(), "LocalSpeechRecognition - HandleUnexpectedException='{0}'", e);
     ExWatson.SendReport(e, ReportOptions.None, null);
     this.HandleException(e, -2147466752, callback);
 }
Ejemplo n.º 9
0
 internal override void StartRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback)
 {
     ValidateArgument.NotNull(callback, "callback is null");
     ExTraceGlobals.SpeechRecognitionTracer.TraceDebug((long)this.GetHashCode(), "InvalidRequestSpeechRecognitionScenarios.StartRecoRequestAsync");
     callback(new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(string.Empty, this.status));
 }
Ejemplo n.º 10
0
 public abstract void RecognizeAsync(byte[] audioBytes, SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback);
Ejemplo n.º 11
0
 public abstract void AddRecoRequestAsync(SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedDelegate callback);