Migrated to new connman::technology interface.
authorOssama Othman <ossama.othman@intel.com>
Tue, 26 Nov 2013 19:03:49 +0000 (11:03 -0800)
committerOssama Othman <ossama.othman@intel.com>
Tue, 26 Nov 2013 19:03:49 +0000 (11:03 -0800)
Change-Id: I4dd40214baf16fda00177da11fa7e83cdc4f2e3c
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
12 files changed:
plugins/connman/Makefile.am
plugins/connman/bluetooth.cpp [deleted file]
plugins/connman/bluetooth.hpp [deleted file]
plugins/connman/connman_manager.hpp
plugins/connman/connman_technology.cpp [new file with mode: 0644]
plugins/connman/connman_technology.hpp [moved from plugins/connman/ethernet.hpp with 56% similarity]
plugins/connman/ethernet.cpp [deleted file]
plugins/connman/registration.cpp
plugins/connman/technology.cpp
plugins/connman/technology.hpp
plugins/connman/wifi.cpp [deleted file]
plugins/connman/wifi.hpp [deleted file]

index e87ac62..b8ebe39 100644 (file)
@@ -36,12 +36,10 @@ connman_la_SOURCES =                \
        dbus_connection.cpp     \
        connman.cpp             \
        connman_manager.cpp     \
+       connman_technology.cpp  \
        service.cpp             \
        technology.cpp          \
-       bluetooth.cpp           \
        clock.cpp               \
-       ethernet.cpp            \
-       wifi.cpp                \
        registration.cpp        \
        $(BUILT_SOURCES)
 connman_la_CXXFLAGS = \
@@ -65,12 +63,10 @@ noinst_HEADERS =            \
        dbus_connection.hpp     \
        connman.hpp             \
        connman_manager.hpp     \
+       connman_technology.hpp  \
        service.hpp             \
        technology.hpp          \
-       bluetooth.hpp           \
-       clock.hpp               \
-       ethernet.hpp            \
-       wifi.hpp
+       clock.hpp
 
 dbus_codegen_verbose = $(dbus_codegen_verbose_$(V))
 dbus_codegen_verbose_ = $(dbus_codegen_verbose_$(AM_DEFAULT_VERBOSITY))
diff --git a/plugins/connman/bluetooth.cpp b/plugins/connman/bluetooth.cpp
deleted file mode 100644 (file)
index 5ad2fbd..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * @file bluetooth.cpp
- *
- * @brief Connman-based bluetooth settings.
- *
- * @author Ossama Othman @<ossama.othman@@intel.com@>
- *
- * @copyright @par
- * Copyright 2013 Intel Corporation All Rights Reserved.
- * @par
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- * @par
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * @par
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301  USA
- */
-
-#include "bluetooth.hpp"
-#include <settingsd/response_callback.hpp>
-
-// ----------------------------------------------------------------------
-
-namespace
-{
-  std::string const technology_name("bluetooth");
-}
-
-// ----------------------------------------------------------------------
-
-ivi::settings::bluetooth::bluetooth(GDBusConnection * connection,
-                                    connman_manager & manager,
-                                    event_callback const & e)
-  : technology_(technology_name, connection, manager, e)
-{
-}
-
-ivi::settings::bluetooth::~bluetooth()
-{
-}
-
-std::string const &
-ivi::settings::bluetooth::id() const
-{
-  return technology_name;
-}
-
-void
-ivi::settings::bluetooth::handle_request(std::string request,
-                                         response_callback response)
-{
-  technology_.handle_request(request, response);
-}
-
-
-// Local Variables:
-// mode:c++
-// c-basic-offset:2
-// indent-tabs-mode: nil
-// End:
diff --git a/plugins/connman/bluetooth.hpp b/plugins/connman/bluetooth.hpp
deleted file mode 100644 (file)
index c947f99..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * @file bluetooth.hpp
- *
- * @brief Bluetooth settings plugin.
- *
- * Connman-based bluetooth settings plugin.
- *
- * @author Ossama Othman @<ossama.othman@@intel.com@>
- *
- * @copyright @par
- * Copyright 2012, 2013 Intel Corporation All Rights Reserved.
- * @par
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- * @par
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * @par
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * @note This header is internal.  Settings provider plugin implementors
- *       should write their own library/symbol export macros as
- *       needed.
- */
-
-
-#ifndef IVI_SETTINGS_CONNMAN_BLUETOOTH_HPP
-#define IVI_SETTINGS_CONNMAN_BLUETOOTH_HPP
-
-#include <settingsd/plugin.hpp>
-
-#include "technology.hpp"
-
-
-namespace ivi
-{
-  namespace settings
-  {
-    /**
-     * @class bluetooth
-     *
-     * @brief Connman-based bluetooth settings.
-     *
-     * This class implements all connman-based bluetooth settings.
-     */
-    class bluetooth : public plugin
-    {
-    public:
-
-      /// Constructor.
-      bluetooth(GDBusConnection * connection,
-                connman_manager & manager,
-                event_callback const & e);
-
-      /// Destructor.
-      virtual ~bluetooth();
-
-      /**
-       * @name Settings Plugin API
-       *
-       * Interface defined by the @c ivi::settings::plugin abstract
-       * base class.
-       *
-       * @see settingsd/plugin.hpp
-       */
-      //@{
-      virtual std::string const & id() const;
-      virtual void handle_request(std::string request,
-                                  response_callback response);
-      //@}
-
-    private:
-
-      /// Underlying connman proxy.
-      technology technology_;
-
-    };
-
-  }
-}
-
-
-#endif  /* IVI_SETTINGS_CONNMAN_BLUETOOTH_HPP */
-
-
-// Local Variables:
-// mode:c++
-// c-basic-offset:2
-// indent-tabs-mode: nil
-// End:
-
index 66f39d7..23ef262 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * @file connman_manager.hpp
  *
