Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: src/device.h

Issue 4304002: cashew: don't invoke D-Bus methods from within a D-Bus handler (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DEVICE_H_ 5 #ifndef SRC_DEVICE_H_
6 #define SRC_DEVICE_H_ 6 #define SRC_DEVICE_H_
7 7
8 #include <glib.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include <base/basictypes.h> // NOLINT 12 #include <base/basictypes.h> // NOLINT
11 #include <dbus-c++/dbus.h> // NOLINT 13 #include <dbus-c++/dbus.h> // NOLINT
12 14
13 #include "src/flimflam_device_client_glue.h" 15 #include "src/flimflam_device_client_glue.h"
14 16
15 namespace cashew { 17 namespace cashew {
16 18
17 class Service; 19 class Service;
(...skipping 29 matching lines...) Expand all
47 static const char *kCarrierUnknown; 49 static const char *kCarrierUnknown;
48 50
49 // get cellular carrier for this device 51 // get cellular carrier for this device
50 // returns kCarrierUnknown if we don't know 52 // returns kCarrierUnknown if we don't know
51 virtual const std::string& GetCarrier() const; 53 virtual const std::string& GetCarrier() const;
52 54
53 // Flimflam Device D-Bus Proxy methods 55 // Flimflam Device D-Bus Proxy methods
54 virtual void PropertyChanged(const std::string& property_name, 56 virtual void PropertyChanged(const std::string& property_name,
55 const DBus::Variant& new_value); 57 const DBus::Variant& new_value);
56 58
59 // glib integration interface
60
61 // get idle/timer source id
62 virtual guint GetGetPropertiesSourceId() const;
63
64 // set idle/timer source id
65 virtual void SetGetPropertiesSourceId(guint source_id);
66
67 // are we in the process of retrying our GetProperties call?
68 virtual bool RetryingGetProperties() const;
69
70 // set the retrying flag
71 virtual void OnRetryingGetProperties(bool retrying);
72
57 private: 73 private:
58 // back pointer to our parent Service 74 // back pointer to our parent Service
59 Service * const parent_; 75 Service * const parent_;
60 76
61 // D-Bus path for Flimflam device that we represent 77 // D-Bus path for Flimflam device that we represent
62 // this is our unique identifier 78 // this is our unique identifier
63 const DBus::Path path_; 79 const DBus::Path path_;
64 80
65 // device type 81 // device type
66 Type type_; 82 Type type_;
67 83
68 // cellular carrier 84 // cellular carrier
69 std::string carrier_; 85 std::string carrier_;
70 86
87 // GetProperties timer glib source id
88 // 0 means no source
89 guint get_properties_source_id_;
90
91 // are we in the process of retrying our GetProperties call?
92 // this flag exists to distinguish between our initial g_idle_add call
93 // and our subsequent timer calls
94 bool retrying_get_properties_;
95
71 // convert type string to Type enum value 96 // convert type string to Type enum value
72 Type TypeFromString(const std::string& type) const; 97 Type TypeFromString(const std::string& type) const;
73 98
74 // we've received updated Cellular.Carrier info from Flimflam 99 // we've received updated Cellular.Carrier info from Flimflam
75 void OnCarrierUpdate(const std::string& carrier); 100 void OnCarrierUpdate(const std::string& carrier);
76 101
77 // we've received updated Type info from Flimflam 102 // we've received updated Type info from Flimflam
78 void OnTypeUpdate(const std::string& type); 103 void OnTypeUpdate(const std::string& type);
79 104
105 // glib integration: static wrapper for GetDeviceProperties
106 // takes object ptr as data and invokes object->GetDeviceProperties
107 static gboolean StaticGetDevicePropertiesCallback(gpointer data);
108
80 // get device properties from Flimflam 109 // get device properties from Flimflam
81 void GetDeviceProperties(); 110 // returns true on success and false on failure
111 bool GetDeviceProperties();
82 112
83 DISALLOW_COPY_AND_ASSIGN(Device); 113 DISALLOW_COPY_AND_ASSIGN(Device);
84 }; 114 };
85 115
86 } // namespace cashew 116 } // namespace cashew
87 117
88 #endif // SRC_DEVICE_H_ 118 #endif // SRC_DEVICE_H_
OLDNEW
« no previous file with comments | « no previous file | src/device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698