Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: src/device.h

Issue 3576011: Cashew: track cellular service state. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git
Patch Set: Make debug logging less verbose Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/data_plan.cc ('k') | src/device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/device.h
diff --git a/src/device.h b/src/device.h
new file mode 100644
index 0000000000000000000000000000000000000000..5fca3b6df152250466298971ec1c6effb1e920f6
--- /dev/null
+++ b/src/device.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2010 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.
+
+#ifndef SRC_DEVICE_H_
+#define SRC_DEVICE_H_
+
+#include <string>
+
+#include <base/basictypes.h> // NOLINT
+#include <dbus-c++/dbus.h> // NOLINT
+
+#include "src/flimflam_device_client_glue.h"
+
+namespace cashew {
+
+// represents a cellular device and monitors Flimflam state for that device
+class Device : public org::chromium::flimflam::Device_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy {
+ public:
+ Device(DBus::Connection& connection, const DBus::Path& path); // NOLINT
+ virtual ~Device();
+
+ // get D-Bus path for this device
+ virtual const DBus::Path& GetPath() const;
+
+ // valid type values for this device
+ typedef enum {
+ kTypeUnknown = 0,
+ kTypeEthernet,
+ kTypeWifi,
+ kTypeWimax,
+ kTypeBluetooth,
+ kTypeGPS,
+ kTypeCellular,
+ kTypeVendor,
+ } Type;
+
+ // get type for this device
+ // NOTE: for now, should always be kTypeCellular
+ virtual Type GetType() const;
+
+ static const char* kCarrierUnknown;
+
+ // get cellular carrier for this device
+ // returns kCarrierUnknown if we don't know
+ virtual const std::string& GetCarrier() const;
+
+ // Flimflam Device D-Bus Proxy methods
+ virtual void PropertyChanged(const std::string& property_name,
+ const DBus::Variant& new_value);
+
+ private:
+ // D-Bus path for Flimflam device that we represent
+ // this is our unique identifier
+ const DBus::Path path_;
+
+ // device type
+ Type type_;
+
+ // cellular carrier
+ std::string carrier_;
+
+ // convert type string to Type enum value
+ Type TypeFromString(const std::string& type) const;
+
+ // we've received updated Cellular.Carrier info from Flimflam
+ void OnCarrierUpdate(const std::string& carrier);
+
+ // we've received updated Type info from Flimflam
+ void OnTypeUpdate(const std::string& type);
+
+ // get device properties from Flimflam
+ void GetDeviceProperties();
+
+ DISALLOW_COPY_AND_ASSIGN(Device);
+};
+
+} // namespace cashew
+
+#endif // SRC_DEVICE_H_
« no previous file with comments | « src/data_plan.cc ('k') | src/device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698