- * @brief Connman connman_manager-based settings plugin header.
+ * @brief Connman Manager-based settings plugin header.
  *
  * @author Ossama Othman @<ossama.othman@@intel.com@>
  *
diff --git a/plugins/connman/connman_technology.cpp b/plugins/connman/connman_technology.cpp
new file mode 100644 (file)
index 0000000..b44d59e
--- /dev/null
@@ -0,0 +1,117 @@
+/**
+ * @file connman_technology.cpp
+ *
+ * @brief Connman Technology operations.
+ *
+ * @author Ossama Othman @<ossama.othman@@intel.com@>
+ *
+ * @copyright @par
+ * Copyright 2013 Intel Corporation All Rights Reserved.
+ * @par
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ * @par
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * @par
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301  USA
+ */
+
+#include "connman_technology.hpp"
+#include "technology.hpp"
+
+#include <settingsd/response_callback.hpp>
+#include <settingsd/glib_traits.hpp>
+#include <settingsd/unique_ptr.hpp>
+
+
+#include <cstring>
+
+// ----------------------------------------------------------------------
+
+namespace
+{
+  std::string const technology_name("connman::technology");
+}
+
+// ----------------------------------------------------------------------
+
+ivi::settings::connman_technology::connman_technology(
+  GDBusConnection * connection,
+  connman_manager & manager,
+  event_callback const & e)
+  : connman_("net.connman.Technology",     // Interface
+             "/",                       // Object path
+             connection,
+             e)
+  , manager_(manager)
+  , event_callback_(e)
+{
+}
+
+ivi::settings::connman_technology::~connman_technology()
+{
+}
+
+std::string const &
+ivi::settings::connman_technology::id() const
+{
+  return technology_name;
+}
+
+void
+ivi::settings::connman_technology::handle_request(
+  std::string request,
+  response_callback response)
+{
+  unique_ptr<JsonParser> const parser(json_parser_new());
+  json_parser_load_from_data(parser.get(), request.c_str(), -1, nullptr);
+
+  unique_ptr<JsonReader> const safe_reader(
+    json_reader_new(json_parser_get_root(parser.get())));
+  JsonReader * const reader = safe_reader.get();
+
+  char const * name = nullptr;
+  if (json_reader_read_member(reader, "name"))
+    name = json_reader_get_string_value(reader);
+  else
+    response.send_error(
+      "Malformed " + id() + " request: missing 'name' element");
+
+  json_reader_end_member(reader);
+
+  if (name != nullptr) {
+    if (json_reader_read_member(reader, "value")) {
+      // The technology object path is the first array element.
+      json_reader_read_element(reader, 0);
+      char const * const path = json_reader_get_string_value(reader);
+      json_reader_end_element(reader);
+
+      if (path != nullptr) {
+        technology t(path,
+                     connman_.connection(),
+                     manager_,
+                     event_callback_);
+        t.handle_request(name, reader, response);
+      }
+    }
+    json_reader_end_member(reader);
+  } else {
+    response.send_error(
+      "Operation name for " + id() + " request is not a string.");
+  }
+}
+
+
+// Local Variables:
+// mode:c++
+// c-basic-offset:2
+// indent-tabs-mode: nil
+// End:
similarity index 56%
rename from plugins/connman/ethernet.hpp
rename to plugins/connman/connman_technology.hpp
index a777e1b..ad8b78c 100644 (file)
@@ -1,14 +1,12 @@
 /**
- * @file ethernet.hpp
+ * @file connman_technology.hpp
  *
- * @brief Ethernet settings plugin.
- *
- * Connman-based ethernet settings plugin.
+ * @brief Connman Technology-based settings plugin header.
  *
  * @author Ossama Othman @<ossama.othman@@intel.com@>
  *
  * @copyright @par
- * Copyright 2012, 2013 Intel Corporation All Rights Reserved.
+ * Copyright 2013 Intel Corporation All Rights Reserved.
  * @par
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA  02110-1301  USA
- *
- * @note This header is internal.  Settings provider plugin implementors
- *       should write their own library/symbol export macros as
- *       needed.
  */
 
