return STT_ERROR_NONE;
}
+static int __stt_check_precondition(stt_h stt, stt_client_s* client)
+{
+ RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
+ RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
+ RETV_IF(0 != __stt_check_handle(stt, client), STT_ERROR_INVALID_PARAMETER);
+ return STT_ERROR_NONE;
+}
+
int stt_create(stt_h* stt)
{
RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
int stt_destroy(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
-
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Destroy STT");
/* check used callback */
int stt_foreach_supported_engines(stt_h stt, stt_supported_engine_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Foreach Supported engine");
int stt_get_engine(stt_h stt, char** engine_id)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Get current engine");
int stt_set_credential(stt_h stt, const char* credential)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Set credential");
int stt_set_private_data(stt_h stt, const char* key, const char* data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Set private data");
int stt_get_private_data(stt_h stt, const char* key, char** data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Get private data");
int ret = -1;
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Set STT server");
int stt_prepare(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Prepare STT");
int stt_unprepare(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Unprepare STT");
int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Foreach Supported Language");
int stt_get_default_language(stt_h stt, char** language)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== Get Default Language");
int stt_get_state(stt_h stt, stt_state_e* state)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
int stt_get_error_message(stt_h stt, char** err_msg)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == err_msg) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL");
int stt_is_recognition_type_supported(stt_h stt, const char* type, bool* support)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == type || NULL == support) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
/* check state */
if (client->current_state != STT_STATE_READY) {
int stt_set_start_sound(stt_h stt, const char* filename)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT SET START SOUND");
int stt_unset_start_sound(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT UNSET START SOUND");
int stt_set_stop_sound(stt_h stt, const char* filename)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT SET STOP SOUND");
int stt_unset_stop_sound(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT UNSET STOP SOUND");
int stt_start(stt_h stt, const char* language, const char* type)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT START");
int stt_stop(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT STOP");
int stt_cancel(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT CANCEL");
int stt_get_recording_volume(stt_h stt, float* volume)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == volume) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL"); //LCOV_EXCL_LINE
int stt_foreach_detailed_result(stt_h stt, stt_result_time_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT FOREACH DETAILED RESULT");
int stt_set_recognition_result_cb(stt_h stt, stt_recognition_result_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (callback == NULL)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_recognition_result_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_set_state_changed_cb(stt_h stt, stt_state_changed_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == callback)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_state_changed_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_set_error_cb(stt_h stt, stt_error_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == callback)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_error_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_set_default_language_changed_cb(stt_h stt, stt_default_language_changed_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == callback)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_default_language_changed_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_set_engine_changed_cb(stt_h stt, stt_engine_changed_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == callback)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_engine_changed_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_set_speech_status_cb(stt_h stt, stt_speech_status_cb callback, void* user_data)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == callback)
return STT_ERROR_INVALID_PARAMETER;
int stt_unset_speech_status_cb(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (STT_STATE_CREATED != client->current_state) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Current state(%d) is not 'Created'", client->current_state);
int stt_start_file(stt_h stt, const char* language, const char* type, const char* filepath, stt_audio_type_e audio_type, int sample_rate)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
if (NULL == filepath) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Input parameter is NULL");
return STT_ERROR_INVALID_PARAMETER;
int stt_cancel_file(stt_h stt)
{
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
SLOG(LOG_INFO, TAG_STTC, "===== STT CANCEL FILE");
SLOG(LOG_DEBUG, TAG_STTC, "[STT] Change system volume, volume_event(%d)", volume_event);
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
/* check state */
if (client->current_state != STT_STATE_READY && client->current_state != STT_STATE_CREATED) {
SLOG(LOG_DEBUG, TAG_STTC, "[STT] recover system volume");
stt_client_s* client = NULL;
- RETV_IF(0 != __stt_get_feature_enabled(), STT_ERROR_NOT_SUPPORTED);
- RETV_IF(0 != __stt_check_privilege(), STT_ERROR_PERMISSION_DENIED);
- RETV_IF(0 != __stt_check_handle(stt, &client), STT_ERROR_INVALID_PARAMETER);
+ int temp = __stt_check_precondition(stt, client);
+ if (STT_ERROR_NONE != temp)) {
+ return temp;
+ }
/* check state */
if (client->current_state != STT_STATE_READY && client->current_state != STT_STATE_CREATED) {