[Stt] Fix lock issue (#127)
[platform/core/csapi/tizenfx.git] / src / Tizen.Uix.Stt / Tizen.Uix.Stt / SttClient.cs
old mode 100644 (file)
new mode 100755 (executable)
index c08f390..c057a86
@@ -23,36 +23,36 @@ using static Interop.Stt;
 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,
@@ -89,144 +89,144 @@ namespace Tizen.Uix.Stt
     };
 
     /// <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>
+        /// <since_tizen> 3 </since_tizen>.
         OutOfMemory,
         /// <summary>
-        /// I/O error
+        /// I/O error.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <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,
@@ -236,73 +236,73 @@ namespace Tizen.Uix.Stt
         /// <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
@@ -310,11 +310,11 @@ namespace Tizen.Uix.Stt
 
     /// <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
@@ -346,10 +346,10 @@ namespace Tizen.Uix.Stt
         /// 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>
+        /// <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;
@@ -374,18 +374,18 @@ namespace Tizen.Uix.Stt
                 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)
                     {
@@ -414,7 +414,7 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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
@@ -438,7 +438,6 @@ namespace Tizen.Uix.Stt
                     {
                         _stateChanged += value;
                     }
-
                 }
             }
 
@@ -461,7 +460,7 @@ namespace Tizen.Uix.Stt
         /// <summary>
         /// Event to be invoked when an error occurs.
         /// </summary>
-        /// <since_tizen> 3 </since_tizen>
+        /// <since_tizen> 4 </since_tizen>
         public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
         {
             add
@@ -469,10 +468,10 @@ namespace Tizen.Uix.Stt
                 lock (thisLock)
                 {
                     _errorDelegate = (IntPtr handle, SttError reason, IntPtr userData) =>
-                {
-                    ErrorOccurredEventArgs args = new ErrorOccurredEventArgs(handle, reason);
-                    _errorOccurred?.Invoke(this, args);
-                };
+                    {
+                        ErrorOccurredEventArgs args = new ErrorOccurredEventArgs(handle, reason);
+                        _errorOccurred?.Invoke(this, args);
+                    };
                     SttError error = SttSetErrorCB(_handle, _errorDelegate, IntPtr.Zero);
                     if (error != SttError.None)
                     {
@@ -484,7 +483,6 @@ namespace Tizen.Uix.Stt
                         _errorOccurred += value;
                     }
                 }
-
             }
 
             remove
@@ -503,7 +501,7 @@ namespace Tizen.Uix.Stt
         }
 
         /// <summary>
-        /// Event to be invoked when default language change.
+        /// Event to be invoked when the default language changes.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         public event EventHandler<DefaultLanguageChangedEventArgs> DefaultLanguageChanged
@@ -513,12 +511,12 @@ namespace Tizen.Uix.Stt
                 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)
                     {
@@ -530,7 +528,6 @@ namespace Tizen.Uix.Stt
                         _defaultLanguageChanged += value;
                     }
                 }
-
             }
 
             remove
@@ -550,7 +547,7 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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
@@ -560,12 +557,12 @@ namespace Tizen.Uix.Stt
                 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)
                     {
@@ -638,7 +635,7 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/privilege/recorder
         /// </privilege>
         /// <pre>
-        /// The State must be Recording.
+        /// The state must be recording.
         /// </pre>
         public float RecordingVolume
         {
@@ -653,7 +650,6 @@ namespace Tizen.Uix.Stt
                         Log.Error(LogTag, "GetRecordingVolume Failed with error " + error);
                         return 0.0f;
                     }
-
                 }
 
                 return volume;
@@ -672,7 +668,7 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/privilege/recorder
         /// </privilege>
         /// <returns>