+#ifndef IVI_SETTINGS_CONNMAN_CONNMAN_TECHNOLOGY_HPP
+#define IVI_SETTINGS_CONNMAN_CONNMAN_TECHNOLOGY_HPP
 
-#ifndef IVI_SETTINGS_CONNMAN_ETHERNET_HPP
-#define IVI_SETTINGS_CONNMAN_ETHERNET_HPP
+#include "connman.hpp"
 
 #include <settingsd/plugin.hpp>
+#include <settingsd/event_callback.hpp>
 
-#include "technology.hpp"
+#include <gio/gio.h>
+
+#include <string>
 
 
 namespace ivi
 {
   namespace settings
   {
+    class connman_manager;
+
     /**
-     * @class ethernet
+     * @class connman_technology
      *
-     * @brief Connman-based ethernet settings.
+     * @brief D-Bus Connman Technology object bridge.
      *
-     * This class implements all connman-based ethernet settings.
+     * This class exposes the Connman Technology D-Bus API through the
+     * settings daemon WebSocket API.
      */
-    class ethernet : public plugin
+    class connman_technology : public plugin
     {
     public:
 
       /// Constructor.
-      ethernet(GDBusConnection * connection,
-               connman_manager & manager,
-               event_callback const & e);
+      connman_technology(GDBusConnection * connection,
+                         connman_manager & manager,
+                         event_callback const & e);
 
       /// Destructor.
-      virtual ~ethernet();
+      ~connman_technology();
 
       /**
        * @name Settings Plugin API
@@ -78,8 +79,14 @@ namespace ivi
 
     private:
 
-      /// Underlying connman proxy.
-      technology technology_;
+      /// The proxy used to access the connman Technology D-Bus API.
+      connman connman_;
+
+      /// The proxy used to access the connman Manager D-Bus API.
+      connman_manager & manager_;
+
+      /// Callback through which events will be sent to clients.
+      event_callback event_callback_;
 
     };
 
@@ -87,7 +94,7 @@ namespace ivi
 }
 
 
-#endif  /* IVI_SETTINGS_CONNMAN_ETHERNET_HPP */
+#endif  /* IVI_SETTINGS_CONNMAN_CONNMAN_TECHNOLOGY_HPP */
 
 
 // Local Variables:
@@ -95,4 +102,3 @@ namespace ivi
 // c-basic-offset:2
 // indent-tabs-mode: nil
 // End:
-
diff --git a/plugins/connman/ethernet.cpp b/plugins/connman/ethernet.cpp
deleted file mode 100644 (file)
index c740a48..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * @file ethernet.cpp
- *
- * @brief Connman-based ethernet settings.
- *
- * @author Ossama Othman @<ossama.othman@@intel.com@>
- *
- * @copyright @par
- * Copyright 2013 Intel Corporation All Rights Reserved.
- * @par
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- * @par
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * @par
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301  USA
- */
-
-#include "ethernet.hpp"
-#include <settingsd/response_callback.hpp>
-
-// ----------------------------------------------------------------------
-
-namespace
-{
-  std::string const technology_name("ethernet");
-}
-
-// ----------------------------------------------------------------------
-
-ivi::settings::ethernet::ethernet(GDBusConnection * connection,
-                                  connman_manager & manager,
-                                  event_callback const & e)
-  : technology_(technology_name, connection, manager, e)
-{
-}
-
-ivi::settings::ethernet::~ethernet()
-{
-}
-
-std::string const &
-ivi::settings::ethernet::id() const
-{
-  return technology_name;
-}
-
-void
-ivi::settings::ethernet::handle_request(std::string request,
-                                        response_callback response)
-{
-  technology_.handle_request(request, response);
-}
-
-
-// Local Variables:
-// mode:c++
-// c-basic-offset:2
-// indent-tabs-mode: nil
-// End:
index d12f6b0..4b37c82 100644 (file)
@@ -27,6 +27,7 @@
 #include "connman_api.hpp"
 #include "dbus_connection.hpp"
 #include "connman_manager.hpp"
+#include "connman_technology.hpp"
 #include "clock.hpp"
 
 #include <settingsd/registrar.hpp>
@@ -52,14 +53,19 @@ register_settings(ivi::settings::registrar & r,
   static ivi::settings::dbus_connection con;
   GDBusConnection * const connection = con.connection();
 
-  std::unique_ptr<ivi::settings::plugin> manager(
-    new ivi::settings::connman_manager(connection, e));
+  ivi::settings::connman_manager * const mgr =
+    new ivi::settings::connman_manager(connection, e);
+  std::unique_ptr<ivi::settings::plugin> manager(mgr);
+
+  std::unique_ptr<ivi::settings::plugin> technology(
+    new ivi::settings::connman_technology(connection, *mgr, e));
 
   std::unique_ptr<ivi::settings::plugin> clk(
     new ivi::settings::clock(connection, e));
 
   return
     r.register_setting(std::move(manager))
+    && r.register_setting(std::move(technology))
     && r.register_setting(std::move(clk));
 }
 
index 5fb22bd..15c0f1f 100644 (file)
 #include <settingsd/unique_ptr.hpp>
 
 #include <cstring>
-#include <chrono>
 
 
-ivi::settings::technology::technology(std::string tech,
+ivi::settings::technology::technology(char const * path,
                                       GDBusConnection * connection,
                                       connman_manager & manager,
                                       event_callback const & e)
   : connman_("net.connman.Technology",     // Interface
-             ("/net/connman/technology/"
-              + tech).c_str(),             // Object path
+             path,                         // Object path
              connection,
              e)
   , manager_(manager)
-  , technology_(tech)
   , event_callback_(e)
 {
 }
 
 void
-ivi::settings::technology::handle_request(std::string request,
-                                          response_callback response)
+ivi::settings::technology::handle_request(char const * name,
+                                          JsonReader * reader,
+                                          response_callback & response)
 {
-  unique_ptr<JsonParser> const parser(json_parser_new());
-  json_parser_load_from_data(parser.get(), request.c_str(), -1, nullptr);
-
-  unique_ptr<JsonReader> const safe_reader(
-    json_reader_new(json_parser_get_root(parser.get())));
-  JsonReader * const reader = safe_reader.get();
-
-  char const * name = nullptr;
-  if (json_reader_read_member(reader, "name"))
-    name = json_reader_get_string_value(reader);
-  else
-    response.send_error(
-      "Malformed " + technology_ + " request: missing 'name' element");
-
-  json_reader_end_member(reader);
-
   if (name != nullptr) {
     if (strcmp(name, "is_enabled") == 0)
       get_powered(reader, response);
@@ -79,34 +61,28 @@ ivi::settings::technology::handle_request(std::string request,
       set_powered(reader, response);
     else if (strcmp(name, "scan") == 0)
       scan(reader, response);
-    else if (strcmp(name, "connect") == 0)
-      connect(reader, response);
-    else if (strcmp(name, "disconnect") == 0)
-      disconnect(reader, response);
     else {
       response.send_error(
-        "Unrecognized " + technology_ + " request name: "
+        std::string("Unrecognized connman technology request name: ")
         + name);
     }
-  } else {
-    response.send_error(
-      "Operation name for " + technology_ + " request is not a string.");
   }
 }
 
 void
 ivi::settings::technology::get_powered(JsonReader * reader,
-                                       response_callback response)
+                                       response_callback response)
 {
   bool null = false;
-  if (json_reader_read_member(reader, "value")) {
+  // The value is the second array element.
+  if (json_reader_read_element(reader, 1)) {
     null = json_reader_get_null_value(reader);
   }
-  json_reader_end_member(reader);
+  json_reader_end_element(reader);
 
   if (!null) {
     response.send_error(
-      technology_ + " is_enabled parameter is not null.");
+      "connman::technology is_enabled parameter is not null.");
     return;
   }
 
@@ -129,14 +105,14 @@ ivi::settings::technology::get_powered(JsonReader * reader,
 
 void
 ivi::settings::technology::set_powered(JsonReader * reader,
-                                       response_callback response)
+                                       response_callback response)
 {
   bool enable = false;
-  if (json_reader_read_member(reader, "value")) {
+  // The value is the second array element.
+  if (json_reader_read_element(reader, 1)) {
     enable = json_reader_get_boolean_value(reader);
   }
-
-  json_reader_end_member(reader);
+  json_reader_end_element(reader);
 
   constexpr char const name[] = "Powered";
 
@@ -155,26 +131,28 @@ ivi::settings::technology::set_powered(JsonReader * reader,
         [](JsonBuilder * /* builder */) {});
   } else if (error != nullptr) {
     response.send_error(
-      "Unable to set " + technology_ + " powered state: "
+      std::string("Unable to set connman::technology powered state: ")
       + error->message);
   } else {
     response.send_error(
-      "Malformed " + technology_ + " enable request value.");
+      "Malformed connman::technology enable request value.");
   }
 }
 
 void
 ivi::settings::technology::scan(JsonReader * reader,
-                                response_callback response)
+                                response_callback response)
 {
   bool null = false;
-  if (json_reader_read_member(reader, "value")) {
+  // The value is the second array element.
+  if (json_reader_read_element(reader, 1)) {
     null = json_reader_get_null_value(reader);
   }
-  json_reader_end_member(reader);
+  json_reader_end_element(reader);
 
   if (!null) {
-    response.send_error(technology_ + " scan parameter is not null.");
+    response.send_error(
+      "connman::technology scan parameter is not null.");
     return;
   }
 
@@ -197,66 +175,34 @@ ivi::settings::technology::scan(JsonReader * reader,
     manager_.get_services(response);
   } else if (error != nullptr) {
     response.send_error(
-      "Unable to scan " + technology_ + ": "
+      std::string("Unable to scan connman::technology: ")
       + error->message);
   } else {
     response.send_error(
-      "Malformed " + technology_ + " scan request value.");
-  }
-}
-
-void
-ivi::settings::technology::connect(JsonReader * reader,
-                                   response_callback response)
-{
-  char const * service_path = nullptr;
-  if (json_reader_read_member(reader, "value")) {
-    service_path = json_reader_get_string_value(reader);
-  }
-  json_reader_end_member(reader);
-
-  /// @todo Refactor malformed JSON request handling code.
-  if (service_path != nullptr) {
-    service s(service_path,
-              connman_.connection(),
-              event_callback_);
-    s.connect(response);
-  } else {
-    response.send_error(
-      "Malformed " + technology_ + " connect request value.");
-  }
-}
-
-void
-ivi::settings::technology::disconnect(JsonReader * reader,
-                                      response_callback response)
-{
-  char const * service_path = nullptr;
-  if (json_reader_read_member(reader, "value")) {
-    service_path = json_reader_get_string_value(reader);
-  }
-  json_reader_end_member(reader);
-
-  if (service_path != nullptr) {
-    service s(service_path,
-              connman_.connection(),
-              event_callback_);
-    s.disconnect(response);
-  } else {
-    response.send_error(
-      "Malformed " + technology_ + " disconnect request value.");
+      "Malformed connman::technology scan request value.");
   }
 }
 
 GVariant *
 ivi::settings::technology::get_property(char const * name,
                                         GVariantType const * type,
-                                        response_callback response)
+                                        response_callback response)
 {
   GError * error = nullptr;
 
+  std::string tech(connman_.object_path());
+  auto const n = tech.rfind('/');
+  if (n == std::string::npos) {
+    response.send_error(
+      "Unable to determine Connman technology.  Malformed object path.");
+
+    return nullptr;
+  }
+
+  tech = tech.substr(n);
+
   unique_ptr<GVariant> const properties(
-    manager_.get_properties(technology_, error));
+    manager_.get_properties(tech.c_str(), error));
 
   unique_ptr<GError> safe_error(error);
 
@@ -267,19 +213,20 @@ ivi::settings::technology::get_property(char const * name,
 
     if (property == nullptr) {
       response.send_error(
-        "Internal " + technology_
+        "Internal " + tech
         + "error: \"" + name + "\" property lookup failed.");
     }
   } else if (error != nullptr) {
     response.send_error(
-      "Unable to get " + technology_ + "properties: "
+      "Unable to get " + tech + "properties: "
       + error->message);
   } else {
     // This scenario will occur if the technology doesn't exist on
     // the platform.  For example, attempting to retrieve the wifi
     // "Powered" property on a platform without supported hardware
     // will result in this error.
-    response.send_error(technology_ + " properties are not available.");
+    response.send_error(
+      "Connman technology properties are not available.");
   }
 
   return property.release();
index 536d179..fde6737 100644 (file)
@@ -56,52 +56,48 @@ namespace ivi
       /**
        * Constructor.
        *
-       * @param[in] tech       The connman technology,
-       *                       e.g. "bluetooth".
+       * @param[in] path       The connman technology object path.
        * @param[in] connection Underlying D-Bus connection.
        * @param[in] manager    Connman manager proxy.
        * @param[in] e          Callback through which events will be
        *                       sent to clients.
        */
-      technology(std::string tech,
+      technology(char const * path,
                  GDBusConnection * connection,
                  connman_manager & manager,
                  event_callback const & e);
 
-      /// Handle requests common to all connman technologies.
-      void handle_request(std::string request,
-                          response_callback response);
+
+      /**
+       * Handle connman technology-specific request.
+       *
+       * @param[in] name     The Connman Technology method name.
+       * @param[in] reader   @c JsonReader object containing desired
+       *                     values.  The value will be in the second
+       *                     array element.
+       * @param[in] response Callback through which results will be
+       *                     sent.
+       */
+      void handle_request(char const * name,
+                          JsonReader * reader,
+                          response_callback & response);
 
     private:
 
       /// Get technology "Powered" state.
       void get_powered(JsonReader * reader,
-                       response_callback response);
+                       response_callback response);
 
       /// Set technology "Powered" state.
       void set_powered(JsonReader * reader,
-                       response_callback response);
+                       response_callback &response);
 
       /**
        * Scan for services that implement the technology, e.g. WiFi
        * access points.
        */
       void scan(JsonReader * reader,
-                response_callback response);
-
-      /**
-       * Connect to service whose object path is found in the JSON
-       * request.
-       */
-      void connect(JsonReader * reader,
-                   response_callback response);
-
-      /**
-       * Disconnect from service whose object path is found in the
-       * JSON request.
-       */
-      void disconnect(JsonReader * reader,
-                      response_callback response);
+                response_callback & response);
 
       /**
        * Get property for this technology.
@@ -116,7 +112,7 @@ namespace ivi
        */
       GVariant * get_property(char const * name,
                               GVariantType const * type,
-                              response_callback response);
+                              response_callback response);
 
     private:
 
