|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Connection manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CRSFWCONNECTIONMANAGER_H |
|
20 #define CRSFWCONNECTIONMANAGER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <commdb.h> |
|
24 #include <rconnmon.h> |
|
25 #include <es_sock.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 // DATA TYPES |
|
30 // Connection event types for MRsfwConnectionObserver |
|
31 enum TRsfwConnectionObserverEventConnection |
|
32 { |
|
33 ERsfwConnectionObserverEventConnectionDisconnected = 0, |
|
34 ERsfwConnectionObserverEventConnectionWeaklyConnected, |
|
35 ERsfwConnectionObserverEventConnectionStronglyConnected |
|
36 }; |
|
37 |
|
38 enum TRsfwConnectionManagerConnectionQuality |
|
39 { |
|
40 ERsfwConnectionQualityNull = 0, |
|
41 ERsfwConnectionQualityStrong |
|
42 }; |
|
43 |
|
44 // IAP selection algorithms |
|
45 enum TRsfwConnectionManagerIapSelection |
|
46 { |
|
47 ERsfwIapSelectionAskUser = 0, // show the IAP selection menu |
|
48 ERsfwIapSelectionUseDefaultPreferences, // use CommDB preferences |
|
49 ERsfwIapSelectionExplicit // use explicit list |
|
50 }; |
|
51 |
|
52 // CLASS DECLARATION |
|
53 class TIapInfo |
|
54 { |
|
55 public: |
|
56 TBuf<KCommsDbSvrMaxColumnNameLength> iName; |
|
57 TUint32 iId; |
|
58 TBuf<KCommsDbSvrMaxColumnNameLength> iNetworkName; |
|
59 TBuf<KCommsDbSvrMaxColumnNameLength> iServiceName; |
|
60 TBuf<KCommsDbSvrMaxColumnNameLength> iSsId; |
|
61 TBuf<KCommsDbSvrMaxColumnNameLength> iBearerType; |
|
62 TInt iBearerQuality; // weak/strong |
|
63 }; |
|
64 |
|
65 // CLASS DECLARATION |
|
66 class MRsfwConnectionObserver |
|
67 { |
|
68 public: |
|
69 virtual void HandleConnectionEventL(TInt aConnectionEventType, |
|
70 TAny* aArg) = 0; |
|
71 }; |
|
72 |
|
73 // CLASS DECLARATION |
|
74 // This class manages the link layer for the Rsfw remote access modules. |
|
75 // |
|
76 // The primary input is a list of access point names that are assumed |
|
77 // to be in preference order. However, |
|
78 // 1) if the list only contains a "*" string, |
|
79 // static commdb preference order will be used, or else |
|
80 // 2) if the list is empty, |
|
81 // the user will be prompted for an access point |
|
82 // |
|
83 class CRsfwConnectionManager: public CActive |
|
84 { |
|
85 public: |
|
86 // Ownership of aIapNames moves to RsfwConnectionManager |
|
87 IMPORT_C static CRsfwConnectionManager* NewL( |
|
88 MRsfwConnectionObserver* aConnectionObserver); |
|
89 IMPORT_C virtual ~CRsfwConnectionManager(); |
|
90 IMPORT_C void UseIapL(const TDesC& aIap); |
|
91 IMPORT_C TInt GetConnection(RSocketServ*& aSocketServ, RConnection*& aConnection); |
|
92 |
|
93 private: |
|
94 CRsfwConnectionManager(); |
|
95 void ConstructL(MRsfwConnectionObserver* aConnectionObserver); |
|
96 TInt LoadIapInfoL(TIapInfo& aIapInfo); |
|
97 TInt StartConnection(TUint32 aIapId, TCommDbDialogPref aDialogPreference); |
|
98 void HandleDisconnectionEventL(); |
|
99 |
|
100 // functions related to timer for GPRS 'suspend' event |
|
101 static TInt SuspensionTimerExpiredL(TAny* aArg); |
|
102 void StartSuspensionTimer(); |
|
103 void StopSuspensionTimer(); |
|
104 |
|
105 |
|
106 // from CActive |
|
107 void RunL(); |
|
108 TInt RunError(TInt aError); |
|
109 void DoCancel(); |
|
110 |
|
111 private: // Data |
|
112 RSocketServ iSocketServ; |
|
113 RConnection iConnection; |
|
114 MRsfwConnectionObserver* iConnectionObserver; |
|
115 TInt iIapSelection; // IAP selection policy |
|
116 RArray<TIapInfo> iIaps; // allowed IAPs, if any |
|
117 TPckgBuf<TNifProgress> iProgress; |
|
118 CPeriodic* iSuspensionTimer; // for GPRS 'suspend' events |
|
119 }; |
|
120 |
|
121 #endif // CRSFWCONNECTIONMANAGER_H |
|
122 |
|
123 // End of File |