| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SRC_SERVICE_MANAGER_H_ | 5 #ifndef SRC_SERVICE_MANAGER_H_ |
| 6 #define SRC_SERVICE_MANAGER_H_ | 6 #define SRC_SERVICE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const DBus::Variant& new_value); | 71 const DBus::Variant& new_value); |
| 72 | 72 |
| 73 // receive incoming StateChanged D-Bus signal from Flimflam | 73 // receive incoming StateChanged D-Bus signal from Flimflam |
| 74 virtual void StateChanged(const std::string& new_state_string); | 74 virtual void StateChanged(const std::string& new_state_string); |
| 75 | 75 |
| 76 // Service methods | 76 // Service methods |
| 77 | 77 |
| 78 // a child Service wants us to emit an update about its data plans | 78 // a child Service wants us to emit an update about its data plans |
| 79 virtual void EmitDataPlansUpdate(const Service& service); | 79 virtual void EmitDataPlansUpdate(const Service& service); |
| 80 | 80 |
| 81 // glib integration interface |
| 82 |
| 83 // get idle/timer source id |
| 84 virtual guint GetGetPropertiesSourceId() const; |
| 85 |
| 86 // set idle/timer source id |
| 87 virtual void SetGetPropertiesSourceId(guint source_id); |
| 88 |
| 89 // are we in the process of retrying our GetProperties call? |
| 90 virtual bool RetryingGetProperties() const; |
| 91 |
| 92 // set the retrying flag |
| 93 virtual void OnRetryingGetProperties(bool retrying); |
| 94 |
| 81 private: | 95 private: |
| 82 // D-Bus connection owned by our creator | 96 // D-Bus connection owned by our creator |
| 83 // shared with Service objs that we create | 97 // shared with Service objs that we create |
| 84 DBus::Connection& connection_; | 98 DBus::Connection& connection_; |
| 85 | 99 |
| 86 // collection of Service objs representing cellular services | 100 // collection of Service objs representing cellular services |
| 87 ServiceMap services_; | 101 ServiceMap services_; |
| 88 | 102 |
| 89 // Cashew server implementing our front-end interface | 103 // Cashew server implementing our front-end interface |
| 90 CashewServer *cashew_server_; | 104 CashewServer *cashew_server_; |
| 91 | 105 |
| 92 // default technology most recently reported by Flimflam | 106 // default technology most recently reported by Flimflam |
| 93 Service::Type default_technology_; | 107 Service::Type default_technology_; |
| 94 | 108 |
| 95 // the cellular service, if any, that we think is the default service | 109 // the cellular service, if any, that we think is the default service |
| 96 // can be NULL if we don't know the default service or a non-cellular | 110 // can be NULL if we don't know the default service or a non-cellular |
| 97 // service is the default | 111 // service is the default |
| 98 Service *default_cellular_service_; | 112 Service *default_cellular_service_; |
| 99 | 113 |
| 100 // global connectivity state most recently reported by Flimflam | 114 // global connectivity state most recently reported by Flimflam |
| 101 ConnectivityState connectivity_state_; | 115 ConnectivityState connectivity_state_; |
| 102 | 116 |
| 117 // GetProperties timer glib source id |
| 118 // 0 means no source |
| 119 guint get_properties_source_id_; |
| 120 |
| 121 // are we in the process of retrying our GetProperties call? |
| 122 // this flag exists to distinguish between our initial g_idle_add call |
| 123 // and our subsequent timer calls |
| 124 bool retrying_get_properties_; |
| 125 |
| 103 // delete a collection of services | 126 // delete a collection of services |
| 104 void DeleteServices(ServiceMap *service_map); | 127 void DeleteServices(ServiceMap *service_map); |
| 105 | 128 |
| 129 // glib integration: static wrapper for GetFlimflamProperties |
| 130 // takes object ptr as data and invokes object->GetFlimflamProperties() |
| 131 static gboolean StaticGetFlimflamPropertiesCallback(gpointer data); |
| 132 |
| 106 // get interesting properties from Flimflam such as Services and | 133 // get interesting properties from Flimflam such as Services and |
| 107 // DefaultTechnology | 134 // DefaultTechnology |
| 108 void GetFlimflamProperties(); | 135 // returns true on success and false on failure |
| 136 bool GetFlimflamProperties(); |
| 109 | 137 |
| 110 // we've received updated DefaultTechnology info from Flimflam | 138 // we've received updated DefaultTechnology info from Flimflam |
| 111 void OnDefaultTechnologyUpdate(const std::string& default_technology); | 139 void OnDefaultTechnologyUpdate(const std::string& default_technology); |
| 112 | 140 |
| 113 // we've received updated Services info from Flimflam | 141 // we've received updated Services info from Flimflam |
| 114 void OnServicesUpdate(const ServicePathList& paths); | 142 void OnServicesUpdate(const ServicePathList& paths); |
| 115 | 143 |
| 116 // Flimflam has started advertising a new service | 144 // Flimflam has started advertising a new service |
| 117 void OnNewService(const DBus::Path& path); | 145 void OnNewService(const DBus::Path& path); |
| 118 | 146 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 140 | 168 |
| 141 // Flimflam has told us that it has gone offline | 169 // Flimflam has told us that it has gone offline |
| 142 void OnFlimflamOffline(); | 170 void OnFlimflamOffline(); |
| 143 | 171 |
| 144 DISALLOW_COPY_AND_ASSIGN(ServiceManager); | 172 DISALLOW_COPY_AND_ASSIGN(ServiceManager); |
| 145 }; | 173 }; |
| 146 | 174 |
| 147 } // namespace cashew | 175 } // namespace cashew |
| 148 | 176 |
| 149 #endif // SRC_SERVICE_MANAGER_H_ | 177 #endif // SRC_SERVICE_MANAGER_H_ |
| OLD | NEW |