upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:57 +0000 (17:01 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:57 +0000 (17:01 +0900)
24 files changed:
COPYING [deleted file]
LICENSE [new file with mode: 0644]
client/stt.c
client/stt.h
client/stt_client.c
client/stt_client.h
client/stt_dbus.c
client/stt_dbus.h
client/stt_setting.c
client/stt_setting_dbus.c
common/stt_defs.h
debian/changelog
debian/copyright
packaging/stt.spec
server/sttd_dbus.c
server/sttd_dbus_server.c
server/sttd_dbus_server.h
server/sttd_engine_agent.c
server/sttd_engine_agent.h
server/sttd_main.h
server/sttd_recorder.c
server/sttd_server.c
server/sttd_server.h
server/sttp.h

diff --git a/COPYING b/COPYING
deleted file mode 100644 (file)
index 1c166a2..0000000
--- a/COPYING
+++ /dev/null
@@ -1,10 +0,0 @@
-Copyright (c) 2011 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.
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bbe9d02
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+\r
+\r
index 536c8114ddc4439c9562ce613e5e693c43d3df0b..a05ef53518d1dbabe182a7113e0dbc9f70012876 100644 (file)
@@ -21,9 +21,9 @@
 #include "stt_client.h"
 #include "stt_dbus.h"
 
-#define CONNECTION_RETRY_COUNT 3
+#define CONNECTION_RETRY_COUNT 2
 
-int __check_stt_daemon();
+static int __check_stt_daemon();
 
 int stt_create(stt_h* stt)
 {
@@ -36,9 +36,6 @@ int stt_create(stt_h* stt)
                return STT_ERROR_INVALID_PARAMETER;
        }
 
-       /* check stt-daemon. */
-       __check_stt_daemon();   
-
        if (0 == stt_client_get_size()) {
                if (0 != stt_dbus_open_connection()) {
                        SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to open connection\n ");
@@ -46,22 +43,31 @@ int stt_create(stt_h* stt)
                }
        }
 
+       /* Send hello */
+       if (0 != stt_dbus_request_hello()) {
+               __check_stt_daemon();
+       }
+
        if (0 != stt_client_new(stt)) {
                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to create client!!!!!");
                return STT_ERROR_OUT_OF_MEMORY;
        }
 
        /* request initialization */
-       int i = 0;
+       int i = 1;
+       bool silence_supported = false;
+       bool profanity_supported = false;
+       bool punctuation_supported = false;
+
        while (1) {
-               ret = stt_dbus_request_initialize((*stt)->handle);
+               ret = stt_dbus_request_initialize((*stt)->handle, &silence_supported, &profanity_supported, &punctuation_supported);
                
                if (STT_ERROR_ENGINE_NOT_FOUND == ret) {
                        stt_client_destroy(*stt);
                        SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : STT Engine Not founded");
                        return ret;
                } else if(0 != ret) {
-                       sleep(1);
+                       usleep(1);
                        if(CONNECTION_RETRY_COUNT == i) {
                                stt_client_destroy(*stt);
                                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to initialize : TIMED OUT");
@@ -70,6 +76,9 @@ int stt_create(stt_h* stt)
                        i++;
                } else {
                        /* success to connect stt-daemon */
+                       stt_client_set_option_supported(*stt, silence_supported, profanity_supported, punctuation_supported);
+                       SLOG(LOG_DEBUG, TAG_STTC, "Supported options : silence(%s), profanity(%s), punctuation(%s)", 
+                               silence_supported ? "true" : "false", profanity_supported ? "true" : "false", punctuation_supported ? "true" : "false");
                        break;
                }
        }
@@ -260,11 +269,15 @@ int stt_set_profanity_filter(stt_h stt, stt_option_profanity_e type)
                return STT_ERROR_INVALID_PARAMETER;
        }
 
-       if (type >= STT_OPTION_PROFANITY_FALSE && type <= STT_OPTION_PROFANITY_AUTO)
-               client->profanity = type;       
-       else {
-               SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
-               return STT_ERROR_INVALID_PARAMETER;
+       if (true == client->profanity_supported) {
+               if (type >= STT_OPTION_PROFANITY_FALSE && type <= STT_OPTION_PROFANITY_AUTO)
+                       client->profanity = type;       
+               else {
+                       SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
+                       return STT_ERROR_INVALID_PARAMETER;
+               }
+       } else {
+               return STT_ERROR_NOT_SUPPORTED_FEATURE; 
        }
 
        return STT_ERROR_NONE;
@@ -284,11 +297,15 @@ int stt_set_punctuation_override(stt_h stt, stt_option_punctuation_e type)
                return STT_ERROR_INVALID_PARAMETER;
        }
        
-       if (type >= STT_OPTION_PUNCTUATION_FALSE && type <= STT_OPTION_PUNCTUATION_AUTO)
-               client->punctuation = type;     
-       else {
-               SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
-               return STT_ERROR_INVALID_PARAMETER;
+       if (true == client->punctuation_supported) {
+               if (type >= STT_OPTION_PUNCTUATION_FALSE && type <= STT_OPTION_PUNCTUATION_AUTO)
+                       client->punctuation = type;     
+               else {
+                       SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
+                       return STT_ERROR_INVALID_PARAMETER;
+               }
+       } else {
+               return STT_ERROR_NOT_SUPPORTED_FEATURE; 
        }
 
        return STT_ERROR_NONE;
@@ -308,11 +325,15 @@ int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type)
                return STT_ERROR_INVALID_PARAMETER;
        }
 
