Change-Id: I9efc756419d76bc79b8dd9a531a775f3eacdfe13
//TODO: move to vconf/vconf-internal-setting-keys.h?
#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH "db/setting/accessibility/universal-switch"
//TODO: move to vconf/vconf-internal-setting-keys.h?
#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH "db/setting/accessibility/universal-switch"
+#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SCANNING "db/setting/accessibility/universal-switch/scanning"
+
+#define MAX_NUMBER_OF_KEYS_PER_CLIENT 2
#define APP_CONTROL_OPERATION_SCREEN_READ "http://tizen.org/appcontrol/operation/read_screen"
#define APP_CONTROL_OPERATION_UNIVERSAL_SWITCH "http://tizen.org/appcontrol/operation/universal_switch"
#define APP_CONTROL_OPERATION_SCREEN_READ "http://tizen.org/appcontrol/operation/read_screen"
#define APP_CONTROL_OPERATION_UNIVERSAL_SWITCH "http://tizen.org/appcontrol/operation/universal_switch"
typedef struct {
const char * name;
const char * app_control_operation;
typedef struct {
const char * name;
const char * app_control_operation;
- const char * vconf_key;
+ const char * vconf_key[MAX_NUMBER_OF_KEYS_PER_CLIENT];
+ int number_of_keys;
int launch_repeats;
int pid;
} A11yBusClient;
int launch_repeats;
int pid;
} A11yBusClient;
void vconf_client_cb(keynode_t *node, void *user_data)
{
A11yBusClient *client = user_data;
void vconf_client_cb(keynode_t *node, void *user_data)
{
A11yBusClient *client = user_data;
- int client_needed = vconf_keynode_get_bool(node);
- LOGD("vconf_keynode_get_bool(node): %i", client_needed);
- if (client_needed < 0)
- return;
+
+ gboolean client_needed = FALSE;
+ int i;
+ for (i = 0; i < client->number_of_keys; i++) {
+ int status = 0;
+ int ret =vconf_get_bool(client->vconf_key[i], &status);
+ if (ret != 0)
+ {
+ LOGD("Could not read %s key value.\n", client->vconf_key[i]);
+ return;
+ }
+ LOGD("vconf_keynode_get_bool(node): %i", status);
+ if (status < 0)
+ return;
+
+ if (status == 1) {
+ client_needed = TRUE;
+ break;
+ }
+ }
//check if process really exists (e.g didn't crash)
if (client->pid > 0)
//check if process really exists (e.g didn't crash)
if (client->pid > 0)
{
gboolean client_needed = FALSE;
{
gboolean client_needed = FALSE;
- if(!client->vconf_key) {
- LOGE("Vconf_key missing for client: %s \n", client->vconf_key);
- return FALSE;
- }
+ int i;
+ for (i = 0; i < client->number_of_keys; i++) {
+ if (!client->vconf_key[i]) {
+ LOGE("Vconf_key missing for client: %d \n", i);
+ return FALSE;
+ }
- int ret = vconf_get_bool(client->vconf_key, &client_needed);
- if (ret != 0)
- {
- LOGD("Could not read %s key value.\n", client->vconf_key);
- return FALSE;
- }
- ret = vconf_notify_key_changed(client->vconf_key, vconf_client_cb, client);
- if(ret != 0)
- {
- LOGD("Could not add information level callback\n");
- return FALSE;
- }
+ int status = 0;
+ int ret = vconf_get_bool(client->vconf_key[i], &status);
+ if (ret != 0)
+ {
+ LOGD("Could not read %s key value.\n", client->vconf_key[i]);
+ return FALSE;
+ }
+ ret = vconf_notify_key_changed(client->vconf_key[i], vconf_client_cb, client);
+ if (ret != 0)
+ {
+ LOGD("Could not add information level callback\n");
+ return FALSE;
+ }
+ if (status)
+ client_needed = TRUE;
+ }
- g_timeout_add_seconds(2,_launch_process_repeat_until_success, client);
+ g_timeout_add_seconds(2,_launch_process_repeat_until_success, client);
_global_app->screen_reader.name = "screen-reader";
_global_app->screen_reader.app_control_operation = APP_CONTROL_OPERATION_SCREEN_READ;
_global_app->screen_reader.name = "screen-reader";
_global_app->screen_reader.app_control_operation = APP_CONTROL_OPERATION_SCREEN_READ;
- _global_app->screen_reader.vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS;
+ _global_app->screen_reader.vconf_key[0] = VCONFKEY_SETAPPL_ACCESSIBILITY_TTS;
+ _global_app->screen_reader.number_of_keys = 1;
_global_app->universal_switch.name = "universal-switch";
_global_app->universal_switch.app_control_operation = APP_CONTROL_OPERATION_UNIVERSAL_SWITCH;
_global_app->universal_switch.name = "universal-switch";
_global_app->universal_switch.app_control_operation = APP_CONTROL_OPERATION_UNIVERSAL_SWITCH;
- _global_app->universal_switch.vconf_key = VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH;
+ _global_app->universal_switch.vconf_key[0] = VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH;
+ _global_app->universal_switch.vconf_key[1] = VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_SCANNING;
+ _global_app->universal_switch.number_of_keys = 2;
for (i = 1; i < argc; i++)
{
for (i = 1; i < argc; i++)
{