Tizen Native API  3.0
Voice control command

The Voice control command API provides functions for creating/destroying command list and add/remove/retrieve commands of list.

Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Functions

int vc_cmd_list_create (vc_cmd_list_h *vc_cmd_list)
 Creates a handle for command list.
int vc_cmd_list_destroy (vc_cmd_list_h vc_cmd_list, bool free_command)
 Destroys the handle for command list.
int vc_cmd_list_get_count (vc_cmd_list_h vc_cmd_list, int *count)
 Gets command count of list.
int vc_cmd_list_add (vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command)
 Adds command to command list.
int vc_cmd_list_remove (vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command)
 Removes command from command list.
int vc_cmd_list_foreach_commands (vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callback, void *user_data)
 Retrieves all commands of command list using callback function.
int vc_cmd_list_first (vc_cmd_list_h vc_cmd_list)
 Moves index to first command.
int vc_cmd_list_last (vc_cmd_list_h vc_cmd_list)
 Moves index to last command.
int vc_cmd_list_next (vc_cmd_list_h vc_cmd_list)
 Moves index to next command.
int vc_cmd_list_prev (vc_cmd_list_h vc_cmd_list)
 Moves index to previous command.
int vc_cmd_list_get_current (vc_cmd_list_h vc_cmd_list, vc_cmd_h *vc_command)
 Get current command from command list by index.
int vc_cmd_create (vc_cmd_h *vc_command)
 Creates a handle for command.
int vc_cmd_destroy (vc_cmd_h vc_command)
 Destroys the handle.
int vc_cmd_set_command (vc_cmd_h vc_command, const char *command)
 Sets command or action.
int vc_cmd_get_command (vc_cmd_h vc_command, char **command)
 Gets command.
int vc_cmd_get_unfixed_command (vc_cmd_h vc_command, char **command)
 Gets the unfixed command.
int vc_cmd_set_type (vc_cmd_h vc_command, int type)
 Sets command type.
int vc_cmd_get_type (vc_cmd_h vc_command, int *type)
 Gets command type.
int vc_cmd_set_format (vc_cmd_h vc_command, int format)
 Sets the command format.
int vc_cmd_get_format (vc_cmd_h vc_command, int *format)
 Gets the command format.

Typedefs

typedef struct vc_cmd_s * vc_cmd_h
 The voice command handle.
typedef struct vc_cmd_list_s * vc_cmd_list_h
 The voice command list handle.
typedef bool(* vc_cmd_list_cb )(vc_cmd_h vc_command, void *user_data)
 Called to retrieve The commands in list.

Defines

#define VC_COMMAND_FORMAT_FIXED   0
 Definition for fixed command format.
#define VC_COMMAND_FORMAT_FIXED_AND_VFIXED   1
 Definition for fixed and variable fixed command format.
#define VC_COMMAND_FORMAT_VFIXED_AND_FIXED   2
 Definition for variable fixed and fixed command format.
#define VC_COMMAND_FORMAT_FIXED_AND_NONFIXED   3
 Definition for fixed and non-fixed command format.
#define VC_COMMAND_FORMAT_NONFIXED_AND_FIXED   4
 Definition for non-fixed and fixed command format.

Define Documentation

#define VC_COMMAND_FORMAT_FIXED   0

Definition for fixed command format.

Since :
3.0

Definition for fixed and non-fixed command format.

Since :
3.0

Definition for fixed and variable fixed command format.

Since :
3.0

Definition for non-fixed and fixed command format.

Since :
3.0

Definition for variable fixed and fixed command format.

Since :
3.0

Typedef Documentation

typedef struct vc_cmd_s* vc_cmd_h

The voice command handle.

Since :
3.0
typedef bool(* vc_cmd_list_cb)(vc_cmd_h vc_command, void *user_data)

Called to retrieve The commands in list.

Since :
3.0
Parameters:
[in]vc_commandThe command handle
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop, false to break out of the loop
Precondition:
vc_cmd_list_foreach_commands() will invoke this callback.
See also:
vc_cmd_list_foreach_commands()
typedef struct vc_cmd_list_s* vc_cmd_list_h

The voice command list handle.

Since :
3.0

Function Documentation

int vc_cmd_create ( vc_cmd_h vc_command)

Creates a handle for command.

Since :
3.0
Remarks:
If the function succeeds, The command handle must be released with vc_cmd_destroy() or vc_cmd_list_destroy(). You should set command and type if command is valid. The command format is set to VC_COMMAND_FORMAT_FIXED by default and can be changed with vc_cmd_set_format().
Parameters:
[out]vc_commandThe command handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_OUT_OF_MEMORYOut of memory
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_destroy()
int vc_cmd_destroy ( vc_cmd_h  vc_command)

Destroys the handle.

Since :
3.0
Parameters:
[in]vc_commandThe command handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_create()
int vc_cmd_get_command ( vc_cmd_h  vc_command,
char **  command 
)

Gets command.

