Add support for removing WiFi connections. Fixes TIVI-2326. 64/14764/1
authorOssama Othman <ossama.othman@intel.com>
Fri, 10 Jan 2014 20:44:16 +0000 (12:44 -0800)
committerOssama Othman <ossama.othman@intel.com>
Fri, 10 Jan 2014 20:44:16 +0000 (12:44 -0800)
Change-Id: Iad368daf498908e7daab14cfb50a5e378552515e
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
plugins/connman/service.cpp
plugins/connman/service.hpp

index 55e4eac..e444cd2 100644 (file)
@@ -60,7 +60,9 @@ ivi::settings::service::handle_request(char const * name,
     if (strcmp(name, "connect") == 0)
       connect(reader, response);
     else if (strcmp(name, "disconnect") == 0)
-      disconnect(reader, response);
+      call_nullary_method("Disconnect", reader, response);
+    else if (strcmp(name, "remove") == 0)
+      call_nullary_method("Remove", reader, response);
     else {
       response.send_error(
         std::string("Unrecognized connman service request name: ")
@@ -114,8 +116,9 @@ ivi::settings::service::connect(JsonReader * reader,
 }
 
 void
-ivi::settings::service::disconnect(JsonReader * reader,
-                                   response_callback response)
+ivi::settings::service::call_nullary_method(char const * name,
+                                            JsonReader * reader,
+                                            response_callback response)
 {
   bool null = false;
   // The value is the second array element.
@@ -126,11 +129,12 @@ ivi::settings::service::disconnect(JsonReader * reader,
 
   if (!null) {
     response.send_error(
-      "connman::service::disconnect parameter is not null.");
+      std::string(name)
+      + " connman::service method parameter is not null.");
     return;
   }
 
-  call_method("Disconnect", response);
+  call_method(name, response);
 }
 
 void
index 6c765f8..481124d 100644 (file)
@@ -47,7 +47,7 @@ namespace ivi
      * @brief Connman Service object proxy.
      *
      * This class exposes functionality found in the connman
-     * @c Service interface to the caller.
+    * @c Service interface to the caller.
      */
     class service
     {
@@ -89,9 +89,14 @@ namespace ivi
       void connect(JsonReader * reader,
                    response_callback response);
 
-      /// Disconnect from the service.
-      void disconnect(JsonReader * reader,
-                      response_callback response);
+      /**
+       * Call Connman service API method with no arguments.
+       *
+       * @note @c Disconnect, @c Remove, etc.
+       */
+      void call_nullary_method(char const * name,
+                               JsonReader * reader,
+                               response_callback response);
 
       /**
        * Call the method @a name on the connman Service object.