Added fix to display the connected AP name in network submenu 40/128340/3
authorAbhishek Sansanwal <abhishek.s94@samsung.com>
Tue, 9 May 2017 06:35:25 +0000 (12:05 +0530)
committerAbhishek Sansanwal <abhishek.s94@samsung.com>
Tue, 9 May 2017 06:54:35 +0000 (12:24 +0530)
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
Change-Id: Ia255e34f3d41a273e23113b8f8023a062c3a81ce

include/common/datamgr.h
include/data/system/data_wireless.h
src/common/datamgr.c
src/data/system/data_wireless.c
src/layout/layout_network.c

index 6824699..445011c 100644 (file)
@@ -43,6 +43,10 @@ struct data_class {
        bool (*select)(void *dclass_data, Elm_Object_Item *it, void *data);
        Eina_List *(*get_data)(void *dclass_data);
 };
+struct datamgr {
+       struct data_class *dclass;
+       void *dclass_data;
+};
 
 /**
 * @brief Creates the data manager.
index 4648a1e..9a1bd87 100644 (file)
@@ -40,5 +40,6 @@ struct wifi_manager_ap_info {
 * @return The pointer to data_class
 */
 struct data_class *get_wireless_data_class(void);
-int wireless_get_connected_ap(wifi_manager_h wifi, char *essid);
+int wireless_get_connected_ap(void *dclass_data, char **essid);
+
 #endif /* __AIR_SETTINGS_DATA_WIRELESS_H__ */
index b9ac116..3359576 100644 (file)
 #include "app_debug.h"
 #include "common/datamgr.h"
 
-struct datamgr {
-       struct data_class *dclass;
-       void *dclass_data;
-};
 
 struct datamgr *datamgr_create(struct data_class *dclass,
                void (*event_cb)(enum event_type type, void *data),
index 23a58ae..5626622 100644 (file)
@@ -564,3 +564,30 @@ struct data_class *get_wireless_data_class(void)
        return &_dclass;
 }
 
+int wireless_get_connected_ap(void *dclass_data, char **essid)
+{      struct _priv *priv;
+       wifi_manager_ap_h ap;
+       int r;
+
+       if (!dclass_data) {
+               _ERR("Invalid argument.");
+               return 0;
+       }
+
+       priv = dclass_data;
+       r = wifi_manager_get_connected_ap(priv->wifi, &ap);
+       if (r != WIFI_MANAGER_ERROR_NONE) {
+               _ERR("wifi_manager_get_connected_ap failed.");
+               return 0;
+       }
+       r = wifi_manager_ap_get_essid(ap, essid);
+       if (r != WIFI_MANAGER_ERROR_NONE) {
+               _ERR("wifi_manager_ap_get_essid failed.");
+               wifi_manager_ap_destroy(ap);
+               return 0;
+       }
+
+       wifi_manager_ap_destroy(ap);
+       return 1;
+
+}
index 58027b5..9ff0741 100644 (file)
@@ -22,6 +22,7 @@
 #include "common/layoutmgr.h"
 #include "common/menumgr.h"
 #include "common/listmgr.h"
+#include "common/datamgr.h"
 #include "common/utils.h"
 #include "common/viewmgr.h"
 #include "data/system/data_wired.h"
@@ -70,6 +71,7 @@ static bool _draw_wifi_passcode_popup(struct _priv *priv, char *wifi_name,
                bool isReconnect);
 static void _focused1(void *data, int id);
 static void _selected(void *data, int id);
+static char *_get_connected_ap(void *data, int id);
 
 struct _priv * current_priv = NULL;
 
@@ -83,10 +85,9 @@ static struct menumgr_info menu_info[] = {
        {
                .id = TYPE_WIRELESS,
                .title = STR_WIRELESS,
-               .style = STYLE_NORMAL_BTN,
+               .style = STYLE_STATUS_BTN,
                .disabled = EINA_FALSE,
-               //.status = _get_connected_ap,
-               .status = NULL,
+               .status = _get_connected_ap,
                .progress_value = NULL,
                .progress_evas = NULL,
                .selected = _selected,
@@ -114,6 +115,20 @@ static struct menumgr_info menu_info[] = {
        }
 };
 
+static char *_get_connected_ap(void *data, int id)
+{
+       struct _priv *priv;
+       char *essid, *temp;
+       int r;
+       priv = data;
+       r = wireless_get_connected_ap(priv->wirelessmgr->dclass_data, &essid);
+       if (r) {
+               temp = strdup(essid);
+               free(essid);
+               return temp;
+       }
+       return strdup("");
+}
 
 static void _destroy_status_popup()
 {
@@ -1759,6 +1774,7 @@ static void _show(void *layout_data)
 //             if (priv->cur_type == TYPE_WIRELESS)
 //                     _retry_wireless_network(priv);
        }
+       menumgr_update(priv->menu);
 }
 
 static void _hide(void *layout_data)
@@ -1804,6 +1820,7 @@ static void _destroy(void *layout_data)
                priv->wired = NULL;
        }
 
+       menumgr_destroy(priv->menu);
        evas_object_del(priv->ly);
 
        free(priv);
@@ -1825,6 +1842,9 @@ static void _update(void *layout_data, int update_type, void *data)
        case UPDATE_ENABLE:
                elm_object_disabled_set(priv->ly, EINA_FALSE);
                break;
+       case UPDATE_CONTENT:
+               menumgr_update(priv->menu);
+               break;
        default:
                break;
        }