62 |
62 |
63 #include <icd/dbus_api.h> |
63 #include <icd/dbus_api.h> |
64 |
64 |
65 QTM_BEGIN_NAMESPACE |
65 QTM_BEGIN_NAMESPACE |
66 |
66 |
|
67 struct ICd2DetailsDBusStruct |
|
68 { |
|
69 QString serviceType; |
|
70 uint serviceAttributes; |
|
71 QString setviceId; |
|
72 QString networkType; |
|
73 uint networkAttributes; |
|
74 QByteArray networkId; |
|
75 }; |
|
76 |
|
77 typedef QList<ICd2DetailsDBusStruct> ICd2DetailsList; |
|
78 |
67 class QNetworkSessionPrivate : public QObject |
79 class QNetworkSessionPrivate : public QObject |
68 { |
80 { |
69 Q_OBJECT |
81 Q_OBJECT |
70 public: |
82 public: |
71 QNetworkSessionPrivate() : |
83 QNetworkSessionPrivate() : |
72 tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), |
84 tx_data(0), rx_data(0), m_activeTime(0), isOpen(false), |
73 connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), |
85 connectFlags(ICD_CONNECTION_FLAG_USER_EVENT), |
74 currentState(QNetworkSession::Invalid) |
86 currentState(QNetworkSession::Invalid), |
|
87 m_asynchCallActive(false) |
75 { |
88 { |
76 m_stopTimer.setSingleShot(true); |
89 m_stopTimer.setSingleShot(true); |
77 connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal())); |
90 connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal())); |
|
91 |
|
92 QDBusConnection systemBus = QDBusConnection::systemBus(); |
|
93 |
|
94 m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE, |
|
95 ICD_DBUS_API_PATH, |
|
96 ICD_DBUS_API_INTERFACE, |
|
97 systemBus, |
|
98 this); |
|
99 |
|
100 systemBus.connect(ICD_DBUS_API_INTERFACE, |
|
101 ICD_DBUS_API_PATH, |
|
102 ICD_DBUS_API_INTERFACE, |
|
103 ICD_DBUS_API_CONNECT_SIG, |
|
104 this, |
|
105 SLOT(stateChange(const QDBusMessage&))); |
|
106 |
|
107 qDBusRegisterMetaType<ICd2DetailsDBusStruct>(); |
|
108 qDBusRegisterMetaType<ICd2DetailsList>(); |
|
109 |
|
110 m_connectRequestTimer.setSingleShot(true); |
|
111 connect(&m_connectRequestTimer, SIGNAL(timeout()), this, SLOT(connectTimeout())); |
78 } |
112 } |
79 |
113 |
80 ~QNetworkSessionPrivate() |
114 ~QNetworkSessionPrivate() |
81 { |
115 { |
82 cleanupSession(); |
116 cleanupSession(); |
119 void do_open(); |
153 void do_open(); |
120 void networkConfigurationsChanged(); |
154 void networkConfigurationsChanged(); |
121 void iapStateChanged(const QString& iapid, uint icd_connection_state); |
155 void iapStateChanged(const QString& iapid, uint icd_connection_state); |
122 void updateProxies(QNetworkSession::State newState); |
156 void updateProxies(QNetworkSession::State newState); |
123 void finishStopBySendingClosedSignal(); |
157 void finishStopBySendingClosedSignal(); |
|
158 void stateChange(const QDBusMessage& rep); |
|
159 void connectTimeout(); |
124 |
160 |
125 private: |
161 private: |
126 QNetworkConfigurationManager manager; |
162 QNetworkConfigurationManager manager; |
127 |
163 |
128 quint64 tx_data; |
164 quint64 tx_data; |
129 quint64 rx_data; |
165 quint64 rx_data; |
130 quint64 m_activeTime; |
166 quint64 m_activeTime; |
131 |
167 |
132 // The config set on QNetworkSession. |
168 // The config set on QNetworkSession. |
133 QNetworkConfiguration publicConfig; |
169 QNetworkConfiguration publicConfig; |
|
170 QNetworkConfiguration config; |
134 |
171 |
135 // If publicConfig is a ServiceNetwork this is a copy of publicConfig. |
172 // If publicConfig is a ServiceNetwork this is a copy of publicConfig. |
136 // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual |
173 // If publicConfig is an UserChoice that is resolved to a ServiceNetwork this is the actual |
137 // ServiceNetwork configuration. |
174 // ServiceNetwork configuration. |
138 QNetworkConfiguration serviceConfig; |
175 QNetworkConfiguration serviceConfig; |
164 |
201 |
165 void updateProxyInformation(); |
202 void updateProxyInformation(); |
166 void clearProxyInformation(); |
203 void clearProxyInformation(); |
167 QNetworkSession::State currentState; |
204 QNetworkSession::State currentState; |
168 |
205 |
|
206 QDBusInterface *m_dbusInterface; |
|
207 |
169 QTimer m_stopTimer; |
208 QTimer m_stopTimer; |
|
209 |
|
210 bool m_asynchCallActive; |
|
211 QTimer m_connectRequestTimer; |
170 }; |
212 }; |
171 |
213 |
172 QTM_END_NAMESPACE |
214 QTM_END_NAMESPACE |
173 |
215 |
|
216 // Marshall the ICd2DetailsDBusStruct data into a D-Bus argument |
|
217 QDBusArgument &operator<<(QDBusArgument &argument, const QtMobility::ICd2DetailsDBusStruct &icd2); |
|
218 |
|
219 // Retrieve the ICd2DetailsDBusStruct data from the D-Bus argument |
|
220 const QDBusArgument &operator>>(const QDBusArgument &argument, QtMobility::ICd2DetailsDBusStruct &icd2); |
|
221 |
|
222 Q_DECLARE_METATYPE(QtMobility::ICd2DetailsDBusStruct); |
|
223 Q_DECLARE_METATYPE(QtMobility::ICd2DetailsList); |
|
224 |
174 #endif //QNETWORKSESSIONPRIVATE_H |
225 #endif //QNETWORKSESSIONPRIVATE_H |
175 |
226 |