shill: wimax: Autoconnect only one service per WiMAX device.
BUG=chrome-os-partner:11162
TEST=unit tests
Change-Id: Ie7a67035f2410f13c25991c57a955b76b71d791e
Reviewed-on: https://gerrit.chromium.org/gerrit/27169
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/wimax_service.cc b/wimax_service.cc
index c3d075e..391520f 100644
--- a/wimax_service.cc
+++ b/wimax_service.cc
@@ -25,6 +25,8 @@
const char WiMaxService::kStorageNetworkId[] = "NetworkId";
const char WiMaxService::kNetworkIdProperty[] = "NetworkId";
+const char WiMaxService::kAutoConnBusy[] = "busy";
+
WiMaxService::WiMaxService(ControlInterface *control,
EventDispatcher *dispatcher,
@@ -186,6 +188,19 @@
return "/";
}
+bool WiMaxService::IsAutoConnectable(const char **reason) const {
+ if (!Service::IsAutoConnectable(reason)) {
+ return false;
+ }
+ WiMaxRefPtr device = manager()->wimax_provider()->SelectCarrier(this);
+ DCHECK(device);
+ if (!device->IsIdle()) {
+ *reason = kAutoConnBusy;
+ return false;
+ }
+ return true;
+}
+
bool WiMaxService::Is8021x() const {
return true;
}