Tizen Native API
4.0
|
The STT Engine APIs provide functions to operate Speech-To-Text Engine.
#include <stte.h>
Speech-To-Text Engine (below STTE) is an engine for recording speech and resulting in texts of speech recognition. Using the STT Engine APIs, STTE developers can provide STTE service users, who want to apply STTE, with functions necessary to operate the engine. According to the indispensability of STTE services, there are two ways to provide them to the users.
A. Required STTE services
These services are indispensable to operate STTE. Therefore, the STTE developers MUST implement callback functions corresponding to the required STTE services. The following is a list of the callback functions.
FUNCTION | DESCRIPTION |
---|---|
stte_get_info_cb() | Called when the engine service user requests the basic information of STT engine. |
stte_initialize_cb() | Called when the engine service user initializes STT engine. |
stte_deinitialize_cb() | Called when the engine service user deinitializes STT engine. |
stte_is_valid_language_cb() | Called when the engine service user checks whether the corresponding language is valid or not. |
stte_foreach_supported_langs_cb() | Called when the engine service user gets the whole supported language list. |
stte_support_silence_detection_cb() | Called when the engine service user checks whether STT engine supports silence detection. |
stte_set_silence_detection_cb() | Called when the engine service user sets the silence detection. |
stte_support_recognition_type_cb() | Called when the engine service user checks whether STT engine supports the corresponding recognition type. |
stte_get_recording_format_cb() | Called when the engine service user gets the proper recording format of STT engine. |
stte_set_recording_data_cb() | Called when the engine service user sets and sends the recording data for speech recognition. |
stte_foreach_result_time_cb() | Called when the engine service user gets the result time information(stamp). |
stte_start_cb() | Called when the engine service user starts to recognize the recording data. |
stte_stop_cb() | Called when the engine service user stops to recognize the recording data. |
stte_cancel_cb() | Called when the engine service user cancels to recognize the recording data. |
stte_check_app_agreed_cb() | Called when the engine service user requests for STT engine to check whether the application agreed the usage of STT engine. |
stte_need_app_credential_cb() | Called when the engine service user checks whether STT engine needs the application's credential. |
The STTE developers can register the above callback functions at a time with using a structure 'stte_request_callback_s' and an API 'stte_main()'. To operate STTE, the following steps should be used:
1. Create a structure 'stte_request_callback_s'.
2. Implement callback functions. (NOTE that the callback functions should return appropriate values in accordance with the instruction. If the callback function returns an unstated value, STT framework will handle it as STTE_ERROR_OPERATION_FAILED.)
3. Register callback functions using 'stte_main()'. (The registered callback functions will be called when the STTE service users request the STTE services.)
4. Use 'service_app_main()' for working STTE.
B. Optional STTE services
Unlike the required STTE services, these services are optional to operate STTE. The followings are optional STTE services.
FUNCTION | DESCRIPTION | CORRESPONDING CALLBACK |
---|---|---|
stte_set_private_data_set_cb() | Sets a callback function for receiving the private data from the engine service user. | stte_private_data_set_cb() |
stte_set_private_data_requested_cb() | Sets a callback function for providing the private data to the engine service user. | stte_private_data_requested_cb() |
FUNCTION | DESCRIPTION |
---|---|
stte_send_result() | Sends the recognition result to the engine service user. |
stte_send_error() | Sends the error to the engine service user. |
stte_send_speech_status() | Sends the speech status to the engine service user when STT engine notifies the change of the speech status. |
This API is related with the following features:
Functions | |
int | stte_main (int argc, char **argv, stte_request_callback_s *callback) |
Main function for Speech-To-Text (STT) engine. | |
int | stte_send_result (stte_result_event_e event, const char *type, const char **result, int result_count, const char *msg, void *time_info, void *user_data) |
Sends the recognition result to the engine service user. | |
int | stte_send_error (stte_error_e error, const char *msg) |
Sends the error to the engine service user. | |
int | stte_send_speech_status (stte_speech_status_e status, void *user_data) |
Sends the speech status to the engine service user when STT engine notifies the change of the speech status. | |
int | stte_set_private_data_set_cb (stte_private_data_set_cb callback_func) |
Sets a callback function for setting the private data. | |
int | stte_set_private_data_requested_cb (stte_private_data_requested_cb callback_func) |
Sets a callback function for requesting the private data. | |
Typedefs | |
typedef bool(* | stte_result_time_cb )(int index, stte_result_time_event_e event, const char *text, long start_time, long end_time, void *user_data) |
Called when STT engine provides the time stamp of result to the engine service user. | |
typedef bool(* | stte_supported_language_cb )(const char *language, void *user_data) |
Called when STT engine informs the engine service user about whole supported language list. | |
typedef int(* | stte_initialize_cb )(void) |
Called when the engine service user initializes STT engine. | |
typedef int(* | stte_deinitialize_cb )(void) |
Called when the engine service user deinitializes STT engine. | |
typedef int(* | stte_foreach_supported_langs_cb )(stte_supported_language_cb callback, void *user_data) |
Called when the engine service user gets the whole supported language list. | |
typedef int(* | stte_is_valid_language_cb )(const char *language, bool *is_valid) |
Called when the engine service user checks whether the corresponding language is valid or not in STT engine. | |
typedef bool(* | stte_support_silence_detection_cb )(void) |
Called when the engine service user checks whether STT engine supports silence detection. | |
typedef int(* | stte_support_recognition_type_cb )(const char *type, bool *is_supported) |
Called when the engine service user checks whether STT engine supports the corresponding recognition type. | |
typedef int(* | stte_get_recording_format_cb )(stte_audio_type_e *types, int *rate, int *channels) |
Called when the engine service user gets the proper recording format of STT engine. | |
typedef int(* | stte_set_silence_detection_cb )(bool is_set) |
Called when the engine service user sets the silence detection. | |
typedef int(* | stte_check_app_agreed_cb )(const char *appid, bool *is_agreed) |
Called when the engine service user requests for STT engine to check whether the application agreed the usage of STT engine. | |
typedef bool(* | stte_need_app_credential_cb )(void) |
Called when the engine service user checks whether STT engine needs the application's credential. | |
typedef int(* | stte_foreach_result_time_cb )(void *time_info, stte_result_time_cb callback, void *user_data) |
Called when the engine service user gets the result time information(stamp). | |
typedef int(* | stte_start_cb )(const char *language, const char *type, const char *appid, const char *credential, void *user_data) |
Called when the engine service user starts to recognize the recording data. | |
typedef int(* | stte_set_recording_data_cb )(const void *data, unsigned int length) |
Called when the engine service user sets and sends the recording data for speech recognition. | |
typedef int(* | stte_stop_cb )(void) |
Called when the engine service user stops to recognize the recording data. | |
typedef int(* | stte_cancel_cb )(void) |
Called when the engine service user cancels to recognize the recording data. | |
typedef int(* | stte_get_info_cb )(char **engine_uuid, char **engine_name, char **engine_setting, bool *use_network) |
Called when the engine service user requests the basic information of STT engine. | |
typedef int(* | stte_private_data_set_cb )(const char *key, const char *data) |
Called when STT engine receives the private data from the engine service user. | |
typedef int(* | stte_private_data_requested_cb )(const char *key, char **data) |
Called when STT engine provides the engine service user with the private data. | |
Defines | |
#define | STTE_RECOGNITION_TYPE_FREE "stt.recognition.type.FREE" |
Definition for free form dictation and default type. | |
#define | STTE_RECOGNITION_TYPE_FREE_PARTIAL "stt.recognition.type.FREE.PARTIAL" |
Definition for free form dictation continuously. | |
#define | STTE_RESULT_MESSAGE_NONE "stt.result.message.none" |
Definition for None message. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_SOON "stt.result.message.error.too.soon" |
Definition for failed recognition because the speech started too soon. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_SHORT "stt.result.message.error.too.short" |
Definition for failed recognition because the speech started too short. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_LONG "stt.result.message.error.too.long" |
Definition for failed recognition because the speech started too long. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_QUIET "stt.result.message.error.too.quiet" |
Definition for failed recognition because the speech started too quiet to listen. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_LOUD "stt.result.message.error.too.loud" |
Definition for failed recognition because the speech started too loud to listen. | |
#define | STTE_RESULT_MESSAGE_ERROR_TOO_FAST "stt.result.message.error.too.fast" |
Definition for failed recognition because the speech started too fast to listen. |
#define STTE_RECOGNITION_TYPE_FREE "stt.recognition.type.FREE" |
Definition for free form dictation and default type.
#define STTE_RECOGNITION_TYPE_FREE_PARTIAL "stt.recognition.type.FREE.PARTIAL" |
Definition for free form dictation continuously.
#define STTE_RESULT_MESSAGE_ERROR_TOO_FAST "stt.result.message.error.too.fast" |
Definition for failed recognition because the speech started too fast to listen.
#define STTE_RESULT_MESSAGE_ERROR_TOO_LONG "stt.result.message.error.too.long" |
Definition for failed recognition because the speech started too long.
#define STTE_RESULT_MESSAGE_ERROR_TOO_LOUD "stt.result.message.error.too.loud" |
Definition for failed recognition because the speech started too loud to listen.
#define STTE_RESULT_MESSAGE_ERROR_TOO_QUIET "stt.result.message.error.too.quiet" |
Definition for failed recognition because the speech started too quiet to listen.
#define STTE_RESULT_MESSAGE_ERROR_TOO_SHORT "stt.result.message.error.too.short" |
Definition for failed recognition because the speech started too short.
#define STTE_RESULT_MESSAGE_ERROR_TOO_SOON "stt.result.message.error.too.soon" |
Definition for failed recognition because the speech started too soon.
#define STTE_RESULT_MESSAGE_NONE "stt.result.message.none" |
Definition for None message.
typedef int(* stte_cancel_cb)(void) |
Called when the engine service user cancels to recognize the recording data.
This callback function is called by the engine service user to cancel to recognize the recording data. Also, when starting the recorder is failed, this function is called.
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful. |
STTE_ERROR_INVALID_STATE | Invalid state. |
typedef int(* stte_check_app_agreed_cb)(const char *appid, bool *is_agreed) |
Called when the engine service user requests for STT engine to check whether the application agreed the usage of STT engine.
This callback function is called when the engine service user requests for STT engine to check the application's agreement about using the engine. According to the need, the engine developer can provide some user interfaces to check the agreement.
true
if the developer regards that every application agreed the usage of the engine, false
if the developer regards that every application disagreed. NOTE that, however, there may be any legal issue unless the developer checks the agreement. Therefore, we suggest that the engine developers should provide a function to check the agreement. [in] | appid | The Application ID |
[out] | is_agreed | A variable for checking whether the application agreed to use STT engine or not. true to agree, false to disagree |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_STATE | Not initialized |
STTE_ERROR_NOT_SUPPORTED_FEATURE | Not supported feature |
typedef int(* stte_deinitialize_cb)(void) |
Called when the engine service user deinitializes STT engine.
This callback function is called by the engine service user to request for STT engine to be deinitialized.
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_STATE | Not initialized |
typedef int(* stte_foreach_result_time_cb)(void *time_info, stte_result_time_cb callback, void *user_data) |
Called when the engine service user gets the result time information(stamp).
false
, it should be stopped to call 'stte_result_time_cb()'. time_info is transferred from stte_send_result(). The type of time_info is up to the STT engine developer. [in] | time_info | The time information |
[in] | callback | The callback function |
[in] | user_data | The user data which must be passed to the callback function 'stte_result_time_cb()' |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_INVALID_STATE | Not initialized |
typedef int(* stte_foreach_supported_langs_cb)(stte_supported_language_cb callback, void *user_data) |
Called when the engine service user gets the whole supported language list.
false
, it should be stopped to call 'stte_supported_language_cb()'. [in] | callback | The callback function |
[in] | user_data | The user data which must be passed to the callback function 'stte_supported_language_cb()' |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_INVALID_STATE | Not initialized |
typedef int(* stte_get_info_cb)(char **engine_uuid, char **engine_name, char **engine_setting, bool *use_network) |
Called when the engine service user requests the basic information of STT engine.
[out] | engine_uuid | UUID of engine |
[out] | engine_name | Name of engine |
[out] | engine_setting | The engine setting application(ui app)'s app ID |
[out] | use_network | A variable for checking whether the network is used or not |
0
on success, otherwise a negative error code on failure STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_OPERATION_FAILED | Operation failure |
typedef int(* stte_get_recording_format_cb)(stte_audio_type_e *types, int *rate, int *channels) |
Called when the engine service user gets the proper recording format of STT engine.
[out] | types | The format used by the recorder |
[out] | rate | The sample rate used by the recorder |
[out] | channels | The number of channels used by the recorder |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_STATE | Not initialized |
typedef int(* stte_initialize_cb)(void) |
Called when the engine service user initializes STT engine.
This callback function is called by the engine service user to request for STT engine to be started.
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_INVALID_STATE | Already initialized |
STTE_ERROR_OPERATION_FAILED | Operation failure |
typedef int(* stte_is_valid_language_cb)(const char *language, bool *is_valid) |
Called when the engine service user checks whether the corresponding language is valid or not in STT engine.
[in] | language | The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code For example, "ko_KR" for Korean, "en_US" for American English |
[out] | is_valid | A variable for checking whether the corresponding language is valid or not. true to be valid, false to be invalid |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
typedef bool(* stte_need_app_credential_cb)(void) |
Called when the engine service user checks whether STT engine needs the application's credential.
true
if STT engine needs the application's credential, otherwise false
typedef int(* stte_private_data_requested_cb)(const char *key, char **data) |
Called when STT engine provides the engine service user with the private data.
This callback function is called when the engine service user gets the private data from STT engine.
[out] | key | The key field of private data |
[out] | data | The data field of private data |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_OPERATION_FAILED | Operation failure |
typedef int(* stte_private_data_set_cb)(const char *key, const char *data) |
Called when STT engine receives the private data from the engine service user.
This callback function is called when the engine service user sends the private data to STT engine.
[in] | key | The key field of private data |
[in] | data | The data field of private data |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_OPERATION_FAILED | Operation failure |
typedef bool(* stte_result_time_cb)(int index, stte_result_time_event_e event, const char *text, long start_time, long end_time, void *user_data) |
Called when STT engine provides the time stamp of result to the engine service user.
This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
[in] | index | The result index |
[in] | event | The token event |
[in] | text | The result text |
[in] | start_time | The time started speaking the result text |
[in] | end_time | The time finished speaking the result text |
[in] | user_data | The user data passed from stte_foreach_result_time_cb() |
true
to continue with the next iteration of the loop false
to break out of the loop typedef int(* stte_set_recording_data_cb)(const void *data, unsigned int length) |
Called when the engine service user sets and sends the recording data for speech recognition.
This callback function is called by the engine service user to send the recording data to STT engine. The engine receives the recording data and uses for speech recognition.
[in] | data | The recording data |
[in] | length | The length of recording data |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_INVALID_STATE | Invalid state |
STTE_ERROR_OPERATION_FAILED | Operation failure |
typedef int(* stte_set_silence_detection_cb)(bool is_set) |
Called when the engine service user sets the silence detection.
[in] | is_set | A variable for setting the silence detection. true to detect the silence, false not to detect the silence |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_STATE | Not initialized |
STTE_ERROR_NOT_SUPPORTED_FEATURE | Not supported feature |
typedef int(* stte_start_cb)(const char *language, const char *type, const char *appid, const char *credential, void *user_data) |
Called when the engine service user starts to recognize the recording data.
[in] | language | The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code For example, "ko_KR" for Korean, "en_US" for American English |
[in] | type | The recognition type. (e.g. STTE_RECOGNITION_TYPE_FREE) |
[in] | appid | The Application ID |
[in] | credential | The credential granted to the application |
[in] | user_data | The user data to be passed to the callback function |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_INVALID_STATE | Invalid state |
STTE_ERROR_INVALID_LANGUAGE | Invalid language |
STTE_ERROR_OPERATION_FAILED | Operation failure |
STTE_ERROR_NETWORK_DOWN | Out of network |
typedef int(* stte_stop_cb)(void) |
Called when the engine service user stops to recognize the recording data.
This callback function is called by the engine service user to stop recording and to get the recognition result.
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_STATE | Invalid state |
STTE_ERROR_OPERATION_FAILED | Operation failure |
STTE_ERROR_NETWORK_DOWN | Out of network |
typedef int(* stte_support_recognition_type_cb)(const char *type, bool *is_supported) |
Called when the engine service user checks whether STT engine supports the corresponding recognition type.
[in] | type | The type for recognition (e.g. STTE_RECOGNITION_TYPE_FREE) |
[out] | is_supported | A variable for checking whether STT engine supports the corresponding recognition type. true to support recognition type, false not to support recognition type |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
typedef bool(* stte_support_silence_detection_cb)(void) |
Called when the engine service user checks whether STT engine supports silence detection.
true
to support silence detection, false
not to support silence detection typedef bool(* stte_supported_language_cb)(const char *language, void *user_data) |
Called when STT engine informs the engine service user about whole supported language list.
This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function.
[in] | language | The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code For example, "ko_KR" for Korean, "en_US" for American English |
[in] | user_data | The user data passed from stte_foreach_supported_langs_cb() |
true
to continue with the next iteration of the loop false
to break out of the loop enum stte_audio_type_e |
enum stte_error_e |
Enumeration for error codes.
enum stte_result_event_e |
enum stte_speech_status_e |
int stte_main | ( | int | argc, |
char ** | argv, | ||
stte_request_callback_s * | callback | ||
) |
Main function for Speech-To-Text (STT) engine.
This function is the main function for operating STT engine.
[in] | argc | The argument count(original) |
[in] | argv | The argument(original) |
[in] | callback | The structure of engine request callback function |
zero
on success, or negative with error code on failure STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |
#include <stte.h> // Required callback functions - MUST BE IMPLEMENTED static int sttengine_get_info_cb(char** engine_uuid, char** engine_name, char** engine_setting, bool* use_network); static int sttengine_initialize_cb(void); static int sttengine_deinitialize_cb(void); static int sttengine_is_valid_language_cb(const char* language, bool* is_valid); static int sttengine_foreach_supported_langs_cb(stte_supported_language_cb callback, void* user_data); static bool sttengine_support_silence_detection_cb(void); static int sttengine_set_silence_detection_cb(bool is_set); static int sttengine_support_recognition_type_cb(const char* type, bool* is_supported); static int sttengine_get_recording_format_cb(stte_audio_type_e* types, int* rate, int* channels); static int sttengine_set_recording_data_cb(const void* data, unsigned int length); static int sttengine_foreach_result_time_cb(void* time_info, stte_result_time_cb callback, void* user_data); static int sttengine_start_cb(const char* language, const char* type, const char* appid, const char* credential, void *user_data); static int sttengine_stop_cb(void); static int sttengine_cancel_cb(void); static int sttengine_check_app_agreed_cb(const char* appid, bool* is_agreed); static bool sttengine_need_app_credential_cb(void); // Optional callback function static int sttengine_private_data_set_cb(const char* key, const char* data); int main(int argc, char* argv[]) { // 1. Create a structure 'stte_request_callback_s' stte_request_callback_s engine_callback = { 0, }; engine_callback.size = sizeof(stte_request_callback_s); engine_callback.version = 1; engine_callback.get_info = sttengine_get_info_cb; engine_callback.initialize = sttengine_initialize_cb; engine_callback.deinitialize = sttengine_deinitialize_cb; engine_callback.foreach_langs = sttengine_foreach_supported_langs_cb; engine_callback.is_valid_lang = sttengine_is_valid_language_cb; engine_callback.support_silence = sttengine_support_silence_detection_cb; engine_callback.support_recognition_type = sttengine_support_recognition_type_cb; engine_callback.get_audio_format = sttengine_get_recording_format_cb; engine_callback.foreach_result_time = sttengine_foreach_result_time_cb; engine_callback.set_silence_detection = sttengine_set_silence_detection_cb; engine_callback.start = sttengine_start_cb; engine_callback.set_recording = sttengine_set_recording_data_cb; engine_callback.stop = sttengine_stop_cb; engine_callback.cancel = sttengine_cancel_cb; engine_callback.check_app_agreed = sttengine_check_app_agreed_cb; engine_callback.need_app_credential = sttengine_need_app_credential_cb; // 2. Run 'stte_main()' if (0 != stte_main(argc, argv, &engine_callback)) { return -1; } // Optional stte_set_private_data_set_cb(sttengine_private_data_set_cb); // 3. Set event callbacks for service app and Run 'service_app_main()' char ad[50] = { 0, }; service_app_lifecycle_callback_s event_callback; app_event_handler_h handlers[5] = { NULL, }; event_callback.create = service_app_create; event_callback.terminate = service_app_terminate; event_callback.app_control = service_app_control; service_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, service_app_low_battery, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, service_app_low_memory, &ad); service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); return service_app_main(argc, argv, &event_callback, ad); }
int stte_send_error | ( | stte_error_e | error, |
const char * | msg | ||
) |
Sends the error to the engine service user.
The following error codes can be delivered. STTE_ERROR_NONE, STTE_ERROR_OUT_OF_MEMORY, STTE_ERROR_IO_ERROR, STTE_ERROR_INVALID_PARAMETER, STTE_ERROR_NETWORK_DOWN, STTE_ERROR_INVALID_STATE, STTE_ERROR_INVALID_LANGUAGE, STTE_ERROR_OPERATION_FAILED, STTE_ERROR_NOT_SUPPORTED_FEATURE, STTE_ERROR_NOT_SUPPORTED, STTE_ERROR_PERMISSION_DENIED, STTE_ERROR_RECORDING_TIMED_OUT.
[in] | error | The error reason |
[in] | msg | The error message |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |
int stte_send_result | ( | stte_result_event_e | event, |
const char * | type, | ||
const char ** | result, | ||
int | result_count, | ||
const char * | msg, | ||
void * | time_info, | ||
void * | user_data | ||
) |
Sends the recognition result to the engine service user.
[in] | event | The result event |
[in] | type | The recognition type (e.g. STTE_RECOGNITION_TYPE_FREE, STTE_RECOGNITION_TYPE_FREE_PARTIAL) |
[in] | result | Result texts |
[in] | result_count | Result text count |
[in] | msg | Engine message (e.g. STTE_RESULT_MESSAGE_NONE, STTE_RESULT_MESSAGE_ERROR_TOO_SHORT) |
[in] | time_info | The time information |
[in] | user_data | The user data passed from stte_start_cb() |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |
int stte_send_speech_status | ( | stte_speech_status_e | status, |
void * | user_data | ||
) |
Sends the speech status to the engine service user when STT engine notifies the change of the speech status.
[in] | status | The status of speech (e.g. STTE_SPEECH_STATUS_START_POINT_DETECTED or STTE_SPEECH_STATUS_END_POINT_DETECTED) |
[in] | user_data | The user data passed from the start function. |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |
int stte_set_private_data_requested_cb | ( | stte_private_data_requested_cb | callback_func | ) |
Sets a callback function for requesting the private data.
[in] | callback_func | stte_private_data_requested event callback function |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |
int stte_set_private_data_set_cb | ( | stte_private_data_set_cb | callback_func | ) |
Sets a callback function for setting the private data.
[in] | callback_func | stte_private_data_set event callback function |
0
on success, otherwise a negative error value STTE_ERROR_NONE | Successful |
STTE_ERROR_INVALID_PARAMETER | Invalid parameter |
STTE_ERROR_PERMISSION_DENIED | Permission denied |
STTE_ERROR_NOT_SUPPORTED | Not supported |
STTE_ERROR_OPERATION_FAILED | Operation failure |