| 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_H_ | 5 #ifndef SRC_SERVICE_H_ |
| 6 #define SRC_SERVICE_H_ | 6 #define SRC_SERVICE_H_ |
| 7 | 7 |
| 8 #include <glib.h> | 8 #include <glib.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // get Device object for this service | 76 // get Device object for this service |
| 77 // this can return NULL if we don't yet have Device info | 77 // this can return NULL if we don't yet have Device info |
| 78 virtual Device* GetDevice() const; | 78 virtual Device* GetDevice() const; |
| 79 | 79 |
| 80 // get data plan info, formatted for D-Bus | 80 // get data plan info, formatted for D-Bus |
| 81 virtual DBusDataPlanList GetDBusDataPlans() const; | 81 virtual DBusDataPlanList GetDBusDataPlans() const; |
| 82 | 82 |
| 83 // do we think that we're the default service at this time? | 83 // do we think that we're the default service at this time? |
| 84 virtual bool IsDefaultService() const; | 84 virtual bool IsDefaultService() const; |
| 85 | 85 |
| 86 typedef enum { |
| 87 kConnectivityStateUnknown = 0, |
| 88 kConnectivityStateRestricted, |
| 89 kConnectivityStateUnrestricted, |
| 90 kConnectivityStateNone, |
| 91 } ConnectivityState; |
| 92 |
| 93 // get connectivity state for this service |
| 94 virtual ConnectivityState GetConnectivityState() const; |
| 95 |
| 86 // Flimflam Service D-Bus Proxy methods | 96 // Flimflam Service D-Bus Proxy methods |
| 87 | 97 |
| 88 // receive incoming PropertyChanged D-Bus signal from Flimflam service | 98 // receive incoming PropertyChanged D-Bus signal from Flimflam service |
| 89 virtual void PropertyChanged(const std::string& property_name, | 99 virtual void PropertyChanged(const std::string& property_name, |
| 90 const DBus::Variant& new_value); | 100 const DBus::Variant& new_value); |
| 91 | 101 |
| 92 // Device methods | 102 // Device methods |
| 93 | 103 |
| 94 // we've received updated Cellular.Carrier info from our child Device | 104 // we've received updated Cellular.Carrier info from our child Device |
| 95 virtual void OnCarrierUpdate(const std::string& carrier); | 105 virtual void OnCarrierUpdate(const std::string& carrier); |
| 96 | 106 |
| 107 // we've received updated byte counter info from our child Device |
| 108 virtual void OnByteCounterUpdate(uint64 rx_bytes, uint64 tx_bytes); |
| 109 |
| 97 // DataPlanProviderDelegate methods | 110 // DataPlanProviderDelegate methods |
| 98 | 111 |
| 99 // a request to our carrier usage API proxy has completed | 112 // a request to our carrier usage API proxy has completed |
| 100 virtual void OnRequestComplete(const DataPlanProvider *provider, | 113 virtual void OnRequestComplete(const DataPlanProvider *provider, |
| 101 bool successful, | 114 bool successful, |
| 102 const Value *parsed_usage_update); | 115 const Value *parsed_usage_update); |
| 103 | 116 |
| 104 // Service Manager methods | 117 // Service Manager methods |
| 105 | 118 |
| 106 // we've received an update from our parent about whether or not we're the | 119 // we've received an update from our parent about whether or not we're the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 185 |
| 173 // GetProperties timer glib source id | 186 // GetProperties timer glib source id |
| 174 // 0 means no source | 187 // 0 means no source |
| 175 guint get_properties_source_id_; | 188 guint get_properties_source_id_; |
| 176 | 189 |
| 177 // are we in the process of retrying our GetProperties call? | 190 // are we in the process of retrying our GetProperties call? |
| 178 // this flag exists to distinguish between our initial g_idle_add call | 191 // this flag exists to distinguish between our initial g_idle_add call |
| 179 // and our subsequent timer calls | 192 // and our subsequent timer calls |
| 180 bool retrying_get_properties_; | 193 bool retrying_get_properties_; |
| 181 | 194 |
| 195 // Service connectivity state |
| 196 // finer-grained connectivity info applicable when |state_| == kStateReady |
| 197 ConnectivityState connectivity_state_; |
| 198 |
| 199 // convert connectivity state string to ConnectivityState enum value |
| 200 static ConnectivityState ConnectivityStateFromString( |
| 201 const std::string& connectivity_state); |
| 202 |
| 182 // convert state string to State enum value | 203 // convert state string to State enum value |
| 183 State StateFromString(const std::string& state) const; | 204 static State StateFromString(const std::string& state); |
| 184 | 205 |
| 185 // we've received updated Device info from Flimflam | 206 // we've received updated Device info from Flimflam |
| 186 void OnDeviceUpdate(const DBus::Path& device_path); | 207 void OnDeviceUpdate(const DBus::Path& device_path); |
| 187 | 208 |
| 209 // we've received updated Connectivity State info from Flimflam |
| 210 void OnConnectivityStateUpdate(const std::string& connectivity_state); |
| 211 |
| 188 // we've received updated State info from Flimflam | 212 // we've received updated State info from Flimflam |
| 189 void OnStateUpdate(const std::string& state); | 213 void OnStateUpdate(const std::string& state); |
| 190 | 214 |
| 191 // we've received updated Type info from Flimflam | 215 // we've received updated Type info from Flimflam |
| 192 void OnTypeUpdate(const std::string& type); | 216 void OnTypeUpdate(const std::string& type); |
| 193 | 217 |
| 194 // we've received updated Cellular.UsageUrl info from Flimflam | 218 // we've received updated Cellular.UsageUrl info from Flimflam |
| 195 void OnUsageUrlUpdate(const std::string& usage_url); | 219 void OnUsageUrlUpdate(const std::string& usage_url); |
| 196 | 220 |
| 197 // glib integration: static wrapper for GetServiceProperties | 221 // glib integration: static wrapper for GetServiceProperties |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // stop sending periodic usage API requests | 287 // stop sending periodic usage API requests |
| 264 void StopSendingUsageRequests(); | 288 void StopSendingUsageRequests(); |
| 265 | 289 |
| 266 // start sending periodic usage API requests | 290 // start sending periodic usage API requests |
| 267 void StartSendingUsageRequests(); | 291 void StartSendingUsageRequests(); |
| 268 | 292 |
| 269 // something has changed, so reevaluate whether or not we should be sending | 293 // something has changed, so reevaluate whether or not we should be sending |
| 270 // periodic usage API requests and adjust our behavior if necessary | 294 // periodic usage API requests and adjust our behavior if necessary |
| 271 void ReconsiderSendingUsageRequests(); | 295 void ReconsiderSendingUsageRequests(); |
| 272 | 296 |
| 297 // consult policy to determine if we should send an unsolicited update |
| 298 void MaybeEmitDataPlansUpdate(); |
| 299 |
| 273 DISALLOW_COPY_AND_ASSIGN(Service); | 300 DISALLOW_COPY_AND_ASSIGN(Service); |
| 274 }; | 301 }; |
| 275 | 302 |
| 276 } // namespace cashew | 303 } // namespace cashew |
| 277 | 304 |
| 278 #endif // SRC_SERVICE_H_ | 305 #endif // SRC_SERVICE_H_ |
| OLD | NEW |