-       if (type >= STT_OPTION_SILENCE_DETECTION_FALSE && type <= STT_OPTION_SILENCE_DETECTION_AUTO)
-               client->silence = type; 
-       else {
-               SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
-               return STT_ERROR_INVALID_PARAMETER;
+       if (true == client->silence_supported) {
+               if (type >= STT_OPTION_SILENCE_DETECTION_FALSE && type <= STT_OPTION_SILENCE_DETECTION_AUTO)
+                       client->silence = type; 
+               else {
+                       SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Type is invalid");
+                       return STT_ERROR_INVALID_PARAMETER;
+               }
+       } else {
+               return STT_ERROR_NOT_SUPPORTED_FEATURE; 
        }
 
        return STT_ERROR_NONE;
@@ -828,40 +849,38 @@ int stt_unset_error_cb(stt_h stt)
 static bool __stt_is_alive()
 {
        FILE *fp = NULL;
-       char buff[256];
-       char cmd[256];
-       int i=0;
+       char buff[256] = {'\0',};
+       char cmd[256] = {'\0',};
 
        memset(buff, '\0', 256);
        memset(cmd, '\0', 256);
 
-       if ((fp = popen("ps -eo \"cmd\"", "r")) == NULL) {
-               SLOG(LOG_DEBUG, TAG_STTC, "[ERROR] popen error \n");
+       fp = popen("ps", "r");
+       if (NULL == fp) {
+               SLOG(LOG_DEBUG, TAG_STTC, "[STT SETTING ERROR] popen error \n");
                return FALSE;
        }
 
-       while(fgets(buff, 255, fp)) {
-               if (i == 0) {
-                       i++;
-                       continue;
-               }
-
-               sscanf(buff, "%s", cmd);
+       while (fgets(buff, 255, fp)) {
+               strcpy(cmd, buff + 26);
 
                if( 0 == strncmp(cmd, "[stt-daemon]", strlen("[stt-daemon]")) ||
-                       0 == strncmp(cmd, "stt-daemon", strlen("stt-daemon")) ||
-                       0 == strncmp(cmd, "/usr/bin/stt-daemon", strlen("/usr/bin/stt-daemon"))
-                       ) {
+               0 == strncmp(cmd, "stt-daemon", strlen("stt-daemon")) ||
+               0 == strncmp(cmd, "/usr/bin/stt-daemon", strlen("/usr/bin/stt-daemon"))) {
+                       SLOG(LOG_DEBUG, TAG_STTC, "stt-daemon is ALIVE !! \n");
                        fclose(fp);
                        return TRUE;
                }
-               i++;
        }
+
        fclose(fp);
 
+       SLOG(LOG_DEBUG, TAG_STTC, "THERE IS NO stt-daemon !! \n");
+
        return FALSE;
 }
 
+
 static void __my_sig_child(int signo, siginfo_t *info, void *data)
 {
        int status;
@@ -885,8 +904,6 @@ int __check_stt_daemon()
                return 0;
        
        /* fork-exec stt-daemon */
-       SLOG(LOG_DEBUG, TAG_STTC, "THERE IS NO stt-daemon \n");
-
        int pid, i;
        struct sigaction act, dummy;
 
index 0fdf71cf698438c16a485f0b2cb5ce591768fedc..01879ecfd6fdbbabd140d8b195f8fa3c787569d4 100644 (file)
@@ -1,16 +1,18 @@
 /*
-* Copyright (c) 2011 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.
-*/
-
+ * Copyright (c) 2011 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. 
+ */
 
 #ifndef __STT_H__
 #define __STT_H__
@@ -42,7 +44,8 @@ typedef enum {
        STT_ERROR_INVALID_STATE         = -0x0100031,   /**< Invalid state */
        STT_ERROR_INVALID_LANGUAGE      = -0x0100032,   /**< Invalid language */
        STT_ERROR_ENGINE_NOT_FOUND      = -0x0100033,   /**< No available engine  */    
-       STT_ERROR_OPERATION_FAILED      = -0x0100034    /**< Operation failed  */
+       STT_ERROR_OPERATION_FAILED      = -0x0100034,   /**< Operation failed  */
+       STT_ERROR_NOT_SUPPORTED_FEATURE = -0x0100035    /**< Not supported feature of current engine */
 }stt_error_e;
 
 /** 
@@ -135,6 +138,72 @@ typedef enum {
 */
 #define STT_RECOGNITION_TYPE_COMMAND_TTS               "stt.recognition.type.COMMAND.TTS"
 
+/** 
+* @brief Result message : None message
+*/
+#define STT_RESULT_MESSAGE_NONE                        "stt.result.message.none"
+
+/** 
+* @brief Result warning message : The speech has started too soon
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_SOON    "stt.result.message.warning.too.soon"
+
+/** 
+* @brief Result warning message : The speech is too short
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_SHORT   "stt.result.message.warning.too.short"
+
+/** 
+* @brief Result warning message : The speech is too long
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_LONG    "stt.result.message.warning.too.long"
+
+/** 
+* @brief Result warning message : The speech is too quiet to listen
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_QUIET   "stt.result.message.warning.too.quiet"
+
+/** 
+* @brief Result warning message : The speech is too loud to listen
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_LOUD    "stt.result.message.warning.too.loud"
+
+/** 
+* @brief Result warning message : The speech is too fast to listen
+*/
+#define STT_RESULT_MESSAGE_WARNING_TOO_FAST    "stt.result.message.warning.too.fast"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too soon
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_SOON      "stt.result.message.error.too.soon"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too short
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_SHORT     "stt.result.message.error.too.short"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too long
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_LONG      "stt.result.message.error.too.long"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too quiet to listen
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_QUIET     "stt.result.message.error.too.quiet"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too loud to listen 
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_LOUD      "stt.result.message.error.too.loud"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too fast to listen
+*/
+#define STT_RESULT_MESSAGE_ERROR_TOO_FAST      "stt.result.message.error.too.fast"
+
+
 /** 
 * @brief Enumerations of state.
 */
@@ -183,10 +252,10 @@ typedef struct stt_s *stt_h;
 *      this function is called. 
 *
 * @param[in] stt The handle for STT
-* @param[in] type Recognition type
-* @param[in] data Result data
-* @param[in] data_count Result count
-* @param[in] msg Engine message
+* @param[in] type Recognition type (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_COMMAND)
+* @param[in] data Result texts
+* @param[in] data_count Result text count
+* @param[in] msg Engine message        (e.g. #STT_RESULT_MESSAGE_WARNING_TOO_SOON, #STT_RESULT_MESSAGE_ERROR_TOO_SHORT)
 * @param[in] user_data The user data passed from the callback registration function
 *
 * @pre stt_stop() will invoke this callback if you register it using stt_set_result_cb().
@@ -254,8 +323,8 @@ typedef void (*stt_error_cb)(stt_h stt, stt_error_e reason, void *user_data);
 *
 * @param[in] stt The handle for STT
 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n
-*              followed by ISO 639-1 for the two-letter language code. \n
-*              For example, "ko_KR" for Korean, "en_US" for American English.
+* followed by ISO 639-1 for the two-letter language code. \n
+* For example, "ko_KR" for Korean, "en_US" for American English.
 * @param[in] user_data The user data passed from the foreach function
 *
 * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
@@ -324,8 +393,8 @@ int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callbac
 *
 * @param[in] stt The handle for STT
 * @param[out] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n
-*                      followed by ISO 639-1 for the two-letter language code. \n
-*                      For example, "ko_KR" for Korean, "en_US" for American English.
+* followed by ISO 639-1 for the two-letter language code. \n
+* For example, "ko_KR" for Korean, "en_US" for American English.
 *
 * @return 0 on success, otherwise a negative error value
 * @retval #STT_ERROR_NONE Successful
@@ -385,6 +454,7 @@ int stt_is_partial_result_supported(stt_h stt, bool* partial_result);
 * @retval #STT_ERROR_NONE Successful
 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #STT_ERROR_INVALID_STATE Invalid state
+* @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
 *
 * @pre The state should be #STT_STATE_READY.
 */
@@ -400,6 +470,7 @@ int stt_set_profanity_filter(stt_h stt, stt_option_profanity_e type);
 * @retval #STT_ERROR_NONE Successful
 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #STT_ERROR_INVALID_STATE Invalid state
+* @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
 *
 * @pre The state should be #STT_STATE_READY.
 */
@@ -415,6 +486,7 @@ int stt_set_punctuation_override(stt_h stt, stt_option_punctuation_e type);
 * @retval #STT_ERROR_NONE Successful
 * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
 * @retval #STT_ERROR_INVALID_STATE Invalid state
+* @retval #STT_ERROR_NOT_SUPPORTED_FEATURE Not supported feature of current engine
 *
 * @pre The state should be #STT_STATE_READY.
 */
@@ -423,12 +495,12 @@ int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
 /**
 * @brief Starts recording and recognition.
 *
-* @remark This function starts recording in the daemon and sending recording data to engine.
-*      This work continues until stt_stop(), stt_cancel() or silence detected.
+* @remark This function starts recording in the daemon and sending recording data to engine. \n
+* This work continues until stt_stop(), stt_cancel() or silence detected.
 *
 * @param[in] stt The handle for STT
 * @param[in] language The language selected from stt_foreach_supported_languages()
-* @param[in] type The type for recognition (e.g. #RECOGNITION_TYPE_FREE, #RECOGNITION_TYPE_WEB_SEARCH)
+* @param[in] type The type for recognition (e.g. #STT_RECOGNITION_TYPE_FREE, #STT_RECOGNITION_TYPE_WEB_SEARCH)
 *
 * @return 0 on success, otherwise a negative error value
 * @retval #STT_ERROR_NONE Successful
@@ -439,8 +511,8 @@ int stt_set_silence_detection(stt_h stt, stt_option_silence_detection_e type);
 * @retval #STT_ERROR_INVALID_LANGUAGE Invalid language
 *
 * @pre The state should be #STT_STATE_READY.
-* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb().
-*      If this function succeeds, the STT state will be #STT_STATE_RECORDING.
+* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
+* If this function succeeds, the STT state will be #STT_STATE_RECORDING.
 *
 * @see stt_stop()
 * @see stt_cancel()
@@ -462,9 +534,9 @@ int stt_start(stt_h stt, const char* language, const char* type);
 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
 *
 * @pre The state should be #STT_STATE_RECORDING.
-* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb().
-*      If this function succeeds, the STT state will be #STT_STATE_PROCESSING.
-*      After processing of engine, stt_result_cb() is called.
+* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
+* If this function succeeds, the STT state will be #STT_STATE_PROCESSING. \n
+* After processing of engine, stt_result_cb() is called.
 *
 * @see stt_start()
 * @see stt_cancel()
@@ -476,9 +548,8 @@ int stt_stop(stt_h stt);
 /**
 * @brief Cancels processing recognition and recording.
 *
-* @remark This function cancels recording and engine cancels recognition processing.
-*      After successful cancel, stt_state_changed_cb() is called otherwise
-*      if error is occurred, stt_error_cb() is called. 
+* @remark This function cancels recording and engine cancels recognition processing. \n
+* After successful cancel, stt_state_changed_cb() is called otherwise if error is occurred, stt_error_cb() is called. 
 *
 * @param[in] stt The handle for STT
 *
@@ -490,8 +561,8 @@ int stt_stop(stt_h stt);
 * @retval #STT_ERROR_OPERATION_FAILED Operation failure
 *
 * @pre The state should be #STT_STATE_RECORDING or #STT_STATE_PROCESSING.
-* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb().
-*      If this function succeeds, the STT state will be #STT_STATE_READY.
+* @post It will invoke stt_state_changed_cb(), if you register a callback with stt_state_changed_cb(). \n
+* If this function succeeds, the STT state will be #STT_STATE_READY.
 *
 * @see stt_start()
 * @see stt_stop()
index 6bb57724b316fa1ccf54f6d2cad4d1a8e1df639e..a8b4fb9bcb142fbcb175e7ad075101e4047c6bec 100644 (file)
@@ -60,6 +60,10 @@ int stt_client_new(stt_h* stt)
        client->error_cb = NULL;
        client->error_user_data = NULL;
 
+       client->silence_supported = false;
+       client->profanity_supported = false;
+       client->punctuation_supported = false;
+
        client->profanity = STT_OPTION_PROFANITY_AUTO;  
        client->punctuation = STT_OPTION_PUNCTUATION_AUTO;
        client->silence = STT_OPTION_SILENCE_DETECTION_AUTO;
@@ -194,4 +198,19 @@ int stt_client_not_use_callback(stt_client_s* client)
 }
 
 
+int stt_client_set_option_supported(stt_h stt, bool silence, bool profanity, bool punctuation)
+{
+       stt_client_s* client = stt_client_get(stt);
+       
+       /* check handle */
+       if (NULL == client) 
+               return STT_ERROR_INVALID_PARAMETER;
+       
+       client->silence_supported = silence;
+       client->profanity_supported = profanity;
+       client->punctuation_supported = punctuation;
+
+       return 0;
+}
+
 
index 3cfa7a17fad964551b6676c3cd9c4b3c261518de..e18ef5f6c6c25e55e403a2c109af09e988ee347a 100644 (file)
@@ -40,6 +40,10 @@ typedef struct {
        void*                   error_user_data;
 
        /* option */
+       bool    silence_supported;
+       bool    profanity_supported;
+       bool    punctuation_supported;
+
        stt_option_profanity_e          profanity;      
        stt_option_punctuation_e        punctuation;
        stt_option_silence_detection_e  silence;
@@ -65,6 +69,8 @@ int stt_client_use_callback(stt_client_s* client);
 
 int stt_client_not_use_callback(stt_client_s* client);
 
+int stt_client_set_option_supported(stt_h stt, bool silence, bool profanity, bool punctuation);
+
 #ifdef __cplusplus
 }
 #endif
index cbfb0cb7d2d98254eb8e133d940910c243fb1b96..2f752c18fd1ab94a5353e537071566ded9eb0805 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <Ecore.h>
 
+static int g_waiting_time = 1500;
+static int g_waiting_start_time = 2000;
+
 static Ecore_Fd_Handler* g_fd_handler = NULL;
 
 static DBusConnection* g_conn = NULL;
@@ -35,6 +38,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 {
        DBusConnection* conn = (DBusConnection*)data;
        DBusMessage* msg = NULL;
+       DBusMessage *reply = NULL;
 
        if (NULL == conn)
                return ECORE_CALLBACK_RENEW;
@@ -50,10 +54,11 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
        DBusError err;
        dbus_error_init(&err);
+
        char if_name[64];
        snprintf(if_name, 64, "%s%d", STT_CLIENT_SERVICE_INTERFACE, getpid());
 
-       if( dbus_message_is_signal(msg, if_name, STT_SIGNAL_RESULT)) {
+       if (dbus_message_is_method_call(msg, if_name, STT_METHOD_RESULT)) {
                SLOG(LOG_DEBUG, TAG_STTC, "===== Get Result");
                int uid = 0;
                DBusMessageIter args;
@@ -122,11 +127,17 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                } else {
                        SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get result : invalid uid \n");
                } 
+               
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply); 
+
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-       }/* STT_SIGNAL_RESULT */
+       }/* STT_METHOD_RESULT */
 
-       else if( dbus_message_is_signal(msg, if_name, STT_SIGNAL_PARTIAL_RESULT)) {
+       else if (dbus_message_is_method_call(msg, if_name, STT_METHOD_PARTIAL_RESULT)) {
                SLOG(LOG_DEBUG, TAG_STTC, "===== Get Partial Result");
                int uid = 0;
                DBusMessageIter args;
@@ -152,11 +163,16 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                } else {
                        SLOG(LOG_ERROR, TAG_STTC, "<<<< stt get partial result : invalid uid \n");
                }
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply); 
+
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-       }/* STT_SIGNAL_PARTIAL_RESULT */
+       }/* STT_METHOD_PARTIAL_RESULT */
 
-       else if( dbus_message_is_signal(msg, if_name, STT_SIGNAL_STOP)) {
+       else if (dbus_message_is_method_call(msg, if_name, STT_METHOD_STOPED)) {
                SLOG(LOG_DEBUG, TAG_STTC, "===== Get Silence Detection");
                int uid;
                dbus_message_get_args(msg, &err,
@@ -170,11 +186,17 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_STTC, "<<<< Get stop by daemon signal : uid(%d)\n", uid);
                        __stt_cb_stop_by_daemon(uid);
                }
+
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply); 
+
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-       }/* STT_SIGNAL_STOP */
+       }/* STT_METHOD_STOP */
 