@@ -126,9 +122,6 @@ namespace ivi
       /// The proxy used to access the connman Manager D-Bus API.
       connman_manager & manager_;
 
-      /// Technology name, e.g. "bluetooth" or "wifi".
-      std::string const technology_;
-
       /// Callback through which events will be sent to clients.
       event_callback event_callback_;
 
diff --git a/plugins/connman/wifi.cpp b/plugins/connman/wifi.cpp
deleted file mode 100644 (file)
index 3738d71..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * @file wifi.cpp
- *
- * @brief Connman-based wifi settings.
- *
- * @author Ossama Othman @<ossama.othman@@intel.com@>
- *
- * @copyright @par
- * Copyright 2013 Intel Corporation All Rights Reserved.
- * @par
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- * @par
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * @par
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301  USA
- */
-
-#include "wifi.hpp"
-#include <settingsd/response_callback.hpp>
-
-// ----------------------------------------------------------------------
-
-namespace
-{
-  std::string const technology_name("wifi");
-}
-
-// ----------------------------------------------------------------------
-
-ivi::settings::wifi::wifi(GDBusConnection * connection,
-                          connman_manager & manager,
-                          event_callback const & e)
-  : technology_(technology_name, connection, manager, e)
-{
-}
-
-ivi::settings::wifi::~wifi()
-{
-}
-
-std::string const &
-ivi::settings::wifi::id() const
-{
-  return technology_name;
-}
-
-void
-ivi::settings::wifi::handle_request(std::string request,
-                                    response_callback response)
-{
-  technology_.handle_request(request, response);
-}
-
-
-// Local Variables:
-// mode:c++
-// c-basic-offset:2
-// indent-tabs-mode: nil
-// End:
diff --git a/plugins/connman/wifi.hpp b/plugins/connman/wifi.hpp
deleted file mode 100644 (file)
index 2ab51ec..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * @file wifi.hpp
- *
- * @brief Wifi settings plugin.
- *
- * Connman-based wifi settings plugin.
- *
- * @author Ossama Othman @<ossama.othman@@intel.com@>
- *
- * @copyright @par
- * Copyright 2012, 2013 Intel Corporation All Rights Reserved.
- * @par
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License.
- * @par
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * @par
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA  02110-1301  USA
- *
- * @note This header is internal.  Settings provider plugin implementors
- *       should write their own library/symbol export macros as
- *       needed.
- */
-
-
-#ifndef IVI_SETTINGS_CONNMAN_WIFI_HPP
-#define IVI_SETTINGS_CONNMAN_WIFI_HPP
-
-#include <settingsd/plugin.hpp>
-
-#include "technology.hpp"
-
-
-namespace ivi
-{
-  namespace settings
-  {
-    class response_callback;
-
-    /**
-     * @class wifi
-     *
-     * @brief Connman-based wifi settings.
-     *
-     * This class implements all connman-based wifi settings.
-     */
-    class wifi : public plugin
-    {
-    public:
-
-      /// Constructor.
-      wifi(GDBusConnection * connection,
-           connman_manager & manager,
-           event_callback const & e);
-
-      /// Destructor.
-      virtual ~wifi();
-
-      /**
-       * @name Settings Plugin API
-       *
-       * Interface defined by the @c ivi::settings::plugin abstract
-       * base class.
-       *
-       * @see settingsd/plugin.hpp
-       */
-      //@{
-      virtual std::string const & id() const;
-      virtual void handle_request(std::string request,
-                                  response_callback response);
-      //@}
-
-    private:
-
-      /// Underlying connman proxy.
-      technology technology_;
-
-    };
-
-  }
-}
-
-
-#endif  /* IVI_SETTINGS_CONNMAN_WIFI_HPP */
-
-
-// Local Variables:
-// mode:c++
-// c-basic-offset:2
-// indent-tabs-mode: nil
-// End:
-