|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __IMUTCON_H__ |
|
17 #define __IMUTCON_H__ |
|
18 |
|
19 #include <mentact.h> |
|
20 #include <iapprefs.h> |
|
21 #include <es_sock.h> |
|
22 #include <in_sock.h> |
|
23 #include <commdbconnpref.h> |
|
24 |
|
25 class CStoreableOverrideSettings; |
|
26 class CImTextServerSession; |
|
27 |
|
28 // simulate failures if this is set |
|
29 #ifdef _DEBUG |
|
30 #define __IMSK_SIMULATION |
|
31 #endif |
|
32 |
|
33 class CImConnect : public CActive |
|
34 /** |
|
35 @internalTechnology |
|
36 @released |
|
37 */ |
|
38 { |
|
39 public: |
|
40 // text session is used to log |
|
41 static CImConnect* NewL(const CImIAPPreferences& aIAPPreferences, CImTextServerSession &aTextSession); |
|
42 IMPORT_C static CImConnect* NewL(const CImIAPPreferences& aIAPPreferences, RSocketServ& aSocketServerHandle); |
|
43 |
|
44 ~CImConnect(); |
|
45 |
|
46 IMPORT_C void StartL(TRequestStatus& aStatus); |
|
47 |
|
48 /** |
|
49 Intended Usage : Returns the IAP value |
|
50 @since 8.0 |
|
51 @return Returns the IAP value |
|
52 */ |
|
53 IMPORT_C TInt GetIAPValue(TUint32& aIap); |
|
54 |
|
55 /** |
|
56 Intended Usage : On return, the unique name of the RConnection. |
|
57 @since 9.1 |
|
58 @return KErrNone if succesful, or another of the system-wide error codes. |
|
59 */ |
|
60 IMPORT_C TInt GetRConnectionName(TName &aName); |
|
61 |
|
62 /** |
|
63 @fn GetIAPBearer(TUint32& aBearer) |
|
64 Intended Usage : Returns the IAP bearer |
|
65 @since 8.0 |
|
66 @param aBearer is a return argument containing the bearer if it exists |
|
67 @return Returns KErrNone, KErrNotFound or KErrBadHandle |
|
68 */ |
|
69 IMPORT_C TInt GetIAPBearer(TUint32& aBearer); |
|
70 |
|
71 /** |
|
72 @fn GetConnection() |
|
73 Intended Usage : Returns RConnection |
|
74 @since 8.0 |
|
75 @return Returns RConnection |
|
76 */ |
|
77 IMPORT_C RConnection& GetConnection(); |
|
78 |
|
79 /** |
|
80 Intended Usage : Returns progress of the connection |
|
81 @since 8.0 |
|
82 @param On return, progress information |
|
83 @return Returns KErrNone or KErrBadHandle |
|
84 */ |
|
85 IMPORT_C TInt Progress(TNifProgress& aProgress); |
|
86 |
|
87 /** |
|
88 @fn GetLastSocketActivityTimeout(TUint32& aTimeout) |
|
89 Intended Usage : Returns the last socket activity timeout value |
|
90 @since 9.1 |
|
91 @param aTimeout is a return argument containing the timeout if it was found |
|
92 @post aTimeout will be filled with the timeout value |
|
93 @return Returns KErrNone, KErrNotFound or KErrBadHandle |
|
94 */ |
|
95 IMPORT_C TInt GetLastSocketActivityTimeout(TUint32& aTimeout); |
|
96 |
|
97 #ifdef __IMSK_SIMULATION |
|
98 // the code will ignore the first aIAPsToFail iaps in the preferences passed in. |
|
99 // if this is more than the number of iaps then it will fail with KErrEtelModemNotDetected |
|
100 void SetIAPsToFail(TInt aIAPsToFail); |
|
101 #endif |
|
102 |
|
103 /** |
|
104 @fn SecondaryStartL(CImTextServerSession* aPrimaryTextServerSession) |
|
105 Intended Usage : Attaches the existing RConnection. |
|
106 @since 9.2 |
|
107 @param aPrimaryTextServerSession is set on secondary session |
|
108 */ |
|
109 void SecondaryStartL(CImTextServerSession* aPrimaryTextServerSession); |
|
110 |
|
111 protected: |
|
112 // From CActive; |
|
113 void RunL(); |
|
114 void DoCancel(); |
|
115 TInt RunError(TInt aError); |
|
116 |
|
117 private: |
|
118 CImConnect(const CImIAPPreferences& aIAPPreferences, CImTextServerSession* aTextSession, RSocketServ* aSocketServerHandle); |
|
119 // checks to see if we are online, if we are not online call ConnectL |
|
120 void CheckAndConnectL(); |
|
121 void ConnectL(); |
|
122 void ConnectWithSNAP(); |
|
123 void ConnectWithIAPListL(); |
|
124 |
|
125 private: |
|
126 const CImIAPPreferences& iIAPPreferences; |
|
127 RConnection iConn; |
|
128 TCommDbMultiConnPref iPrefs; |
|
129 TInt iAttempt; |
|
130 TRequestStatus* iReportStatus; |
|
131 |
|
132 // Text server session. Session is not owned by this class. |
|
133 // Pointer can be NULL which indicates that our class was |
|
134 // instantiated with a socket server handle instead of a |
|
135 // reference to a text server session. |
|
136 CImTextServerSession* iTextSession; |
|
137 |
|
138 // Socket server handle. Handle is not owned by this object. |
|
139 // Pointer can be NULL which indicates that handle must be |
|
140 // fetched from iTextSession text server session class. |
|
141 RSocketServ* iSocketServerHandle; |
|
142 |
|
143 CStoreableOverrideSettings* iOverrides; |
|
144 |
|
145 #ifdef __IMSK_SIMULATION |
|
146 // the code will ignore the first iIAPsToFail iaps in the preferences passed in. |
|
147 // if this is more than the number of iaps then it will fail with KErrEtelModemNotDetected |
|
148 TInt iIAPsToFail; |
|
149 #endif |
|
150 }; |
|
151 |
|
152 #endif |
|
153 |