apmanager: abstraction for AP service.
Add an abstraction for AP service, which creates/manages hostapd process.
Update org.chromium.apmanager.Manager.CreateService method to be asynchronous,
where the service dbus path is return when the respective Service and Config
object completes the DBus interface registration.
While there, correctly register DBus object interfaces for each dbus object.
BUG=chromium:431760
TEST=unittests
CQ-DEPEND=CL:229600,CL:229430
Change-Id: I5bfb775d2cedb4d636b4f6963795c0d9180cc840
Reviewed-on: https://chromium-review.googlesource.com/229463
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
diff --git a/config.h b/config.h
index 1f7bb65..580d6db 100644
--- a/config.h
+++ b/config.h
@@ -19,11 +19,14 @@
: public org::chromium::apmanager::ConfigAdaptor,
public org::chromium::apmanager::ConfigInterface {
public:
- Config(const std::string& service_path,
- chromeos::dbus_utils::ExportedObjectManager* object_manager,
- chromeos::dbus_utils::AsyncEventSequencer* sequencer);
+ explicit Config(const std::string& service_path);
virtual ~Config();
+ // Register Config DBus object.
+ void RegisterAsync(
+ chromeos::dbus_utils::ExportedObjectManager* object_manager,
+ chromeos::dbus_utils::AsyncEventSequencer* sequencer);
+
// Generate a config file string for a hostapd instance. Raise appropriate
// error when encounter invalid configuration. Return true if success,
// false otherwise.
@@ -89,12 +92,9 @@
// Append security related configurations to the config file.
bool AppendSecurityMode(chromeos::ErrorPtr* error, std::string* config_str);
- static void SetError(const std::string& method,
- const std::string& message,
- chromeos::ErrorPtr* error);
-
dbus::ObjectPath dbus_path_;
std::string control_interface_;
+ std::unique_ptr<chromeos::dbus_utils::DBusObject> dbus_object_;
DISALLOW_COPY_AND_ASSIGN(Config);
};