error = NULL;\
}
-static void on_window_activate(void *data, AtspiAccessible * window);
+static void on_window_activate(void *data, AtspiAccessible *window);
static void _highlight_on_slider(Eina_Bool is_slider);
typedef struct {
}
#ifndef SCREEN_READER_TV
-static void _read_quickpanel(void)
+static void _read_quickpanel(Service_Data *service_data)
{
DEBUG("START");
- device_time_get();
- device_battery_get();
- device_bluetooth_get();
- device_signal_strenght_get();
+ device_time_get(service_data);
+ device_battery_get(service_data);
+ device_bluetooth_get(service_data);
+ device_signal_strenght_get(service_data);
- device_date_get();
- device_missed_events_get();
+ device_date_get(service_data);
+ device_missed_events_get(service_data);
if (sound_feedback)
smart_notification(CONTEXTUAL_MENU_NOTIFICATION_EVENT, 0, 0);
DEBUG("END");
return;
nd->last_hover_event_time = info->state != 1 ? -1 : info->event_time;
#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
- keyboard_win = top_window_get(info->x_end, info->y_end, NULL); //TODO: pass screen_reader_gestures context instead of NULL
+ keyboard_win = top_window_get(info->x_end, info->y_end, sd->screen_reader_gestures_ctx); //TODO: pass screen_reader_gestures context instead of NULL
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_read(keyboard_win, info->x_end, info->y_end);
break;
break;
case ONE_FINGER_SINGLE_TAP:
#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
- keyboard_win = top_window_get(info->x_end, info->y_end, NULL); //TODO: pass screen_reader_gestures context instead of NULL
+ keyboard_win = top_window_get(info->x_end, info->y_end, sd->screen_reader_gestures_ctx); //TODO: pass screen_reader_gestures context instead of NULL
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_read(keyboard_win, info->x_end, info->y_end);
break;
break;
case ONE_FINGER_DOUBLE_TAP:
#if defined(ELM_ACCESS_KEYBOARD) && defined(X11_ENABLED)
- keyboard_win = top_window_get(info->x_end, info->y_end, NULL); //TODO: pass screen_reader_gestures context instead of NULL
+ keyboard_win = top_window_get(info->x_end, info->y_end, sd->screen_reader_gestures_ctx); //TODO: pass screen_reader_gestures context instead of NULL
if (keyboard_win && ecore_x_e_virtual_keyboard_get(keyboard_win)) {
elm_access_adaptor_emit_activate(keyboard_win, info->x_end, info->y_end);
break;
break;
case TWO_FINGERS_TRIPLE_TAP:
#ifndef SCREEN_READER_TV
- _read_quickpanel();
+ _read_quickpanel(sd);
#endif
break;
case THREE_FINGERS_SINGLE_TAP:
return ret;
}
-static void on_window_activate(void *data, AtspiAccessible * window)
+static void on_window_activate(void *data, AtspiAccessible *window)
{
DEBUG("START");
window_tracker_active_window_request();
smart_notification_init();
#ifndef SCREEN_READER_TV
- system_notifications_init();
+ sd->system_data = system_notifications_init(sd);
#endif
return nd;
window_tracker_shutdown();
smart_notification_shutdown();
#ifndef SCREEN_READER_TV
- system_notifications_shutdown();
+ system_notifications_shutdown(sd->system_data);
+ sd->system_data = NULL;
#endif
free(sd->navigator_data);
#define MAX_SIM_COUNT 2
#define DATE_TIME_BUFFER_SIZE 26
-TapiHandle *tapi_handle[MAX_SIM_COUNT + 1] = { 0, };
+struct Screen_Reader_System_Data_s {
+ TapiHandle *tapi_handle[MAX_SIM_COUNT + 1];
+};
static void device_system_cb(device_callback_e type, void *value, void *user_data);
-static void tapi_init(void)
+static void tapi_init(Screen_Reader_System_Data_t *system_data)
{
int i = 0;
char **cp_list = tel_get_cp_name_list();
DEBUG("TAPI INIT");
for (i = 0; cp_list[i]; ++i) {
- tapi_handle[i] = tel_init(cp_list[i]);
+ system_data->tapi_handle[i] = tel_init(cp_list[i]);
DEBUG("CP_LIST %d = %s", i, cp_list[i]);
}
-
}
/**
* @brief Initializer for smart notifications
*
*/
-void system_notifications_init(void)
+Screen_Reader_System_Data_t *system_notifications_init(Service_Data *service_data)
{
DEBUG("******************** START ********************");
+
int ret = -1;
+ Screen_Reader_System_Data_t *system_data = malloc(sizeof(Screen_Reader_System_Data_t));
+
+ if (!system_data) {
+ ERROR("malloc(%d) failed", sizeof(Screen_Reader_System_Data_t));
+ return NULL;
+ }
// BATTERY LOW/FULL
- device_add_callback(DEVICE_CALLBACK_BATTERY_LEVEL, device_system_cb, NULL);
+ device_add_callback(DEVICE_CALLBACK_BATTERY_LEVEL, device_system_cb, service_data);
// BATTERY CHARGING/NOT-CHARGING
- device_add_callback(DEVICE_CALLBACK_BATTERY_CHARGING, device_system_cb, NULL);
+ device_add_callback(DEVICE_CALLBACK_BATTERY_CHARGING, device_system_cb, service_data);
// SCREEN OFF/ON
- device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, device_system_cb, NULL);
+ device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, device_system_cb, service_data);
ret = bt_initialize();
if (ret != BT_ERROR_NONE) {
ERROR("ret == %d", ret);
}
- tapi_init();
+ tapi_init(system_data);
DEBUG(" ********************* END ********************* ");
+
+ return system_data;
}
/**
* @brief Initializer for smart notifications
*
*/
-void system_notifications_shutdown(void)
+void system_notifications_shutdown(Screen_Reader_System_Data_t *system_data)
{
int ret = -1;
+ if (system_data)
+ free(system_data);
+
// BATTERY LOW/FULL
device_remove_callback(DEVICE_CALLBACK_BATTERY_LEVEL, device_system_cb);
// BATTERY CHARGING/NOT-CHARGING
*/
static void device_system_cb(device_callback_e type, void *value, void *user_data)
{
+ if (!user_data) {
+ ERROR("Invalid parameter");
+ return;
+ }
+
+ Service_Data *service_data = (Service_Data *)user_data;
+
if (type == DEVICE_CALLBACK_BATTERY_LEVEL) {
device_battery_level_e status;
+
if (device_battery_get_level_status(&status)) {
ERROR("Cannot get battery level status");
return;
}
} else if (type == DEVICE_CALLBACK_BATTERY_CHARGING) {
bool charging;
+
if (device_battery_is_charging(&charging)) {
ERROR("Cannot check if battery is charging");
return;
tts_speak(_("IDS_SYSTEM_NOT_CHARGING"), EINA_FALSE);
} else if (type == DEVICE_CALLBACK_DISPLAY_STATE) {
display_state_e state;
+
if (device_display_get_state(&state)) {
ERROR("Cannot check if battery is charging");
return;
return read_text;
}
-void device_time_get(void)
+void device_time_get(Service_Data *service_data)
{
char buffer[DATE_TIME_BUFFER_SIZE];
int disp_12_24 = VCONFKEY_TIME_FORMAT_12;
}
}
-void device_battery_get(void)
+void device_battery_get(Service_Data *service_data)
{
char *buffer = NULL;
char *charging_text = NULL;
free(buffer);
}
-static void _signal_strength_sim_get(void)
+static void _signal_strength_sim_get(Service_Data *service_data)
{
int i = 0;
int val = 0;
char *buffer = NULL;
int service_type = TAPI_NETWORK_SERVICE_TYPE_UNKNOWN;
char *service_type_text = NULL;
+ Screen_Reader_System_Data_t *system_data = service_data->system_data;
+
+ if (!system_data) {
+ ERROR("system data is null");
+ return;
+ }
str_buf = eina_strbuf_new();
- for (i = 0; tapi_handle[i]; ++i) {
+ for (i = 0; system_data->tapi_handle[i]; ++i) {
++sim_card_count;
}
- for (i = 0; tapi_handle[i]; ++i) {
- ret = tel_get_property_int(tapi_handle[i], TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &val);
+ for (i = 0; system_data->tapi_handle[i]; ++i) {
+ ret = tel_get_property_int(system_data->tapi_handle[i], TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &val);
if (ret != TAPI_API_SUCCESS) {
ERROR("Can not get %s", TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL);
val = 0;
eina_strbuf_append_printf(str_buf, "%s %d; ", _("IDS_SYSTEM_SIGNAL_STRENGTH"), val);
DEBUG("sim: %d TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL %d", i, val);
- ret = tel_get_property_int(tapi_handle[i], TAPI_PROP_NETWORK_SERVICE_TYPE, &service_type);
+ ret = tel_get_property_int(system_data->tapi_handle[i], TAPI_PROP_NETWORK_SERVICE_TYPE, &service_type);
if (ret != TAPI_API_SUCCESS) {
ERROR("Can not get %s", TAPI_PROP_NETWORK_SERVICE_TYPE);
}
DEBUG("Text to say: %s", buffer);
tts_speak(buffer, EINA_FALSE);
-
eina_strbuf_string_free(str_buf);
free(buffer);
}
-static void _signal_strength_wifi_get(void)
+static void _signal_strength_wifi_get(Service_Data *service_data)
{
int val = 0;
int ret = -1;
}
}
-void device_signal_strenght_get(void)
+void device_signal_strenght_get(Service_Data *service_data)
{
if (!_read_text_get(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS_INDICATOR_INFORMATION_SIGNAL_STRENGHT)) {
return;
}
- _signal_strength_sim_get();
- _signal_strength_wifi_get();
+
+ _signal_strength_sim_get(service_data);
+ _signal_strength_wifi_get(service_data);
}
-void device_missed_events_get(void)
+void device_missed_events_get(Service_Data *service_data)
{
notification_list_h list = NULL;
notification_list_h elem = NULL;
}
}
-void device_date_get(void)
+void device_date_get(Service_Data *service_data)
{
char buffer[DATE_TIME_BUFFER_SIZE];
int date_format = SETTING_DATE_FORMAT_DD_MM_YYYY;
return false;
}
-void device_bluetooth_get(void)
+void device_bluetooth_get(Service_Data *service_data)
{
char *buffer = NULL;
int device_count = 0;
bt_adapter_state_e adapter_state = BT_ADAPTER_DISABLED;
int ret = bt_adapter_get_state(&adapter_state);
+
if (ret != BT_ERROR_NONE) {
ERROR("ret == %d", ret);
return;