Class VoiceControlClient

Definition

Namespace:
Tizen.Uix.VoiceControl
Assembly:
Tizen.Uix.VoiceControl.dll
API Level:
3

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.

C#
Copy
public static class VoiceControlClient
Inheritance
System.Object
VoiceControlClient

Properties

View Source

CurrentLanguage

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
C#
Copy
public static string CurrentLanguage { get; }
Property Value
Type Description
System.String

The current language in voice control.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Precondition: The state must be initialized or ready.
View Source

ServiceState

Gets the current state of the voice control service.

Declaration
C#
Copy
public static ServiceState ServiceState { get; }
Property Value
Type Description
ServiceState

The current state of the voice control service.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Precondition: The state must be ready.
View Source

State

Gets the current state of the voice control client.

Declaration
C#
Copy
public static State State { get; }
Property Value
Type Description
State

The current state of the voice control client.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Precondition: The state must be initialized or ready.

Methods

View Source

Deinitialize()

Deinitializes the voice control.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
View Source

GetResult()

Gets the recognition result.

Declaration
C#
Copy
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.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

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
C#
Copy
public static IEnumerable<string> GetSupportedLanguages()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready or initialized.
View Source

GetSystemCommandList()

Gets the system command list.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public.
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

Initialize()

Initializes the voice control.

Declaration
C#
Copy
public static void Initialize()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to operation failed.

OutOfMemoryException

This exception can be due to out Of memory.

System.NotSupportedException

This exception can be due to not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Postcondition: The state will be initialized.
View Source

Prepare()

Connects the voice control service.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be initialized.
Postcondition: The state must be ready.
View Source

RequestDialog(String, String, Boolean)

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
C#
Copy
public static void RequestDialog(string dispText, string uttText, bool autoStart)
Parameters
Type Name Description
System.String dispText

Text to be displayed on the screen.

System.String uttText

Text to be spoken.

Boolean 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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

SetCommandList(VoiceCommandList, CommandType)

Sets the command list.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

SetInvocationName(String)

Sets the invocation name.

Declaration
C#
Copy
public static void SetInvocationName(string name)
Parameters
Type Name Description
System.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.ArgumentException

This exception can be due to an invalid parameter.

System.NotSupportedException

This exception can be due to not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

Unprepare()

Disconnects the voice control service.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state must be ready.
Postcondition: The state must be initialized.
View Source

UnsetCommandList(CommandType)

Unsets the command list.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.control http://tizen.org/feature/microphone
Precondition: The state should be ready.

Events

View Source

CurrentLanguageChanged

Event to be invoked when the default language changes.

Declaration
C#
Copy
public static event EventHandler<CurrentLanguageChangedEventArgs> CurrentLanguageChanged
Event Type
Type Description
System.EventHandler<CurrentLanguageChangedEventArgs>
API Level: 3
Precondition: The state must be initialized.
View Source

ErrorOccured

Event to be invoked when an error occurs.

Declaration
C#
Copy
public static event EventHandler<ErrorOccuredEventArgs> ErrorOccured
Event Type
Type Description
System.EventHandler<ErrorOccuredEventArgs>
API Level: 3
Precondition: The state must be initialized.
View Source

RecognitionResult

Event to be invoked when the recognition is done.

Declaration
C#
Copy
public static event EventHandler<RecognitionResultEventArgs> RecognitionResult
Event Type
Type Description
System.EventHandler<RecognitionResultEventArgs>
API Level: 3
Precondition: The state must be initialized.
View Source

ServiceStateChanged

Event to be invoked when the VoiceControl service state changes.

Declaration
C#
Copy
public static event EventHandler<ServiceStateChangedEventArgs> ServiceStateChanged
Event Type
Type Description
System.EventHandler<ServiceStateChangedEventArgs>
API Level: 3
Precondition: The state must be initialized.
View Source

StateChanged

Event to be invoked when the VoiceControl client state changes.

Declaration
C#
Copy
public static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type Description
System.EventHandler<StateChangedEventArgs>
API Level: 3
Precondition: The state must be initialized.