* @brief Function that check whether voice touch is set as auto mode or not
* @param[out] is_vt_automode a parameter for checking whether voice touch is set as auto mode or not
*/
-int vc_elm_is_supported_vt_auto(bool* is_vt_automode);
+int vc_elm_is_supported_vt_auto(int* is_vt_automode);
#ifdef __cplusplus
}
*/
static unsigned is_vc_elm_initialized = false;
+/**
+* @brief An internal variable for checking whether voice touch's auto mode is ON or not.
+*/
+static int g_is_vt_automode = 0;
+
/**
* @brief App domain name of the current app.
*/
int ret = cynara_initialize(&p_cynara, NULL);
if (CYNARA_API_SUCCESS != ret)
VC_ELM_LOG_ERR("[ERROR] fail to initialize");
-
+
return ret == CYNARA_API_SUCCESS;
}
}
g_privilege_allowed = 1;
- return VC_ELM_ERROR_NONE;
+ return VC_ELM_ERROR_NONE;
+}
+
+void __vc_config_vtauto_changed_cb(keynode_t *key, void *data)
+{
+ int ret = vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &g_is_vt_automode);
+ if (0 != ret) {
+ VC_ELM_LOG_ERR("Fail to get vconfkey(%s), current voice touch mode(%d)", key, g_is_vt_automode);
+ }
+
+ return;
}
int vc_elm_initialize()
is_vc_elm_initialized = true;
+ /* Initialize voice touch's automode and Register to detect voice touch automode change */
+ vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &g_is_vt_automode);
+
+ vconf_notify_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, __vc_config_vtauto_changed_cb, NULL);
+
VC_ELM_LOG_DBG("vc elm is initialized");
return VC_ELM_ERROR_NONE;
}
eina_list_free(g_handlers_list);
}
+ vconf_ignore_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, __vc_config_vtauto_changed_cb);
+
_vc_elm_core_fini();
- if (NULL != g_app_domain)
+ if (NULL != g_app_domain) {
free(g_app_domain);
+ g_app_domain = NULL;
+ }
is_vc_elm_initialized = false;
VC_ELM_LOG_DBG("shutting down vc_elm");
return VC_ELM_ERROR_NONE;
}
-int _vc_elm_is_supported_vt_auto(bool* is_vt_automode)
+int vc_elm_is_supported_vt_auto(int* is_vt_automode)
{
if (0 != __vc_elm_get_feature_enabled()) {
return VC_ELM_ERROR_NOT_SUPPORTED;
}
- int ret = -1;
- ret = vconf_get_bool(VC_VOICE_TOUCH_AUTOMODE, is_vt_automode);
-
- if (0 != ret) {
- VC_ELM_LOG_DBG("Fail to get vconfkey");
- return VC_ELM_ERROR_OPERATION_FAILED;
- }
-
- VC_ELM_LOG_DBG("Success to get vconfkey(%d)", (int)(*is_vt_automode));
-
- return ret;
-}
-
-int vc_elm_is_supported_vt_auto(bool* is_vt_automode)
-{
- if (0 != __vc_elm_get_feature_enabled()) {
- return VC_ELM_ERROR_NOT_SUPPORTED;
- }
+ *is_vt_automode = g_is_vt_automode;
+ VC_ELM_LOG_DBG("Success to get vconfkey(%d)", *is_vt_automode);
- return _vc_elm_is_supported_vt_auto(is_vt_automode);
+ return VC_ELM_ERROR_NONE;
}
int _vc_elm_set_auto_register_mode(int mode, int click_method)
int _vc_elm_get_auto_register_mode(int* mode, int* click_method)
{
- bool is_vt_auto;
- if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) {
- return VC_ELM_ERROR_OPERATION_FAILED;
+ if (0 == g_is_vt_automode) {
+ VC_ELM_LOG_DBG("vt_automode is FALSE");
+ *mode = g_auto_mode;
+ *click_method = g_click_method;
} else {
- if (false == is_vt_auto) {
- VC_ELM_LOG_DBG("vt_automode is FALSE");
- *mode = g_auto_mode;
- *click_method = g_click_method;
- } else {
- VC_ELM_LOG_DBG("vt_automode is TRUE");
- *mode = (int)VC_ELM_MODE_AUTO_APPFW;
- *click_method = g_click_method;
- }
+ VC_ELM_LOG_DBG("vt_automode is TRUE");
+ *mode = (int)VC_ELM_MODE_AUTO_APPFW;
+ *click_method = g_click_method;
}
VC_ELM_LOG_DBG("mode: %d, click_method: %d", *mode, *click_method);
return VC_ELM_ERROR_NOT_SUPPORTED;
}
- bool is_vt_auto;
- if (0 != _vc_elm_is_supported_vt_auto(&is_vt_auto)) {
- return VC_ELM_ERROR_OPERATION_FAILED;
+ if (0 == g_is_vt_automode) {
+ VC_ELM_LOG_DBG("vt_automode is FALSE");
+ return _vc_elm_set_auto_register_mode(mode, click_method);
} else {
- if (false == is_vt_auto) {
- VC_ELM_LOG_DBG("vt_automode is FALSE");
- return _vc_elm_set_auto_register_mode(mode, click_method);
- } else {
- VC_ELM_LOG_DBG("vt_automode is TRUE");
- return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method);
- }
+ VC_ELM_LOG_DBG("vt_automode is TRUE");
+ return _vc_elm_set_auto_register_mode((int)VC_ELM_MODE_AUTO_APPFW, click_method);
}
return _vc_elm_set_auto_register_mode(mode, click_method);
while (NULL != parent_info) {
if (EINA_TRUE == parent_info->focusable) {
VC_ELM_LOG_DBG("Focusable Parent");
- char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+ const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
VC_ELM_LOG_DBG("type (%s)", widget_type);
Elm_Object_Item* item = NULL;
if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) {
while (NULL != parent_info) {
if (EINA_TRUE == parent_info->focusable) {
VC_ELM_LOG_DBG("Focusable Parent");
- const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+ const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
VC_ELM_LOG_DBG("type (%s)", widget_type);
Elm_Object_Item* item = NULL;
if (NULL != widget_type && !strcmp(widget_type, "Elm_Genlist")) {
}
VC_ELM_LOG_DBG("command(%s)", temp);
- char* action = NULL;
+ const char* action = NULL;
if (strlen(cmd) > strlen(temp)) {
action = &cmd[strlen(temp) + 1];
VC_ELM_LOG_DBG("action(%s)", &cmd[strlen(temp) + 1]);
}
evas_object_geometry_get(obj, &x_1, &y_1, &w_1, &h_1);
- name = elm_widget_type_get(obj);
+ name = elm_widget_type_get((const Evas_Object *)obj);
if (NULL != name && NULL == eina_hash_find(registered_item_map, name) && NULL != eina_hash_find(g_config_widget_map, name)) {
Eina_List *list2 = eina_hash_find(g_config_widget_map, name);
VC_ELM_LOG_DBG("CORE LIST action size %u", eina_list_count(list2));
Object_Info* parent = ea_object_dump_parent_widget_data_get(info);
Object_Info* grand = ea_object_dump_parent_widget_data_get(parent);
- char *widget_type = NULL;
- widget_type = elm_widget_type_get((Evas_Object*)grand->address);
+ const char *widget_type = NULL;
+ widget_type = elm_widget_type_get((const Evas_Object*)grand->address);
while (NULL == widget_type) {
grand = ea_object_dump_parent_widget_data_get(grand);
if (NULL == grand) {
break;
}
- widget_type = elm_widget_type_get((Evas_Object*)grand->address);
+ widget_type = elm_widget_type_get((const Evas_Object*)grand->address);
}
VC_ELM_LOG_DBG("info(%s) parent(%s) grand(%s)", elm_widget_type_get((Evas_Object*)info->address), elm_widget_type_get((Evas_Object*)parent->address), widget_type);
VC_ELM_LOG_DBG("Focused g_default %ud", elm_win_xwindow_get(g_default_window));
if (!is_focused) {
/* window changed, we need to get new one */
- int count = eina_list_count(ui_objects_list);
+ unsigned int count = eina_list_count(ui_objects_list);
VC_ELM_LOG_DBG("list count %d", count);
if (0 == count) {
/* TODO - get window object */
Ecore_Evas *ee = NULL;
Evas *evas = NULL;
Eina_List *objs = NULL;
- Evas_Object *obj = NULL;
Evas_Object *window = NULL;
EINA_LIST_FREE(ecore_evas_list, ee) {
evas = ecore_evas_get(ee);
{
VC_ELM_LOG_DBG("obj(%p)", (void*)obj);
- if (NULL != elm_widget_type_get(obj)) {
+ if (NULL != elm_widget_type_get((const Evas_Object *)obj)) {
if (EINA_TRUE == elm_object_focus_get(obj)) {
VC_ELM_LOG_DBG("Already focused");
ecore_timer_add(g_click_time, __click_event, NULL);
}
}
-static void __emulate_click(const Evas_Object *obj)
+static void __emulate_click(Evas_Object *obj)
{
int auto_mode = 0;
int click_method = 0;
evas_object_geometry_get(obj, &x_1, &y_1, &w_1, &h_1);
if (x_1 + (w_1 / 2) >= x && y_1 + (h_1 / 2) >= y && (x_1 + (w_1 / 2)) <= (x + w) && (y_1 + (h_1 / 2)) <= (y + h)) {
- const char *name = elm_widget_type_get(obj);
+ const char *name = elm_widget_type_get((const Evas_Object *)obj);
if (name == NULL) {
char *item_string = NULL;
if (NULL != (item_string = evas_object_data_get(obj, VC_ELM_HINT_DATA_KEY)))
(void)widget;
EINA_LIST_FOREACH(list, l, obj) {
- const char *type = elm_widget_type_get(obj);
+ const char *type = elm_widget_type_get((const Evas_Object *)obj);
if (type && !strcmp(type, "Elm_Layout")) {
evas_object_data_set(obj, VC_ELM_COLORSELECTOR_PARENT, widget);
evas_object_data_set(obj, _vc_elm_get_custom_widget_name(), "Elm_Button");
list = elm_widget_can_focus_child_list_get(entry);
EINA_LIST_FOREACH(list, l, obj) {
- const char *type = elm_widget_type_get(obj);
+ const char *type = elm_widget_type_get((const Evas_Object *)obj);
const char *part = elm_object_part_text_get(obj, "mbe.label");
if (part)
continue;
#include "vc_elm_tools.h"
#include "vc_elm_efl_dump.h"
+#include <voice_control_elm_private.h>
+
#define EVAS_OBJECT_DUMP_DEBUG
#ifdef EVAS_OBJECT_DUMP_DEBUG
#define VC_ELM_LOG_DUMP(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__)
static int find_popup = 0;
static int skip_text = 0;
-bool vc_elm_efl_dump_is_vt_auto_enabled()
+int vc_elm_efl_dump_is_vt_auto_enabled()
{
- bool is_vt_automode = false;
+ int is_vt_automode = 0;
int ret = vc_elm_is_supported_vt_auto(&is_vt_automode);
if (0 != ret) {
VC_ELM_LOG_DUMP("Fail to check vt auto mode");
{
Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
while (NULL != parent_info) {
- const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+ const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
if (NULL != widget_type) {
VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type);
if (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List") || !strcmp(widget_type, "Elm_Ctxpopup") || !strcmp(widget_type, "Elm_Index"))
{
Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
while (NULL != parent_info) {
- const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+ const char* widget_type = elm_widget_type_get((const Evas_Object*)(parent_info->address));
if (NULL != widget_type) {
VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type);
if (!strcmp(widget_type, "Elm_Toolbar"))
}
text = NULL;
- if (false == vc_elm_efl_dump_is_vt_auto_enabled()) {
+ if (0 == vc_elm_efl_dump_is_vt_auto_enabled()) {
if (!strcmp(evas_object_type_get(obj), "text"))
text = eina_stringshare_add(evas_object_text_text_get(obj));
else if (!strcmp(evas_object_type_get(obj), "textblock")) {