shill: cellular: Persist the Allow.Roaming property of cellular devices
Persist the Allow.Roaming property of cellular devices
BUG=none
TEST=unit tests and manually testing on the machine. restart shill.
Change-Id: I25c25588ca20e9fb941b0024d558b229e5fcfa90
Reviewed-on: https://gerrit.chromium.org/gerrit/21540
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Tested-by: Jason Glasgow <jglasgow@chromium.org>
Commit-Ready: Jason Glasgow <jglasgow@chromium.org>
diff --git a/cellular_capability.cc b/cellular_capability.cc
index 22eb749..f278793 100644
--- a/cellular_capability.cc
+++ b/cellular_capability.cc
@@ -30,44 +30,11 @@
CellularCapability::CellularCapability(Cellular *cellular,
ProxyFactory *proxy_factory)
: cellular_(cellular),
- proxy_factory_(proxy_factory),
- allow_roaming_(false) {
- HelpRegisterDerivedBool(flimflam::kCellularAllowRoamingProperty,
- &CellularCapability::GetAllowRoaming,
- &CellularCapability::SetAllowRoaming);
+ proxy_factory_(proxy_factory) {
}
CellularCapability::~CellularCapability() {}
-void CellularCapability::HelpRegisterDerivedBool(
- const string &name,
- bool(CellularCapability::*get)(Error *error),
- void(CellularCapability::*set)(const bool &value, Error *error)) {
- cellular()->mutable_store()->RegisterDerivedBool(
- name,
- BoolAccessor(
- new CustomAccessor<CellularCapability, bool>(this, get, set)));
-}
-
-void CellularCapability::SetAllowRoaming(const bool &value, Error */*error*/) {
- SLOG(Cellular, 2) << __func__
- << "(" << allow_roaming_ << "->" << value << ")";
- if (allow_roaming_ == value) {
- return;
- }
- allow_roaming_ = value;
- // Use AllowRoaming() instead of allow_roaming_ in order to
- // incorporate provider preferences when evaluating if a disconnect
- // is required.
- if (!AllowRoaming() &&
- GetRoamingStateString() == flimflam::kRoamingStateRoaming) {
- Error error;
- cellular()->Disconnect(&error);
- }
- cellular()->adaptor()->EmitBoolChanged(
- flimflam::kCellularAllowRoamingProperty, value);
-}
-
void CellularCapability::RunNextStep(CellularTaskList *tasks) {
CHECK(!tasks->empty());
SLOG(Cellular, 2) << __func__ << ": " << tasks->size() << " remaining tasks";