| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SRC_DEVICE_H_ |
| 6 #define SRC_DEVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include <base/basictypes.h> // NOLINT |
| 11 #include <dbus-c++/dbus.h> // NOLINT |
| 12 |
| 13 #include "src/flimflam_device_client_glue.h" |
| 14 |
| 15 namespace cashew { |
| 16 |
| 17 // represents a cellular device and monitors Flimflam state for that device |
| 18 class Device : public org::chromium::flimflam::Device_proxy, |
| 19 public DBus::IntrospectableProxy, |
| 20 public DBus::ObjectProxy { |
| 21 public: |
| 22 Device(DBus::Connection& connection, const DBus::Path& path); // NOLINT |
| 23 virtual ~Device(); |
| 24 |
| 25 // get D-Bus path for this device |
| 26 virtual const DBus::Path& GetPath() const; |
| 27 |
| 28 // valid type values for this device |
| 29 typedef enum { |
| 30 kTypeUnknown = 0, |
| 31 kTypeEthernet, |
| 32 kTypeWifi, |
| 33 kTypeWimax, |
| 34 kTypeBluetooth, |
| 35 kTypeGPS, |
| 36 kTypeCellular, |
| 37 kTypeVendor, |
| 38 } Type; |
| 39 |
| 40 // get type for this device |
| 41 // NOTE: for now, should always be kTypeCellular |
| 42 virtual Type GetType() const; |
| 43 |
| 44 static const char* kCarrierUnknown; |
| 45 |
| 46 // get cellular carrier for this device |
| 47 // returns kCarrierUnknown if we don't know |
| 48 virtual const std::string& GetCarrier() const; |
| 49 |
| 50 // Flimflam Device D-Bus Proxy methods |
| 51 virtual void PropertyChanged(const std::string& property_name, |
| 52 const DBus::Variant& new_value); |
| 53 |
| 54 private: |
| 55 // D-Bus path for Flimflam device that we represent |
| 56 // this is our unique identifier |
| 57 const DBus::Path path_; |
| 58 |
| 59 // device type |
| 60 Type type_; |
| 61 |
| 62 // cellular carrier |
| 63 std::string carrier_; |
| 64 |
| 65 // convert type string to Type enum value |
| 66 Type TypeFromString(const std::string& type) const; |
| 67 |
| 68 // we've received updated Cellular.Carrier info from Flimflam |
| 69 void OnCarrierUpdate(const std::string& carrier); |
| 70 |
| 71 // we've received updated Type info from Flimflam |
| 72 void OnTypeUpdate(const std::string& type); |
| 73 |
| 74 // get device properties from Flimflam |
| 75 void GetDeviceProperties(); |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(Device); |
| 78 }; |
| 79 |
| 80 } // namespace cashew |
| 81 |
| 82 #endif // SRC_DEVICE_H_ |
| OLD | NEW |