*
* Copyright 2012 Samsung Electronics Co., Ltd
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include <dpm/restriction.h>
#include "mh_view_main.h"
+#include "mh_common_utility.h"
#include "mh_popup.h"
#include "mh_string.h"
mh_appdata_t *g_ad = NULL;
#define UPDATE_INTERVAL 1
+#ifdef TIZEN_FEATURE_EMULATOR
+static tethering_type_e updated_type = TETHERING_TYPE_ALL;
+static tethering_type_e selected_type = TETHERING_TYPE_ALL;
+static Eina_Bool selected_state = EINA_FALSE;
+
+tethering_type_e _get_updated_type(void)
+{
+ return updated_type;
+}
+
+tethering_type_e _get_selected_type(void)
+{
+ return selected_type;
+}
+
+Eina_Bool _get_selected_state(void)
+{
+ return selected_state;
+}
+#endif
+
void _list_connected_dev(mh_appdata_t *ap)
{
__MOBILE_AP_FUNC_ENTER__;
return ECORE_CALLBACK_CANCEL;
}
mh_appdata_t *ad = (mh_appdata_t *)data;
-
int count = 0;
+
+#ifdef TIZEN_FEATURE_EMULATOR
+ if (ad->main.hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_NONE) {
+ _stop_update_device_conn_time(ad);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) {
+ updated_type = TETHERING_TYPE_WIFI;
+ elm_genlist_item_fields_update(ad->main.emul_station_items[TETHERING_TYPE_WIFI],
+ "elm.text.sub", ELM_GENLIST_ITEM_FIELD_TEXT);
+ }
+
+ if (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_BT) {
+ updated_type = TETHERING_TYPE_BT;
+ elm_genlist_item_fields_update(ad->main.emul_station_items[TETHERING_TYPE_BT],
+ "elm.text.sub", ELM_GENLIST_ITEM_FIELD_TEXT);
+ }
+
+ if (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_USB) {
+ updated_type = TETHERING_TYPE_USB;
+ elm_genlist_item_fields_update(ad->main.emul_station_items[TETHERING_TYPE_USB],
+ "elm.text.sub", ELM_GENLIST_ITEM_FIELD_TEXT);
+ }
+
+ updated_type = TETHERING_TYPE_ALL;
+
+ return ECORE_CALLBACK_RENEW;
+#endif
+
if (ad->main.hotspot_mode == VCONFKEY_MOBILE_HOTSPOT_MODE_NONE) {
_stop_update_device_conn_time(ad);
__MOBILE_AP_FUNC_EXIT__;
return;
}
+#ifdef TIZEN_FEATURE_EMULATOR
+void _update_emul_main_view(mh_appdata_t *ad, tethering_type_e type, Eina_Bool state)
+{
+ __MOBILE_AP_FUNC_ENTER__;
+
+ if (ad == NULL) {
+ ERR("Invalid param\n");
+ return;
+ }
+
+ Elm_Object_Item *item = NULL;
+
+ switch (type) {
+ case TETHERING_TYPE_WIFI:
+ /* Update Wi-Fi tethering on / off button */
+ _update_wifi_item(ad, MH_STATE_NONE);
+ if (state) {
+ ad->main.hotspot_mode |= VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI;
+ if (ad->main.help_item) {
+ elm_genlist_item_update(ad->main.help_item);
+ } else {
+ item = elm_genlist_item_insert_after(ad->main.genlist,
+ ad->main.help_itc, ad, NULL,
+ ad->main.wifi_item,
+ ELM_GENLIST_ITEM_NONE, NULL,
+ NULL);
+ if (item == NULL) {
+ ERR("elm_genlist_item_insert_after NULL\n");
+ } else {
+ elm_genlist_item_select_mode_set(item,
+ ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ ad->main.help_item = item;
+ }
+ }
+ } else {
+ ad->main.hotspot_mode ^= VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI;
+ if (ad->main.help_item) {
+ elm_object_item_del(ad->main.help_item);
+ ad->main.help_item = NULL;
+ }
+ }
+
+ if (ad->main.wifi_item)
+ elm_genlist_item_update(ad->main.wifi_item);
+ break;
+
+ case TETHERING_TYPE_BT:
+ /* Update BT tethering on / off button */
+ _update_bt_item(ad, MH_STATE_NONE);
+ if (state)
+ ad->main.hotspot_mode |= VCONFKEY_MOBILE_HOTSPOT_MODE_BT;
+ else
+ ad->main.hotspot_mode ^= VCONFKEY_MOBILE_HOTSPOT_MODE_BT;
+
+ if (ad->main.bt_item)
+ elm_genlist_item_update(ad->main.bt_item);
+ break;
+
+ case TETHERING_TYPE_USB:
+ /* Update USB tethering on / off button */
+ _update_usb_item(ad, MH_STATE_NONE);
+ if (state)
+ ad->main.hotspot_mode |= VCONFKEY_MOBILE_HOTSPOT_MODE_USB;
+ else
+ ad->main.hotspot_mode ^= VCONFKEY_MOBILE_HOTSPOT_MODE_USB;
+
+ if (ad->main.usb_item)
+ elm_genlist_item_update(ad->main.usb_item);
+ break;
+
+ default:
+ DBG("Unknown tethering type : %d\n", type);
+ break;
+ }
+
+ if (ad->main.hotspot_mode && ad->main.device_item == NULL) {
+ item = elm_genlist_item_append(ad->main.genlist,
+ ad->main.device_itc, ad, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DEFAULT);
+ ad->main.device_item = item;
+ } else if (ad->main.hotspot_mode == 0 && ad->main.device_item) {
+ elm_object_item_del(ad->main.device_item);
+ ad->main.device_item = NULL;
+ }
+
+ __update_emul_clients_genlist(ad);
+
+ __MOBILE_AP_FUNC_EXIT__;
+ return;
+}
+#endif
+
static int __is_allowed(tethering_type_e type)
{
int state = 0;
_update_wifi_item(ad, MH_STATE_PROCESS);
ad->type = TETHERING_TYPE_WIFI;
ad->is_wifi_teth_enabling = true;
+
+#ifdef TIZEN_FEATURE_EMULATOR
+ selected_type = TETHERING_TYPE_WIFI;
+ selected_state = (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) ? EINA_FALSE : EINA_TRUE;
+ DBG("type [%d] state[%d]", selected_type, selected_state);
+#endif
+
if (_handle_wifi_onoff_change(ad) != 0) {
ERR("_handle_wifi_onoff_change is failed\n");
_update_wifi_item(ad, MH_STATE_NONE);
ad->is_wifi_teth_enabling = false;
}
+#ifdef TIZEN_FEATURE_EMULATOR
+ if (_get_checkbox_status(selected_type) || !selected_state)
+ _update_emul_main_view(ad, selected_type, selected_state);
+#endif
+
__MOBILE_AP_FUNC_EXIT__;
return;
ad->type = TETHERING_TYPE_BT;
ad->is_bt_teth_enabling = true;
+#ifdef TIZEN_FEATURE_EMULATOR
+ selected_type = TETHERING_TYPE_BT;
+ selected_state = (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_BT) ? EINA_FALSE : EINA_TRUE;
+ DBG("type [%d] state[%d]", selected_type, selected_state);
+#endif
+
if (_handle_bt_onoff_change(ad) != 0) {
ERR("_handle_bt_onoff_change is failed\n");
_update_bt_item(ad, MH_STATE_NONE);
ad->is_bt_teth_enabling = false;
}
+#ifdef TIZEN_FEATURE_EMULATOR
+ if (_get_checkbox_status(selected_type) || !selected_state)
+ _update_emul_main_view(ad, selected_type, selected_state);
+#endif
+
__MOBILE_AP_FUNC_EXIT__;
return;
_update_usb_item(ad, MH_STATE_PROCESS);
ad->type = TETHERING_TYPE_USB;
ad->is_usb_teth_enabling = true;
+
+#ifdef TIZEN_FEATURE_EMULATOR
+ selected_type = TETHERING_TYPE_USB;
+ selected_state = (ad->main.hotspot_mode & VCONFKEY_MOBILE_HOTSPOT_MODE_USB) ? EINA_FALSE : EINA_TRUE;
+#endif
+
if (_handle_usb_onoff_change(ad) != 0) {
ERR("_handle_usb_onoff_change is failed\n");
_update_usb_item(ad, MH_STATE_NONE);
ad->is_usb_teth_enabling = false;
}
+#ifdef TIZEN_FEATURE_EMULATOR
+ if (_get_checkbox_status(selected_type) || !selected_state)
+ _update_emul_main_view(ad, selected_type, selected_state);
+#endif
+
__MOBILE_AP_FUNC_EXIT__;
return;
passphrase,
security_type,
STR_ENTER_THE_PASSWORD_ON_THE_OTHER_DEVICE,
- hidden[0] != '\0' ? "<br>" : "",
+ hidden && hidden[0] != '\0' ? "<br>" : "",
hidden);
} else {
snprintf(buf, MH_LABEL_LENGTH_MAX,
"</font_size>",
STR_DEV_NAME,
device_name,
- hidden[0] != '\0' ? "<br>" : "",
+ hidden && hidden[0] != '\0' ? "<br>" : "",
hidden);
}