Since :
3.0
Remarks:
If the function succeeds, command must be released with free() by you if they are not NULL.
Parameters:
[in]vc_commandThe command handle
[out]commandThe command text
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_set_command()
int vc_cmd_get_format ( vc_cmd_h  vc_command,
int *  format 
)

Gets the command format.

Since :
3.0
Remarks:
The default format is VC_COMMAND_FORMAT_FIXED.
Parameters:
[in]vc_commandThe command handle
[out]formatThe command format
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported feature
See also:
vc_cmd_set_format()
int vc_cmd_get_type ( vc_cmd_h  vc_command,
int *  type 
)

Gets command type.

Since :
3.0
Parameters:
[in]vc_commandThe command handle
[out]typeThe command type
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_set_type()
int vc_cmd_get_unfixed_command ( vc_cmd_h  vc_command,
char **  command 
)

Gets the unfixed command.

Since :
3.0
Remarks:
If the function succeeds, the command must be released with free() if it is not NULL. If the command of the given vc_command is NULL (vc_command is NOT NULL), command will be also NULL. This function should be used for commands which have non-fixed format.
Parameters:
[in]vc_commandThe command handle
[out]commandThe unfixed command text
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported feature
int vc_cmd_list_add ( vc_cmd_list_h  vc_cmd_list,
vc_cmd_h  vc_command 
)

Adds command to command list.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[in]vc_commandThe command handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_remove()
int vc_cmd_list_create ( vc_cmd_list_h vc_cmd_list)

Creates a handle for command list.

Since :
3.0
Remarks:
If the function succeeds, The list handle must be released with vc_cmd_list_destroy().
Parameters:
[out]vc_cmd_listThe command list handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_OUT_OF_MEMORYOut of memory
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_destroy()
int vc_cmd_list_destroy ( vc_cmd_list_h  vc_cmd_list,
bool  free_command 
)

Destroys the handle for command list.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[in]free_commandThe command free option true = release each commands in list, false = remove command from list
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_create()
int vc_cmd_list_first ( vc_cmd_list_h  vc_cmd_list)

Moves index to first command.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_EMPTYList empty
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_last()
int vc_cmd_list_foreach_commands ( vc_cmd_list_h  vc_cmd_list,
vc_cmd_list_cb  callback,
void *  user_data 
)

Retrieves all commands of command list using callback function.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[in]callbackCallback function to invoke
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
Postcondition:
This function invokes vc_cmd_list_cb() repeatedly for getting commands.
See also:
vc_cmd_list_cb()
int vc_cmd_list_get_count ( vc_cmd_list_h  vc_cmd_list,
int *  count 
)

Gets command count of list.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[out]countThe count
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
int vc_cmd_list_get_current ( vc_cmd_list_h  vc_cmd_list,
vc_cmd_h vc_command 
)

Get current command from command list by index.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[out]vc_commandThe command handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_EMPTYList empty
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_first()
vc_cmd_list_last()
vc_cmd_list_prev()
vc_cmd_list_next()
int vc_cmd_list_last ( vc_cmd_list_h  vc_cmd_list)

Moves index to last command.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_EMPTYList empty
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_first()
int vc_cmd_list_next ( vc_cmd_list_h  vc_cmd_list)

Moves index to next command.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_EMPTYList empty
VC_ERROR_ITERATION_ENDList reached end
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_prev()
int vc_cmd_list_prev ( vc_cmd_list_h  vc_cmd_list)

Moves index to previous command.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_EMPTYList empty
VC_ERROR_ITERATION_ENDList reached end
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_next()
int vc_cmd_list_remove ( vc_cmd_list_h  vc_cmd_list,
vc_cmd_h  vc_command 
)

Removes command from command list.

Since :
3.0
Parameters:
[in]vc_cmd_listThe command list handle
[in]vc_commandThe command handle
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_list_add()
int vc_cmd_set_command ( vc_cmd_h  vc_command,
const char *  command 
)

Sets command or action.

Since :
3.0
Parameters:
[in]vc_commandThe command handle
[in]commandThe command or action text
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_get_command()
int vc_cmd_set_format ( vc_cmd_h  vc_command,
int  format 
)

Sets the command format.

Since :
3.0
Remarks:
The default format is VC_COMMAND_FORMAT_FIXED.
Parameters:
[in]vc_commandThe command handle
[in]formatThe command format
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported feature
See also:
vc_cmd_get_format()
int vc_cmd_set_type ( vc_cmd_h  vc_command,
int  type 
)

Sets command type.

Since :
3.0
Remarks:
If you do not set the command type, the default value is -1. You should set type if command is valid
Parameters:
[in]vc_commandThe command handle
[in]typeThe command type
Returns:
0 on success, otherwise a negative error value
Return values:
VC_ERROR_NONESuccessful
VC_ERROR_INVALID_PARAMETERInvalid parameter
VC_ERROR_PERMISSION_DENIEDPermission denied
VC_ERROR_NOT_SUPPORTEDNot supported
See also:
vc_cmd_get_type()