Class VoiceControlClient
Definition
- Namespace:
- Tizen.Uix.VoiceControl
- Assembly:
- Tizen.Uix.VoiceControl.dll
A main function of the voice control API registers the command and gets a notification for the recognition result. Applications can add their own commands and provide results when their command is recognized by the user voice input.
public static class VoiceControlClient
- Inheritance
-
objectVoiceControlClient
Properties
View SourceCurrentLanguage
Gets the current language. A 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. An empty string is returned in case of some internal error.
Declaration
public static string CurrentLanguage { get; }
Property Value
Type | Description |
---|---|
string | The current language in voice control. |
ServiceState
Gets the current state of the voice control service.
Declaration
public static ServiceState ServiceState { get; }
Property Value
Type | Description |
---|---|
ServiceState | The current state of the voice control service. |
State
Gets the current state of the voice control client.
Declaration
public static State State { get; }
Property Value
Type | Description |
---|---|
State | The current state of the voice control client. |
Methods
View SourceDeinitialize()
Deinitializes the voice control.
Declaration
public static void Deinitialize()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.InvalidOperationException | This exception can be due to operation failed. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
GetResult()
Gets the recognition result.
Declaration
public static RecognitionResult GetResult()
Returns
Type | Description |
---|---|
RecognitionResult | The recognition result if possible, else a null object. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.ArgumentException | This exception can be due to an invalid parameter. |
System.NotSupportedException | This exception can be due to not supported. |
GetSupportedLanguages()
Retrieves all the supported languages. A 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.
Declaration
public static IEnumerable<string> GetSupportedLanguages()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.InvalidOperationException | This exception can be due to operation failed. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
GetSystemCommandList()
Gets the system command list.
Declaration
public static VoiceCommandList GetSystemCommandList()
Returns
Type | Description |
---|---|
VoiceCommandList | The command list, else null in case of no system commands. |
Remarks
In the system command list, there are system commands predefined by product manufacturers. Those commands have the highest priority. Therefore, the user cannot set any commands similar to system commands.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.InvalidOperationException | This exception can be due to operation failed. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Initialize()
Initializes the voice control.
Declaration
public static void Initialize()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to operation failed. |
System.OutOfMemoryException | This exception can be due to out Of memory. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Prepare()
Connects the voice control service.
Declaration
public static void Prepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.InvalidOperationException | This exception can be due to operation failed. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
RequestDialog(string, string, bool)
Requests to start the dialogue. By using this function, the developer can start requesting the dialogue to the framework. When the developer requests the dialogue, two types of texts, dispText and uttText can be sent by this function. dispText is a text for displaying and uttText is that for uttering. For example, if dispText is "October 10th" and uttText is "Today is October 10th.", "October 10th" will be displayed on the screen and "Today is October 10th." will be spoken. Also, the developer can set whether the dialogue starts automatically or not, using autoStart. If the developer sets autoStart as True, the framework will start to record the next speech and continue the dialogue.
Declaration
public static void RequestDialog(string dispText, string uttText, bool autoStart)
Parameters
Type | Name | Description |
---|---|---|
string | dispText | Text to be displayed on the screen. |
string | uttText | Text to be spoken. |
bool | autoStart | A variable for setting whether the dialog session will be restarted automatically or not. |
Remarks
If autoStart is True, the recognition will start again. In this case, it can be restarted up to 4 times.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.ArgumentException | This exception can be due to an invalid parameter. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
SetCommandList(VoiceCommandList, CommandType)
Sets the command list.
Declaration
public static void SetCommandList(VoiceCommandList list, CommandType type)
Parameters
Type | Name | Description |
---|---|---|
VoiceCommandList | list | Command list |
CommandType | type | Command type |
Remarks
The command type is valid for CommandType 'Foreground' or 'Background'. The matched commands of the command list should be set and they should include type and command text at least.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.ArgumentException | This exception can be due to an invalid parameter. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
SetInvocationName(string)
Sets the invocation name.
Declaration
public static void SetInvocationName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | Invocation name to be invoked by an application. |
Remarks
The invocation name is used to activate background commands. The invocation name can be same as the application name or any other phrase. For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample". In order to activate the background command, users can say "Tizen Sample, Play music". The invocation name is dependent on the current language. For example, if the current language is "en_US"(English), the invocation name is also "en_US". If the current language is "ja_JP"(Japanese) and the invocation name is "en_US", the invocation name will not be recognized. This function should be called before the SetCommandList().
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Unprepare()
Disconnects the voice control service.
Declaration
public static void Unprepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
UnsetCommandList(CommandType)
Unsets the command list.
Declaration
public static void UnsetCommandList(CommandType type)
Parameters
Type | Name | Description |
---|---|---|
CommandType | type | Command type |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to an invalid state. |
System.ArgumentException | This exception can be due to an invalid parameter. |
System.NotSupportedException | This exception can be due to not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Events
View SourceCurrentLanguageChanged
Event to be invoked when the default language changes.
Declaration
public static event EventHandler<CurrentLanguageChangedEventArgs> CurrentLanguageChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><CurrentLanguageChangedEventArgs> |
ErrorOccured
Event to be invoked when an error occurs.
Declaration
public static event EventHandler<ErrorOccuredEventArgs> ErrorOccured
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ErrorOccuredEventArgs> |
RecognitionResult
Event to be invoked when the recognition is done.
Declaration
public static event EventHandler<RecognitionResultEventArgs> RecognitionResult
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><RecognitionResultEventArgs> |
ServiceStateChanged
Event to be invoked when the VoiceControl service state changes.
Declaration
public static event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ServiceStateChangedEventArgs> |
StateChanged
Event to be invoked when the VoiceControl client state changes.
Declaration
public static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><StateChangedEventArgs> |