struct datamgr;
+enum wirelessmgr_update_type {
+ WIRELESS_ACTIVATE = 0,
+ WIRELESS_DEACTIVATE
+};
+
enum event_type {
EVENT_DATA_INIT_DONE_WIRELESS,
EVENT_DATA_INIT_FAIL_WIRELESS,
EVENT_DATA_INVALID_PWD_WIRELESS,
+ EVENT_DATA_DEACTIVATE_FAIL,
EVENT_DATA_UPDATE_DONE,
EVENT_DATA_CHANGED,
EVENT_DATA_SELECT_DONE,
void *(*create)(void (*event_cb)(enum event_type type, void *data),
void *cb_data);
bool (*destroy)(void *dclass_data);
- bool (*update)(void *dclass_data);
+ bool (*update)(void *dclass_data, int wireless_update_type);
bool (*select)(void *dclass_data, Elm_Object_Item *it, void *data);
Eina_List *(*get_data)(void *dclass_data);
};
* @brief Call it whenever it is necessary to update view associated with model data.
*
* @param[in] dmgr Data manager pointer.
+* @param[in] wireless_update_type The type id to update.
*
* @return true on success.
*/
-bool datamgr_update(struct datamgr *dmgr);
+bool datamgr_update(struct datamgr *dmgr, int wireless_update_type);
/**
* @brief Call it when associated UI item was selected.
return true;
}
-bool datamgr_update(struct datamgr *dmgr)
+bool datamgr_update(struct datamgr *dmgr, int wireless_update_type)
{
if (!dmgr) {
_ERR("Invalid argument.");
}
if (dmgr->dclass->update)
- return dmgr->dclass->update(dmgr->dclass_data);
+ return dmgr->dclass->update(dmgr->dclass_data, wireless_update_type);
return true;
}
struct _priv *priv;
char *essid;
int r;
+ bool wifi_state = false;
if (!data) {
_ERR("Invalid argument.");
return;
}
+ r = wifi_manager_is_activated(priv->wifi, &wifi_state);
+ if (r == WIFI_MANAGER_ERROR_NONE && wifi_state == false) {
+ _ERR("wifi is not activated, ignore callback.");
+ return;
+ }
+
r = wifi_manager_ap_get_connection_state(ap, &connection_state);
if (r != WIFI_MANAGER_ERROR_NONE) {
_ERR("wifi_manager_ap_get_connection_state failed.");
priv->event_cb(EVENT_DATA_UPDATE_DONE, priv->cb_data);
}
+static void _wifi_manager_deactivated_cb(wifi_manager_error_e err, void *data)
+{
+ struct _priv *priv;
+
+ if (!data) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ priv = data;
+
+ if (err != WIFI_MANAGER_ERROR_NONE) {
+ _ERR("wifi deactivation failed.");
+ if (priv->event_cb)
+ priv->event_cb(EVENT_DATA_DEACTIVATE_FAIL, priv->cb_data);
+ return;
+ }
+
+}
+
static void _wifi_manager_activated_cb(wifi_manager_error_e err, void *data)
{
struct _priv *priv;
}
}
-static bool _update(void *dclass_data)
+static bool _update(void *dclass_data, int wireless_update_type)
{
bool activated;
int r;
priv = dclass_data;
- r = wifi_manager_is_activated(priv->wifi, &activated);
- if (r != WIFI_MANAGER_ERROR_NONE) {
- _ERR("wifi_manager_is_activated failed.");
- return false;
- }
-
- if (activated) {
- r = wifi_manager_scan(priv->wifi, _wifi_manager_scan_finished_cb, dclass_data);
+ switch (wireless_update_type) {
+ case WIRELESS_ACTIVATE:
+ r = wifi_manager_is_activated(priv->wifi, &activated);
if (r != WIFI_MANAGER_ERROR_NONE) {
- _ERR("wifi_manager_scan failed. err[%x]", r);
+ _ERR("wifi_manager_is_activated failed.");
return false;
}
- } else {
- r = wifi_manager_activate(priv->wifi, _wifi_manager_activated_cb, dclass_data);
- if (r != WIFI_MANAGER_ERROR_NONE) {
- _ERR("wifi_manager_activated failed.");
- return false;
+
+ if (activated) {
+ r = wifi_manager_scan(priv->wifi, _wifi_manager_scan_finished_cb, dclass_data);
+ if (r != WIFI_MANAGER_ERROR_NONE) {
+ _ERR("wifi_manager_scan failed. err[%x]", r);
+ return false;
+ }
+ } else {
+ r = wifi_manager_activate(priv->wifi, _wifi_manager_activated_cb, dclass_data);
+ if (r != WIFI_MANAGER_ERROR_NONE) {
+ _ERR("wifi_manager_activated failed.");
+ return false;
+ }
}
+ break;
+ case WIRELESS_DEACTIVATE:
+ r = wifi_manager_deactivate(priv->wifi, _wifi_manager_deactivated_cb, dclass_data);
+ if (r != WIFI_MANAGER_ERROR_NONE) {
+ _ERR("wifi_manager_deactivated failed.");
+ return false;
+ }
+ break;
+ default :
+ _ERR("Unexpected case");
+ return false;
+ break;
}
-
return true;
}
static void *_create(void (*event_cb)(enum event_type type, void *data),
void *cb_data);
static bool _destroy(void *data);
-static bool _update(void *data);
+static bool _update(void *data, int update_type);
static bool _select(void *dclass_data, Elm_Object_Item *it, void *data);
static Eina_List *_get_data(void *dclass_data);
return (VC_ERROR_NONE == ret);
}
-static bool _update(void *data)
+static bool _update(void *data, int update_type)
{
int ret = VC_ERROR_NONE;
private_data *priv = data;
data = priv->wired;
+ datamgr_update(priv->wirelessmgr, WIRELESS_DEACTIVATE);
/* Set progress state */
//elm_object_signal_emit(priv->wired_layout, SIG_WIRED_PROGRESS, SRC_ELM);
//elm_object_part_text_set(priv->wired_layout, "part.wired.text",
/* Update wireless network state */
elm_object_signal_emit(priv->ly, SIG_LOADING_START, SRC_ELM);
- if (!datamgr_update(priv->wirelessmgr)) {
+ if (!datamgr_update(priv->wirelessmgr, WIRELESS_ACTIVATE)) {
_ERR("Unavailable status for updating list.");
elm_object_signal_emit(priv->ly, SIG_NO_WIRELESS, SRC_ELM);
// PART_WIRELESS_LIST);
break;
+ case EVENT_DATA_DEACTIVATE_FAIL:
+ break;
case EVENT_DATA_UPDATE_DONE:
priv->wireless_update_requested = false;
#include "view/network/view_wireless.h"
#define STR_WIRELESS "Wireless"
+Evas_Object *wifi_popup;
+
enum input_type {
EO_NO = 0,
EO_YES
_ERR("Invalid parameter.");
return;
}
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
}*/
static Evas_Object *_create(Evas_Object *win, void *data)
priv = data;
- priv->base = utils_add_popup(win, STYLE_POPUP, STR_WIRELESS, NULL);
- if (!priv->base) {
+ wifi_popup = utils_add_popup(win, STYLE_POPUP, STR_WIRELESS, NULL);
+ if (!wifi_popup) {
_ERR("Add popup failed");
return NULL;
}
- ly = utils_add_layout(priv->base, GRP_CONTENT_NETWORK_POPUP, EINA_FALSE);
+ ly = utils_add_layout(wifi_popup, GRP_CONTENT_NETWORK_POPUP, EINA_FALSE);
if (!ly) {
_ERR("Add layout failed.");
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
return NULL;
}
//elm_object_part_text_set(ly, PART_POPUP_TITLE, "NO network ?");
/*
if (!_fill_popup_btns(priv, ly, LANG_TYPE_MAX, PART_POPUP_BUTTON_X,
language_option, EO_BTN_LANG_ENG)) {
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
return NULL;
}
*/
btn1 = utils_add_button(ly, "part.popup.bottom.no", STYLE_DISABLE_BTN, "No");
if (!btn1) {
_ERR("Add button failed.");
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
return NULL;
}
- //evas_object_smart_callback_add(btn1, "clicked", _clicked_cb, priv->base);
+ //evas_object_smart_callback_add(btn1, "clicked", _clicked_cb, wifi_popup);
inputmgr_add_callback(btn1, EO_NO, &handler, priv);
btn2 = utils_add_button(ly, "part.popup.bottom.yes", STYLE_DISABLE_BTN, "Yes");
if (!btn2) {
_ERR("Add button failed.");
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
return NULL;
}
- //evas_object_smart_callback_add(btn2, "clicked", NULL/*_retry_cb*/, priv->base);
+ //evas_object_smart_callback_add(btn2, "clicked", NULL/*_retry_cb*/, wifi_popup);
//evas_object_show(_content_network_popup);
inputmgr_add_callback(btn2, EO_YES, &handler, priv);
- elm_object_focus_allow_set(priv->base, EINA_TRUE);
+ elm_object_focus_allow_set(wifi_popup, EINA_TRUE);
elm_object_focus_set(btn2, EINA_TRUE);
- elm_object_content_set(priv->base, ly);
+ elm_object_content_set(wifi_popup, ly);
if (!viewmgr_set_view_data(VIEW_WIRELESS, priv)) {
_ERR("Set view data failed.");
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
return NULL;
}
- return priv->base;
+ return wifi_popup;
}
static void _show(void *data)
return;
}
- evas_object_show(priv->base);
+ evas_object_show(wifi_popup);
}
return;
}
- evas_object_hide(priv->base);
+ evas_object_hide(wifi_popup);
}
static void _destroy(void *data)
return;
}
- evas_object_del(priv->base);
+ evas_object_del(wifi_popup);
}
case EO_NO:
viewmgr_pop_view();
viewmgr_pop_view();
+ viewmgr_remove_view(VIEW_WIRELESS);
break;
case EO_YES:
viewmgr_pop_view();
- datamgr_update(priv->wirelessmgr);
+ datamgr_update(priv->wirelessmgr, WIRELESS_ACTIVATE);
break;
default:
_ERR("Unhandled object type.");
if (!listmgr_update_grid(priv->listmgr, LIST_WIRELESS))
_ERR("Listmgr update list failed.");
- datamgr_update(priv->wirelessmgr);
+ datamgr_update(priv->wirelessmgr, WIRELESS_ACTIVATE);
list = datamgr_get_data(priv->wirelessmgr);
if (!list) {
//_draw_no_contents_message(priv);
break;
case EO_YES:
viewmgr_pop_view();
- datamgr_update(priv->wirelessmgr);
+ datamgr_update(priv->wirelessmgr, WIRELESS_ACTIVATE);
break;
default:
_ERR("Unhandled object type.");
break;
case EO_YES:
viewmgr_pop_view();
- datamgr_update(priv->wirelessmgr);
+ datamgr_update(priv->wirelessmgr, WIRELESS_ACTIVATE);
break;
default:
_ERR("Unhandled object type.");