|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef PSETNETWORKWRAPPER_H |
|
19 #define PSETNETWORKWRAPPER_H |
|
20 |
|
21 #include <QObject> |
|
22 |
|
23 class PSetNetworkWrapperPrivate; |
|
24 class CPsetContainer; |
|
25 class HbDialog; |
|
26 |
|
27 #ifdef BUILD_PSETWRAPPER |
|
28 #define PSETWRAPPER_EXPORT Q_DECL_EXPORT |
|
29 #else |
|
30 #define PSETWRAPPER_EXPORT Q_DECL_IMPORT |
|
31 #endif |
|
32 |
|
33 class PSETWRAPPER_EXPORT PSetNetworkWrapper : public QObject |
|
34 { |
|
35 Q_OBJECT |
|
36 |
|
37 public: |
|
38 |
|
39 enum ErrorCode { |
|
40 ErrNoError = 0, |
|
41 ErrGeneral, |
|
42 ErrCauseCallActive, |
|
43 ErrNoNetworkService, |
|
44 ErrOfflineOpNotAllowed, |
|
45 ErrNoNetworkAccess |
|
46 }; |
|
47 |
|
48 enum RequestType { |
|
49 RequestNone, |
|
50 RequestEnumerateNetworks, |
|
51 RequestGetNetworkInfo, |
|
52 RequestGetCurrentNetworkInfo, |
|
53 RequestGetNetworkSearchMode, |
|
54 RequestSetNetwork, |
|
55 RequestSetNetworkMode, |
|
56 RequestSetNetworkAutomatic |
|
57 }; |
|
58 |
|
59 enum RegistrationStatus { |
|
60 RegisteredOnHomeNetwork, |
|
61 RegisteredRoaming |
|
62 }; |
|
63 |
|
64 enum NetworkAccessMode { |
|
65 AccessModeDual, |
|
66 AccessModeUmts, |
|
67 AccessModeGsm |
|
68 }; |
|
69 |
|
70 struct NetworkId{ |
|
71 /*! Country code. Maximum length is 4. */ |
|
72 QString m_countryCode; |
|
73 /*! Network code. Maximum length is 8. */ |
|
74 QString m_networkCode; |
|
75 }; |
|
76 |
|
77 enum NetworkSelectionMode { |
|
78 SelectionModeManual, |
|
79 SelectionModeAutomatic |
|
80 }; |
|
81 |
|
82 enum NetworkStatus { |
|
83 StatusUnknown, |
|
84 StatusAvailable, |
|
85 StatusCurrent, |
|
86 StatusForbidden |
|
87 }; |
|
88 |
|
89 enum NetworkAccessType { |
|
90 AccessTypeGsm, |
|
91 AccessTypeWcdma |
|
92 }; |
|
93 |
|
94 struct NetworkInfo { |
|
95 NetworkId m_id; |
|
96 NetworkStatus m_status; |
|
97 NetworkSelectionMode m_mode; |
|
98 NetworkAccessType m_access; |
|
99 /*! Short name. Maximum length is 20. */ |
|
100 QString m_shortName; |
|
101 /*! Long name. Maximum length is 30. */ |
|
102 QString m_longName; |
|
103 }; |
|
104 |
|
105 public: |
|
106 |
|
107 explicit PSetNetworkWrapper(CPsetContainer &psetContainer, |
|
108 QObject *parent = NULL); |
|
109 |
|
110 virtual ~PSetNetworkWrapper(); |
|
111 |
|
112 public: |
|
113 |
|
114 void getAvailableNetworks(); |
|
115 |
|
116 ErrorCode getNetworkSelectionMode( |
|
117 PSetNetworkWrapper::NetworkSelectionMode& mode) const; |
|
118 |
|
119 void selectNetwork( |
|
120 const PSetNetworkWrapper::NetworkInfo& info); |
|
121 |
|
122 void cancelRequest(); |
|
123 |
|
124 public: |
|
125 |
|
126 void getNetworkAccessMode() const; |
|
127 |
|
128 void setNetworkAccessMode(PSetNetworkWrapper::NetworkAccessMode mode); |
|
129 |
|
130 signals: |
|
131 |
|
132 // Real type of parameter mode is enum PSetNetworkWrapper::NetworkAccessMode. |
|
133 void networkAccessModeGot(int mode); |
|
134 |
|
135 void availableNetworksGot(QList<PSetNetworkWrapper::NetworkInfo*> &networkInfoList); |
|
136 |
|
137 void networkReqestFailed( |
|
138 PSetNetworkWrapper::ErrorCode error, |
|
139 PSetNetworkWrapper::RequestType type); |
|
140 |
|
141 void searchingNetworks(PSetNetworkWrapper::RequestType &type); |
|
142 |
|
143 void requestingSelectedNetwork(bool ongoing); |
|
144 |
|
145 void networkChanged( |
|
146 PSetNetworkWrapper::NetworkInfo& currentInfo, |
|
147 PSetNetworkWrapper::RegistrationStatus& status); |
|
148 |
|
149 private: |
|
150 |
|
151 PSetNetworkWrapper(const PSetNetworkWrapper &); |
|
152 PSetNetworkWrapper &operator=(const PSetNetworkWrapper &); |
|
153 PSetNetworkWrapperPrivate* m_privateImpl; |
|
154 friend class PSetNetworkWrapperPrivate; |
|
155 }; |
|
156 |
|
157 #endif // PSETNETWORKWRAPPER_H |