[shill] Use flimflam-esque storage ids
Devices:
device_<MAC>
IPConfig:
ipconfig_<MAC of associated device>_0
Services:
ethernet_<MAC of associated device>
wifi_<MAC of associated device>_<SSID>_<mode>_<security>
cellular_<MAC of associated device>_<Network_name>
BUG=chromium-os:17744
TEST=unit
Change-Id: Ibf061f9c184e7c86f5afcf97d48e321fc74bde1c
Reviewed-on: http://gerrit.chromium.org/gerrit/6412
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/cellular_service.cc b/cellular_service.cc
index 70b1191..487df55 100644
--- a/cellular_service.cc
+++ b/cellular_service.cc
@@ -7,6 +7,7 @@
#include <string>
#include <base/logging.h>
+#include <base/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
#include "shill/cellular.h"
@@ -15,6 +16,9 @@
namespace shill {
+// static
+const char CellularService::kServiceType[] = "cellular";
+
CellularService::CellularService(ControlInterface *control_interface,
EventDispatcher *dispatcher,
Manager *manager,
@@ -51,6 +55,15 @@
cellular_->Activate(carrier);
}
+string CellularService::GetStorageIdentifier(const string &mac) {
+ string id = base::StringPrintf("%s_%s_%s",
+ kServiceType,
+ mac.c_str(),
+ serving_operator_.GetName().c_str());
+ std::replace_if(id.begin(), id.end(), &Service::LegalChar, '_');
+ return id;
+}
+
string CellularService::GetDeviceRpcId() {
return cellular_->GetRpcIdentifier();
}