private static List<string> s_supportedLanguages;
private static VcSupportedLanguageCb s_supportedLanguagesCb;
private static VcResultCb s_resultCb;
+ private static RecognitionResult s_recognitionResult;
/// <summary>
/// Gets current language.
/// For example, "ko_KR" for Korean, "en_US" for American English.
/// Empty string is returned incase of some internal error
/// </summary>
+ /// <value>
+ /// Current language in voice control.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <precondition>
/// The State must be Initialized or Ready.
/// </precondition>
- public static string GetCurrentLanaguge
+ public static string CurrentLanguage
{
get
{
- string currentLanaguge;
+ string currentLanguage;
- ErrorCode error = VcGetCurrentLanguage(out currentLanaguge);
+ ErrorCode error = VcGetCurrentLanguage(out currentLanguage);
if (error != ErrorCode.None)
{
- Log.Error(LogTag, "CurrentLanaguge Failed with error " + error);
+ Log.Error(LogTag, "CurrentLanguage Failed with error " + error);
return "";
}
- return currentLanaguge;
+ return currentLanguage;
}
}
/// <summary>
- /// Gets current state of voice control client.
+ /// Gets current state of voice control client.
/// </summary>
+ /// <value>
+ /// Current state of voice control client.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <precondition>
/// The State must be Initialized or Ready.
/// </precondition>
- public static State GetState
+ public static State State
{
get
{
ErrorCode error = VcGetState(out state);
if (error != ErrorCode.None)
{
- Log.Error(LogTag, "GetState Failed with error " + error);
+ Log.Error(LogTag, "State Failed with error " + error);
return State.Unavailable;
}
/// <summary>
/// Gets current state of voice control service.
/// </summary>
+ /// <value>
+ /// Current state of voice control service.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <precondition>
/// The State must be Ready.
/// </precondition>
- public static ServiceState GetServiceState
+ public static ServiceState ServiceState
{
get
{
ErrorCode error = VcGetServiceState(out state);
if (error != ErrorCode.None)
{
- Log.Error(LogTag, "GetServiceState Failed with error " + error);
+ Log.Error(LogTag, "ServiceState Failed with error " + error);
return ServiceState.Unavailable;
}
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <remarks>
/// Invocation name is used to activate background commands. The invocation name can be the same as the application name or any other phrase.
/// For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample".
/// This function should be called before SetCommandList().
/// </remarks>
/// <param name="name">Invocation name that an application wants to be invoked by</param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Invalid parameter
- /// 2. Invalid state
- /// 3. Not Supported
- /// 4. Permission Denied
- /// </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State must be Ready.
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Out Of Memory
- /// 2. Operation Failed
- /// 3. Not Supported
- /// 4. Permission Denied
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
+ /// <exception cref="OutOfMemoryException"> This Exception can be due to Out Of Memory. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <postcondition>
/// The State will be Initialized.
/// </postcondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Operation Failed
- /// 2. Invalid state
- /// 3. Not Supported
- /// 4. Permission Denied
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
public static void Deinitialize()
{
ErrorCode error = VcDeinitialize();
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Operation Failed
- /// 2. Not Supported
- /// 3. Permission Denied
- /// 4. Invalid State
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Initialized
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Operation Failed
- /// 2. Not Supported
- /// 3. Permission Denied
- /// 4. Invalid State
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready or Initialized
/// </precondition>
- public static IEnumerable<string> GetSupportedLangauges()
+ public static IEnumerable<string> GetSupportedLanguages()
{
s_supportedLanguages = new List<string>();
s_supportedLanguagesCb = (IntPtr language, IntPtr userData) =>
ErrorCode error = VcForeachSupportedLanguages(s_supportedLanguagesCb, IntPtr.Zero);
if (error != ErrorCode.None)
{
- Log.Error(LogTag, "GetSupportedLangauges Failed with error " + error);
+ Log.Error(LogTag, "GetSupportedLanguages Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <remarks>
/// In the system command list, there are system commands predefined by product manufacturers.
/// Those commands have the highest priority. Therefore, the user can not set any commands same with the system commands.
/// </remarks>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Operation Failed. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready
/// </precondition>
- public static VoiceCommandList GetSytemCommandList()
+ public static VoiceCommandList GetSystemCommandList()
{
IntPtr handle = IntPtr.Zero;
ErrorCode error = VcGetSystemCommandList(out handle);
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <remarks>
/// If autoStart is true, the recognition will start again. In this case, it can be restarted up to 4 times.
/// </remarks>
/// <param name="dispText"> Text to be displayed on the screen/// </param>
/// <param name="uttText">Text to be spoken</param>
/// <param name="autoStart">A variable for setting whether the dialog session will be restarted automatically or not</param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// 4. Invalid parameter
- /// </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <remarks>
/// The command type is valid for CommandType 'Foreground' or 'Background'.
/// The matched commands of command list should be set and they should include type and command text at least.
/// </remarks>
/// <param name="list">Command list</param>
/// <param name="type">Command type</param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// 4. Invalid parameter
- /// </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <param name="type">Command type</param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// 4. Invalid parameter
- /// </exception>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <exception cref="UnauthorizedAccessException"> This Exception can be due to Permission Denied. </exception>
/// <precondition>
/// The State should be Ready
/// </precondition>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <param name="resultDelegate">
- /// Callback function to get recognition result
- /// </param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Not Supported
- /// 2. Invalid State
- /// 3. Invalid parameter
- /// </exception>
+ /// <privlevel>
+ /// public
+ /// </privlevel>
+ /// <feature>
+ /// http://tizen.org/feature/speech.control
+ /// http://tizen.org/feature/microphone
+ /// </feature>
+ /// <exception cref="InvalidOperationException"> This Exception can be due to Invalid State. </exception>
+ /// <exception cref="ArgumentException"> This Exception can be due to Invalid Parameter. </exception>
+ /// <exception cref="NotSupportedException"> This Exception can be due to Not Supported. </exception>
+ /// <returns>The Recognition Result if possible else a null object</returns>
/// <precondition>
/// The State should be Ready
/// </precondition>
- public static void GetResult(RecognitionResultDelegate resultDelegate)
+ public static RecognitionResult GetResult()
{
+ s_recognitionResult = null;
s_resultCb = (ResultEvent evt, IntPtr cmdList, IntPtr result, IntPtr userData) =>
{
- VoiceCommandList list = new VoiceCommandList(new SafeCommandListHandle(cmdList));
- string resultStr = Marshal.PtrToStringAnsi(result);
- resultDelegate(evt, list, resultStr);
+ s_recognitionResult = new RecognitionResult(evt, cmdList, result);
};
ErrorCode error = VcGetResult(s_resultCb, IntPtr.Zero);
if (error != ErrorCode.None)
Log.Error(LogTag, "GetResult Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
+
+ return s_recognitionResult;
}
/// <summary>
Log.Info(LogTag, "Recognition Result Event Triggered");
if ((cmdList != null) && (result != null))
{
- RecognitionResultEventArgs args = new RecognitionResultEventArgs(evt, cmdList, result);
+ RecognitionResultEventArgs args = new RecognitionResultEventArgs(new RecognitionResult( evt, cmdList, result));
_recognitionResult?.Invoke(null, args);
}
else