public override void Start(SpeechIdentifier.StartCallback callback) { ResetIdentifier(); string composedClientId = GetComposedClientIds(); if (string.IsNullOrEmpty(composedClientId)) { Logger?.LogError("SpeechIdentifier_HttpClient_Version1.Start(callback): Missing ClientId and/or GroupIds."); IdentifyResult = SpeechIdentifier.Result.Invalid; return; } Uri uri = Configuration.Server.BuildEndpoint(URI_PATH_START, composedClientId); Logger?.LogDebug("SpeechIdentifier_HttpClient_Version1.Start(callback): URI: " + uri.ToString()); using (var request = BuildRequest(CallMode.Start, uri)) { var task = mHttpClient.SendAsync(request).ContinueWith((requestTask) => { if (requestTask.IsFaulted) { IdentifyResult = SpeechIdentifier.Result.Timeout; Logger?.LogError(requestTask.Exception); callback?.Invoke(false); return; } HandleResponse(CallMode.Start, request, requestTask.Result).ContinueWith((responseTask) => { if (responseTask.IsFaulted) { IdentifyResult = SpeechIdentifier.Result.Timeout; Logger?.LogError(responseTask.Exception); callback?.Invoke(false); return; } callback?.Invoke(responseTask.Result); }); }); if (task.IsFaulted) { IdentifyResult = SpeechIdentifier.Result.Timeout; Logger?.LogError(task.Exception); callback?.Invoke(false); } } }
public abstract void Start(SpeechIdentifier.StartCallback callback);