diff options
author | Ossama Othman <ossama.othman@intel.com> | 2013-10-08 11:11:12 -0700 |
---|---|---|
committer | Ossama Othman <ossama.othman@intel.com> | 2013-10-15 13:26:29 -0700 |
commit | f9ba2cb1939b84ba099ddc7ee7961f1c04eaf837 (patch) | |
tree | 1d807e7b79d17d4f56c32f4c41cc3fc7c3a8cfa2 /plugins/connman/registration.cpp | |
parent | 967168e40c76dac0b3f56b745e5898217b37a09b (diff) | |
download | settings-daemon-f9ba2cb1939b84ba099ddc7ee7961f1c04eaf837.tar.gz settings-daemon-f9ba2cb1939b84ba099ddc7ee7961f1c04eaf837.tar.bz2 settings-daemon-f9ba2cb1939b84ba099ddc7ee7961f1c04eaf837.zip |
Effectively make connman_manager a singleton.
Only one instance of connman_manager is needed since the
corresponding connman Manager is really a global object.
Change-Id: I5143c607c91663d5004024a427dc50142c7aa33a
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Diffstat (limited to 'plugins/connman/registration.cpp')
-rw-r--r-- | plugins/connman/registration.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/plugins/connman/registration.cpp b/plugins/connman/registration.cpp index a072f25..adccd49 100644 --- a/plugins/connman/registration.cpp +++ b/plugins/connman/registration.cpp @@ -25,6 +25,7 @@ */ #include "connman_api.hpp" +#include "connman_manager.hpp" #include "bluetooth.hpp" #include "clock.hpp" #include "ethernet.hpp" @@ -48,23 +49,27 @@ extern "C" IVI_SETTINGS_CONNMAN_API bool 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: |