service: Move setting of WPS input from agent to service.
authorJulien Massot <jmassot@aldebaran-robotics.com>
Fri, 13 Apr 2012 15:16:35 +0000 (15:16 +0000)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 17 Apr 2012 10:37:27 +0000 (13:37 +0300)
src/agent.c
src/service.c

index 7374138..e3433c8 100644 (file)
@@ -172,24 +172,6 @@ static void request_input_passphrase_reply(DBusPendingCall *call, void *user_dat
                dbus_message_iter_next(&dict);
        }
 
-       if (wps == TRUE) {
-               struct connman_network *network;
-
-               network = __connman_service_get_network(
-                                               passphrase_reply->service);
-               if (network == NULL)
-                       goto done;
-
-               connman_network_set_bool(network, "WiFi.UseWPS", wps);
-
-               if (wpspin != NULL && strlen(wpspin) > 0)
-                       connman_network_set_string(network,
-                                               "WiFi.PinWPS", wpspin);
-               else
-                       connman_network_set_string(network,
-                                               "WiFi.PinWPS", NULL);
-       }
-
 done:
        passphrase_reply->callback(passphrase_reply->service, values_received,
                                name, name_len,
index 88d7912..5ce6f32 100644 (file)
@@ -4323,12 +4323,22 @@ static void request_input_cb (struct connman_service *service,
                return;
        }
 
+       err = check_wpspin(wpspin);
+       if (err < 0)
+               goto done;
+       if (service->network != NULL) {
+               connman_network_set_bool(service->network, "Wifi.UseWPS", wps);
+               connman_network_set_string(service->network, "Wifi.PinWPS",
+                                               wpspin);
+       }
+
        if (identity != NULL)
                __connman_service_set_agent_identity(service, identity);
 
        if (passphrase != NULL)
                err = __connman_service_add_passphrase(service, passphrase);
 
+ done:
        if (err >= 0) {
                __connman_service_connect(service);