return STT_ERROR_INVALID_STATE;
}
+ if (true != client->internal && (0 == strcmp(key, "server") || 0 == strcmp(key, "rampcode") || 0 == strcmp(key, "epd"))) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] This is not an internal app");
+ return STT_ERROR_INVALID_PARAMETER;
+ }
+
int ret = -1;
int count = 0;
while (0 != ret) {
return STT_ERROR_NONE;
}
+
+int stt_set_server_stt(stt_h stt, const char* key, char* user_data)
+{
+ int ret = -1;
+ stt_client_s* client = NULL;
+
+ if (0 != __stt_get_feature_enabled()) {
+ return STT_ERROR_NOT_SUPPORTED;
+ }
+ if (0 != __stt_check_privilege()) {
+ return STT_ERROR_PERMISSION_DENIED;
+ }
+ if (0 != __stt_check_handle(stt, &client)) {
+ return STT_ERROR_INVALID_PARAMETER;
+ }
+
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Set STT server");
+
+ if (NULL == key || NULL == user_data) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Invalid parameter");
+ return STT_ERROR_INVALID_PARAMETER;
+ }
+
+ if (STT_STATE_CREATED != client->current_state && STT_STATE_READY != client->current_state) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] The current state is invalid (%d).", client->current_state);
+ return STT_ERROR_INVALID_STATE;
+ }
+
+
+ client->internal = true;
+
+ char* private_key = NULL;
+ private_key = strdup(key);
+ if (NULL == private_key) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory(private_key)");
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
+
+ char* data = NULL;
+ data = strdup(user_data);
+ if (NULL == data) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory(data)");
+ free(private_key);
+ private_key = NULL;
+ return STT_ERROR_OUT_OF_MEMORY;
+ }
+
+ ret = stt_set_private_data(stt, private_key, data);
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to set private data, ret(%d), key(%s)", ret, private_key);
+ }
+
+ free(data);
+ data = NULL;
+ free(private_key);
+ private_key = NULL;
+
+ SLOG(LOG_DEBUG, TAG_STTC, "======");
+ SLOG(LOG_DEBUG, TAG_STTC, " ");
+
+ return ret;
+}
+
static Eina_Bool __stt_connect_daemon(void *data)
{
stt_client_s* client = (stt_client_s*)data;
client->speech_status_user_data = NULL;
return 0;
-}
\ No newline at end of file
+}
#define __STT_INTERNAL_H__
#include <tizen.h>
+#include <stt.h>
/**
* @file stt_internal.h
*/
int stt_unset_speech_status_cb(stt_h stt);
+/**
+ * @brief Sets server STT.
+ * @details Using this API, the application can set server STT with a @a key as a @a user_data
+ * The key is a private data to set STT server.
+ * There are 3 types of keys; "server", "rampcode" and "epd".
+ * "server": STT server address
+ * "rampcode": ASR ramp code
+ * "epd": A threshold for end-point detection
+ *
+ * The application can input the @a user_data corresponding to the @a key.
+ * "server": "qa", "sbx"
+ * "rampcode": "dash_dict", "dash_da"
+ * "epd": "100", "750", etc
+ *
+ * If the application sets those keys, it will be able to use corresponding STT engines and options.
+ *
+ * @since_tizen 3.0
+ * @privilege %http://tizen.org/privilege/recorder
+ *
+ * @param[in] stt The STT handle
+ * @param[in] key The key
+ * @param[in] user_data The user data corresponding to the key
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #STT_ERROR_NONE Successful
+ * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STT_ERROR_INVALID_STATE Invalid state
+ * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
+ * @retval #STT_ERROR_OUT_OF_MEMORY STT Out of memory
+ * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
+ *
+ * @pre The state should be #STT_STATE_READY.
+ */
+int stt_set_server_stt(stt_h stt, const char* key, char* user_data);
+
#ifdef __cplusplus
}
#endif