-       else if( dbus_message_is_signal(msg, if_name, STT_SIGNAL_ERROR)) {
+       else if (dbus_message_is_method_call(msg, if_name, STT_METHOD_ERROR)) {
                SLOG(LOG_DEBUG, TAG_STTC, "===== Get Error");
                int uid;
                int reason;
@@ -193,9 +215,15 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                        SLOG(LOG_DEBUG, TAG_STTC, "<<<< Get Error signal : uid(%d), reason(%d), msg(%s)\n", uid, reason, err_msg);
                        __stt_cb_error(uid, reason);
                }
+
+               reply = dbus_message_new_method_return(msg);
+               dbus_connection_send(conn, reply, NULL);
+               dbus_connection_flush(conn);
+               dbus_message_unref(reply); 
+
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-       }/* STT_SIGNAL_ERROR */
+       }/* STT_METHOD_ERROR */
 
        /* free the message */
        dbus_message_unref(msg);
@@ -304,7 +332,48 @@ int stt_dbus_close_connection()
        return 0;
 }
 
-int stt_dbus_request_initialize(int uid)
+int stt_dbus_request_hello()
+{
+       DBusMessage* msg;
+
+       msg = dbus_message_new_method_call(
+               STT_SERVER_SERVICE_NAME, 
+               STT_SERVER_SERVICE_OBJECT_PATH, 
+               STT_SERVER_SERVICE_INTERFACE, 
+               STT_METHOD_HELLO);
+
+       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);
+
+       DBusMessage* result_msg = NULL;
+       int result = 0;
+
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 500, &err);
+
+       dbus_message_unref(msg);
+
+       if (NULL != result_msg) {
+               dbus_message_unref(result_msg);
+
+               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_initialize(int uid, bool* silence_supported, bool* profanity_supported, bool* punctuation_supported)
 {
        DBusMessage* msg;
 
@@ -333,10 +402,15 @@ int stt_dbus_request_initialize(int uid)
        DBusMessage* result_msg;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
+               dbus_message_get_args(result_msg, &err, 
+                       DBUS_TYPE_INT32, &result, 
+                       DBUS_TYPE_INT32, silence_supported,
+                       DBUS_TYPE_INT32, profanity_supported,
+                       DBUS_TYPE_INT32, punctuation_supported,
+                       DBUS_TYPE_INVALID);
 
                if (dbus_error_is_set(&err)) { 
                        SLOG(LOG_ERROR, TAG_STTC, "<<<< Get arguments error (%s)\n", err.message);
@@ -350,7 +424,8 @@ int stt_dbus_request_initialize(int uid)
        }
 
        if (0 == result) {
-               SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt initialize : result = %d \n", result);
+               SLOG(LOG_DEBUG, TAG_STTC, "<<<< stt initialize : result = %d , silence(%d), profanity(%d), punctuation(%d)", 
+                       result, *silence_supported, *profanity_supported, *punctuation_supported);
        } else {
                SLOG(LOG_ERROR, TAG_STTC, "<<<< stt initialize : result = %d \n", result);
        }
@@ -385,7 +460,7 @@ int stt_dbus_request_finalize(int uid)
        DBusMessage* result_msg;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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, 
@@ -445,7 +520,7 @@ int stt_dbus_request_get_support_langs(int uid, stt_h stt, stt_supported_languag
        DBusMessageIter args;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err );
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err );
 
        if (NULL != result_msg) {
                if (dbus_message_iter_init(result_msg, &args)) {
@@ -528,7 +603,7 @@ int stt_dbus_request_get_default_lang(int uid, char** language)
        int result = STT_ERROR_OPERATION_FAILED;
        char* temp_lang = NULL;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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,
@@ -591,7 +666,7 @@ int stt_dbus_request_is_partial_result_supported(int uid, bool* partial_result)
        int result = STT_ERROR_OPERATION_FAILED;
        int support = -1;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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,
@@ -659,7 +734,7 @@ int stt_dbus_request_start(int uid, const char* lang, const char* type, int prof
        DBusMessage* result_msg;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_start_time, &err);
 
        if (NULL != result_msg) {
                dbus_message_get_args(result_msg, &err,
@@ -715,7 +790,7 @@ int stt_dbus_request_stop(int uid)
        DBusMessage* result_msg;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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,
@@ -771,7 +846,7 @@ int stt_dbus_request_cancel(int uid)
        DBusMessage* result_msg;
        int result = STT_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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,
@@ -833,7 +908,7 @@ int stt_dbus_request_get_audio_volume(int uid, float* volume)
        int result = STT_ERROR_OPERATION_FAILED;
        double vol = 0;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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,
index edc40d4824579e2872f25f52fcdbd75d927fa5d9..5a194bfb2b20ef968e3730a4ef7f617e2a9945e7 100644 (file)
@@ -27,7 +27,9 @@ int stt_dbus_open_connection();
 int stt_dbus_close_connection();
 
 
-int stt_dbus_request_initialize(int uid);
+int stt_dbus_request_hello();
+
+int stt_dbus_request_initialize(int uid, bool* silence_supported, bool* profanity_supported, bool* punctuation_supported);
 
 int stt_dbus_request_finalize(int uid);
 
index cbe49c82ac1a65afbfe8b1407fdb4f775790a238..d3fedd807373cd9cab9979188ad7dae6ac0070ce 100644 (file)
@@ -18,6 +18,8 @@
 #include "stt_setting.h"
 #include "stt_setting_dbus.h"
 
+#define CONNECTION_RETRY_COUNT 2
+
 static bool g_is_setting_initialized = false;
 
 static int __check_stt_daemon();
@@ -27,15 +29,11 @@ int stt_setting_initialize ()
        SLOG(LOG_DEBUG, TAG_STTC, "===== Initialize STT Setting");
 
        int ret = 0;
-
-       /* Check daemon */
-       __check_stt_daemon();
-
        if (true == g_is_setting_initialized) {
-               SLOG(LOG_ERROR, TAG_STTC, "[ERROR] STT Setting has already been initialized. \n");
+               SLOG(LOG_WARN, TAG_STTC, "[WARNING] STT Setting has already been initialized. \n");
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-               return STT_SETTING_ERROR_INVALID_STATE;
+               return STT_SETTING_ERROR_NONE;
        }
 
        if (0 != stt_setting_dbus_open_connection()) {
@@ -45,8 +43,13 @@ int stt_setting_initialize ()
                return STT_SETTING_ERROR_OPERATION_FAILED;
        }
 
+       /* Send hello */
+       if (0 != stt_setting_dbus_request_hello()) {
+               __check_stt_daemon();
+       }
+
        /* do request */
-       int i = 0;
+       int i = 1;
        while(1) {
                ret = stt_setting_dbus_request_initialize();
 
@@ -54,8 +57,8 @@ int stt_setting_initialize ()
                        SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Engine not found");
                        break;
                } else if(ret) {
-                       sleep(1);
-                       if (i == 10) {
+                       usleep(1);
+                       if (i == CONNECTION_RETRY_COUNT) {
                                SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Connection Time out");
                                ret = STT_SETTING_ERROR_TIMED_OUT;                          
                                break;
@@ -67,7 +70,7 @@ int stt_setting_initialize ()
                }
        }
 
-       if (0 == ret) {
+       if (STT_SETTING_ERROR_NONE == ret) {
                g_is_setting_initialized = true;
                SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] Initialize");
        }
@@ -86,10 +89,10 @@ int stt_setting_finalize ()
        int ret = 0;
 
        if (false == g_is_setting_initialized) {
-               SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Not initialized");
+               SLOG(LOG_WARN, TAG_STTC, "[WARNING] Not initialized");
                SLOG(LOG_DEBUG, TAG_STTC, "=====");
                SLOG(LOG_DEBUG, TAG_STTC, " ");
-               return STT_SETTING_ERROR_INVALID_STATE;
+               return STT_SETTING_ERROR_NONE;
        }
 
        ret = stt_setting_dbus_request_finalilze();
@@ -545,35 +548,28 @@ static bool __stt_is_alive()
        FILE *fp = NULL;
        char buff[256] = {'\0',};
        char cmd[256] = {'\0',};
-       int i=0;
 
-       memset(buff, '\0', sizeof(char));
-       memset(cmd, '\0', sizeof(char));
+       memset(buff, '\0', sizeof(char) * 256);
+       memset(cmd, '\0', sizeof(char) * 256);
 
-       if ((fp = popen("ps -eo \"cmd\"", "r")) == NULL) {
-               SLOG(LOG_DEBUG, TAG_STTC, "[STT ERROR] popen error \n");
+       fp = popen("ps", "r");
+       if (NULL == fp) {
+               SLOG(LOG_DEBUG, TAG_STTC, "[STT SETTING ERROR] popen error \n");
                return FALSE;
        }
 
        while (fgets(buff, 255, fp)) {
-               if (i == 0) {
-                       i++;
-                       continue;
-               }
-
-               sscanf(buff, "%s", cmd);
+               strcpy(cmd, buff + 26);
 
                if( 0 == strncmp(cmd, "[stt-daemon]", strlen("[stt-daemon]")) ||
-                       0 == strncmp(cmd, "stt-daemon", strlen("stt-daemon")) ||
-                       0 == strncmp(cmd, "/usr/bin/stt-daemon", strlen("/usr/bin/stt-daemon"))
-                       ) {
+               0 == strncmp(cmd, "stt-daemon", strlen("stt-daemon")) ||
+               0 == strncmp(cmd, "/usr/bin/stt-daemon", strlen("/usr/bin/stt-daemon"))) {
                        SLOG(LOG_DEBUG, TAG_STTC, "stt-daemon is ALIVE !! \n");
                        fclose(fp);
                        return TRUE;
                }
-
-               i++;
        }
+
        fclose(fp);
 
        SLOG(LOG_DEBUG, TAG_STTC, "THERE IS NO stt-daemon !! \n");
@@ -603,8 +599,6 @@ int __check_stt_daemon()
                return 0;
        
        /* fork-exec stt-daemom */
-       SLOG(LOG_DEBUG, TAG_STTC, "THERE IS NO stt-daemon \n");
-
        int pid = 0, i = 0;
        struct sigaction act, dummy;
        act.sa_handler = NULL;
@@ -621,7 +615,7 @@ int __check_stt_daemon()
 
        switch(pid) {
        case -1:
-               SLOG(LOG_DEBUG, TAG_STTC, "fail to create STT-DAEMON \n");
+               SLOG(LOG_DEBUG, TAG_STTC, "Fail to create stt-daemon");
                break;
 
        case 0:
index 1b35c6176efdc25271e4271bb4bd39d82108069f..6f9154c526440f81fc03685974c564b69f0e7ba1 100644 (file)
@@ -15,6 +15,8 @@
 #include "stt_main.h"
 #include "stt_setting_dbus.h"
 
+static int g_waiting_time = 1500;
+
 static DBusConnection* g_conn = NULL;
 
 int stt_setting_dbus_open_connection()
@@ -85,6 +87,47 @@ int stt_setting_dbus_close_connection()
        return 0;
 }
 
+
+int stt_setting_dbus_request_hello()
+{
+       DBusMessage* msg;
+
+       msg = dbus_message_new_method_call(
+               STT_SERVER_SERVICE_NAME, 
+               STT_SERVER_SERVICE_OBJECT_PATH, 
+               STT_SERVER_SERVICE_INTERFACE, 
+               STT_SETTING_METHOD_HELLO);
+
+       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);
+
+       DBusMessage* result_msg = NULL;
+       int result = 0;
+
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 500, &err);
+
+       dbus_message_unref(msg);
+
+       if (NULL != result_msg) {
+               dbus_message_unref(result_msg);
+
+               SLOG(LOG_DEBUG, TAG_STTC, "<<<< setting hello");
+               result = 0;
+       } else {
+               SLOG(LOG_ERROR, TAG_STTC, "<<<< setting hello : no response");
+               result = -1;
+       }
+
+       return result;
+}
+
 int stt_setting_dbus_request_initialize()
 {
        DBusMessage* msg;
@@ -114,7 +157,7 @@ int stt_setting_dbus_request_initialize()
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -165,7 +208,7 @@ int stt_setting_dbus_request_finalilze(void)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -221,7 +264,7 @@ int stt_setting_dbus_request_get_engine_list(stt_setting_supported_engine_cb cal
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
 
        if (NULL != result_msg) {
                DBusMessageIter args;
@@ -313,7 +356,7 @@ int stt_setting_dbus_request_get_engine(char** engine_id)
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
        char* temp;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_STRING, &temp, DBUS_TYPE_INVALID);
@@ -379,7 +422,7 @@ int stt_setting_dbus_request_set_engine(const char* engine_id)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -437,7 +480,7 @@ int stt_setting_dbus_request_get_language_list(stt_setting_supported_language_cb
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
 
        if (NULL != result_msg) {
                DBusMessageIter args;
@@ -531,7 +574,7 @@ int stt_setting_dbus_request_get_default_language(char** language)
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
        char* temp_char;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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, 
@@ -602,7 +645,7 @@ int stt_setting_dbus_request_set_default_language(const char* language)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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, 
@@ -663,7 +706,7 @@ int stt_setting_dbus_request_get_engine_setting(stt_setting_engine_setting_cb ca
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
 
        if (NULL != result_msg) {
                DBusMessageIter args;
@@ -761,7 +804,7 @@ int stt_setting_dbus_request_set_engine_setting(const char* key, const char* val
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -819,7 +862,7 @@ int stt_setting_dbus_request_get_profanity_filter(bool* value)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INT32, value, DBUS_TYPE_INVALID);
@@ -874,7 +917,7 @@ int stt_setting_dbus_request_set_profanity_filter(const bool value)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -933,7 +976,7 @@ int stt_setting_dbus_request_get_punctuation_override(bool* value)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INT32, value, DBUS_TYPE_INVALID);
@@ -988,7 +1031,7 @@ int stt_setting_dbus_request_set_punctuation_override(const bool value )
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
@@ -1048,7 +1091,7 @@ int stt_setting_dbus_request_get_silence_detection(bool* value)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, g_waiting_time, &err);
 
        if (NULL == result_msg) {
                dbus_message_unref(msg);
@@ -1100,7 +1143,7 @@ int stt_setting_dbus_request_set_silence_detection(const bool value)
        DBusMessage* result_msg;
        int result = STT_SETTING_ERROR_OPERATION_FAILED;
 
-       result_msg = dbus_connection_send_with_reply_and_block(g_conn, msg, 3000, &err);
+       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_INVALID);
index 3efe94c45d8eb908b19c6da05c299a81c997b8b4..d70ea26d4a6b186bb29429f7e9835bf472b237b9 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
 * Message Definition for APIs
 *******************************************************************************************/
 
+#define STT_METHOD_HELLO               "stt_method_hello"
 #define STT_METHOD_INITIALIZE          "stt_method_initialize"
 #define STT_METHOD_FINALIZE            "stt_method_finalilze"
 #define STT_METHOD_GET_SUPPORT_LANGS   "stt_method_get_support_langs"
@@ -51,18 +52,18 @@ extern "C" {
 #define STT_METHOD_STOP                        "stt_method_stop"
 #define STT_METHOD_CANCEL              "stt_method_cancel"
 
-#define STT_SIGNAL_RESULT              "stt_signal_result"
-#define STT_SIGNAL_PARTIAL_RESULT      "stt_signal_partial_result"
-#define STT_SIGNAL_STOP                        "stt_signal_stop"
-#define STT_SIGNAL_ERROR               "stt_signal_error"
-
-#define STT_SIGNAL_STOP_BY_DAEMON      "STT_SIGNAL_STOP_BY_DAEMON"
+#define STT_METHOD_RESULT              "sttd_method_result"
+#define STT_METHOD_PARTIAL_RESULT      "sttd_method_partial_result"
+#define STT_METHOD_STOPED              "sttd_method_stop"
+#define STT_METHOD_ERROR               "sttd_method_error"
 
+#define STTD_METHOD_STOP_BY_DAEMON     "sttd_method_stop_by_daemon"
 
 /******************************************************************************************
 * Message Definition for Setting
 *******************************************************************************************/
 
+#define STT_SETTING_METHOD_HELLO               "stt_setting_method_hello"
 #define STT_SETTING_METHOD_INITIALIZE          "stt_setting_method_initialize"
 #define STT_SETTING_METHOD_FINALIZE            "stt_setting_method_finalilze"
 #define STT_SETTING_METHOD_GET_ENGINE_LIST     "stt_setting_method_get_engine_list"
index f484f8e91f728c9a767ca919d06bd63138c1962d..e6cb697e5f87eaaf303611bc8e5b758605854268 100644 (file)
@@ -1,7 +1,7 @@
-stt (0.1.1) unstable; urgency=low
+stt (0.1.1-1) unstable; urgency=low
 
-  * Beta release
-  * Git: tizen2/pkgs/s/stt
-  * Tag: stt_0.1.1
+  * 1.0 release
+  * Git: pkgs/s/stt
+  * Tag: stt_0.1.1-1
 
- -- Dongyeol Lee <dy3.lee@samsung.com>  Fri, 17 Feb 2012 13:49:31 +0900
+ -- Dongyeol Lee <dy3.lee@samsung.com>  Mon, 19 Mar 2012 10:54:03 +0900
index 1c166a21d04d8194c333dd3f0d9dde72d3697f83..3fc3df395647a765cd10b8cc44902c4ab5a50e09 100644 (file)
@@ -1,10 +1,10 @@
 Copyright (c) 2011 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.
+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.
index 26c87fe5c4483d8028ae321f754f2e4858f1fd4c..c4f2e48f10c1199b28bc095816a411cdd0b5ff8f 100644 (file)
@@ -3,8 +3,8 @@ Summary:    Speech To Text client library and daemon
 Version:    0.1.1
 Release:    1
 Group:      libs
-License:    Apache-2.0
-Source0:    %{name}-%{version}.tar.gz
+License:    Samsung
+Source0:    stt-0.1.1.tar.gz
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(glib-2.0)
@@ -42,6 +42,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr
 make %{?jobs:-j%jobs}
 
 %install
+rm -rf %{buildroot}
 %make_install
 
 
@@ -56,12 +57,14 @@ make %{?jobs:-j%jobs}
 
 
 %files
+%defattr(-,root,root,-)
 %{_libdir}/libstt.so
 %{_libdir}/libstt_setting.so
 %{_bindir}/stt-daemon
 
 
 %files devel
+%defattr(-,root,root,-)
 %{_libdir}/pkgconfig/stt.pc
 %{_libdir}/pkgconfig/stt-setting.pc
 %{_includedir}/stt.h
index 9c6db160e7c5d80e09fb2857ebe67f533f1ecf37..6f4697bbf5992ff116978161aa2614acbeec5cf5 100644 (file)
@@ -32,6 +32,10 @@ int sttdc_send_result(int uid, const char* type, const char** data, int data_cou
                return -1;
        }
 
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[128];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
 
@@ -39,10 +43,11 @@ int sttdc_send_result(int uid, const char* type, const char** data, int data_cou
        
        SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send result signal : uid(%d), type(%s), result count(%d)", uid, type, data_count);
 
-       msg = dbus_message_new_signal(
-               STT_CLIENT_SERVICE_OBJECT_PATH,  
-               target_if_name,                  
-               STT_SIGNAL_RESULT );              
+       msg = dbus_message_new_method_call(
+               service_name, 
+               STT_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               STT_METHOD_RESULT);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message"); 
@@ -135,17 +140,22 @@ int sttdc_send_partial_result(int uid, const char* data)
                return -1;
        }
 
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[128];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
 
        DBusMessage* msg;
 
        SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send result signal : uid(%d), result(%s)", uid, data);
-
-       msg = dbus_message_new_signal(
-               STT_CLIENT_SERVICE_OBJECT_PATH,  
-               target_if_name,                  
-               STT_SIGNAL_PARTIAL_RESULT );              
+       msg = dbus_message_new_method_call(
+               service_name, 
+               STT_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               STT_METHOD_PARTIAL_RESULT);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message"); 
@@ -190,15 +200,21 @@ int sttdc_send_error_signal(int uid, int reason, char *err_msg)
                return -1;
        }
 
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[128];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
 
        DBusMessage* msg;
        SLOG(LOG_DEBUG, TAG_STTD, "[Dbus] send error signal : reason(%d), Error Msg(%s)", reason, err_msg);
-       msg = dbus_message_new_signal(
-               STT_CLIENT_SERVICE_OBJECT_PATH,  /* object name of the signal */
-               target_if_name,                  /* interface name of the signal */
-               STT_SIGNAL_ERROR );              /* name of the signal */
+
+       msg = dbus_message_new_method_call(
+               service_name, 
+               STT_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               STT_METHOD_PARTIAL_RESULT);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create message"); 
@@ -231,6 +247,10 @@ int sttd_send_stop(int uid)
                return -1;
        }
 
+       char service_name[64];
+       memset(service_name, 0, 64);
+       snprintf(service_name, 64, "%s%d", STT_CLIENT_SERVICE_NAME, pid);
+
        char target_if_name[64];
        snprintf(target_if_name, sizeof(target_if_name), "%s%d", STT_CLIENT_SERVICE_INTERFACE, pid);
 
@@ -238,11 +258,11 @@ int sttd_send_stop(int uid)
 
        DBusMessage* msg;
 
-       /* create a signal & check for errors */
-       msg = dbus_message_new_signal(
-               STT_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */
-               target_if_name,                 /* interface name of the signal */
-               STT_SIGNAL_STOP );              /* name of the signal */
+       msg = dbus_message_new_method_call(
+               service_name, 
+               STT_CLIENT_SERVICE_OBJECT_PATH, 
+               target_if_name, 
+               STT_METHOD_STOPED);
 
        if (NULL == msg) { 
                SLOG(LOG_ERROR, TAG_STTD, "[Dbus ERROR] Fail to create stop message"); 
@@ -283,10 +303,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
 
        /* daemon internal event */
-       if (dbus_message_is_signal(msg, STT_SERVER_SERVICE_INTERFACE, STT_SIGNAL_STOP_BY_DAEMON))
+       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))
+               sttd_dbus_server_hello(conn, msg);
+
        else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_METHOD_INITIALIZE))
                sttd_dbus_server_initialize(conn, msg);
        
@@ -316,6 +339,9 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
 
 
        /* setting event */
+       else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_SETTING_METHOD_HELLO))
+               sttd_dbus_server_hello(conn, msg);
+
        else if (dbus_message_is_method_call(msg, STT_SERVER_SERVICE_INTERFACE, STT_SETTING_METHOD_INITIALIZE))
                sttd_dbus_server_setting_initialize(conn, msg);
 
@@ -459,10 +485,11 @@ int sttd_send_stop_recognition_by_daemon(int uid)
 {
        DBusMessage* msg;
 
-       msg = dbus_message_new_signal(
-               STT_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */
-               STT_SERVER_SERVICE_INTERFACE,   /* interface name of the signal */
-               STT_SIGNAL_STOP_BY_DAEMON );    /* name of the signal */
+       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'"); 
index cf8b6cb3ba23139bd8a345625ab65f3bc461537d..159231a2143b89fe3b1f75b4c13e44913c0e279b 100644 (file)
 * Dbus Client-Daemon Server
 */ 
 
+int sttd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg)
+{
+       SLOG(LOG_DEBUG, TAG_STTD, ">>>>> STT Hello");
+
+       DBusMessage* reply;
+       reply = dbus_message_new_method_return(msg);
+
+       if (NULL != reply) {
+               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_initialize(DBusConnection* conn, DBusMessage* msg)
 {
        DBusError err;
@@ -30,6 +54,10 @@ int sttd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
 
        int pid;
        int uid;
+       bool silence_supported = false;
+       bool profanity_supported = false;
+       bool punctuation_supported = false;
+
        int ret = STTD_ERROR_OPERATION_FAILED;
 
        dbus_message_get_args(msg, &err,
@@ -45,17 +73,23 @@ int sttd_dbus_server_initialize(DBusConnection* conn, DBusMessage* msg)
                ret = STTD_ERROR_OPERATION_FAILED;
        } else {
                SLOG(LOG_DEBUG, TAG_STTD, "[IN] stt initialize : pid(%d), uid(%d)", pid , uid); 
-               ret =  sttd_server_initialize(pid, uid);
+               ret =  sttd_server_initialize(pid, uid, &silence_supported, &profanity_supported, &punctuation_supported);
        }
 
        DBusMessage* reply;
        reply = dbus_message_new_method_return(msg);
 
        if (NULL != reply) {
-               dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+               dbus_message_append_args(reply, 
+                       DBUS_TYPE_INT32, &ret, 
+                       DBUS_TYPE_INT32, &silence_supported,
+                       DBUS_TYPE_INT32, &profanity_supported,
+                       DBUS_TYPE_INT32, &punctuation_supported,
+                       DBUS_TYPE_INVALID);
 
                if (0 == ret) {
-                       SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d)", ret); 
+                       SLOG(LOG_DEBUG, TAG_STTD, "[OUT SUCCESS] Result(%d), silence(%d), profanity(%d), punctuation(%d)", 
+                               ret, silence_supported, profanity_supported, punctuation_supported); 
                } else {
                        SLOG(LOG_ERROR, TAG_STTD, "[OUT ERROR] Result(%d)", ret); 
                }
index 23a55ab41bdfb1d3e81eb8af2c856b53feed9095..2c203ac840928715f08fa3c23f9ad3cd8f8a0128 100644 (file)
@@ -23,6 +23,9 @@ extern "C" {
 
 #include <dbus/dbus.h>
 
+
+int sttd_dbus_server_hello(DBusConnection* conn, DBusMessage* msg);
+
 /*
 * Dbus Server functions for APIs
 */ 
index c18e09e95b6e72df79897047fea077f7fc52fd6a..2d7195a97c9e277140ae9bb1f426cec46373a050 100644 (file)
@@ -36,6 +36,8 @@ typedef struct {
        bool    is_loaded;      
        bool    need_network;
        bool    support_silence_detection;
+       bool    support_profanity_filter;
+       bool    support_punctuation_override;
        void    *handle;
 
        /* engine base setting */
@@ -460,43 +462,78 @@ int __internal_update_engine_list()
                }
        }
 
-       /* get file name from engine directory and get engine infomation from each filename */
+       /* Get file name from default engine directory */
        DIR *dp;
        struct dirent *dirp;
-       dp  = opendir(ENGINE_DIRECTORY);
-       if (NULL == dp) {
-               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] __internal_update_engine_list : error opendir"); 
-               return -1;
-       }
 
-       while (NULL != (dirp = readdir(dp))) {
-               sttengine_info_s* info;
-               char* filepath;
-               int filesize;
-               
-               filesize = strlen(ENGINE_DIRECTORY) + strlen(dirp->d_name) + 5;
-               filepath = (char*) g_malloc0(sizeof(char) * filesize);
-               
-               if (NULL != filepath) {
-                       strncpy(filepath, ENGINE_DIRECTORY, strlen(ENGINE_DIRECTORY) );
-                       strncat(filepath, "/", strlen("/") );
-                       strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
-               } else {
-                       SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Memory not enough!!" );
-                       continue;       
-               }
-               
-               /* get its info and update engine list */
-               if (0 == __internal_get_engine_info(filepath, &info)) {
-                       /* add engine info to g_engine_list */
-                       g_engine_list = g_list_append(g_engine_list, info);
+       dp  = opendir(ENGINE_DIRECTORY_DEFAULT);
+       if (NULL != dp) {
+               while (NULL != (dirp = readdir(dp))) {
+                       sttengine_info_s* info;
+                       char* filepath;
+                       int filesize;
+
+                       filesize = strlen(ENGINE_DIRECTORY_DEFAULT) + strlen(dirp->d_name) + 5;
+                       filepath = (char*) g_malloc0(sizeof(char) * filesize);
+
+                       if (NULL != filepath) {
+                               strncpy(filepath, ENGINE_DIRECTORY_DEFAULT, strlen(ENGINE_DIRECTORY_DEFAULT) );
+                               strncat(filepath, "/", strlen("/") );
+                               strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
+                       } else {
+                               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Memory not enough!!" );
+                               continue;       
+                       }
+
+                       /* get its info and update engine list */
+                       if (0 == __internal_get_engine_info(filepath, &info)) {
+                               /* add engine info to g_engine_list */
+                               g_engine_list = g_list_append(g_engine_list, info);
+                       }
+
+                       if (NULL != filepath)
+                               g_free(filepath);
                }
 
-               if (NULL != filepath)
-                       g_free(filepath);
+               closedir(dp);
+       } else {
+               SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open default directory"); 
        }
+       
+       /* Get file name from downloadable engine directory */
+       dp  = opendir(ENGINE_DIRECTORY_DOWNLOAD);
+       if (NULL != dp) {
+               while (NULL != (dirp = readdir(dp))) {
+                       sttengine_info_s* info;
+                       char* filepath;
+                       int filesize;
+
+                       filesize = strlen(ENGINE_DIRECTORY_DOWNLOAD) + strlen(dirp->d_name) + 5;
+                       filepath = (char*) g_malloc0(sizeof(char) * filesize);
+
+                       if (NULL != filepath) {
+                               strncpy(filepath, ENGINE_DIRECTORY_DOWNLOAD, strlen(ENGINE_DIRECTORY_DOWNLOAD) );
+                               strncat(filepath, "/", strlen("/") );
+                               strncat(filepath, dirp->d_name, strlen(dirp->d_name) );
+                       } else {
+                               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Memory not enough!!" );
+                               continue;       
+                       }
 
-       closedir(dp);
+                       /* get its info and update engine list */
+                       if (0 == __internal_get_engine_info(filepath, &info)) {
+                               /* add engine info to g_engine_list */
+                               g_engine_list = g_list_append(g_engine_list, info);
+                       }
+
+                       if (NULL != filepath)
+                               g_free(filepath);
+               }
+
+               closedir(dp);
+       } else {
+               SLOG(LOG_WARN, TAG_STTD, "[Engine Agent WARNING] Fail to open downloadable directory"); 
+       }
 
        if (0 >= g_list_length(g_engine_list)) {
                SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] No Engine"); 
@@ -567,7 +604,6 @@ int __internal_set_current_engine(const char* engine_uuid)
        g_cur_engine.is_loaded = false;
        g_cur_engine.is_set = true;
        g_cur_engine.need_network = data->use_network;
-       g_cur_engine.support_silence_detection = data->support_silence_detection;
 
        g_cur_engine.profanity_filter = g_default_profanity_filter;
        g_cur_engine.punctuation_override = g_default_punctuation_override;
@@ -654,11 +690,16 @@ int sttd_engine_agent_load_current_engine()
                return STTD_ERROR_OPERATION_FAILED;
        }
        
+       /* check and set profanity filter */
        ret = g_cur_engine.pefuncs->set_profanity_filter(g_cur_engine.profanity_filter);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_STTD, "[Engine ERROR] Fail to set profanity filter value to engine");
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent] Not support profanity filter");
+               g_cur_engine.support_profanity_filter = false;
+       } else {
+               g_cur_engine.support_profanity_filter = true;
        }
        
+       /* check and set punctuation */
        if (NULL == g_cur_engine.pefuncs->set_punctuation) {
                SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] set_punctuation of engine is NULL!!");
                return STTD_ERROR_OPERATION_FAILED;
@@ -666,19 +707,24 @@ int sttd_engine_agent_load_current_engine()
 
        ret = g_cur_engine.pefuncs->set_punctuation(g_cur_engine.punctuation_override);
        if (0 != ret) {
-               SLOG(LOG_ERROR, TAG_STTD, "[Engine ERROR] Fail to set punctuation override value to engine");
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine ERROR] Not support punctuation override");
+               g_cur_engine.support_punctuation_override = false;
+       } else {
+               g_cur_engine.support_punctuation_override = true;
        }
-       
-       if (true == g_cur_engine.support_silence_detection) {
-               if (NULL == g_cur_engine.pefuncs->set_silence_detection) {
-                       SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] set_silence_detection of engine is NULL!!");
-                       return STTD_ERROR_OPERATION_FAILED;
-               }
 
-               ret = g_cur_engine.pefuncs->set_silence_detection(g_cur_engine.silence_detection);
-               if (0 != ret) {
-                       SLOG(LOG_ERROR, TAG_STTD, "[Engine ERROR] Fail to set silence detection value(%s)", g_cur_engine.silence_detection ? "true":"false");
-               }
+       /* check and set silence detection */
+       if (NULL == g_cur_engine.pefuncs->set_silence_detection) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] set_silence_detection of engine is NULL!!");
+               return STTD_ERROR_OPERATION_FAILED;
+       }
+
+       ret = g_cur_engine.pefuncs->set_silence_detection(g_cur_engine.silence_detection);
+       if (0 != ret) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine ERROR] Not support silence detection");
+               g_cur_engine.support_silence_detection = false;
+       } else {
+               g_cur_engine.support_silence_detection = true;
        }
        
        /* select default language */
