| 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_SERVICE_MANAGER_H_ |
| 6 #define SRC_SERVICE_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include <base/basictypes.h> // NOLINT |
| 13 #include <dbus-c++/dbus.h> // NOLINT |
| 14 |
| 15 #include "src/flimflam_manager_client_glue.h" |
| 16 |
| 17 namespace cashew { |
| 18 |
| 19 class Service; |
| 20 |
| 21 // map of service path names to Service objects |
| 22 typedef std::map<std::string, Service*> ServiceMap; |
| 23 |
| 24 // vector of DBus::Path objects (strings) representing service path names |
| 25 typedef std::vector<DBus::Path> ServicePathList; |
| 26 |
| 27 // monitors Flimflam and maintains a collection of cellular service objects |
| 28 class ServiceManager : public org::chromium::flimflam::Manager_proxy, |
| 29 public DBus::IntrospectableProxy, |
| 30 public DBus::ObjectProxy { |
| 31 public: |
| 32 explicit ServiceManager(DBus::Connection& connection); // NOLINT |
| 33 virtual ~ServiceManager(); |
| 34 |
| 35 // look up a service by its path name |
| 36 // returns NULL if service is not found |
| 37 virtual const Service* GetService(const std::string& service_path) const; |
| 38 |
| 39 // Flimflam Manager D-Bus Proxy methods |
| 40 |
| 41 // receive incoming PropertyChanged D-Bus signal from Flimflam |
| 42 virtual void PropertyChanged(const std::string& property_name, |
| 43 const DBus::Variant& new_value); |
| 44 |
| 45 // receive incoming StateChanged D-Bus signal from Flimflam |
| 46 virtual void StateChanged(const std::string& new_state); |
| 47 |
| 48 private: |
| 49 // D-Bus connection owned by our creator |
| 50 // shared with Service objs that we create |
| 51 DBus::Connection& connection_; |
| 52 |
| 53 // collection of Service objs representing cellular services |
| 54 ServiceMap services_; |
| 55 |
| 56 // delete a collection of services |
| 57 void DeleteServices(ServiceMap *service_map); |
| 58 |
| 59 // get Services info from Flimflam |
| 60 void GetFlimflamServices(); |
| 61 |
| 62 // we've received updated Services info from Flimflam |
| 63 void OnServicesUpdate(const ServicePathList& paths); |
| 64 |
| 65 // Flimflam has started advertising a new service |
| 66 void OnNewService(const DBus::Path& path); |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(ServiceManager); |
| 69 }; |
| 70 |
| 71 } // namespace cashew |
| 72 |
| 73 #endif // SRC_SERVICE_MANAGER_H_ |
| OLD | NEW |