## Dependent packages ##
INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
- glib-2.0 dbus-1
- vconf dlog mm-player mm-common mm-camcorder ecore ecore-file
+ glib-2.0 dbus-1 vconf dlog ecore ecore-file capi-media-audio-io
)
## Client library ##
ADD_SUBDIRECTORY(server)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.APLv2 RENAME stt DESTINATION /usr/share/license)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/stt-server.rule DESTINATION /etc/smack/accesses2.d)
+stt (0.1.1-37)
+
+ * capi-audio-io is used
+ * sound volume code is added
+ * code refactoring
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 20 Feb 2013
+
+stt (0.1.1-36)
+
+ * Update smack rule
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Fri, 08 Feb 2013
+
+stt (0.1.1-35)
+
+ * Update smack rule
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 06 Feb 2013
+
+stt (0.1.1-34)
+
+ * Fix bug on daemon connection
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Mon, 04 Feb 2013
+
+stt (0.1.1-33slp2+1) unstable; urgency=low
+
+ * Fix for GCC 4.7
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Tue, 29 Jan 2013 17:04:53 +0900
+
+stt (0.1.1-32slp2+1) unstable; urgency=low
+
+ * Fix PLM issue(P130121-3243)
+ * Add Daemon termination
+
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Fri, 25 Jan 2013 10:59:06 +0900
+
stt (0.1.1-31slp2+1) unstable; urgency=low
- * Change License and notice file
+ * Change License and notice file
- -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 23 Jan 2013 15:24:59 +0900
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 23 Jan 2013 15:02:21 +0900
stt (0.1.1-30slp2+1) unstable; urgency=low
- * Change License file
+ * Change License File
* Git: /framework/uifw/voice/stt
- * Tag: stt_0.1.1-30slp2+1
+ * Tag: stt_0.1.1-30slp2+1
- -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 16 Jan 2013 18:39:32 +0900
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Wed, 16 Jan 2013 18:21:40 +0900
stt (0.1.1-29slp2+1) unstable; urgency=low
* Git: /framework/uifw/voice/stt
* Tag: stt_0.1.1-29slp2+1
- -- Kwangyoun Kim <ky85.kim@samsung.com> Thu, 03 Jan 2013 16:55:13 +0900
+ -- Kwangyoun Kim <ky85.kim@samsung.com> Thu, 03 Jan 2013 16:19:00 +0900
stt (0.1.1-28slp2+1) unstable; urgency=low
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../common)
## Dependent packages ##
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
- glib-2.0 dbus-1 dlog ecore
-)
+#INCLUDE(FindPkgConfig)
+#pkg_check_modules(pkgs REQUIRED
+# glib-2.0 dbus-1 dlog ecore
+#)
FIND_PROGRAM(UNAME NAMES uname)
EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
static bool g_is_daemon_started = false;
+static Ecore_Timer* g_connect_timer = NULL;
+
static int __check_stt_daemon();
static Eina_Bool __stt_notify_state_changed(void *data);
static Eina_Bool __stt_notify_error(void *data);
return STT_ERROR_INVALID_PARAMETER;
}
+ /* check used callback */
+ if (0 != stt_client_get_use_callback(client)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Cannot destroy in Callback function");
+ return STT_ERROR_OPERATION_FAILED;
+ }
+
int ret = -1;
/* check state */
if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to request finalize");
}
+ g_is_daemon_started = false;
case STT_STATE_CREATED:
+ if (NULL != g_connect_timer) {
+ SLOG(LOG_DEBUG, TAG_STTC, "Connect Timer is deleted");
+ ecore_timer_del(g_connect_timer);
+ }
/* Free resources */
stt_client_destroy(stt);
break;
static Eina_Bool __stt_connect_daemon(void *data)
{
- SLOG(LOG_DEBUG, TAG_STTC, "===== Connect daemon");
-
stt_h stt = (stt_h)data;
stt_client_s* client = stt_client_get(stt);
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] A handle is not available");
- SLOG(LOG_DEBUG, TAG_STTC, "=====");
- SLOG(LOG_DEBUG, TAG_STTC, " ");
return STT_ERROR_INVALID_PARAMETER;
}
return EINA_TRUE;
}
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Connect daemon");
+
/* request initialization */
int ret = -1;
int i = 1;
ecore_timer_add(0, __stt_notify_state_changed, (void*)stt);
+ g_connect_timer = NULL;
+
SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] uid(%d)", client->uid);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
return STT_ERROR_INVALID_STATE;
}
- ecore_timer_add(0, __stt_connect_daemon, (void*)stt);
+ g_connect_timer = ecore_timer_add(0, __stt_connect_daemon, (void*)stt);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
if (0 != ret) {
SLOG(LOG_WARN, TAG_STTC, "[ERROR] Fail to request finalize");
}
+ g_is_daemon_started = false;
client->before_state = client->current_state;
client->current_state = STT_STATE_CREATED;
return ret;
}
+static int __stt_get_audio_volume(float* volume)
+{
+ FILE* fp = fopen(STT_AUDIO_VOLUME_PATH, "rb");
+ if (!fp) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to open Volume File");
+ return -1;
+ }
+
+ fread((void*)volume, sizeof(*volume), 1, fp);
+ fclose(fp);
+
+ return 0;
+}
+
int stt_get_recording_volume(stt_h stt, float* volume)
{
if (NULL == stt || NULL == volume) {
return STT_ERROR_INVALID_STATE;
}
- int ret = 0;
- ret = stt_dbus_request_get_audio_volume(client->uid, volume);
- if (ret) {
+ int ret = 0;
+ ret = __stt_get_audio_volume(volume);
+ if (0 != ret) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get audio volume");
- return ret;
- }
+ return STT_ERROR_OPERATION_FAILED;
+ }
return STT_ERROR_NONE;
}
int __get_cmd_line(char *file, char *buf)
{
FILE *fp = NULL;
- int i;
fp = fopen(file, "r");
if (fp == NULL) {
}
memset(buf, 0, 256);
- fgets(buf, 256, fp);
+ if (NULL == fgets(buf, 256, fp)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to fget command line");
+ fclose(fp);
+ return -1;
+ }
fclose(fp);
return 0;
}
-
-static void __my_sig_child(int signo, siginfo_t *info, void *data)
-{
- int status;
- pid_t child_pid, child_pgid;
-
- child_pgid = getpgid(info->si_pid);
- SLOG(LOG_DEBUG, TAG_STTC, "Signal handler: dead pid = %d, pgid = %d\n", info->si_pid, child_pgid);
-
- while((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
- if(child_pid == child_pgid)
- killpg(child_pgid, SIGKILL);
- }
-
- return;
-}
-
-
static int __check_stt_daemon()
{
if( TRUE == __stt_is_alive() )
/* fork-exec stt-daemon */
int pid, i;
- struct sigaction act, dummy;
-
- act.sa_handler = NULL;
- act.sa_sigaction = __my_sig_child;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-
- if(sigaction(SIGCHLD, &act, &dummy) < 0) {
- SLOG(LOG_DEBUG, TAG_STTC, "%s\n", "Cannot make a signal handler\n");
- return -1;
- }
pid = fork();
return 0;
}
+int stt_client_get_use_callback(stt_client_s* client)
+{
+ return client->cb_ref_count;
+}
int stt_client_set_option_supported(stt_h stt, bool silence, bool profanity, bool punctuation)
{
int stt_client_not_use_callback(stt_client_s* client);
+int stt_client_get_use_callback(stt_client_s* client);
+
int stt_client_set_option_supported(stt_h stt, bool silence, bool profanity, bool punctuation);
#ifdef __cplusplus
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_STTC, ">>>> Request stt hello : Fail to make message \n");
return STT_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_STTC, ">>>> Request stt hello");
- }
+ }
DBusError err;
dbus_error_init(&err);
SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt hello");
result = 0;
} else {
- SLOG(LOG_ERROR, TAG_STTC, "<<<< stt hello : no response");
result = STT_ERROR_OPERATION_FAILED;
}
return result;
}
-
-
-int stt_dbus_request_get_audio_volume(int uid, float* volume)
-{
- if (NULL == volume) {
- SLOG(LOG_ERROR, TAG_STTC, "Input parameter is NULL");
- return STT_ERROR_INVALID_PARAMETER;
- }
-
- DBusMessage* msg;
-
- msg = dbus_message_new_method_call(
- STT_SERVER_SERVICE_NAME,
- STT_SERVER_SERVICE_OBJECT_PATH,
- STT_SERVER_SERVICE_INTERFACE,
- STT_METHOD_GET_AUDIO_VOLUME);
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTC, ">>>> stt get volume : Fail to make message \n");
- return STT_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_STTC, ">>>> stt get volume : uid(%d)", uid);
- }
-
- dbus_message_append_args( msg,
- DBUS_TYPE_INT32, &uid,
- DBUS_TYPE_INVALID);
-
- DBusError err;
- dbus_error_init(&err);
-
- DBusMessage* result_msg;
- int result = STT_ERROR_OPERATION_FAILED;
- double vol = 0;
-
- result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
-
- if (NULL != result_msg) {
- dbus_message_get_args(result_msg, &err,
- DBUS_TYPE_INT32, &result,
- DBUS_TYPE_DOUBLE, &vol,
- DBUS_TYPE_INVALID);
-
- if (dbus_error_is_set(&err)) {
- printf("<<<<< Get arguments error (%s)\n", err.message);
- dbus_error_free(&err);
- result = STT_ERROR_OPERATION_FAILED;
- }
- dbus_message_unref(result_msg);
- } else {
- SLOG(LOG_DEBUG, TAG_STTC, "<<<< Result Message is NULL");
- }
-
- if (0 == result) {
- *volume = (float)vol;
- SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt get audio volume : result = %d, volume = %f \n", result, *volume);
- } else {
- SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get audio volume : result = %d\n", result);
- }
-
- dbus_message_unref(msg);
-
- return result;
-}
-
-
int stt_dbus_request_get_default_lang(int uid, char** language);
-int stt_dbus_request_get_audio_volume(int uid, float* volume);
-
int stt_dbus_request_is_partial_result_supported(int uid, bool* partial_result);
int stt_dbus_request_start(int uid, const char* lang, const char* type, int profanity, int punctuation, int silence);
static bool g_is_daemon_started = false;
+static Ecore_Timer* g_setting_connect_timer = NULL;
+
static stt_setting_state_e g_state = STT_SETTING_STATE_NONE;
static stt_setting_initialized_cb g_initialized_cb;
ecore_timer_add(0, __stt_setting_initialized, NULL);
+ g_setting_connect_timer = NULL;
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
g_initialized_cb = callback;
g_user_data = user_data;
- ecore_timer_add(0, __stt_setting_connect_daemon, NULL);
+ g_setting_connect_timer = ecore_timer_add(0, __stt_setting_connect_daemon, NULL);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, " ");
int ret = 0;
- if (STT_SETTING_STATE_NONE == g_state) {
- SLOG(LOG_WARN, TAG_STTC, "[WARNING] Not initialized");
- SLOG(LOG_DEBUG, TAG_STTC, "=====");
- SLOG(LOG_DEBUG, TAG_STTC, " ");
- return STT_SETTING_ERROR_INVALID_STATE;
+ if (STT_SETTING_STATE_READY == g_state) {
+ ret = stt_setting_dbus_request_finalilze();
+ if (0 != ret) {
+ SLOG(LOG_ERROR, TAG_STTC, "Fail : finialize(%d)", ret);
+ }
}
- ret = stt_setting_dbus_request_finalilze();
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTC, "Fail : finialize(%d)", ret);
- SLOG(LOG_DEBUG, TAG_STTC, "=====");
- SLOG(LOG_DEBUG, TAG_STTC, " ");
- return ret;
+ if (NULL != g_setting_connect_timer) {
+ SLOG(LOG_DEBUG, TAG_STTC, "Setting Connect Timer is deleted");
+ ecore_timer_del(g_setting_connect_timer);
}
-
+
+ g_is_daemon_started = false;
+
if (0 != stt_setting_dbus_close_connection()) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to close connection");
} else {
}
-static void __setting_my_sig_child(int signo, siginfo_t *info, void *data)
-{
- int status = 0;
- pid_t child_pid, child_pgid;
-
- child_pgid = getpgid(info->si_pid);
- SLOG(LOG_DEBUG, TAG_STTC, "Signal handler: dead pid = %d, pgid = %d\n", info->si_pid, child_pgid);
-
- while ((child_pid = waitpid(-1, &status, WNOHANG)) > 0) {
- if(child_pid == child_pgid)
- killpg(child_pgid, SIGKILL);
- }
-
- return;
-}
-
int __check_setting_stt_daemon()
{
if (TRUE == __stt_setting_is_alive())
/* fork-exec stt-daemom */
int pid = 0, i = 0;
- struct sigaction act, dummy;
- act.sa_handler = NULL;
- act.sa_sigaction = __setting_my_sig_child;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
-
- if (sigaction(SIGCHLD, &act, &dummy) < 0) {
- SLOG(LOG_ERROR, TAG_STTC, "%s\n", "Cannot make a signal handler\n");
- return -1;
- }
pid = fork();
if (NULL == msg) {
SLOG(LOG_ERROR, TAG_STTC, ">>>> Request setting hello : Fail to make message \n");
return STT_SETTING_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_STTC, ">>>> Request setting hello");
- }
+ }
DBusError err;
dbus_error_init(&err);
SLOG(LOG_DEBUG, TAG_STTC, "<<<< setting hello");
result = 0;
} else {
- SLOG(LOG_ERROR, TAG_STTC, "<<<< setting hello : no response");
result = -1;
}
#define STT_METHOD_GET_SUPPORT_LANGS "stt_method_get_support_langs"
#define STT_METHOD_GET_CURRENT_LANG "stt_method_get_current_lang"
#define STT_METHOD_IS_PARTIAL_SUPPORTED "stt_method_is_partial_result_supported"
-#define STT_METHOD_GET_AUDIO_VOLUME "stt_method_audio_volume"
#define STT_METHOD_START "stt_method_start"
#define STT_METHOD_STOP "stt_method_stop"
#define STTD_METHOD_SET_STATE "sttd_method_set_state"
#define STTD_METHOD_GET_STATE "sttd_method_get_state"
-#define STTD_METHOD_STOP_BY_DAEMON "sttd_method_stop_by_daemon"
-
/******************************************************************************************
* Message Definition for Setting
*******************************************************************************************/
#define STT_SETTING_METHOD_GET_ENGINE_SETTING "stt_setting_method_get_engine_setting"
#define STT_SETTING_METHOD_SET_ENGINE_SETTING "stt_setting_method_set_engine_setting"
+/******************************************************************************************
+* Temp file for audio volume
+*******************************************************************************************/
+
+#define STT_AUDIO_VOLUME_PATH "/tmp/stt_vol"
+
#ifdef __cplusplus
}
#endif
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(ecore-file)
-BuildRequires: pkgconfig(mm-player)
-BuildRequires: pkgconfig(mm-common)
-BuildRequires: pkgconfig(mm-sound)
-BuildRequires: pkgconfig(mm-camcorder)
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(capi-media-audio-io)
BuildRequires: cmake
%files
%manifest stt-server.manifest
+/etc/smack/accesses2.d/stt-server.rule
%defattr(-,root,root,-)
%{_libdir}/libstt.so
%{_libdir}/libstt_setting.so
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wall,--as-needed")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
## Executable ##
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} -ldl ${pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} -ldl -lm ${pkgs_LDFLAGS})
## Install
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
config_fp = fopen(CONFIG_FILE_PATH, "w+");
if (NULL == config_fp) {
- // make file and file default
+ /* make file and file default */
SLOG(LOG_ERROR, TAG_STTD, "[Config ERROR] Fail to load config (engine id)");
return -1;
}
return ECORE_CALLBACK_RENEW;
}
-
- /* daemon internal event */
- if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STTD_METHOD_STOP_BY_DAEMON))
- sttd_dbus_server_stop_by_daemon(msg);
-
/* client event */
- else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_HELLO))
+ if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_HELLO))
sttd_dbus_server_hello(conn, msg);
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_INITIALIZE))
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_IS_PARTIAL_SUPPORTED))
sttd_dbus_server_is_partial_result_supported(conn, msg);
- else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_GET_AUDIO_VOLUME))
- sttd_dbus_server_get_audio_volume(conn, msg);
-
else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_START))
sttd_dbus_server_start(conn, msg);
return 0;
}
-
-int sttd_send_stop_recognition_by_daemon(int uid)
-{
- DBusMessage* msg;
-
- msg = dbus_message_new_method_call(
- STT_SERVER_SERVICE_NAME,
- STT_SERVER_SERVICE_OBJECT_PATH,
- STT_SERVER_SERVICE_INTERFACE,
- STTD_METHOD_STOP_BY_DAEMON);
-
- if (NULL == msg) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] >>>> Fail to make message for 'stop by daemon'");
- return -1;
- }
-
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
-
- if (!dbus_connection_send(g_conn, msg, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to send message for 'stop by daemon'");
- }
-
- dbus_connection_flush(g_conn);
- dbus_message_unref(msg);
-
- return 0;
-}
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
int sttdc_send_set_state(int uid, int state);
-int sttd_send_stop_recognition_by_daemon(int uid);
#ifdef __cplusplus
}
return 0;
}
-int sttd_dbus_server_get_audio_volume(DBusConnection* conn, DBusMessage* msg)
-{
- DBusError err;
- dbus_error_init(&err);
-
- int uid;
- float current_volume = 0.0;
- int ret = STTD_ERROR_OPERATION_FAILED;
-
- dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &uid, DBUS_TYPE_INVALID);
-
- SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Get audio volume");
-
- if (dbus_error_is_set(&err)) {
- SLOG(LOG_ERROR, TAG_STTD, "[IN ERROR] stt get audio volume : get arguments error (%s)", err.message);
- dbus_error_free(&err);
- ret = STTD_ERROR_OPERATION_FAILED;
- } else {
- SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt get audio volume : uid(%d)", uid);
- ret = sttd_server_get_audio_volume(uid, ¤t_volume);
- }
-
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
-
- if (NULL != reply) {
- double temp = (double)current_volume;
-
- dbus_message_append_args(reply,
- DBUS_TYPE_INT32, &ret,
- DBUS_TYPE_DOUBLE, &temp,
- DBUS_TYPE_INVALID);
-
- if (0 == ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), volume - double(%f), float(%f)", ret, temp, current_volume);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret);
- }
-
- if (!dbus_connection_send(conn, reply, NULL)) {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Out Of Memory!");
- }
-
- dbus_connection_flush(conn);
- dbus_message_unref(reply);
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Fail to create reply message!!");
- }
-
- SLOG(LOG_DEBUG, TAG_STTD, "<<<<<");
- SLOG(LOG_DEBUG, TAG_STTD, " ");
-
- return 0;
-}
-
int sttd_dbus_server_start(DBusConnection* conn, DBusMessage* msg)
{
DBusError err;
int sttd_dbus_server_is_partial_result_supported(DBusConnection* conn, DBusMessage* msg);
-int sttd_dbus_server_get_audio_volume(DBusConnection* conn, DBusMessage* msg);
-
int sttd_dbus_server_start(DBusConnection* conn, DBusMessage* msg);
int sttd_dbus_server_stop(DBusConnection* conn, DBusMessage* msg);
while (NULL != iter) {
/* Get handle data from list */
data = iter->data;
- dlclose(data->handle);
iter = g_list_remove(iter, data);
}
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
ecore_main_loop_begin();
- ecore_shutdown();
+ SLOG(LOG_DEBUG, TAG_STTD, "===== STT Daemon Finalize");
sttd_dbus_close_connection();
sttd_network_finalize();
+ sttd_finalize();
+
+ ecore_shutdown();
+
+ SLOG(LOG_DEBUG, TAG_STTD, "=====");
+ SLOG(LOG_DEBUG, TAG_STTD, " ");
+ SLOG(LOG_DEBUG, TAG_STTD, " ");
+
return 0;
}
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
* limitations under the License.
*/
-
-#include <mm_error.h>
-#include <mm_player.h>
-#include <mm_types.h>
-#include <mm_sound.h>
-#include <mm_camcorder.h>
-#include <mm_session.h>
-
-/* private Header */
+#include <audio_io.h>
+#include <Ecore.h>
+#include <math.h>
#include "sttd_recorder.h"
#include "sttd_main.h"
+#include "stt_defs.h"
-/* Contant values */
-#define DEF_TIMELIMIT 120
-#define DEF_SAMPLERATE 16000
-#define DEF_BITRATE_AMR 12200
-#define DEF_MAXSIZE 1024 * 1024 * 5
-#define DEF_SOURCECHANNEL 1
-#define DEF_BUFFER_SIZE 1024
-/* Sound buf save */
-//#define BUF_SAVE_MODE
+#define FRAME_LENGTH 160
+#define BUFFER_LENGTH FRAME_LENGTH * 2
-typedef struct {
- unsigned int size_limit;
- unsigned int time_limit;
- unsigned int now;
- unsigned int now_ms;
- unsigned int frame;
- float volume;
+static stt_recorder_audio_cb g_audio_cb;
+static audio_in_h g_audio_in_h;
- /* For MMF */
- unsigned int bitrate;
- unsigned int samplerate;
- sttd_recorder_channel channel;
- sttd_recorder_state state;
- sttd_recorder_audio_type audio_type;
+static sttd_recorder_state g_recorder_state = -1;
- sttvr_audio_cb streamcb;
+static sttp_audio_type_e g_audio_type;
- MMHandleType rec_handle;
- MMHandleType ply_handle;
-} sttd_recorder_s;
+static char g_buffer[BUFFER_LENGTH];
+static FILE* g_pFile_vol;
-static sttd_recorder_s *g_objRecorer = NULL;
-static bool g_init = false;
+static char g_temp_vol[64];
-static char g_temp_file_name[128] = {'\0',};
+/* Sound buf save */
+/*
+#define BUF_SAVE_MODE
+*/
#ifdef BUF_SAVE_MODE
-static FILE* g_pFile;
-#endif
-
-/* Recorder obj */
-sttd_recorder_s *__recorder_getinstance();
-void __recorder_state_set(sttd_recorder_state state);
-
-/* MMFW caller */
-int __recorder_setup();
-int __recorder_run();
-int __recorder_pause();
-int __recorder_send_buf_from_file();
+static char g_temp_file_name[128] = {'\0',};
-int __recorder_cancel_to_stop();
-int __recorder_commit_to_stop();
+static FILE* g_pFile;
+static int g_count = 1;
+#endif
-/* Event Callback Function */
-gboolean _mm_recorder_audio_stream_cb (MMCamcorderAudioStreamDataType *stream, void *user_param)
+int sttd_recorder_create(stt_recorder_audio_cb callback, sttp_audio_type_e type, int channel, unsigned int sample_rate)
{
- sttd_recorder_s *pVr = __recorder_getinstance();
-
- if (stream->length > 0 && stream->data) {
- pVr->frame++;
-
- /* If stream callback is set */
- if (STTD_RECORDER_PCM_S16 == pVr->audio_type || STTD_RECORDER_PCM_U8 == pVr->audio_type) {
-#ifdef BUF_SAVE_MODE
- /* write pcm buffer */
- fwrite(stream->data, 1, stream->length, g_pFile);
-#else
- if (pVr->streamcb) {
- pVr->streamcb(stream->data, stream->length);
- }
-#endif
- }
+ if (NULL == callback) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Input param is NOT valid");
+ return STTD_ERROR_INVALID_PARAMETER;
}
- return TRUE;
-}
-
+ audio_channel_e audio_ch;
+ audio_sample_type_e audio_type;
-int _camcorder_message_cb (int id, void *param, void *user_param)
-{
- MMMessageParamType *m = (MMMessageParamType *)param;
-
- sttd_recorder_s *pVr = __recorder_getinstance();
-
- if (pVr) {
- switch(id) {
- case MM_MESSAGE_CAMCORDER_STATE_CHANGED_BY_ASM:
- break;
- case MM_MESSAGE_CAMCORDER_STATE_CHANGED:
- break;
- case MM_MESSAGE_CAMCORDER_MAX_SIZE:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] MM_MESSAGE_CAMCORDER_MAX_SIZE");
- sttd_recorder_stop();
- break;
- case MM_MESSAGE_CAMCORDER_NO_FREE_SPACE:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] MM_MESSAGE_CAMCORDER_NO_FREE_SPACE");
- sttd_recorder_cancel();
- break;
- case MM_MESSAGE_CAMCORDER_TIME_LIMIT:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] MM_MESSAGE_CAMCORDER_TIME_LIMIT");
- sttd_recorder_stop();
- break;
- case MM_MESSAGE_CAMCORDER_ERROR:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] MM_MESSAGE_CAMCORDER_ERROR");
- sttd_recorder_cancel();
- break;
- case MM_MESSAGE_CAMCORDER_RECORDING_STATUS:
- break;
- case MM_MESSAGE_CAMCORDER_CURRENT_VOLUME:
- pVr->volume = m->rec_volume_dB;
- break;
+ switch(channel) {
+ case 1: audio_ch = AUDIO_CHANNEL_MONO; break;
+ case 2: audio_ch = AUDIO_CHANNEL_STEREO; break;
default:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Other Message=%d", id);
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Input channel is not supported");
+ return STTD_ERROR_OPERATION_FAILED;
break;
- }
- } else {
- return -1;
- }
-
- return 0;
-}
-
-
-sttd_recorder_s *__recorder_getinstance()
-{
- if (!g_objRecorer) {
- g_objRecorer = NULL;
- g_objRecorer = g_malloc0(sizeof(sttd_recorder_s));
-
- /* set default value */
- g_objRecorer->time_limit = DEF_TIMELIMIT;
- g_objRecorer->size_limit = DEF_MAXSIZE;
- g_objRecorer->now = 0;
- g_objRecorer->now_ms = 0;
- g_objRecorer->frame = 0;
- g_objRecorer->volume = 0.0f;
- g_objRecorer->state = STTD_RECORDER_STATE_READY;
- g_objRecorer->channel = STTD_RECORDER_CHANNEL_MONO;
- g_objRecorer->audio_type = STTD_RECORDER_PCM_S16;
- g_objRecorer->samplerate = DEF_SAMPLERATE;
- g_objRecorer->streamcb = NULL;
- }
-
- return g_objRecorer;
-}
-
-void __recorder_state_set(sttd_recorder_state state)
-{
- sttd_recorder_s* pVr = __recorder_getinstance();
- pVr->state = state;
-}
-
-void __recorder_remove_temp_file()
-{
- /* NOTE: temp file can cause permission problem */
- if (0 != access(g_temp_file_name, R_OK|W_OK)) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] *** You don't have access right to temp file");
- } else {
- if (0 != remove(g_temp_file_name)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to remove temp file");
- }
}
-}
-
-/* MMFW Interface functions */
-int __recorder_setup()
-{
- sttd_recorder_s *pVr = __recorder_getinstance();
-
- /* mm-camcorder preset */
- MMCamPreset cam_info;
-
- int mmf_ret = MM_ERROR_NONE;
- int err = 0;
- char* err_attr_name = NULL;
-
- cam_info.videodev_type = MM_VIDEO_DEVICE_NONE;
-
- /* Create camcorder */
- mmf_ret = mm_camcorder_create( &pVr->rec_handle, &cam_info);
- if (MM_ERROR_NONE != mmf_ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail mm_camcorder_create ret=(%X)", mmf_ret);
- return mmf_ret;
- }
-
- switch (pVr->audio_type) {
- case STTD_RECORDER_PCM_U8:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] STTD_RECORDER_PCM_U8");
- err = mm_camcorder_set_attributes(pVr->rec_handle,
- &err_attr_name,
- MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
- MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
-
- MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
- MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
-
- MMCAM_AUDIO_SAMPLERATE, pVr->samplerate,
- MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_U8,
- MMCAM_AUDIO_CHANNEL, pVr->channel,
- MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL,
- NULL );
-
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_set_attributes ret=(%X)", mmf_ret);
- return err;
- }
-
- break;
-
- case STTD_RECORDER_PCM_S16:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] STTD_RECORDER_PCM_S16");
- err = mm_camcorder_set_attributes(pVr->rec_handle,
- &err_attr_name,
- MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
- MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
- MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AAC,
- MMCAM_FILE_FORMAT, MM_FILE_FORMAT_3GP,
- MMCAM_AUDIO_SAMPLERATE, pVr->samplerate,
- MMCAM_AUDIO_FORMAT, MM_CAMCORDER_AUDIO_FORMAT_PCM_S16_LE,
- MMCAM_AUDIO_CHANNEL, pVr->channel,
- MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL,
- NULL );
-
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_set_attributes ret=(%X)", mmf_ret);
- return err;
- }
- break;
-
- case STTD_RECORDER_AMR:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] STTD_RECORDER_AMR");
- err = mm_camcorder_set_attributes(pVr->rec_handle,
- &err_attr_name,
- MMCAM_MODE, MM_CAMCORDER_MODE_AUDIO,
- MMCAM_AUDIO_DEVICE, MM_AUDIO_DEVICE_MIC,
-
- MMCAM_AUDIO_ENCODER, MM_AUDIO_CODEC_AMR,
- MMCAM_FILE_FORMAT, MM_FILE_FORMAT_AMR,
-
- MMCAM_AUDIO_SAMPLERATE, pVr->samplerate,
- MMCAM_AUDIO_CHANNEL, pVr->channel,
-
- MMCAM_AUDIO_INPUT_ROUTE, MM_AUDIOROUTE_CAPTURE_NORMAL,
- MMCAM_TARGET_TIME_LIMIT, pVr->time_limit,
- MMCAM_TARGET_FILENAME, g_temp_file_name, strlen(g_temp_file_name)+1,
- NULL );
-
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail mm_camcorder_set_attributes ret=(%X)", mmf_ret);
- return err;
- }
- break;
-
- default:
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder ERROR]");
- return -1;
- break;
- }
-
- mmf_ret = mm_camcorder_set_audio_stream_callback(pVr->rec_handle, (mm_camcorder_audio_stream_callback)_mm_recorder_audio_stream_cb, NULL);
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail mm_camcorder_set_audio_stream_callback ret=(%X)", mmf_ret);
- return err;
- }
-
- mmf_ret = mm_camcorder_set_message_callback(pVr->rec_handle, (MMMessageCallback)_camcorder_message_cb, pVr);
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail mm_camcorder_set_message_callback ret=(%X)", mmf_ret);
- return err;
+ switch (type) {
+ case STTP_AUDIO_TYPE_PCM_S16_LE: audio_type = AUDIO_SAMPLE_TYPE_S16_LE; break;
+ case STTP_AUDIO_TYPE_PCM_U8: audio_type = AUDIO_SAMPLE_TYPE_U8; break;
+ default:
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Invalid Audio Type");
+ return STTD_ERROR_OPERATION_FAILED;
+ break;
}
- mmf_ret = mm_camcorder_realize(pVr->rec_handle);
- if (MM_ERROR_NONE != err) {
- /* Error */
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_realize=(%X)", mmf_ret);
- return err;
+ int ret;
+ ret = audio_in_create(sample_rate, audio_ch, audio_type, &g_audio_in_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to create audio handle : %d", ret);
+ return STTD_ERROR_OPERATION_FAILED;
}
- /* Camcorder start */
- mmf_ret = mm_camcorder_start(pVr->rec_handle);
- if (MM_ERROR_NONE != mmf_ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_start=(%X)", mmf_ret);
- return mmf_ret;
- }
+ //ret = audio_in_ignore_session(g_audio_in_h);
+ //if (AUDIO_IO_ERROR_NONE != ret) {
+ // SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to ignore session : %d", ret);
+ // return STTD_ERROR_OPERATION_FAILED;
+ //}
- SLOG(LOG_DEBUG, TAG_STTD, " - size_limit=%3d", pVr->size_limit);
- SLOG(LOG_DEBUG, TAG_STTD, " - time_limit=%3d", pVr->time_limit);
- SLOG(LOG_DEBUG, TAG_STTD, " - Audio Type=%d", pVr->audio_type);
- SLOG(LOG_DEBUG, TAG_STTD, " - Sample rates=%d", pVr->samplerate);
- SLOG(LOG_DEBUG, TAG_STTD, " - channel=%d", pVr->channel);
+ g_audio_cb = callback;
+ g_recorder_state = STTD_RECORDER_STATE_READY;
+ g_audio_type = type;
return 0;
}
-int __recorder_run()
+int sttd_recorder_destroy()
{
- sttd_recorder_s *pVr = __recorder_getinstance();
- int mmf_ret = MM_ERROR_NONE;
-
- /* If recorder already has recording state, cancel */
- if (STTD_RECORDER_STATE_RECORDING == pVr->state) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Stop recording first");
- __recorder_cancel_to_stop();
- }
-
- /* Reset frame number */
- pVr->frame = 0;
-
- /* Record start */
- mmf_ret = mm_camcorder_record(pVr->rec_handle);
- if(MM_ERROR_NONE != mmf_ret ) {
- /* Error */
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_record=(%X)", mmf_ret);
- return mmf_ret;
- }
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Success mm_camcorder_record");
-
- return 0;
-}
+ if (STTD_RECORDER_STATE_RECORDING == g_recorder_state)
+ audio_in_unprepare(g_audio_in_h);
-int __recorder_pause()
-{
- sttd_recorder_s *pVr = __recorder_getinstance();
- int mmf_ret = MM_ERROR_NONE;
- MMCamcorderStateType state_now = MM_CAMCORDER_STATE_NONE;
-
- /* Get state from MMFW */
- mmf_ret = mm_camcorder_get_state(pVr->rec_handle, &state_now);
- if(mmf_ret != MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to get state : mm_camcorder_get_state");
- return mmf_ret;
- }
+ audio_in_destroy(g_audio_in_h);
- /* Check recording state */
- if(MM_CAMCORDER_STATE_RECORDING != state_now) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Not recording state");
- return mmf_ret;
- }
+ g_audio_cb = NULL;
+ g_recorder_state = -1;
- /* Pause recording */
- mmf_ret = mm_camcorder_pause(pVr->rec_handle);
- if(mmf_ret == MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] mm_camcorder_pause OK");
- return mmf_ret;
- }
+ if (0 == access(STT_AUDIO_VOLUME_PATH, R_OK))
+ remove(STT_AUDIO_VOLUME_PATH);
return 0;
}
-int __recorder_cancel_to_stop()
+static float get_volume_decibel(char* data, int size, sttp_audio_type_e type)
{
- sttd_recorder_s *pVr = __recorder_getinstance();
- int mmf_ret = MM_ERROR_NONE;
- MMCamcorderStateType rec_status = MM_CAMCORDER_STATE_NONE;
-
- /* Cancel camcorder */
- mmf_ret = mm_camcorder_cancel(pVr->rec_handle);
- if(mmf_ret != MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to mm_camcorder_cancel");
- return -1;
- }
+ #define MAX_AMPLITUDE_MEAN_16 23170.115738161934
+ #define MAX_AMPLITUDE_MEAN_08 89.803909382810
- /* Stop camcorder */
- mmf_ret = mm_camcorder_stop(pVr->rec_handle);
- if(mmf_ret != MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to mm_camcorder_stop");
- return -1;
- }
+ int i, depthByte;
+ int count = 0;
- /* Release resouces */
- mm_camcorder_get_state(pVr->rec_handle, &rec_status);
- if (MM_CAMCORDER_STATE_READY == rec_status) {
- mmf_ret = mm_camcorder_unrealize(pVr->rec_handle);
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Call mm_camcorder_unrealize ret=(%X)", mmf_ret);
- }
+ short* pcm16 = 0;
+ char* pcm8 = 0;
- return 0;
-}
+ float db = 0.0;
+ float rms = 0.0;
+ unsigned long long square_sum = 0;
+ if (type == STTP_AUDIO_TYPE_PCM_S16_LE)
+ depthByte = 2;
+ else
+ depthByte = 1;
-int __recorder_commit_to_stop()
-{
- sttd_recorder_s *pVr = __recorder_getinstance();
- int mmf_ret = MM_ERROR_NONE;
- MMCamcorderStateType rec_status = MM_CAMCORDER_STATE_NONE;
-
- /* Commit camcorder */
- mmf_ret = mm_camcorder_commit(pVr->rec_handle);
- if(mmf_ret != MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_commit=%x", mmf_ret);
+ for (i = 0; i < size; i += (depthByte<<1)) {
+ if (depthByte == 2) {
+ pcm16 = (short*)(data + i);
+ square_sum += (*pcm16) * (*pcm16);
+ } else {
+ pcm8 = (char*)(data +i);
+ square_sum += (*pcm8) * (*pcm8);
+ }
+ count++;
}
- /* Stop camcorder */
- mmf_ret = mm_camcorder_stop(pVr->rec_handle);
- if(mmf_ret != MM_ERROR_NONE ) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail mm_camcorder_stop=%x", mmf_ret);
- }
+ rms = sqrt(square_sum/count);
- /* Release resouces */
- mm_camcorder_get_state(pVr->rec_handle, &rec_status);
- if (MM_CAMCORDER_STATE_READY == rec_status) {
- mmf_ret = mm_camcorder_unrealize(pVr->rec_handle);
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Call mm_camcorder_unrealize ret=(%X)", mmf_ret);
- }
+ if (depthByte == 2)
+ db = 20 * log10(rms/MAX_AMPLITUDE_MEAN_16);
+ else
+ db = 20 * log10(rms/MAX_AMPLITUDE_MEAN_08);
- return 0;
+ return db;
}
-
-int __recorder_send_buf_from_file()
+Eina_Bool __read_audio_func(void *data)
{
- sttd_recorder_s *pVr = __recorder_getinstance();
-
- FILE * pFile;
- if (!pVr->streamcb) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Return callback is not set");
- return -1;
- }
-
- if (STTD_RECORDER_AMR != pVr->audio_type) {
-#ifndef BUF_SAVE_MODE
- return 0;
-#else
- fclose(g_pFile);
-#endif
- }
+ int ret = -1;
- pFile = fopen(g_temp_file_name, "rb");
- if (!pFile) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File not found!");
- return -1;
+ if (STTD_RECORDER_STATE_READY == g_recorder_state) {
+ SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Exit audio reading func");
+ return EINA_FALSE;
}
- char buff[1024];
- size_t read_size = 0;
- int ret = 0;
-
- while (!feof(pFile)) {
- read_size = fread(buff, 1, 1024, pFile);
- if (read_size > 0) {
- ret = pVr->streamcb((void*)buff, read_size);
-
- if(ret != 0) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to set recording");
- break;
- }
- }
+ ret = audio_in_read(g_audio_in_h, g_buffer, BUFFER_LENGTH);
+ if (0 > ret) {
+ SLOG(LOG_WARN, TAG_STTD, "[Recorder WARNING] Fail to read audio : %d", ret);
+ g_recorder_state = STTD_RECORDER_STATE_READY;
+ return EINA_FALSE;
}
- fclose(pFile);
-
- return 0;
-}
-
-int __vr_mmcam_destroy()
-{
- int err = 0;
- sttd_recorder_s *pVr = __recorder_getinstance();
-
- MMCamcorderStateType rec_status = MM_CAMCORDER_STATE_NONE;
-
- mm_camcorder_get_state(pVr->rec_handle, &rec_status);
- if (rec_status == MM_CAMCORDER_STATE_NULL) {
- err = mm_camcorder_destroy(pVr->rec_handle);
-
- if (MM_ERROR_NONE == err) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] mm_camcorder_destroy OK");
- pVr->rec_handle = 0;
- } else {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Error mm_camcorder_destroy %x", err);
- }
-
- }
-
- return 0;
-}
-
-
-/* External functions */
-int sttd_recorder_init()
-{
- /* Create recorder instance */
- sttd_recorder_s *pVr = __recorder_getinstance();
- if (!pVr) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to initialize voice recorder!");
- return -1;
+ if (0 != g_audio_cb(g_buffer, BUFFER_LENGTH)) {
+ g_recorder_state = STTD_RECORDER_STATE_READY;
+ return EINA_FALSE;
}
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Voice Recorder Initialized p=%p", pVr);
-
- /* Set temp file name */
- snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/stt_temp_%d", getpid());
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Temp file name=[%s]", g_temp_file_name);
- g_init = true;
+ float vol_db = get_volume_decibel(g_buffer, BUFFER_LENGTH, g_audio_type);
- return 0;
-}
+ rewind(g_pFile_vol);
+ fwrite((void*)(&vol_db), sizeof(vol_db), 1, g_pFile_vol);
-int sttd_recorder_set(sttd_recorder_audio_type type, sttd_recorder_channel ch, unsigned int sample_rate,
- unsigned int max_time, sttvr_audio_cb cbfunc)
-{
- sttd_recorder_s *pVr = __recorder_getinstance();
- int ret = 0;
-
- if (STTD_RECORDER_STATE_RECORDING == pVr->state)
- __recorder_cancel_to_stop();
-
- if (STTD_RECORDER_STATE_READY != pVr->state)
- __vr_mmcam_destroy();
-
- /* Set attributes */
- pVr->audio_type = type;
- pVr->channel = ch;
- pVr->samplerate = sample_rate;
- pVr->time_limit = max_time;
-
- /* Stream data Callback function */
- if (cbfunc)
- pVr->streamcb = cbfunc;
+#ifdef BUF_SAVE_MODE
+ /* write pcm buffer */
+ fwrite(g_buffer, 1, BUFFER_LENGTH, g_pFile);
+#endif
- return ret;
+ return EINA_TRUE;
}
int sttd_recorder_start()
{
- int ret = 0;
-
- __recorder_remove_temp_file();
-
-#ifdef BUF_SAVE_MODE
- sttd_recorder_s *pVr = __recorder_getinstance();
- if (!pVr) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to initialize voice recorder!");
- return -1;
- }
-
- if (STTD_RECORDER_AMR != pVr->audio_type) {
- /* open test file */
- g_pFile = fopen(g_temp_file_name, "wb+");
- if (!g_pFile) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File not found!");
- return -1;
- }
- }
-#endif
-
- /* Check if initialized */
- ret = __recorder_setup();
- if (0 != ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_setup");
- return STTD_ERROR_OPERATION_FAILED;
- }
+ if (STTD_RECORDER_STATE_RECORDING == g_recorder_state)
+ return 0;
- /* Start camcorder */
- ret = __recorder_run();
- if (0 != ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_run");
+ int ret = -1;
+ ret = audio_in_prepare(g_audio_in_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to start audio : %d", ret);
return STTD_ERROR_OPERATION_FAILED;
}
- __recorder_state_set(STTD_RECORDER_STATE_RECORDING);
-
- return 0;
-}
+ /* Add ecore timer to read audio data */
+ ecore_timer_add(0, __read_audio_func, NULL);
+ g_recorder_state = STTD_RECORDER_STATE_RECORDING;
-int sttrecorder_pause()
-{
- int ret = 0;
-
- ret = __recorder_pause();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_pause");
+ g_pFile_vol = fopen(STT_AUDIO_VOLUME_PATH, "wb+");
+ if (!g_pFile_vol) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to create Volume File");
return -1;
}
- /* Set state */
- __recorder_state_set(STTD_RECORDER_STATE_PAUSED);
- return 0;
-}
+#ifdef BUF_SAVE_MODE
+ g_count++;
-int sttd_recorder_cancel()
-{
- int ret = 0;
- ret = __recorder_cancel_to_stop();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_cancel_to_stop");
- return -1;
- }
+ snprintf(g_temp_file_name, sizeof(g_temp_file_name), "/tmp/stt_temp_%d_%d", getpid(), g_count);
+ SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Temp file name=[%s]", g_temp_file_name);
- ret = __vr_mmcam_destroy();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __vr_mmcam_destroy");
+ /* open test file */
+ g_pFile = fopen(g_temp_file_name, "wb+");
+ if (!g_pFile) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] File not found!");
return -1;
- }
-
- /* Set state */
- __recorder_state_set(STTD_RECORDER_STATE_READY);
+ }
+#endif
return 0;
}
-
int sttd_recorder_stop()
{
- int ret = 0;
-
- ret = __recorder_commit_to_stop();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_commit_to_stop");
- return -1;
- }
-
- ret = __recorder_send_buf_from_file();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_send_buf_from_file");
- return -1;
- }
-
- ret = __vr_mmcam_destroy();
- if (ret) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __vr_mmcam_destroy");
- return -1;
- }
-
- __recorder_state_set(STTD_RECORDER_STATE_READY);
-
- return 0;
-}
-
-
-int sttd_recorder_destroy()
-{
- /* Destroy recorder object */
- if (g_objRecorer)
- g_free(g_objRecorer);
-
- g_objRecorer = NULL;
-
- __recorder_state_set(STTD_RECORDER_STATE_READY);
-
- return 0;
-}
+ if (STTD_RECORDER_STATE_READY == g_recorder_state)
+ return 0;
+ g_recorder_state = STTD_RECORDER_STATE_READY;
-int sttd_recorder_state_get(sttd_recorder_state* state)
-{
- sttd_recorder_s *pVr = __recorder_getinstance();
- if (!pVr) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to get instance");
- return -1;
+ int ret = STTD_ERROR_OPERATION_FAILED;
+ ret = audio_in_unprepare(g_audio_in_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to stop audio : %d", ret);
+ return STTD_ERROR_OPERATION_FAILED;
}
- *state = pVr->state;
-
- return 0;
-}
-
-
-int sttd_recorder_get_volume(float *vol)
-{
- sttd_recorder_state state;
-
- sttd_recorder_s *pVr = __recorder_getinstance();
- if (!pVr) {
- SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to get instance");
- return -1;
- }
+ fclose(g_pFile_vol);
- sttd_recorder_state_get(&state);
- if (STTD_RECORDER_STATE_RECORDING != state) {
- SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Not in Recording state");
- return -1;
- }
- *vol = pVr->volume;
+#ifdef BUF_SAVE_MODE
+ fclose(g_pFile);
+#endif
return 0;
-}
+}
\ No newline at end of file
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012, 2013 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
#ifndef __STTD_RECORDER_H__
#define __STTD_RECORDER_H__
+#include "sttp.h"
+
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
STTD_RECORDER_STATE_READY, /**< Recorder is ready to start */
- STTD_RECORDER_STATE_RECORDING, /**< In the middle of recording */
- STTD_RECORDER_STATE_PAUSED
+ STTD_RECORDER_STATE_RECORDING /**< In the middle of recording */
} sttd_recorder_state;
-typedef enum {
- STTD_RECORDER_PCM_S16, /**< PCM, signed 16-bit */
- STTD_RECORDER_PCM_U8, /**< PCM, unsigned 8-bit */
- STTD_RECORDER_AMR /**< AMR (Callback will be invoked after recording) */
-} sttd_recorder_audio_type;
-
-typedef enum {
- STTD_RECORDER_CHANNEL_MONO = 1, /**< Mono channel : Default value */
- STTD_RECORDER_CHANNEL_STEREO = 2 /**< Stereo */
-} sttd_recorder_channel;
-
-typedef int (*sttvr_audio_cb)(const void* data, const unsigned int length);
-typedef int (*sttvr_volume_data_cb)(const float data);
+typedef int (*stt_recorder_audio_cb)(const void* data, const unsigned int length);
-int sttd_recorder_set(sttd_recorder_audio_type type, sttd_recorder_channel ch, unsigned int sample_rate, unsigned int max_time, sttvr_audio_cb cbfunc);
+int sttd_recorder_create(stt_recorder_audio_cb callback, sttp_audio_type_e type, int channel, unsigned int sample_rate);
-int sttd_recorder_init();
+int sttd_recorder_destroy();
int sttd_recorder_start();
-int sttd_recorder_cancel();
-
int sttd_recorder_stop();
-int sttrecorder_pause();
-
-int sttd_recorder_state_get(sttd_recorder_state* state);
-
-int sttd_recorder_get_volume(float *vol);
-
-int sttd_recorder_destroy();
#ifdef __cplusplus
}
}
ecore_timer_add(0, __stop_by_silence, NULL);
-
- /*if (0 != sttd_send_stop_recognition_by_daemon(uid)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail ");
- } else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] <<<< stop message : uid(%d)", uid);
- }*/
return -1;
}
SLOG(LOG_ERROR, TAG_STTD, "[Server WARNING] Fail to initialize config.");
}
- /* recoder init */
- ret = sttd_recorder_init();
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to initialize recorder : result(%d)", ret);
- return ret;
- }
-
/* Engine Agent initialize */
ret = sttd_engine_agent_init(sttd_server_recognition_result_callback, sttd_server_partial_result_callback,
sttd_server_silence_dectection_callback);
return 0;
}
+int sttd_finalize()
+{
+ sttd_config_finalize();
+
+ sttd_engine_agent_release();
+
+ return STTD_ERROR_NONE;
+}
+
Eina_Bool sttd_cleanup_client(void *data)
{
int* client_list = NULL;
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to load current engine");
return STTD_ERROR_OPERATION_FAILED;
}
- }
- /* initialize recorder using audio format from engine */
- sttp_audio_type_e atype;
- int rate;
- int channels;
+ /* set type, channel, sample rate */
+ sttp_audio_type_e atype;
+ int rate;
+ int channels;
- if (0 != sttd_engine_get_audio_format(&atype, &rate, &channels)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get audio format of engine.");
- return STTD_ERROR_OPERATION_FAILED;
- }
-
- sttd_recorder_channel sttchannel = STTD_RECORDER_CHANNEL_MONO;
- sttd_recorder_audio_type sttatype = STTD_RECORDER_PCM_S16;
-
- switch (atype) {
- case STTP_AUDIO_TYPE_PCM_S16_LE: sttatype = STTD_RECORDER_PCM_S16; break;
- case STTP_AUDIO_TYPE_PCM_U8: sttatype = STTD_RECORDER_PCM_U8; break;
- case STTP_AUDIO_TYPE_AMR: sttatype = STTD_RECORDER_AMR; break;
- default:
- /* engine error */
- sttd_engine_agent_unload_current_engine();
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Invalid Audio Type");
- return STTD_ERROR_OPERATION_FAILED;
- break;
- }
+ if (0 != sttd_engine_get_audio_format(&atype, &rate, &channels)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get audio format of engine.");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
- switch (channels) {
- case 1: sttchannel = STTD_RECORDER_CHANNEL_MONO; break;
- case 2: sttchannel = STTD_RECORDER_CHANNEL_STEREO; break;
- default: sttchannel = STTD_RECORDER_CHANNEL_MONO; break;
- }
+ if (0 != sttd_recorder_create(audio_recorder_callback, atype, channels, rate)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set recorder");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
- if (0 != sttd_recorder_set(sttatype, sttchannel, rate, 60, audio_recorder_callback)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set recorder");
- return STTD_ERROR_OPERATION_FAILED;
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] audio type(%d), channel(%d)", (int)atype, (int)channels);
}
-
- SLOG(LOG_DEBUG, TAG_STTD, "[Server] audio type(%d), channel(%d)", (int)atype, (int)sttchannel);
/* Add client information to client manager */
if (0 != sttd_client_add(pid, uid)) {
return STTD_ERROR_NONE;
}
+static Eina_Bool __quit_ecore_loop(void *data)
+{
+ ecore_main_loop_quit();
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] quit ecore main loop");
+ return EINA_FALSE;
+}
+
int sttd_server_finalize(const int uid)
{
/* check if uid is valid */
/* release recorder */
if (APP_STATE_RECORDING == state || APP_STATE_PROCESSING == state) {
- sttd_recorder_cancel();
+ sttd_recorder_stop();
sttd_engine_recognize_cancel();
}
/* unload engine, if ref count of client is 0 */
if (0 == sttd_client_get_ref_count()) {
- if (0 != sttd_engine_agent_unload_current_engine()) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unload current engine");
- } else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] unload current engine");
- }
+ sttd_recorder_destroy();
+
+ ecore_timer_add(0, __quit_ecore_loop, NULL);
}
return STTD_ERROR_NONE;
return STTD_ERROR_NONE;
}
-int sttd_server_get_audio_volume( const int uid, float* current_volume)
-{
- /* check if uid is valid */
- app_state_e state;
- if (0 != sttd_client_get_state(uid, &state)) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] uid is NOT valid ");
- return STTD_ERROR_INVALID_PARAMETER;
- }
-
- /* check uid state */
- if (APP_STATE_RECORDING != state) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Current state is not recording");
- return STTD_ERROR_INVALID_STATE;
- }
-
- if (NULL == current_volume) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Input parameter is NULL");
- return STTD_ERROR_INVALID_PARAMETER;
- }
-
- /* get audio volume from recorder */
- int ret = sttd_recorder_get_volume(current_volume);
- if (0 != ret) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get volume : result(%d)", ret);
- return STTD_ERROR_OPERATION_FAILED;
- }
-
- return STTD_ERROR_NONE;
-}
-
Eina_Bool __check_recording_state(void *data)
{
/* current uid */
/* stop recorder */
if (APP_STATE_RECORDING == state)
- sttd_recorder_cancel();
+ sttd_recorder_stop();
/* cancel engine recognition */
int ret = sttd_engine_recognize_cancel();
SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to load current engine");
return STTD_ERROR_OPERATION_FAILED;
}
+
+ /* set type, channel, sample rate */
+ sttp_audio_type_e atype;
+ int rate;
+ int channels;
+
+ if (0 != sttd_engine_get_audio_format(&atype, &rate, &channels)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get audio format of engine.");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ if (0 != sttd_recorder_create(audio_recorder_callback, atype, channels, rate)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to set recorder");
+ return STTD_ERROR_OPERATION_FAILED;
+ }
+
+ SLOG(LOG_DEBUG, TAG_STTD, "[Server] audio type(%d), channel(%d)", (int)atype, (int)channels);
}
/* Add setting client information to client manager (For internal use) */
/* unload engine, if ref count of client is 0 */
if (0 == sttd_client_get_ref_count()) {
- if (0 != sttd_engine_agent_unload_current_engine()) {
- SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to unload current engine");
- } else {
- SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] unload current engine");
- }
+ sttd_recorder_destroy();
+
+ ecore_timer_add(0, __quit_ecore_loop, NULL);
}
return STTD_ERROR_NONE;
*/
int sttd_initialize();
+int sttd_finalize();
+
Eina_Bool sttd_cleanup_client(void *data);
/*
*/
typedef enum {
STTP_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */
- STTP_AUDIO_TYPE_PCM_U8, /**< Unsigned 8bit audio type */
- STTP_AUDIO_TYPE_AMR /**< AMR audio type */
+ STTP_AUDIO_TYPE_PCM_U8 /**< Unsigned 8bit audio type */
}sttp_audio_type_e;
/**
#define STTP_RECOGNITION_TYPE_WEB_SEARCH "stt.recognition.type.WEB_SEARCH"
/**
-* @brief Recognition type : all voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND "stt.recognition.type.COMMAND"
-
-/**
-* @brief Recognition type : call of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_CALL "stt.recognition.type.COMMAND.CALL"
-
-/**
-* @brief Recognition type : music of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_MUSIC "stt.recognition.type.COMMAND.MUSIC"
-
-/**
-* @brief Recognition type : web search of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_WEB_SEARCH "stt.recognition.type.COMMAND.WEB_SEARCH"
-
-/**
-* @brief Recognition type : schedule of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_SCHEDULE "stt.recognition.type.COMMAND.SCHEDULE"
-
-/**
-* @brief Recognition type : search of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_SEARCH "stt.recognition.type.COMMAND.SEARCH"
-
-/**
-* @brief Recognition type : contact of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_CONTACT "stt.recognition.type.COMMAND.CONTACT"
-
-/**
-* @brief Recognition type : social of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_SOCIAL "stt.recognition.type.COMMAND.SOCIAL"
-
-/**
-* @brief Recognition type : message of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_MESSAGE "stt.recognition.type.COMMAND.MESSAGE"
-
-/**
-* @brief Recognition type : email of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_EMAIL "stt.recognition.type.COMMAND.EMAIL"
-
-/**
-* @brief Recognition type : memo of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_MEMO "stt.recognition.type.COMMAND.MEMO"
-
-/**
-* @brief Recognition type : alarm of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_ALARM "stt.recognition.type.COMMAND.ALARM"
-
-/**
-* @brief Recognition type : application of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_APPLICATION "stt.recognition.type.COMMAND.APPLICATION"
-
-/**
-* @brief Recognition type : driving mode of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_DRIVING_MODE "stt.recognition.type.COMMAND.DRIVING_MODE"
-
-/**
-* @brief Recognition type : navigation of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_NAVIGATION "stt.recognition.type.COMMAND.NAVIGATION"
-
-/**
-* @brief Recognition type : text-to-speech of voice commands.
-*/
-#define STTP_RECOGNITION_TYPE_COMMAND_TTS "stt.recognition.type.COMMAND.TTS"
-
-/**
* @brief Result message : None message
*/
#define STTP_RESULT_MESSAGE_NONE "stt.result.message.none"
--- /dev/null
+stt-server system::homedir rwx
+stt-server system::app_logging wx
+stt-server dbus rw
+stt-server system::vconf rwx
+stt-server system::share rwx
+stt-server location_fw::db rw
+stt-server system::use_internet rw
+stt-server sound_server rw
+stt-server mdm-server w
+stt-server pulseaudio rwx
+system::use_internet stt-server w
+stt-server tts-server rwx
+stt-server sys-assert::core rwxat