[shill] Use composition instead of inheritance with PropertyStore
Instead of having Device, Manager, etc all inherit from PropertyStore
and have it be difficult to follow the getting/setting property code,
have each include a PropertyStore as a data member. Provide an
accessor so that RPC adaptor classes can get and set properties
directly and continue to handle any necessary type conversion
themselves.
BUG=None
TEST=unit tests
Change-Id: I34781bde4de0e152550ca636e28d472abde756af
Reviewed-on: http://gerrit.chromium.org/gerrit/3616
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/cellular_service.cc b/cellular_service.cc
index 6cb4095..bf71840 100644
--- a/cellular_service.cc
+++ b/cellular_service.cc
@@ -28,22 +28,24 @@
strength_(0),
type_(flimflam::kTypeCellular) {
- RegisterConstString(flimflam::kActivationStateProperty, &activation_state_);
- RegisterConstString(flimflam::kOperatorNameProperty, &operator_name_);
- RegisterConstString(flimflam::kOperatorCodeProperty, &operator_code_);
- RegisterConstString(flimflam::kNetworkTechnologyProperty, &network_tech_);
- RegisterConstString(flimflam::kRoamingStateProperty, &roaming_state_);
- RegisterConstString(flimflam::kPaymentURLProperty, &payment_url_);
+ store_.RegisterConstString(flimflam::kActivationStateProperty,
+ &activation_state_);
+ store_.RegisterConstString(flimflam::kOperatorNameProperty, &operator_name_);
+ store_.RegisterConstString(flimflam::kOperatorCodeProperty, &operator_code_);
+ store_.RegisterConstString(flimflam::kNetworkTechnologyProperty,
+ &network_tech_);
+ store_.RegisterConstString(flimflam::kRoamingStateProperty, &roaming_state_);
+ store_.RegisterConstString(flimflam::kPaymentURLProperty, &payment_url_);
- RegisterStringmap(flimflam::kCellularApnProperty, &apn_info_);
- RegisterConstStringmap(flimflam::kCellularLastGoodApnProperty,
- &last_good_apn_info_);
+ store_.RegisterStringmap(flimflam::kCellularApnProperty, &apn_info_);
+ store_.RegisterConstStringmap(flimflam::kCellularLastGoodApnProperty,
+ &last_good_apn_info_);
- RegisterConstUint8(flimflam::kSignalStrengthProperty, &strength_);
- // RegisterDerivedString(flimflam::kStateProperty,
+ store_.RegisterConstUint8(flimflam::kSignalStrengthProperty, &strength_);
+ // HelpRegisterDerivedString(flimflam::kStateProperty,
// &Service::CalculateState,
// NULL);
- RegisterConstString(flimflam::kTypeProperty, &type_);
+ store_.RegisterConstString(flimflam::kTypeProperty, &type_);
}
CellularService::~CellularService() { }