|
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 #ifndef IRQNETWORKCONTROLLER_H_ |
|
18 #define IRQNETWORKCONTROLLER_H_ |
|
19 |
|
20 #include <QObject> |
|
21 |
|
22 #include "irqenums.h" |
|
23 #include "irqevent.h" |
|
24 |
|
25 class IRQNetworkControllerBody; |
|
26 |
|
27 /** |
|
28 * This class provides the interface to IR Network Controller component |
|
29 * |
|
30 * IRQNetworkController follows a singleton pattern |
|
31 * hence the destructor is private and to destroy it we need to use an API |
|
32 * |
|
33 */ |
|
34 |
|
35 class IRQNetworkController : public QObject |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Get the instance of IRQNetworkController |
|
43 * @return IRQNetworkController* |
|
44 */ |
|
45 IMPORT_C static IRQNetworkController* openInstance(); |
|
46 |
|
47 /** |
|
48 * Close the instance of IRQNetworkController |
|
49 */ |
|
50 IMPORT_C void closeInstance(); |
|
51 |
|
52 /** |
|
53 * Return the variable which indicates if connection is active or not |
|
54 * @return bool |
|
55 */ |
|
56 IMPORT_C bool getNetworkStatus() const; |
|
57 |
|
58 /** |
|
59 * Return the IAP Id of the chosen IAP |
|
60 * @return int Error code |
|
61 */ |
|
62 IMPORT_C IRQError getIAPId(unsigned long& aIapId) const; |
|
63 |
|
64 /** |
|
65 * Returns the list of available access points |
|
66 * @return QStringList &aList specifying the access point names |
|
67 */ |
|
68 IMPORT_C void getAccessPointList(QStringList &aList); |
|
69 |
|
70 /** |
|
71 * Returns the list of iap ids for available access points |
|
72 * @return QList<unsigned long> &aList specifying the iap ids |
|
73 */ |
|
74 IMPORT_C void getApIdList(QList<unsigned long> &aList); |
|
75 |
|
76 /** |
|
77 * Returns the list of bearer ids for available access points |
|
78 * @return QList<unsigned long> &aList specifying the bearer ids |
|
79 */ |
|
80 IMPORT_C void getBearerList(QList<unsigned long> &aList); |
|
81 |
|
82 /** |
|
83 * Returns the list of network ids for available access points |
|
84 * @return QList<unsigned long> &aList specifying the network ids |
|
85 */ |
|
86 IMPORT_C void getNetworkList(QList<unsigned long> &aList); |
|
87 |
|
88 /** |
|
89 * Configure the Access Point which is used by all the components for network connectivity |
|
90 */ |
|
91 IMPORT_C void chooseAccessPoint(); |
|
92 |
|
93 /* |
|
94 * Cancel configuring access point |
|
95 */ |
|
96 IMPORT_C void cancelConnecting(); |
|
97 |
|
98 /** |
|
99 * This api is used to determine if the phone is in offline mode |
|
100 * @return True if the phone is in offline mode else False |
|
101 */ |
|
102 IMPORT_C bool isOfflineMode(); |
|
103 |
|
104 /** |
|
105 * This api is used to determine if the phone supports WLan usage |
|
106 * @return True if the phone supports else False |
|
107 */ |
|
108 IMPORT_C bool isWlanSupported() const; |
|
109 |
|
110 /** |
|
111 * Reset the connection status to Disconnected state |
|
112 */ |
|
113 IMPORT_C void resetConnectionStatus(); |
|
114 |
|
115 /** |
|
116 * Used to determine the type of connection |
|
117 * @return enum describing the type of connection ( GPRS/3G/WiFi ) |
|
118 */ |
|
119 IMPORT_C IRQConnectionType identifyConnectionType() const; |
|
120 |
|
121 /** |
|
122 * Notifies all observers whose network request is active to reissue the request |
|
123 */ |
|
124 IMPORT_C void notifyActiveNetworkObservers(IRQNetworkEvent aEvent); |
|
125 |
|
126 /** |
|
127 * Indicates if the hand over of network connection has happened |
|
128 */ |
|
129 IMPORT_C bool isHandlingOverConnection(); |
|
130 |
|
131 /** |
|
132 * Indicates if chooseAccessPoint is called |
|
133 */ |
|
134 IMPORT_C bool isConnectRequestIssued() const; |
|
135 |
|
136 signals: |
|
137 |
|
138 /** |
|
139 * Notifies all observers whose network request is active to reissue the request |
|
140 */ |
|
141 void networkRequestNotified(IRQNetworkEvent aEvent); |
|
142 |
|
143 /** |
|
144 * Notifies all observers whose network request is active to reset the pending request status |
|
145 */ |
|
146 void pendingRequestsReset(bool aValue); |
|
147 |
|
148 /** |
|
149 * Notifies the type of network event that occurred |
|
150 */ |
|
151 void networkEventNotified(IRQNetworkEvent aEvent); |
|
152 |
|
153 /** |
|
154 * Notifies the error |
|
155 */ |
|
156 void errorOccured(IRQError aError); |
|
157 |
|
158 private: |
|
159 /** |
|
160 * Creates IRQNetworkController instance |
|
161 */ |
|
162 static IRQNetworkController* createInstanceL(); |
|
163 |
|
164 void constructL(); |
|
165 |
|
166 /** |
|
167 * Default C++ Constructor |
|
168 */ |
|
169 IRQNetworkController(); |
|
170 |
|
171 /** |
|
172 * Default C++ Destructor |
|
173 */ |
|
174 ~IRQNetworkController(); |
|
175 |
|
176 private: |
|
177 |
|
178 /** |
|
179 * IRQNetworkControllerBody instance |
|
180 */ |
|
181 IRQNetworkControllerBody* iBody; |
|
182 |
|
183 /** |
|
184 * Number of objects currently referring to the singleton object IRQNetworkController |
|
185 */ |
|
186 int iSingletonInstances; |
|
187 }; |
|
188 |
|
189 #endif /* IRQNETWORKCONTROLLER_H_ */ |