@@ -799,6 +845,30 @@ bool sttd_engine_agent_need_network()
        return g_cur_engine.need_network;
 }
 
+int sttd_engine_get_option_supported(bool* silence, bool* profanity, bool* punctuation)
+{
+       if (false == g_agent_init) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not Initialized" );
+               return STTD_ERROR_INVALID_STATE;
+       }
+
+       if (false == g_cur_engine.is_loaded) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Not loaded engine");
+               return STTD_ERROR_OPERATION_FAILED;
+       }
+
+       if (NULL == silence || NULL == profanity || NULL == punctuation) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Engine Agent ERROR] Invalid Parameter"); 
+               return STTD_ERROR_INVALID_PARAMETER;
+       }
+
+       *silence = g_cur_engine.support_silence_detection;
+       *profanity = g_cur_engine.support_profanity_filter;
+       *punctuation = g_cur_engine.support_punctuation_override;
+
+       return 0;
+}
+
 /*
 * STT Engine Interfaces for client
 */
index aa5a875bec5a92435092bfeab65b59f6fbbffd07..d9c4a7d4dfc18d3401c97b91bc94364bf598782a 100644 (file)
@@ -63,6 +63,8 @@ int sttd_print_enginelist();
 /** Get state of current engine to need network */
 bool sttd_engine_agent_need_network();
 
