#define TYPE_POPUP_X_OFFSET 190
+/*
+ * Index returned by elm_genlist_item_index_get() starts from 1,
+ * while eina_list_nth() index starts from 0
+ */
+#define ELM_GENLIST_ITEM_INDEX_GET_NORMALIZER 1
+
enum action_btn_enum {
CONNECT,
REFRESH,
enum network_type_enum network_type;
enum view_type cur_view;
- int wifi_init;
+ Eina_Bool is_wifi_initialized;
Eina_Bool wifi_conn;
Eina_Bool wired_conn;
int index;
if (!data || !ei) {
- _ERR("Parameter error!");
+ _ERR("Invalid parameter");
return;
}
gen_item = ei;
if (priv->last_item == gen_item) {
+ _DBG("The same item is selected again");
elm_object_item_signal_emit(gen_item, SIG_STATE_UNSELECTED, ELM);
_disable_connect_btn(priv);
_enable_connect_btn(priv);
_enable_other_btn(priv);
- index = elm_genlist_item_index_get(priv->last_item);
+ index = elm_genlist_item_index_get(priv->last_item)
+ - ELM_GENLIST_ITEM_INDEX_GET_NORMALIZER;
if (index < 0) {
- _ERR("the index of item is invalid.");
+ _ERR("Invalid index");
return;
}
ap_info = eina_list_nth(priv->ap_list, index);
if (!ap_info) {
- _ERR("ap info is NULL.");
+ _ERR("Failed to get AP info");
return;
}
priv->ap_name = strdup(ap_info->essid);
if (!priv->ap_name) {
- _ERR("ap name gets failed.");
+ _ERR("Failed to get AP name");
return;
}
+ _DBG("Selected AP name: %s", priv->ap_name);
if (priv->ap) {
wifi_mgr_ap_destroy(priv->ap);
wifi_mgr_ap_clone(&priv->ap, ap_info->ap);
if (!priv->ap) {
- _ERR("ap clone failed.");
+ _ERR("AP clone failed");
return;
}
/**
* Clear the genlist item list.
*
-* Called when need clear the ap list,eg.refrsh button is clicked
+* Called when need clear the AP list, e.g., when the refresh button is clicked
*
* @param[in] priv _priv object bypassed
*/
void *temp;
if (!priv || !priv->genlist) {
- _ERR("Parameter error!");
+ _ERR("Invalid parameter");
return;
}
int ret;
if (!priv) {
- _ERR("the param is invalid.");
+ _ERR("Invalid parameter");
return RET_FAILED;
}
_create_wireless_disconnect_part(priv);
- if (!priv->wifi_init) {
+ if (!priv->is_wifi_initialized) {
obj = _create_genlist_view(priv);
if (!obj) {
- _ERR("fail to create genlist");
+ _ERR("Failed to create genlist");
return RET_FAILED;
}
ret = wifi_mgr_init();
if (ret != RET_SUCCESS) {
- _ERR("fail to init wifi network");
+ _ERR("Failed to initialize Wi-Fi network");
return RET_FAILED;
}
- priv->wifi_init = 1;
+ priv->is_wifi_initialized = EINA_TRUE;
}
_clear_genlist_item_list(priv);
activated = EINA_FALSE;
ret = wifi_mgr_is_activated(&activated);
if (ret != RET_SUCCESS) {
- _ERR("the wifi is not activated.");
+ _ERR("Wi-Fi is still not activated");
return RET_FAILED;
}
int ret;
if (!priv) {
- _ERR("the param is NULL.");
+ _ERR("Invalid parameter");
return;
}
if (priv->network_type == TYPE_WIRELESS) {
if (priv->last_item) {
- index = elm_genlist_item_index_get(priv->last_item);
+ index = elm_genlist_item_index_get(priv->last_item)
+ - ELM_GENLIST_ITEM_INDEX_GET_NORMALIZER;
ret = _wifi_connect_ap(priv, index);
if (ret != RET_SUCCESS) {
- _ERR("connect ap");
+ _DBG("Failed to connect to selected AP");
_show_confirm_popup(priv);
return;
}
} else {
ret = _wired_connect_proc(priv);
if (ret != RET_SUCCESS) {
- _ERR("connect ap");
+ _DBG("Failed to connect to selected network");
_show_confirm_popup(priv);
return;
}