@@ -246,13 +246,13 @@ public float SilenceThreshold
246
246
/// This callback object is used by the Recognize() and StartListening() methods.
247
247
/// </summary>
248
248
/// <param name="results">The ResultList object containing the results.</param>
249
- public delegate void OnRecognize ( SpeechRecognitionEvent results , Dictionary < string , object > customData = null ) ;
249
+ public delegate void OnRecognize ( SpeechRecognitionEvent results ) ;
250
250
251
251
/// <summary>
252
252
/// This callback object is used by the RecognizeSpeaker() method.
253
253
/// </summary>
254
254
/// <param name="speakerRecognitionEvent">Array of speaker label results.</param>
255
- public delegate void OnRecognizeSpeaker ( SpeakerRecognitionEvent speakerRecognitionEvent , Dictionary < string , object > customData = null ) ;
255
+ public delegate void OnRecognizeSpeaker ( SpeakerRecognitionEvent speakerRecognitionEvent ) ;
256
256
257
257
/// <summary>
258
258
/// This starts the service listening and it will invoke the callback for any recognized speech.
@@ -262,25 +262,19 @@ public float SilenceThreshold
262
262
/// <param name="callback">All recognize results are passed to this callback.</param>
263
263
/// <param name="speakerLabelCallback">Speaker label goes through this callback if it arrives separately from recognize result.</param>
264
264
/// <returns>Returns true on success, false on failure.</returns>
265
- public bool StartListening ( OnRecognize callback , OnRecognizeSpeaker speakerLabelCallback = null , Dictionary < string , object > customData = null )
265
+ public bool StartListening ( OnRecognize callback , OnRecognizeSpeaker speakerLabelCallback = null )
266
266
{
267
267
if ( callback == null )
268
268
throw new ArgumentNullException ( "callback" ) ;
269
269
if ( _isListening )
270
270
return false ;
271
271
if ( ! CreateListenConnector ( ) )
272
272
return false ;
273
-
274
- if ( customData == null )
275
- customData = new Dictionary < string , object > ( ) ;
276
-
273
+
277
274
Dictionary < string , string > customHeaders = new Dictionary < string , string > ( ) ;
278
- if ( customData . ContainsKey ( Constants . String . CUSTOM_REQUEST_HEADERS ) )
275
+ foreach ( KeyValuePair < string , string > kvp in customRequestHeaders )
279
276
{
280
- foreach ( KeyValuePair < string , string > kvp in customData [ Constants . String . CUSTOM_REQUEST_HEADERS ] as Dictionary < string , string > )
281
- {
282
- customHeaders . Add ( kvp . Key , kvp . Value ) ;
283
- }
277
+ customHeaders . Add ( kvp . Key , kvp . Value ) ;
284
278
}
285
279
286
280
if ( customHeaders != null && _listenSocket != null )
@@ -539,10 +533,10 @@ private void OnListenMessage(WSConnector.Message msg)
539
533
if ( msg is WSConnector . TextMessage )
540
534
{
541
535
WSConnector . TextMessage tm = ( WSConnector . TextMessage ) msg ;
542
- Dictionary < string , object > customData = new Dictionary < string , object > ( ) ;
543
- customData . Add ( Constants . String . JSON , tm . Text ) ;
544
- if ( tm . Headers != null && tm . Headers . Count > 0 )
545
- customData . Add ( Constants . String . RESPONSE_HEADERS , tm . Headers ) ;
536
+ // Dictionary<string, object> customData = new Dictionary<string, object>();
537
+ // customData.Add(Constants.String.JSON, tm.Text);
538
+ // if (tm.Headers != null && tm.Headers.Count > 0)
539
+ // customData.Add(Constants.String.RESPONSE_HEADERS, tm.Headers);
546
540
547
541
IDictionary json = Json . Deserialize ( tm . Text ) as IDictionary ;
548
542
if ( json != null )
@@ -558,7 +552,7 @@ private void OnListenMessage(WSConnector.Message msg)
558
552
// SendStart();
559
553
560
554
if ( _listenCallback != null )
561
- _listenCallback ( results , customData ) ;
555
+ _listenCallback ( results ) ;
562
556
else
563
557
StopListening ( ) ; // automatically stop listening if our callback is destroyed.
564
558
}
0 commit comments