[Wi-Fi Direct tethering] Adding ssid in CreateGroup method call. 25/130525/3
authorNishant Chaprana <n.chaprana@samsung.com>
Mon, 22 May 2017 15:26:35 +0000 (20:56 +0530)
committertaesub kim <taesub.kim@samsung.com>
Wed, 7 Jun 2017 01:46:44 +0000 (01:46 +0000)
Description: This patch will add ssid parameter in CreateGroup so that mobileap-agent
can configure Group's name on CreateGroup method call.

Change-Id: I693f0fcd5e1f9b299be41ad970ec7335f9a3011a
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
oem/wifi-direct-oem.h
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c
src/wifi-direct-iface.c

index 013402d..c3bf64d 100644 (file)
@@ -397,6 +397,7 @@ typedef struct {
        int persistent_group_id;
        int freq;
        char passphrase[OEM_PASS_PHRASE_LEN + 1];
+       char ssid[OEM_DEV_NAME_LEN + 1];
 } wfd_oem_group_param_s;
 
 typedef struct {
index ebe1f76..60847a1 100644 (file)
@@ -8,7 +8,7 @@
 
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.223
+Version:       1.2.224
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
index 039b86a..21fed3b 100644 (file)
@@ -5235,6 +5235,10 @@ int ws_create_group(wfd_oem_group_param_s *param)
                g_variant_builder_add(builder, "{sv}", "passphrase",
                                g_variant_new_string(param->passphrase));
 
+       if (param->ssid && strlen(param->ssid) > 0)
+               g_variant_builder_add(builder, "{sv}", "ssid",
+                               g_variant_new_string(param->ssid));
+
        if (param->freq)
                g_variant_builder_add(builder, "{sv}", "frequency",
                                g_variant_new_int32(param->freq));
index 1ce91bb..b7b9121 100644 (file)
@@ -174,6 +174,7 @@ const gchar wfd_manager_introspection_xml[] = {
                "</interface>"
                "<interface name='net.wifidirect.group'>"
                        "<method name='CreateGroup'>"
+                               "<arg type='a{sv}' name='parameters' direction='in'/>"
                                "<arg type='i' name='error_code' direction='out'/>"
                        "</method>"
                        "<method name='DestroyGroup'>"
@@ -1178,10 +1179,28 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
        if (!g_strcmp0(method_name, "CreateGroup")) {
                wfd_group_s *group = manager->group;
                wfd_oem_group_param_s param;
+               GVariantIter *iter = NULL;
+               gchar *key = NULL;
+               GVariant *var = NULL;
+               const char *ssid = NULL;
+
+               g_variant_get(parameters, "(a{sv})", &iter);
+               while (g_variant_iter_loop(iter, "{sv}", &key, &var)) {
+                       if (!g_strcmp0(key, "ssid")) {
+                               g_variant_get(var, "&s", &ssid);
+                               if (ssid == NULL) {
+                                       ret = WIFI_DIRECT_ERROR_INVALID_PARAMETER;
+                                       g_variant_iter_free(iter);
+                                       goto failed;
+                               }
+                               WDS_LOGD("SSID received [%s]", ssid);
+                       }
+               }
 
                if (group || manager->state < WIFI_DIRECT_STATE_ACTIVATED) {
                        WDS_LOGE("Group already exist or not a proper state");
                        ret = WIFI_DIRECT_ERROR_NOT_PERMITTED;
+                       g_variant_iter_free(iter);
                        goto failed;
                }
 
@@ -1193,6 +1212,7 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
                if (!group) {
                        WDS_LOGE("Failed to create pending group");
                        ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
+                       g_variant_iter_free(iter);
                        goto failed;
                }
                group->flags |= WFD_GROUP_FLAG_AUTONOMOUS;
@@ -1209,6 +1229,11 @@ static void __wfd_manager_group_iface_handler(const gchar *method_name,
                param.freq = WFD_FREQ_2G;
 #endif
 
+               if (ssid != NULL)
+                       g_strlcpy(param.ssid, ssid, WIFI_DIRECT_MAX_DEVICE_NAME_LEN+1);
+
+               g_variant_iter_free(iter);
+
                ret = wfd_oem_create_group(manager->oem_ops, &param);
                if (ret < 0) {
                        WDS_LOGE("Failed to create group");