-        /// Current STT State value.
+        /// Current STT state value.
         /// </returns>
         public State CurrentState
         {
@@ -705,16 +701,16 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/privilege/recorder
         /// </privilege>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can occur while setting due to the following reasons
+        /// This exceptioncan occur while setting due to the following reasons:
         /// 1. Operation Failed
         /// 2. Invalid State
         /// </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>
-        /// <exception cref="ArgumentException"> This can happen if Improper EngineId is provided while setting the value. </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>
+        /// <exception cref="ArgumentException">This can happen if improper EngineId is provided while setting the value.</exception>
         /// <pre>
-        /// The State must be Created.
+        /// The state must be created.
         /// </pre>
         public string Engine
         {
@@ -749,11 +745,11 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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
@@ -763,39 +759,42 @@ namespace Tizen.Uix.Stt
         /// 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 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>
+        /// <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>
         /// <privilege>
         /// http://tizen.org/privilege/recorder
@@ -804,11 +803,11 @@ namespace Tizen.Uix.Stt
         /// 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="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.
+        /// The state must be ready.
         /// </pre>
         public string GetPrivateData(string key)
         {
@@ -827,14 +826,14 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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>
         /// <privilege>
         /// http://tizen.org/privilege/recorder
@@ -843,12 +842,12 @@ namespace Tizen.Uix.Stt
         /// 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="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.
+        /// The state must be ready.
         /// </pre>
         public void SetPrivateData(string key, string data)
         {
@@ -864,11 +863,11 @@ namespace Tizen.Uix.Stt
         }
 
         /// <summary>
-        /// Gets the list of Supported Engine
+        /// Gets the list of supported engines.
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <returns>
-        /// IEnumerable&lt;SupportedEngine&gt; list of supported engines
+        /// IEnumerable&lt;SupportedEngine&gt; list of supported engines.
         /// </returns>
         /// <privilege>
         /// http://tizen.org/privilege/recorder
@@ -877,23 +876,23 @@ namespace Tizen.Uix.Stt
         /// 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>
+        /// <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)
                 {
@@ -906,11 +905,11 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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
@@ -920,16 +919,16 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can be due to the following reasons
+        /// This exceptioncan be due to the following reasons:
         /// 1. Operation Failed
         /// 2. Invalid State
         /// </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>
+        /// <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.
+        /// The state must be created.
         /// </pre>
         public void SetCredential(string credential)
         {
@@ -955,15 +954,15 @@ namespace Tizen.Uix.Stt
         /// 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>
+        /// <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.
+        /// 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
+        /// 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()
         {
@@ -989,14 +988,14 @@ namespace Tizen.Uix.Stt
         /// 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>
+        /// <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.
+        /// The state must be ready.
         /// </pre>
         /// <post>
-        /// If this function is successful, the STT state will be Created
+        /// If this function is successful, the STT state will be Created.
         /// </post>
         public void Unprepare()
         {
@@ -1012,39 +1011,39 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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> 3 </since_tizen>
+        /// <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
+        /// This exception can be due to the following reasons:
         /// 1. Engine Not Found.
         /// 2. 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>
+        /// <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)
@@ -1068,21 +1067,21 @@ namespace Tizen.Uix.Stt
         /// 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
+        /// This exception can be due to the following reasons:
         /// 1. Invalid State
-        /// 2. Engine Not Found.
-        /// 3. Operation Failed.
+        /// 2. Engine Not Found
+        /// 3. Operation Failed
         /// </exception>
-        /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
+        /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
         /// <pre>
-        /// The state should be Ready.
+        /// The state should be ready.
         /// </pre>
         public bool IsRecognitionTypeSupported(RecognitionType type)
         {
@@ -1121,7 +1120,6 @@ namespace Tizen.Uix.Stt
                             recType = "stt.recognition.type.MAP";
                             break;
                         }
-
                 }
 
                 SttError error = SttIsRecognitionTypeSupported(_handle, recType, out supported);
@@ -1130,7 +1128,6 @@ namespace Tizen.Uix.Stt
                     Log.Error(LogTag, "IsRecognitionTypeSupported Failed with error " + error);
                     throw ExceptionFactory.CreateException(error);
                 }
-
             }
 
             return supported;
@@ -1151,14 +1148,14 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can be due to the following reasons
+        /// This exception can be due to the following reasons:
         /// 1. Invalid State
-        /// 2. Not supported feature of current engine.
-        /// 3. Operation Failed.
+        /// 2. Not supported feature of current engine
+        /// 3. Operation Failed
         /// </exception>
-        /// <exception cref="NotSupportedException"> This Exception can be due to STT Not Supported. </exception>
+        /// <exception cref="NotSupportedException">This exception can be due to STT not supported.</exception>
         /// <pre>
-        /// The state should be Ready.
+        /// The state should be ready.
         /// </pre>
         public void SetSilenceDetection(SilenceDetection type)
         {
@@ -1175,29 +1172,29 @@ namespace Tizen.Uix.Stt
 
         /// <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. Invalid State.
-        /// 2. Operation Failed.
+        /// This exception can be due to the following reasons:
+        /// 1. Invalid State
+        /// 2. 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>
+        /// <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.
+        /// The state should be ready.
         /// </pre>
         public void SetStartSound(string filePath)
         {
@@ -1224,14 +1221,14 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can be due to the following reasons
-        /// 1. Invalid State.
-        /// 2. Operation Failed.
+        /// This exception can be due to the following reasons:
+        /// 1. Invalid State
+        /// 2. 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>
+        /// <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.
+        /// The state should be ready.
         /// </pre>
         public void UnsetStartSound()
         {
@@ -1248,7 +1245,7 @@ namespace Tizen.Uix.Stt
 
         /// <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>
@@ -1262,15 +1259,15 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can be due to the following reasons
-        /// 1. Invalid State.
-        /// 2. Operation Failed.
+        /// This exception can be due to the following reasons:
+        /// 1. Invalid State
+        /// 2. 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>
-        /// <exception cref="ArgumentException"> If an Invalid Parameter is provided. </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 exception can be due to Invalid Parameter.</exception>
         /// <pre>
-        /// The state should be Ready.
+        /// The state should be ready.
         /// </pre>
         public void SetStopSound(string filePath)
         {
@@ -1297,14 +1294,14 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// This Exception can be due to the following reasons
-        /// 1. Invalid State.
-        /// 2. Operation Failed.
+        /// This exception can be due to the following reasons:
+        /// 1. Invalid State
+        /// 2. 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>
+        /// <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.
+        /// The state should be ready.
         /// </pre>
         public void UnsetStopSound()
         {
@@ -1320,41 +1317,41 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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. Invalid State.
-        /// 2. Operation Failed.
-        /// 3. Recorder Busy.
+        /// 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>
-        /// <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 Language is provided. </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 exception can be due to an invalid language.</exception>
         /// <pre>
-        /// The state should be Ready.
+        /// The state should be ready.
         /// </pre>
         /// <post>
-        /// It will invoke StateChanged Event if registered.
-        /// If this function succeeds, the STT state will be Recording.
-        /// If you call this function again before state changes, you will receive ErrorINProgressToRecording.
+        /// 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)
         {
@@ -1392,7 +1389,6 @@ namespace Tizen.Uix.Stt
                             recType = "stt.recognition.type.MAP";
                             break;
                         }
-
                 }
 
                 SttError error = SttStart(_handle, language, recType);
@@ -1405,7 +1401,7 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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>
@@ -1416,23 +1412,23 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// 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.
+        /// 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>
-        /// <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="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.
         /// </pre>
         /// <post>
-        /// It will invoke StateChanged Event if registered.
-        /// 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
+        /// 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()
         {
@@ -1448,9 +1444,9 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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, ErrorOccurred 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>
@@ -1461,22 +1457,22 @@ namespace Tizen.Uix.Stt
         /// http://tizen.org/feature/microphone
         /// </feature>
         /// <exception cref="InvalidOperationException">
-        /// 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.
+        /// 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>
-        /// <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="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.
         /// </pre>
         /// <post>
-        /// It will invoke StateChanged Event if registered.
-        /// If this function succeeds, the STT state will be Ready.
-        /// If you call this function again before state changes, you will receive ErrorINProgressToReady.
+        /// 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()
         {
@@ -1492,23 +1488,34 @@ namespace Tizen.Uix.Stt
         }
 
         /// <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);
+                        }
                     }
                 }