// ----------------------------------------------------------------------
-ivi::settings::bluetooth::bluetooth(event_callback const & e)
- : technology_(technology_name, e)
+ivi::settings::bluetooth::bluetooth(connman_manager & manager,
+ event_callback const & e)
+ : technology_(technology_name, manager, e)
{
}
public:
/// Constructor.
- bluetooth(event_callback const & e);
+ bluetooth(connman_manager & manager, event_callback const & e);
/// Destructor.
virtual ~bluetooth();
// ----------------------------------------------------------------------
-ivi::settings::ethernet::ethernet(event_callback const & e)
- : technology_(technology_name, e)
+ivi::settings::ethernet::ethernet(connman_manager & manager,
+ event_callback const & e)
+ : technology_(technology_name, manager, e)
{
}
public:
/// Constructor.
- ethernet(event_callback const & e);
+ ethernet(connman_manager & manager, event_callback const & e);
/// Destructor.
virtual ~ethernet();
*/
#include "connman_api.hpp"
+#include "connman_manager.hpp"
#include "bluetooth.hpp"
#include "clock.hpp"
#include "ethernet.hpp"
register_settings(ivi::settings::registrar & r,
ivi::settings::event_callback const & e)
{
- std::unique_ptr<ivi::settings::plugin> bt(
- new ivi::settings::bluetooth(e));
+ // Only one instance of connman_manager is needed since the
+ // corresponding connman Manager is really a global object.
+ static ivi::settings::connman_manager manager(e);
- std::unique_ptr<ivi::settings::plugin> clk(
- new ivi::settings::clock(e));
+ std::unique_ptr<ivi::settings::plugin> bt(
+ new ivi::settings::bluetooth(manager, e));
std::unique_ptr<ivi::settings::plugin> eth(
- new ivi::settings::ethernet(e));
+ new ivi::settings::ethernet(manager, e));
std::unique_ptr<ivi::settings::plugin> wifi(
- new ivi::settings::wifi(e));
+ new ivi::settings::wifi(manager, e));
+
+ std::unique_ptr<ivi::settings::plugin> clk(
+ new ivi::settings::clock(e));
return
r.register_setting(std::move(bt))
- && r.register_setting(std::move(clk))
&& r.register_setting(std::move(eth))
- && r.register_setting(std::move(wifi));
+ && r.register_setting(std::move(wifi))
+ && r.register_setting(std::move(clk));
}
// Local Variables:
*/
#include "technology.hpp"
+#include "connman_manager.hpp"
#include "service.hpp"
+
#include <settingsd/response_callback.hpp>
#include <settingsd/glib_traits.hpp>
#include <settingsd/json_glib_traits.hpp>
ivi::settings::technology::technology(std::string tech,
+ connman_manager & manager,
event_callback const & e)
: connman_("net.connman.Technology", // Interface
("/net/connman/technology/"
+ tech).c_str(), // Object path
e)
- , manager_(e)
+ , manager_(manager)
, technology_(tech)
, event_callback_(e)
{
#define IVI_SETTINGS_CONNMAN_TECHNOLOGY_HPP
#include "connman.hpp"
-#include "connman_manager.hpp"
+
+#include <string>
#include <json-glib/json-glib.h>
namespace settings
{
class response_callback;
+ class connman_manager;
/**
* @class technology
* clients.
*/
technology(std::string tech,
+ connman_manager & manager,
event_callback const & e);
/// Handle requests common to all connman technologies.
/// The proxy used to access the connman Technology D-Bus API.
connman connman_;
- /**
- * The proxy used to access the connman Manager D-Bus API.
- *
- * @todo There is no point in making this @c connman_manager
- * instance technology-specific since it is really a
- * connman global object.
- */
- connman_manager manager_;
+ /// 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_;
// ----------------------------------------------------------------------
-ivi::settings::wifi::wifi(event_callback const & e)
- : technology_(technology_name, e)
+ivi::settings::wifi::wifi(connman_manager & manager,
+ event_callback const & e)
+ : technology_(technology_name, manager, e)
{
}
public:
/// Constructor.
- wifi(event_callback const & e);
+ wifi(connman_manager & manager, event_callback const & e);
/// Destructor.
virtual ~wifi();