[shill] Add support for setting properties.
This CL adds a framework for supporting RPC-exposed properties in Shill.
It also plumbs the code for setting properties on Service objects to prove
the approach. Device and Manager settings will follow.
BUG=chromium-os:16343
TEST=build shill, run unit tests.
Change-Id: I55869453d6039e688f1a49be9dfb1ba1315efe0a
Reviewed-on: http://gerrit.chromium.org/gerrit/3004
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
diff --git a/cellular_service.cc b/cellular_service.cc
new file mode 100644
index 0000000..a125c77
--- /dev/null
+++ b/cellular_service.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/cellular_service.h"
+
+#include <string>
+
+#include <base/logging.h>
+#include <chromeos/dbus/service_constants.h>
+
+#include "shill/cellular.h"
+#include "shill/control_interface.h"
+#include "shill/device.h"
+#include "shill/device_info.h"
+#include "shill/manager.h"
+#include "shill/shill_event.h"
+
+using std::string;
+
+namespace shill {
+CellularService::CellularService(ControlInterface *control_interface,
+ EventDispatcher *dispatcher,
+ Cellular *device,
+ const string &name)
+ : Service(control_interface, dispatcher, device, name),
+ cellular_(device),
+ 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_);
+
+ RegisterStringmap(flimflam::kCellularApnProperty, &apn_info_);
+ RegisterConstStringmap(flimflam::kCellularLastGoodApnProperty,
+ &last_good_apn_info_);
+
+ RegisterConstUint8(flimflam::kSignalStrengthProperty, &strength_);
+ // RegisterDerivedString(flimflam::kStateProperty,
+ // &Service::CalculateState,
+ // NULL);
+ RegisterConstString(flimflam::kTypeProperty, &type_);
+}
+
+CellularService::~CellularService() { }
+
+void CellularService::Connect() { }
+
+void CellularService::Disconnect() { }
+
+bool CellularService::Contains(const string &property) {
+ return (Service::Contains(property) ||
+ uint8_properties_.find(property) != uint8_properties_.end() ||
+ stringmap_properties_.find(property) != stringmap_properties_.end());
+}
+
+} // namespace shill