Tizen Native API  5.0
Multi assistant client

The Multi assistant client API provides functions for getting queries from multi assistant service and sending responses.

Copyright (c) 2011-2018 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 ma_initialize (void)
 Initializes multi-assistant client.
int ma_deinitialize (void)
 Deinitializes multi-assistant client.
int ma_prepare (void)
 Prepares multi-assistant client.
int ma_unprepare (void)
 Unprepares multi-assistant client.
int ma_get_state (ma_state_e *state)
 Gets the current state of the multi-assistant client.
int ma_get_current_language (char **language)
 Gets the current language of multi-assistant client.
int ma_get_recording_audio_format (int *rate, ma_audio_channel_e *channel, ma_audio_type_e *audio_type)
 Gets the recording audio format.
int ma_set_state_changed_cb (ma_state_changed_cb callback, void *user_data)
 Sets a state changed callback.
int ma_unset_state_changed_cb (void)
 Unsets a state changed callback.
int ma_set_error_cb (ma_error_cb callback, void *user_data)
 Sets an error callback.
int ma_unset_error_cb (void)
 Unsets an error callback.
int ma_set_language_changed_cb (ma_language_changed_cb callback, void *user_data)
 Sets a language changed callback.
int ma_unset_language_changed_cb (void)
 Unsets a language changed callback.
int ma_set_audio_streaming_cb (ma_audio_streaming_cb callback, void *user_data)
 Sets an audio streaming callback.
int ma_unset_audio_streaming_cb (void)
 Unsets an audio streaming callback.
int ma_send_asr_result (ma_asr_result_event_e event, const char *asr_result)
 Sends ASR(auto speech recognition) results to the multi-assistant service.
int ma_send_result (const char *display_text, const char *utterance_text, const char *result_json)
 Sends results to the multi-assistant service.

Function Documentation

int ma_deinitialize ( void  )

Deinitializes multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_STATEInvalid state
Postcondition:
If this function is called, the state will be MA_STATE_NONE.
See also:
ma_initialize()
int ma_get_current_language ( char **  language)

Gets the current language of multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Remarks:
The language should be released using free().
Parameters:
[out]languageThe current language
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_PARAMETERInvalid parameter
int ma_get_recording_audio_format ( int *  rate,
ma_audio_channel_e channel,
ma_audio_type_e audio_type 
)

Gets the recording audio format.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Parameters:
[out]rateThe audio sampling rate
[out]channelThe audio channel
[out]audio_typeThe audio type
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
MA_ERROR_OPERATION_FAILEDOperation failed
Precondition:
The state should be MA_STATE_READY.
int ma_get_state ( ma_state_e state)

Gets the current state of the multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Parameters:
[out]stateThe current state
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
int ma_initialize ( void  )

Initializes multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_OPERATION_FAILEDOperation failed
MA_ERROR_OUT_OF_MEMORYOut of memory
Postcondition:
If this function is called, the state will be MA_STATE_INITIALIZED.
See also:
ma_deinitialize()
int ma_prepare ( void  )

Prepares multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_INITIALIZED.
Postcondition:
If this function is called, the state will be MA_STATE_READY.
See also:
ma_unprepare()
int ma_send_asr_result ( ma_asr_result_event_e  event,
const char *  asr_result 
)

Sends ASR(auto speech recognition) results to the multi-assistant service.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Parameters:
[in]eventThe ASR result event (e.g. MA_ASR_RESULT_EVENT_FINAL_RESULT)
[in]asr_resultThe ASR result text
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_PARAMETERInvalid parameter
int ma_send_result ( const char *  display_text,
const char *  utterance_text,
const char *  result_json 
)

Sends results to the multi-assistant service.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Parameters:
[in]display_textThe text shown on the display
[in]utterance_textThe utterance text
[in]result_jsonThe result data (JSON format)
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_PARAMETERInvalid parameter
int ma_set_audio_streaming_cb ( ma_audio_streaming_cb  callback,
void *  user_data 
)

Sets an audio streaming callback.

Since :
5.0
Parameters:
[in]callbackThe callback
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_audio_streaming_cb()
ma_unset_audio_streaming_cb()
int ma_set_error_cb ( ma_error_cb  callback,
void *  user_data 
)

Sets an error callback.

Since :
5.0
Parameters:
[in]callbackThe callback
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_error_cb()
ma_unset_errord_cb()
int ma_set_language_changed_cb ( ma_language_changed_cb  callback,
void *  user_data 
)

Sets a language changed callback.

Since :
5.0
Parameters:
[in]callbackThe callback
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_language_changed_cb()
ma_unset_language_changed_cb()
int ma_set_state_changed_cb ( ma_state_changed_cb  callback,
void *  user_data 
)

Sets a state changed callback.

Since :
5.0
Parameters:
[in]callbackThe callback
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
MA_ERROR_INVALID_PARAMETERInvalid parameter
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_state_changed_cb()
ma_unset_state_changed_cb()
int ma_unprepare ( void  )

Unprepares multi-assistant client.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/recorder
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_PERMISSION_DENIEDPermission denied
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_READY.
Postcondition:
If this function is called, the state will be MA_STATE_INITIALIZED.
See also:
ma_prepare()

Unsets an audio streaming callback.

Since :
5.0
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_audio_streaming_cb()
ma_set_audio_streaming_cb()
int ma_unset_error_cb ( void  )

Unsets an error callback.

Since :
5.0
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_error_cb()
ma_set_error_cb()

Unsets a language changed callback.

Since :
5.0
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_language_changed_cb()
ma_set_language_changed_cb()
int ma_unset_state_changed_cb ( void  )

Unsets a state changed callback.

Since :
5.0
Returns:
0 on success, otherwise a negative error value
Return values:
MA_ERROR_NONESuccessful
MA_ERROR_NOT_SUPPORTEDNot supported
MA_ERROR_INVALID_STATEInvalid state
Precondition:
The state should be MA_STATE_INITIALIZED.
See also:
ma_state_changed_cb()
ma_set_state_changed_cb()