+int sttd_engine_get_option_supported(bool* silence, bool* profanity, bool* punctuation);
+
 /*
 * STT Engine Interfaces for client
 */
index 0e0f55032a347279f8a95fbacd7a61b85fd9d24f..57fc5f997865d55c48d7d6290e18e655ec2cd05b 100644 (file)
@@ -34,8 +34,11 @@ extern "C" {
 
 #define TAG_STTD "sttd"
 
-#define ENGINE_DIRECTORY "/usr/lib/voice/stt/1.0/engine"
-#define ENGINE_DIRECTORY_DOWNLOAD "/opt/apps/voice/stt/engine"
+#define ENGINE_DIRECTORY_DEFAULT               "/usr/lib/voice/stt/1.0/engine"
+#define ENGINE_DIRECTORY_DEFAULT_SETTING       "/usr/lib/voice/stt/1.0/setting"
+
+#define ENGINE_DIRECTORY_DOWNLOAD              "/opt/apps/voice/stt/1.0/engine"
+#define ENGINE_DIRECTORY_DOWNLOAD_SETTING      "/opt/apps/voice/stt/1.0/setting"
 
 /* for debug message */
 #define RECORDER_DEBUG
@@ -51,7 +54,8 @@ typedef enum {
        STTD_ERROR_INVALID_STATE        = -0x0100031,   /**< Invalid state */
        STTD_ERROR_INVALID_LANGUAGE     = -0x0100032,   /**< Invalid language */
        STTD_ERROR_ENGINE_NOT_FOUND     = -0x0100033,   /**< No available engine  */    
-       STTD_ERROR_OPERATION_FAILED     = -0x0100034    /**< Operation failed  */
+       STTD_ERROR_OPERATION_FAILED     = -0x0100034,   /**< Operation failed  */
+       STTD_ERROR_NOT_SUPPORTED_FEATURE= -0x0100035    /**< Not supported feature of current engine */
 }stt_error_e;
 
 typedef struct {
index da65b56d406b76191a125e602c301e578c6a6a17..ee831166ea5534c86ce8e06987e96e607e4db4a1 100644 (file)
@@ -576,14 +576,16 @@ int sttd_recorder_start()
 
        /* Check if initialized */
        ret = __recorder_setup();
-       if (ret) {
+       if (0 != ret) {
                SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_setup");
+               return STTD_ERROR_OPERATION_FAILED;
        }
 
        /* Start camcorder */
        ret = __recorder_run();
-       if (ret) {
-               SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_run");                
+       if (0 != ret) {
+               SLOG(LOG_DEBUG, TAG_STTD, "[Recorder] Fail to call __recorder_run");    
+               return STTD_ERROR_OPERATION_FAILED;
        }
 
        __recorder_state_set(STTD_RECORDER_STATE_RECORDING);
index 2ca713089582f708a98d87f6d03b1d911f033622..8fba549120dcb11a84e6a9324dbd90f695bc4aa0 100644 (file)
@@ -258,7 +258,7 @@ int sttd_initialize()
 * STT Server Functions for Client
 */
 
-int sttd_server_initialize(int pid, int uid)
+int sttd_server_initialize(int pid, int uid, bool* silence, bool* profanity, bool* punctuation)
 {
        if (false == g_is_engine) {
                if (0 != sttd_engine_agent_initialize_current_engine()) {
@@ -321,13 +321,20 @@ int sttd_server_initialize(int pid, int uid)
                return STTD_ERROR_OPERATION_FAILED;
        }
        
+       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)) {
                SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to add client info"); 
                return STTD_ERROR_OPERATION_FAILED;
        }
 
-       SLOG(LOG_DEBUG, TAG_STTD, "[Server SUCCESS] audio type(%d), channel(%d)", (int)atype, (int)sttchannel); 
+       if (0 != sttd_engine_get_option_supported(silence, profanity, punctuation)) {
+               SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get engine options supported"); 
+               return STTD_ERROR_OPERATION_FAILED;
+       }
+
+       SLOG(LOG_DEBUG, TAG_STTD, "[Server Success] Initialize"); 
 
        return STTD_ERROR_NONE;
 }
index 878998f935379f3347b9a692727c5d59477db8d2..634f424e3232cd2ae858bd22b6e197a85f9e4634 100644 (file)
@@ -29,7 +29,7 @@ int sttd_initialize();
 * API for client
 */
 
-int sttd_server_initialize(int pid, int uid);
+int sttd_server_initialize(int pid, int uid, bool* silence, bool* profanity, bool* punctuation);
 
 int sttd_server_finalize(const int uid);
 
index da393f844330438fda4e50afdd20c21260f26920..3af02713df1560847fd9c9847592d709f251c2a8 100644 (file)
@@ -38,7 +38,7 @@ typedef enum {
        STTP_ERROR_INVALID_STATE        = -0x0100031,   /**< Invalid state */
        STTP_ERROR_INVALID_LANGUAGE     = -0x0100032,   /**< Invalid language */
        STTP_ERROR_OPERATION_FAILED     = -0x0100034,   /**< Operation failed */
-       STTP_ERROR_NOT_SUPPORTED        = -0x0100035    /**< Not supported function */
+       STTP_ERROR_NOT_SUPPORTED_FEATURE= -0x0100035    /**< Not supported feature */
 }sttp_error_e;
 
 /**
@@ -149,15 +149,79 @@ typedef enum {
 */
 #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"
+
+/** 
+* @brief Result warning message : The speech has started too soon
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_SOON   "stt.result.message.warning.too.soon"
+
+/** 
+* @brief Result warning message : The speech is too short
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_SHORT  "stt.result.message.warning.too.short"
+
+/** 
+* @brief Result warning message : The speech is too long
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_LONG   "stt.result.message.warning.too.long"
+
+/** 
+* @brief Result warning message : The speech is too quiet to listen
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_QUIET  "stt.result.message.warning.too.quiet"
+
+/** 
+* @brief Result warning message : The speech is too loud to listen
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_LOUD   "stt.result.message.warning.too.loud"
+
+/** 
+* @brief Result warning message : The speech is too fast to listen
+*/
+#define STTP_RESULT_MESSAGE_WARNING_TOO_FAST   "stt.result.message.warning.too.fast"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too soon
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_SOON     "stt.result.message.error.too.soon"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too short
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_SHORT    "stt.result.message.error.too.short"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too long
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_LONG     "stt.result.message.error.too.long"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too quiet to listen
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_QUIET    "stt.result.message.error.too.quiet"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too loud to listen 
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_LOUD     "stt.result.message.error.too.loud"
+
+/** 
+* @brief Result error message : Recognition was failed because the speech started too fast to listen
+*/
+#define STTP_RESULT_MESSAGE_ERROR_TOO_FAST     "stt.result.message.error.too.fast"
 
 /** 
 * @brief Called to get recognition result.
 * 
 * @param[in] event A result event
-* @param[in] type A recognition type
+* @param[in] type A recognition type (e.g. #STTP_RECOGNITION_TYPE_FREE, #STTP_RECOGNITION_TYPE_COMMAND)
 * @param[in] data Result texts
 * @param[in] data_count Result text count
-* @param[in] msg engine A Message
+* @param[in] msg Engine message (e.g. #STTP_RESULT_MESSAGE_WARNING_TOO_SOON, #STTP_RESULT_MESSAGE_ERROR_TOO_SHORT)
 * @param[in] user_data The user data passed from the start function
 *
 * @pre sttpe_stop() will invoke this callback.
@@ -321,7 +385,7 @@ typedef int (* sttpe_get_recording_format)(sttp_audio_type_e* types, int* rate,
 * @return 0 on success, otherwise a negative error value
 * @retval #STTP_ERROR_NONE Successful
 * @retval #STTP_ERROR_INVALID_STATE Not initialized
-* @retval #STTP_ERROR_NOT_SUPPORTED Not supported
+* @retval #STTP_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
 */
 typedef int (* sttpe_set_profanity_filter)(bool value);
 
@@ -333,7 +397,7 @@ typedef int (* sttpe_set_profanity_filter)(bool value);
 * @return 0 on success, otherwise a negative error value
 * @retval #STTP_ERROR_NONE Successful
 * @retval #STTP_ERROR_INVALID_STATE Not initialized
-* @retval #STTP_ERROR_NOT_SUPPORTED Not supported
+* @retval #STTP_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
 */
 typedef int (* sttpe_set_punctuation_override)(bool value);
 
@@ -345,7 +409,7 @@ typedef int (* sttpe_set_punctuation_override)(bool value);
 * @return 0 on success, otherwise a negative error value
 * @retval #STTP_ERROR_NONE Successful
 * @retval #STTP_ERROR_INVALID_STATE Not initialized
-* @retval #STTP_ERROR_NOT_SUPPORTED Not supported
+* @retval #STTP_ERROR_NOT_SUPPORTED_FEATURE Not supported feature
 */
 typedef int (* sttpe_set_silence_detection)(bool value);
 
@@ -353,7 +417,7 @@ typedef int (* sttpe_set_silence_detection)(bool value);
 * @brief Start recognition.
 *
 * @param[in] language A language. 
-* @param[in] type A recognition type.
+* @param[in] type A recognition type. (e.g. #STTP_RECOGNITION_TYPE_FREE, #STTP_RECOGNITION_TYPE_WEB_SEARCH)
 * @param[in] user_data The user data to be passed to the callback function. 
 *
 * @return 0 on success, otherwise a negative error value