| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // we've received an update from our parent about whether or not we're the | 106 // we've received an update from our parent about whether or not we're the |
| 107 // default service | 107 // default service |
| 108 virtual void OnDefaultServiceUpdate(bool is_default_service); | 108 virtual void OnDefaultServiceUpdate(bool is_default_service); |
| 109 | 109 |
| 110 // we've received an update from our parent that Flimflam has come online | 110 // we've received an update from our parent that Flimflam has come online |
| 111 virtual void OnFlimflamOnline(); | 111 virtual void OnFlimflamOnline(); |
| 112 | 112 |
| 113 // we've received an update from our parent that Flimflam has gone offline | 113 // we've received an update from our parent that Flimflam has gone offline |
| 114 virtual void OnFlimflamOffline(); | 114 virtual void OnFlimflamOffline(); |
| 115 | 115 |
| 116 // glib integration interface |
| 117 |
| 118 // get idle/timer source id |
| 119 virtual guint GetGetPropertiesSourceId() const; |
| 120 |
| 121 // set idle/timer source id |
| 122 virtual void SetGetPropertiesSourceId(guint source_id); |
| 123 |
| 124 // are we in the process of retrying our GetProperties call? |
| 125 virtual bool RetryingGetProperties() const; |
| 126 |
| 127 // set the retrying flag |
| 128 virtual void OnRetryingGetProperties(bool retrying); |
| 129 |
| 116 private: | 130 private: |
| 117 // back pointer to our parent ServiceManager | 131 // back pointer to our parent ServiceManager |
| 118 ServiceManager * const parent_; | 132 ServiceManager * const parent_; |
| 119 | 133 |
| 120 // D-Bus connection, owned by our creator | 134 // D-Bus connection, owned by our creator |
| 121 // shared with Device obj that we create | 135 // shared with Device obj that we create |
| 122 DBus::Connection& connection_; | 136 DBus::Connection& connection_; |
| 123 | 137 |
| 124 // D-Bus path for Flimflam service that we represent | 138 // D-Bus path for Flimflam service that we represent |
| 125 // this is our unique identifier | 139 // this is our unique identifier |
| (...skipping 23 matching lines...) Expand all Loading... |
| 149 | 163 |
| 150 // periodic update timeout | 164 // periodic update timeout |
| 151 GSource *update_timeout_source_; | 165 GSource *update_timeout_source_; |
| 152 | 166 |
| 153 // carrier policy | 167 // carrier policy |
| 154 Policy *policy_; | 168 Policy *policy_; |
| 155 | 169 |
| 156 // do we think that we're the default service? | 170 // do we think that we're the default service? |
| 157 bool is_default_service_; | 171 bool is_default_service_; |
| 158 | 172 |
| 173 // GetProperties timer glib source id |
| 174 // 0 means no source |
| 175 guint get_properties_source_id_; |
| 176 |
| 177 // are we in the process of retrying our GetProperties call? |
| 178 // this flag exists to distinguish between our initial g_idle_add call |
| 179 // and our subsequent timer calls |
| 180 bool retrying_get_properties_; |
| 181 |
| 159 // convert state string to State enum value | 182 // convert state string to State enum value |
| 160 State StateFromString(const std::string& state) const; | 183 State StateFromString(const std::string& state) const; |
| 161 | 184 |
| 162 // we've received updated Device info from Flimflam | 185 // we've received updated Device info from Flimflam |
| 163 void OnDeviceUpdate(const DBus::Path& device_path); | 186 void OnDeviceUpdate(const DBus::Path& device_path); |
| 164 | 187 |
| 165 // we've received updated State info from Flimflam | 188 // we've received updated State info from Flimflam |
| 166 void OnStateUpdate(const std::string& state); | 189 void OnStateUpdate(const std::string& state); |
| 167 | 190 |
| 168 // we've received updated Type info from Flimflam | 191 // we've received updated Type info from Flimflam |
| 169 void OnTypeUpdate(const std::string& type); | 192 void OnTypeUpdate(const std::string& type); |
| 170 | 193 |
| 171 // we've received updated Cellular.UsageUrl info from Flimflam | 194 // we've received updated Cellular.UsageUrl info from Flimflam |
| 172 void OnUsageUrlUpdate(const std::string& usage_url); | 195 void OnUsageUrlUpdate(const std::string& usage_url); |
| 173 | 196 |
| 197 // glib integration: static wrapper for GetServiceProperties |
| 198 // takes object ptr as data and invokes object->GetServiceProperties() |
| 199 static gboolean StaticGetServicePropertiesCallback(gpointer data); |
| 200 |
| 174 // get service properties from Flimflam | 201 // get service properties from Flimflam |
| 175 void GetServiceProperties(); | 202 // returns true on success and false on failure |
| 203 bool GetServiceProperties(); |
| 176 | 204 |
| 177 // clear a DataPlanList and delete its data plan objects | 205 // clear a DataPlanList and delete its data plan objects |
| 178 void DeleteDataPlans(DataPlanList *data_plans); | 206 void DeleteDataPlans(DataPlanList *data_plans); |
| 179 | 207 |
| 180 // create a hardcoded data plan and add it to data_plans_ list | 208 // create a hardcoded data plan and add it to data_plans_ list |
| 181 // for debugging | 209 // for debugging |
| 182 void AddHardcodedDataPlan(); | 210 void AddHardcodedDataPlan(); |
| 183 | 211 |
| 184 // ask provider to request a usage update if it makes sense | 212 // ask provider to request a usage update if it makes sense |
| 185 void RequestUsageUpdate(); | 213 void RequestUsageUpdate(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // something has changed, so reevaluate whether or not we should be sending | 269 // something has changed, so reevaluate whether or not we should be sending |
| 242 // periodic usage API requests and adjust our behavior if necessary | 270 // periodic usage API requests and adjust our behavior if necessary |
| 243 void ReconsiderSendingUsageRequests(); | 271 void ReconsiderSendingUsageRequests(); |
| 244 | 272 |
| 245 DISALLOW_COPY_AND_ASSIGN(Service); | 273 DISALLOW_COPY_AND_ASSIGN(Service); |
| 246 }; | 274 }; |
| 247 | 275 |
| 248 } // namespace cashew | 276 } // namespace cashew |
| 249 | 277 |
| 250 #endif // SRC_SERVICE_H_ | 278 #endif // SRC_SERVICE_H_ |
| OLD | NEW |