namespace Tizen.Uix.Stt
{
/// <summary>
- /// The token event
+ /// The token event.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum ResultEvent
{
/// <summary>
- /// Event when the recognition full or last result is ready
+ /// Event when the recognition for full or last result is ready.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
FinalResult = 0,
/// <summary>
- /// Event when the recognition partial result is ready
+ /// Event when the recognition for partial result is ready.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
PartialResult,
/// <summary>
- /// Event when the recognition has failed
+ /// Event when the recognition has failed.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Error
};
/// <summary>
- /// Enumeration representing the result message
+ /// Enumeration for representing the result message.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum ResultMessage
{
/// <summary>
- /// No Error
+ /// No Error.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
None,
/// <summary>
/// Recognition failed because the speech started too soon.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooSoon,
/// <summary>
/// Recognition failed because the speech is too short.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooShort,
/// <summary>
/// Recognition failed because the speech is too long.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooLong,
/// <summary>
/// Recognition failed because the speech is too quiet to listen.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooQuiet,
/// <summary>
/// Recognition failed because the speech is too loud to listen.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooLoud,
/// <summary>
/// Recognition failed because the speech is too fast to listen.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TooFast
};
/// <summary>
- /// Enumeration for the Token type
+ /// Enumeration for the token types.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum TimeEvent
{
/// <summary>
- /// Event when the token is beginning type
+ /// Event when the token is beginning type.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Beginning = 0,
/// <summary>
- /// Event when the token is middle type
+ /// Event when the token is middle type.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Middle = 1,
/// <summary>
- /// Event when the token is end type
+ /// Event when the token is end type.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
End = 2
};
/// <summary>
- /// Enum for Error values that can occur
+ /// Enumeration for the error values that can occur.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum Error
{
/// <summary>
- /// Successful, No error
+ /// Successful, No error.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
None,
/// <summary>
- /// Out of Memory
+ /// Out of Memory.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>.
OutOfMemory,
/// <summary>
- /// I/O error
+ /// I/O error.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>.
IoError,
/// <summary>
- /// Invalid parameter
+ /// Invalid parameter.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InvalidParameter,
/// <summary>
- /// No answer from the STT service
+ /// No answer from the STT service.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
TimedOut,
/// <summary>
- /// Device or resource busy
+ /// Device or resource busy.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
RecorderBusy,
/// <summary>
- /// Network is down
+ /// Network is down.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
OutOfNetwork,
/// <summary>
- /// Permission denied
+ /// Permission denied.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
PermissionDenied,
/// <summary>
- /// STT NOT supported
+ /// STT NOT supported.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
NotSupported,
/// <summary>
- /// Invalid state
+ /// Invalid state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InvalidState,
/// <summary>
- /// Invalid language
+ /// Invalid language.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InvalidLanguage,
/// <summary>
- /// No available engine
+ /// No available engine.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
EngineNotFound,
/// <summary>
- /// Operation failed
+ /// Operation failed.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
OperationFailed,
/// <summary>
- /// Not supported feature of current engine
+ /// Not supported feature of current engine.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
NotSupportedFeature,
/// <summary>
- /// Recording timed out
+ /// Recording timed out.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
RecordingTimedOut,
/// <summary>
- /// No speech while recording
+ /// No speech while recording.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
NoSpeech,
/// <summary>
- /// Progress to ready is not finished
+ /// Progress to ready is not finished.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InProgressToReady,
/// <summary>
- /// Progress to recording is not finished
+ /// Progress to recording is not finished.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InProgressToRecording,
/// <summary>
- /// Progress to processing is not finished
+ /// Progress to processing is not finished.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
InProgressToProcessing,
/// <summary>
- /// Service reset
+ /// Service reset.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
ServiceReset
};
/// <summary>
- /// Enumeration for Recognition Types
+ /// Enumeration for the recognition types.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum RecognitionType
{
/// <summary>
- /// Free form dictation
+ /// Free form dictation.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Free,
/// <summary>
/// Continuous free dictation.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Partial,
/// <summary>
- /// Search
+ /// Search.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Search,
/// <summary>
- /// Web Search
+ /// Web search.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
WebSearch,
/// <summary>
- /// Map
+ /// Map.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Map
};
/// <summary>
- /// Enumeration for the State types
+ /// Enumeration for the state types.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum State
{
/// <summary>
- /// Created state
+ /// Created state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Created = 0,
/// <summary>
- /// Ready state
+ /// Ready state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Ready = 1,
/// <summary>
- /// Recording state
+ /// Recording state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Recording = 2,
/// <summary>
- /// Processing state
+ /// Processing state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Processing = 3,
/// <summary>
- /// Unavailable
+ /// Unavailable.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Unavailable
};
/// <summary>
- /// Enumeration for the Silence Detection types
+ /// Enumeration for the silence detection types.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public enum SilenceDetection
{
/// <summary>
- /// Silence detection type - False
+ /// Silence detection type - False.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
False = 0,
/// <summary>
- /// Silence detection type - True
+ /// Silence detection type - True.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
True = 1,
/// <summary>
- /// Silence detection type - Auto
+ /// Silence detection type - Auto.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
Auto = 2
};
/// <summary>
/// A main function of Speech-To-Text (below STT) API recognizes sound data recorded by users.
- /// After choosing a language, applications will start recording and recognizing.
+ /// After choosing a language, the applications will start recording and recognizing.
/// After recording, the applications will receive the recognized result.
/// The STT has a client-server for the service of multi-applications.
- /// The STT service always works in the background as a server. If the service is not working, client library will invoke it and client will communicate with it.
- /// The service has engines and the recorder so client does not have the recorder itself. Only the client request commands to the STT service for using STT.
+ /// The STT service always works in the background as a server. If the service is not working, client library will invoke it and the client will communicate with it.
+ /// The service has engines and a recorder, so that the client does not have the recorder itself. Only the client request commands to the STT service for using STT.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public class SttClient : IDisposable
{
private IntPtr _handle;
private Object thisLock = new Object();
private event EventHandler<RecognitionResultEventArgs> _recognitionResult;
private event EventHandler<StateChangedEventArgs> _stateChanged;
- private event EventHandler<ErrorOccuredEventArgs> _errorOccured;
+ private event EventHandler<ErrorOccurredEventArgs> _errorOccurred;
private event EventHandler<DefaultLanguageChangedEventArgs> _defaultLanguageChanged;
private event EventHandler<EngineChangedEventArgs> _engineChanged;
private bool disposedValue = false;
/// <summary>
/// Constructor to create a STT instance.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <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. STT Not Supported
- /// 4. Permission Denied
- /// </exception>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public SttClient()
{
IntPtr handle;
/// <summary>
/// Event to be invoked when the recognition is done.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public event EventHandler<RecognitionResultEventArgs> RecognitionResult
{
add
lock (thisLock)
{
_resultDelegate = (IntPtr handle, ResultEvent e, IntPtr data, int dataCount, IntPtr msg, IntPtr userData) =>
- {
- Log.Info(LogTag, "Recognition Result Event Triggered");
- if (data != null && msg != null)
- {
- RecognitionResultEventArgs args = new RecognitionResultEventArgs(e, data, dataCount, Marshal.PtrToStringAnsi(msg));
- _recognitionResult?.Invoke(this, args);
- }
- else
{
- Log.Info(LogTag, "Recognition Result Event null received");
- }
- };
+ Log.Info(LogTag, "Recognition Result Event Triggered");
+ if (data != null && msg != null)
+ {
+ RecognitionResultEventArgs args = new RecognitionResultEventArgs(e, data, dataCount, Marshal.PtrToStringAnsi(msg));
+ _recognitionResult?.Invoke(this, args);
+ }
+ else
+ {
+ Log.Info(LogTag, "Recognition Result Event null received");
+ }
+ };
SttError error = SttSetRecognitionResultCB(_handle, _resultDelegate, IntPtr.Zero);
if (error != SttError.None)
{
}
/// <summary>
- /// Event to be invoked when STT state changes.
+ /// Event to be invoked when the STT state changes.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public event EventHandler<StateChangedEventArgs> StateChanged
{
add
{
_stateChanged += value;
}
-
}
}
/// <summary>
/// Event to be invoked when an error occurs.
/// </summary>
- public event EventHandler<ErrorOccuredEventArgs> ErrorOccured
+ /// <since_tizen> 4 </since_tizen>
+ public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
{
add
{
lock (thisLock)
{
_errorDelegate = (IntPtr handle, SttError reason, IntPtr userData) =>
- {
- ErrorOccuredEventArgs args = new ErrorOccuredEventArgs(handle, reason);
- _errorOccured?.Invoke(this, args);
- };
+ {
+ ErrorOccurredEventArgs args = new ErrorOccurredEventArgs(handle, reason);
+ _errorOccurred?.Invoke(this, args);
+ };
SttError error = SttSetErrorCB(_handle, _errorDelegate, IntPtr.Zero);
if (error != SttError.None)
{
- Log.Error(LogTag, "Add ErrorOccured Failed with error " + error);
+ Log.Error(LogTag, "Add ErrorOccurred Failed with error " + error);
}
else
{
- _errorOccured += value;
+ _errorOccurred += value;
}
}
-
}
remove
SttError error = SttUnsetErrorCB(_handle);
if (error != SttError.None)
{
- Log.Error(LogTag, "Remove ErrorOccured Failed with error " + error);
+ Log.Error(LogTag, "Remove ErrorOccurred Failed with error " + error);
}
- _errorOccured -= value;
+ _errorOccurred -= value;
}
}
}
/// <summary>
- /// Event to be invoked when default laungage change.
+ /// Event to be invoked when the default language changes.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public event EventHandler<DefaultLanguageChangedEventArgs> DefaultLanguageChanged
{
add
lock (thisLock)
{
_languageDelegate = (IntPtr handle, IntPtr previousLanguage, IntPtr currentLanguage, IntPtr userData) =>
- {
- string previousLanguageString = Marshal.PtrToStringAnsi(previousLanguage);
- string currentLanguageString = Marshal.PtrToStringAnsi(currentLanguage);
- DefaultLanguageChangedEventArgs args = new DefaultLanguageChangedEventArgs(previousLanguageString, currentLanguageString);
- _defaultLanguageChanged?.Invoke(this, args);
- };
+ {
+ string previousLanguageString = Marshal.PtrToStringAnsi(previousLanguage);
+ string currentLanguageString = Marshal.PtrToStringAnsi(currentLanguage);
+ DefaultLanguageChangedEventArgs args = new DefaultLanguageChangedEventArgs(previousLanguageString, currentLanguageString);
+ _defaultLanguageChanged?.Invoke(this, args);
+ };
SttError error = SttSetDefaultLanguageChangedCB(_handle, _languageDelegate, IntPtr.Zero);
if (error != SttError.None)
{
_defaultLanguageChanged += value;
}
}
-
}
remove
}
/// <summary>
- /// Event to be invoked to detect engine change.
+ /// Event to be invoked to detect the engine change.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public event EventHandler<EngineChangedEventArgs> EngineChanged
{
add
lock (thisLock)
{
_engineDelegate = (IntPtr handle, IntPtr engineId, IntPtr language, bool supportSilence, bool needCredential, IntPtr userData) =>
- {
- string engineIdString = Marshal.PtrToStringAnsi(engineId);
- string languageString = Marshal.PtrToStringAnsi(language);
- EngineChangedEventArgs args = new EngineChangedEventArgs(engineIdString, languageString, supportSilence, needCredential);
- _engineChanged?.Invoke(this, args);
- };
+ {
+ string engineIdString = Marshal.PtrToStringAnsi(engineId);
+ string languageString = Marshal.PtrToStringAnsi(language);
+ EngineChangedEventArgs args = new EngineChangedEventArgs(engineIdString, languageString, supportSilence, needCredential);
+ _engineChanged?.Invoke(this, args);
+ };
SttError error = SttSetEngineChangedCB(_handle, _engineDelegate, IntPtr.Zero);
if (error != SttError.None)
{
/// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.
/// For example, "ko_KR" for Korean, "en_US" for American English.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <value>
+ /// Default language in STT.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <returns>
- /// Default Lanaguage string value.
+ /// Default Language string value.
/// </returns>
- public string GetDefaultLanguage
+ public string DefaultLanguage
{
get
{
SttError error = SttGetDefaultLanguage(_handle, out language);
if (error != SttError.None)
{
- Log.Error(LogTag, "DefaultLanaguage Failed with error " + error);
+ Log.Error(LogTag, "DefaultLanguage Failed with error " + error);
return "";
}
}
/// <summary>
/// Gets the microphone volume during recording.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <value>
+ /// Recording volume in STT.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <precondition>
- /// The State must be Recording.
- /// </precondition>
- public float GetRecordingVolume
+ /// <pre>
+ /// The state must be recording.
+ /// </pre>
+ public float RecordingVolume
{
get
{
Log.Error(LogTag, "GetRecordingVolume Failed with error " + error);
return 0.0f;
}
-
}
return volume;
/// <summary>
/// Gets the current STT state.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <value>
+ /// Current state of STT.
+ /// </value>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <returns>
- /// Current STT State value.
+ /// Current STT state value.
/// </returns>
- public State GetState
+ public State CurrentState
{
get
{
/// <summary>
/// This property can be used to get and set the current engine id.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <value>
+ /// Current STT engine id.
+ /// </value>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
/// <exception cref="InvalidOperationException">
- /// This Exception can occur while setting due to the following reaons
- /// 1. Out Of Memory
- /// 2. Operation Failed
- /// 3. STT Not Supported
- /// 4. Permission Denied
- /// 5. Invalid State
- /// </exception>
- /// <exception cref="ArgumentException">
- /// This can happen if Improper EngineId is provided while setting the value.
+ /// This exceptioncan occur while setting due to the following reasons:
+ /// 1. Operation Failed
+ /// 2. Invalid State
/// </exception>
- /// <precondition>
- /// The State must be Created.
- /// </precondition>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This can happen if improper EngineId is provided while setting the value.</exception>
+ /// <pre>
+ /// The state must be created.
+ /// </pre>
public string Engine
{
get
}
/// <summary>
- /// Retrieves the time stamp of the current recognition result
+ /// Retrieves the time stamp of the current recognition result.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <returns>
- /// list of ResultTime
+ /// List of ResultTime.
/// </returns>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <remarks>
- /// This function should only be called in RecognitionResult Event
+ /// This function should only be called in the RecognitionResult event.
/// </remarks>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Opearation Failed.
- /// 2. STT Not Supported
- /// 3. Permission Denied.
- /// </exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public IEnumerable<ResultTime> GetDetailedResult()
{
List<ResultTime> list = new List<ResultTime>();
- _resultTimeDelegate = (IntPtr handle, int index, TimeEvent e, IntPtr text, IntPtr startTime, IntPtr endTime, IntPtr userData) =>
- {
- _result = new ResultTime(index, e, Marshal.PtrToStringAnsi(text), (long)startTime, (long)endTime);
- list.Add(_result);
- return true;
- };
- SttError error = SttForeachDetailedResult(_handle, _resultTimeDelegate, IntPtr.Zero);
- if (error != SttError.None)
+ lock (thisLock)
{
- Log.Error(LogTag, "GetDetailedResult Failed with error " + error);
- throw ExceptionFactory.CreateException(error);
+ _resultTimeDelegate = (IntPtr handle, int index, TimeEvent e, IntPtr text, IntPtr startTime, IntPtr endTime, IntPtr userData) =>
+ {
+ _result = new ResultTime(index, e, Marshal.PtrToStringAnsi(text), (long)startTime, (long)endTime);
+ list.Add(_result);
+ return true;
+ };
+ SttError error = SttForeachDetailedResult(_handle, _resultTimeDelegate, IntPtr.Zero);
+ if (error != SttError.None)
+ {
+ Log.Error(LogTag, "GetDetailedResult Failed with error " + error);
+ throw ExceptionFactory.CreateException(error);
+ }
}
return list;
}
/// <summary>
- /// Gets the private data from stt engine.
+ /// Gets the private data from the STT engine.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <param name="key">
- /// The key string
+ /// The key string.
/// </param>
/// <returns>
- /// The Data Corresponding to the Key provided
+ /// The data corresponding to the key is provided.
/// </returns>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. No Answer from STT Service
- /// 2. STT Not Supported
- /// 3. Invalid State
- /// </exception>
- /// <precondition>
- /// The State must be Ready.
- /// </precondition>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="TimeoutException">This exception can be due to No Answer from STT Service.</exception>
+ /// <pre>
+ /// The state must be ready.
+ /// </pre>
public string GetPrivateData(string key)
{
string data;
}
/// <summary>
- /// Sets the private data to stt engine.
+ /// Sets the private data to the STT engine.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <param name="key">
- /// The key string
+ /// The key string.
/// </param>
/// <param name="data">
- /// The data string
+ /// The data string.
/// </param>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. No Answer from STT Service
- /// 2. STT Not Supported
- /// 3. Invalid State
- /// </exception>
- /// <exception cref="ArgumentException">
- /// This can happen if Improper value is provided while setting the value.
- /// </exception>
- /// <precondition>
- /// The State must be Ready.
- /// </precondition>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="TimeoutException">This exception can be due to No Answer from STT Service.</exception>
+ /// <exception cref="ArgumentException"> This can happen if Improper value is provided while setting the value. </exception>
+ /// <pre>
+ /// The state must be ready.
+ /// </pre>
public void SetPrivateData(string key, string data)
{
lock (thisLock)
}
/// <summary>
- /// Gets the list of Supported Engine
+ /// Gets the list of supported engines.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <returns>
- /// IEnumerable<SupportedEngine> list of supported engines
+ /// IEnumerable<SupportedEngine> list of supported engines.
/// </returns>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Out Of Memory
- /// 2. Operation Failed
- /// 3. STT Not Supported
- /// 4. Permission Denied
- /// </exception>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
public IEnumerable<SupportedEngine> GetSupportedEngines()
{
List<SupportedEngine> engineList = new List<SupportedEngine>();
lock (thisLock)
{
SupportedEngineCallback supportedEngineDelegate = (IntPtr handle, IntPtr engineId, IntPtr engineName, IntPtr userData) =>
- {
- string id = Marshal.PtrToStringAnsi(engineId);
- string name = Marshal.PtrToStringAnsi(engineName);
- SupportedEngine engine = new SupportedEngine(id, name);
- engineList.Add(engine);
- return true;
- };
+ {
+ string id = Marshal.PtrToStringAnsi(engineId);
+ string name = Marshal.PtrToStringAnsi(engineName);
+ SupportedEngine engine = new SupportedEngine(id, name);
+ engineList.Add(engine);
+ return true;
+ };
SttError error = SttForeEachSupportedEngines(_handle, supportedEngineDelegate, IntPtr.Zero);
if (error != SttError.None)
{
}
/// <summary>
- /// Sets the app credential
+ /// Sets the application credential.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <param name="credential">
- /// The credential string
+ /// The credential string.
/// </param>
+ /// <privilege>
+ /// http://tizen.org/privilege/recorder
+ /// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reaons
- /// 1. Out Of Memory
- /// 2. Operation Failed
- /// 3. STT Not Supported
- /// 4. Permission Denied
- /// 5. Invalid State
- /// </exception>
- /// <exception cref="ArgumentException">
- /// This can happen if Improper value is provided while setting the value.
+ /// This exceptioncan be due to the following reasons:
+ /// 1. Operation Failed
+ /// 2. Invalid State
/// </exception>
- /// <precondition>
- /// The State must be Created.
- /// </precondition>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException"> This can happen if Improper value is provided while setting the value. </exception>
+ /// <pre>
+ /// The state must be created.
+ /// </pre>
public void SetCredential(string credential)
{
lock (thisLock)
/// <summary>
/// Connects to the STT service asynchronously.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// </exception>
- /// <precondition>
- /// The State must be Created.
- /// </precondition>
- /// <postcondition>
- /// If this function is successful, the STT state will be Ready
- /// If this function is unsuccessful, ErrorOccured event will be invoked
- /// </postcondition>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <pre>
+ /// The state must be created.
+ /// </pre>
+ /// <post>
+ /// If this function is successful, the STT state will be ready.
+ /// If this function is unsuccessful, ErrorOccurred event will be invoked.
+ /// </post>
public void Prepare()
{
lock (thisLock)
/// <summary>
/// Disconnects from the STT service.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
- /// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported
- /// 2. Permission Denied
- /// 3. Invalid State
- /// </exception>
- /// <precondition>
- /// The State must be Ready.
- /// </precondition>
- /// <postcondition>
- /// If this function is successful, the STT state will be Created
- /// </postcondition>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// 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 STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <pre>
+ /// The state must be ready.
+ /// </pre>
+ /// <post>
+ /// If this function is successful, the STT state will be Created.
+ /// </post>
public void Unprepare()
{
lock (thisLock)
}
/// <summary>
- /// Retrieves all supported languages of current engine.
+ /// Retrieves all the supported languages of the current engine.
/// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code.
/// For example, "ko_KR" for Korean, "en_US" for American English.
/// </summary>
+ /// <since_tizen> 4 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <returns>
- /// list of strings of supported languages.
+ /// List of strings for supported languages.
/// </returns>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported
- /// 2. Permission Denied
- /// 3. Engine Not Found.
- /// 4. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Engine Not Found.
+ /// 2. Operation Failed.
/// </exception>
- public IEnumerable<string> GetSupportedLangauages()
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ public IEnumerable<string> GetSupportedLanguages()
{
List<string> languageList = new List<string>();
lock (thisLock)
{
SupportedLanguageCallback supportedLanguageDelegate = (IntPtr handle, IntPtr language, IntPtr userData) =>
- {
- string lang = Marshal.PtrToStringAnsi(language);
- languageList.Add(lang);
- return true;
- };
+ {
+ string lang = Marshal.PtrToStringAnsi(language);
+ languageList.Add(lang);
+ return true;
+ };
SttError error = SttForeachSupportedLanguages(_handle, supportedLanguageDelegate, IntPtr.Zero);
if (error != SttError.None)
{
- Log.Error(LogTag, "GetSupportedLangauages Failed with error " + error);
+ Log.Error(LogTag, "GetSupportedLanguages Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
}
/// <summary>
/// Checks whether the recognition type is supported.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// RecognitionType value.
/// </param>
/// <returns>
- /// bool value indicating whether the recognition type is supported.
+ /// Bool value indicating whether the recognition type is supported.
/// </returns>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported
- /// 2. Invalid State
- /// 3. Engine Not Found.
- /// 4. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Engine Not Found
+ /// 3. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public bool IsRecognitionTypeSupported(RecognitionType type)
{
bool supported;
recType = "stt.recognition.type.MAP";
break;
}
-
}
SttError error = SttIsRecognitionTypeSupported(_handle, recType, out supported);
Log.Error(LogTag, "IsRecognitionTypeSupported Failed with error " + error);
throw ExceptionFactory.CreateException(error);
}
-
}
return supported;
/// <summary>
/// Sets the silence detection.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="type">
/// SilenceDetection value.
/// </param>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported
- /// 2. Invalid State
- /// 3. Not supported feature of current engine.
- /// 4. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Not supported feature of current engine
+ /// 3. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public void SetSilenceDetection(SilenceDetection type)
{
lock (thisLock)
/// <summary>
/// Sets the sound to start recording.
- /// Sound file type should be wav type.
+ /// Sound file type should be .wav type.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="filePath">
- /// File Path for the sound.
+ /// File path for the sound.
/// </param>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// If an Invalid Parameter is provided.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException"> If an Invalid Parameter is provided. </exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public void SetStartSound(string filePath)
{
lock (thisLock)
/// <summary>
/// Unsets the sound to start recording.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public void UnsetStartSound()
{
lock (thisLock)
/// <summary>
/// Sets the sound to stop recording.
- /// Sound file type should be wav type.
+ /// Sound file type should be .wav type.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="filePath">
/// File Path for the sound.
/// </param>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// If an Invalid Parameter is provided.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to Invalid Parameter.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public void SetStopSound(string filePath)
{
lock (thisLock)
/// <summary>
/// Unsets the sound to stop recording.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException"> his exception can be due to permission denied.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
public void UnsetStopSound()
{
lock (thisLock)
}
/// <summary>
- /// Starts recording and recognition asynchronously.
- /// This function starts recording in the STT service and sending recording data to engine.
- /// This work continues until Stop, Cancel or silence detected by engine
+ /// Starts the recording and recognition asynchronously.
+ /// This function starts recording in the STT service and sends the recording data to the engine.
+ /// This work continues until stop, cancel, or silence is detected by engine.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
/// <param name="language">
- /// The language selected
+ /// The language selected.
/// </param>
/// <param name="type">
- /// The type for recognition
+ /// The type for recognition.
/// </param>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
- /// 5. Recorder Busy.
- /// 6. Progress to recording is not finished
- /// </exception>
- /// <exception cref="ArgumentException">
- /// If an Invalid Language is provided
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Recorder Busy
+ /// 4. Progress to recording is not finished
/// </exception>
- /// <precondition>
- /// The state should be Ready.
- /// </precondition>
- /// <postcondition>
- /// It will invoke StateChanged Event if registerd.
- /// If this function succeeds, the STT state will be Recording.
- /// If you call this function again before state changes, you will receive ErrorINProgressToRecording.
- /// </postcondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid language.</exception>
+ /// <pre>
+ /// The state should be ready.
+ /// </pre>
+ /// <post>
+ /// It will invoke the StateChanged event, if registered.
+ /// If this function succeeds, the STT state will be recording.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToRecording.
+ /// </post>
public void Start(string language, RecognitionType type)
{
lock (thisLock)
recType = "stt.recognition.type.MAP";
break;
}
-
}
SttError error = SttStart(_handle, language, recType);
}
/// <summary>
- /// Finishes the recording and starts recognition processing in engine asynchronously.
+ /// Finishes the recording and starts recognition processing in the engine asynchronously.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
- /// 5. Progress to ready is not finished.
- /// 6. Progress to recording is not finished.
- /// 7. Progress to processing is not finished.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Progress to ready is not finished
+ /// 4. Progress to recording is not finished
+ /// 5. Progress to processing is not finished
/// </exception>
- /// <precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <pre>
/// The state should be Recording.
- /// </precondition>
- /// <postcondition>
- /// It will invoke StateChanged Event if registerd.
- /// If this function succeeds, the STT state will be Processing.
- /// If you call this function again before state changes, you will receive ErrorINProgressToProcessing.
- /// After processing of engine, RecognitionResult event is invoked
- /// </postcondition>
+ /// </pre>
+ /// <post>
+ /// It will invoke the StateChanged Event, if registered.
+ /// If this function succeeds, the STT state will be processing.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToProcessing.
+ /// After processing of engine, the RecognitionResult event is invoked.
+ /// </post>
public void Stop()
{
lock (thisLock)
}
/// <summary>
- /// Cancels processing recognition and recording asynchronously.
- /// This function cancels recording and engine cancels recognition processing.
- /// After successful cancel, StateChanged event is invoked otherwise if error is occurred, ErrorOccured event is invoked.
+ /// Cancels processing the recognition and recording asynchronously.
+ /// This function cancels recording and the engine cancels recognition processing.
+ /// After successful cancellation, the StateChanged event is invoked, otherwise if an error is occurs, the ErrorOccurred event is invoked.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
/// <privilege>
/// http://tizen.org/privilege/recorder
/// </privilege>
+ /// <feature>
+ /// http://tizen.org/feature/speech.recognition
+ /// http://tizen.org/feature/microphone
+ /// </feature>
/// <exception cref="InvalidOperationException">
- /// This Exception can be due to the following reasons
- /// 1. STT Not Supported.
- /// 2. Permission Denied.
- /// 3. Invalid State.
- /// 4. Operation Failed.
- /// 5. Progress to ready is not finished.
- /// 6. Progress to recording is not finished.
- /// 7. Progress to processing is not finished.
+ /// This exception can be due to the following reasons:
+ /// 1. Invalid State
+ /// 2. Operation Failed
+ /// 3. Progress to ready is not finished
+ /// 4. Progress to recording is not finished
+ /// 5. Progress to processing is not finished
/// </exception>
- /// <precondition>
+ /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <pre>
/// The state should be Recording or Processing.
- /// </precondition>
- /// <postcondition>
- /// It will invoke StateChanged Event if registerd.
- /// If this function succeeds, the STT state will be Ready.
- /// If you call this function again before state changes, you will receive ErrorINProgressToReady.
- /// </postcondition>
+ /// </pre>
+ /// <post>
+ /// It will invoke the StateChanged event, if registered.
+ /// If this function succeeds, the STT state will be ready.
+ /// If you call this function again before the state changes, you will receive ErrorINProgressToReady.
+ /// </post>
public void Cancel()
{
lock (thisLock)
}
/// <summary>
- /// Method to release resources
+ /// Method to release resources.
/// </summary>
+ /// <since_tizen> 3 </since_tizen>
public void Dispose()
{
Dispose(true);
}
+ /// <summary>
+ /// Method to release resources.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ /// <param name="disposing">
+ /// The boolean value for destoying stt handle.
+ /// </param>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
- SttError error = SttDestroy(_handle);
- if (error != SttError.None)
+ lock (thisLock)
{
- Log.Error(LogTag, "Destroy Failed with error " + error);
+ SttError error = SttDestroy(_handle);
+ if (error != SttError.None)
+ {
+ Log.Error(LogTag, "Destroy Failed with error " + error);
+ }
}
}