author | Sebastian Brannstrom <sebastianb@symbian.org> |
Sun, 11 Jul 2010 11:36:24 +0100 | |
branch | 3rded |
changeset 177 | 269e3f3e544a |
parent 176 | 1c8b56cb6409 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
#include "connectionengine.h" |
|
20 |
#include "settingsengine.h" |
|
21 |
#include "podcastmodel.h" |
|
22 |
||
23 |
CConnectionEngine* CConnectionEngine::NewL(CPodcastModel& aPodcastModel) |
|
24 |
{ |
|
25 |
CConnectionEngine* self = new (ELeave) CConnectionEngine(aPodcastModel); |
|
26 |
CleanupStack::PushL(self); |
|
27 |
self->ConstructL(); |
|
28 |
CleanupStack::Pop(self); |
|
29 |
return self; |
|
30 |
} |
|
31 |
||
32 |
CConnectionEngine::~CConnectionEngine() |
|
33 |
{ |
|
34 |
Cancel(); |
|
35 |
||
36 |
iConnection.Close(); |
|
37 |
||
38 |
iSocketServer.Close(); |
|
39 |
||
40 |
iObserverArray.Close(); |
|
41 |
} |
|
42 |
||
43 |
CConnectionEngine::CConnectionEngine(CPodcastModel& aPodcastModel): |
|
44 |
CActive(CActive::EPriorityStandard),iPodcastModel(aPodcastModel) |
|
45 |
{ |
|
46 |
CActiveScheduler::Add(this); |
|
47 |
} |
|
48 |
||
49 |
void CConnectionEngine::ConstructL() |
|
50 |
{ |
|
51 |
User::LeaveIfError(iSocketServer.Connect()); |
|
52 |
User::LeaveIfError( iConnection.Open( iSocketServer ) ); |
|
53 |
} |
|
54 |
||
55 |
void CConnectionEngine::RunL() |
|
56 |
{ |
|
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
57 |
// if ( iStatus.Int() == KErrNone ) |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
58 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
59 |
// delete iMobility; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
60 |
// iMobility = NULL; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
61 |
// iMobility = CActiveCommsMobilityApiExt::NewL( iConnection, *this ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
62 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
63 |
// |
177
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
64 |
iConnectionState = iStatus.Int() == KErrNone?CConnectionEngine::EConnected:CConnectionEngine::ENotConnected; |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
65 |
ReportConnectionL( iStatus.Int() ); |
2 | 66 |
} |
67 |
||
68 |
void CConnectionEngine::DoCancel() |
|
69 |
{ |
|
70 |
} |
|
71 |
||
72 |
TInt CConnectionEngine::RunError( TInt /*aError*/ ) |
|
73 |
{ |
|
74 |
return KErrNone; |
|
75 |
} |
|
76 |
||
77 |
void CConnectionEngine::PreferredCarrierAvailable( TAccessPointInfo /*aOldAPInfo*/, |
|
78 |
TAccessPointInfo /*aNewAPInfo*/, |
|
79 |
TBool aIsUpgrade, |
|
80 |
TBool aIsSeamless ) |
|
81 |
{ |
|
82 |
if ( aIsUpgrade ) |
|
83 |
{ |
|
84 |
} |
|
85 |
else |
|
86 |
{ |
|
87 |
} |
|
88 |
||
89 |
if ( aIsSeamless ) |
|
90 |
{ |
|
91 |
// in S60 3.2, this situation cannot occur. |
|
92 |
} |
|
93 |
else |
|
94 |
{ |
|
95 |
// Sockets have to be closed at this point. |
|
96 |
||
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
97 |
// iMobility->MigrateToPreferredCarrier(); |
2 | 98 |
} |
99 |
||
100 |
} |
|
101 |
||
102 |
void CConnectionEngine::NewCarrierActive( TAccessPointInfo /*aNewAPInfo*/, TBool aIsSeamless ) |
|
103 |
{ |
|
104 |
if ( aIsSeamless ) |
|
105 |
{ |
|
106 |
// in S60 3.2, this situation cannot occur. |
|
107 |
||
108 |
} |
|
109 |
else |
|
110 |
{ |
|
111 |
// Sockets have to be re-opened and check they can connect |
|
112 |
// to their server at this point. |
|
113 |
||
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
114 |
// iMobility->NewCarrierAccepted(); |
2 | 115 |
} |
116 |
} |
|
117 |
||
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
90
diff
changeset
|
118 |
void CConnectionEngine::Error( TInt /*aError*/ ) |
2 | 119 |
{ |
164
000f9fc147b2
Catch up with default branch; New v 27 SIS
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
90
diff
changeset
|
120 |
|
2 | 121 |
} |
122 |
||
123 |
TBool CConnectionEngine::ConnectionSettingL() |
|
124 |
{ |
|
125 |
TBool selected( EFalse ); |
|
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
126 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
127 |
// CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL(); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
128 |
// CleanupStack::PushL( settings ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
129 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
130 |
// TUint listedItems = |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
131 |
// CMManager::EShowDefaultConnection | |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
132 |
// CMManager::EShowDestinations; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
133 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
134 |
// TBearerFilterArray filter; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
135 |
// ReportConnectionSelectionStart(); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
136 |
// selected = settings->RunApplicationSettingsL( iUserSelection, |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
137 |
// listedItems, |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
138 |
// filter ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
139 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
140 |
// CleanupStack::PopAndDestroy( settings ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
141 |
// ReportConnectionSelectionEnd(); |
2 | 142 |
return selected; |
143 |
} |
|
144 |
||
145 |
||
146 |
void CConnectionEngine::StartL(TConnectionType aConnectionType) |
|
147 |
{ |
|
148 |
DP1("CConnectionEngine::StartL, aConnectionType=%d", aConnectionType); |
|
149 |
||
150 |
iConnection.Close(); |
|
151 |
User::LeaveIfError( iConnection.Open( iSocketServer ) ); |
|
177
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
152 |
|
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
153 |
// Connect using UI Setting |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
154 |
if(aConnectionType == EDefaultConnection || EUserSelectConnection) |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
155 |
{ |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
156 |
iConnection.Start( iStatus ); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
157 |
SetActive(); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
158 |
} |
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
159 |
// else if(aConnectionType == EUserSelectConnection) |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
160 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
161 |
// TBool selected = ConnectionSettingL(); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
162 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
163 |
// if ( selected ) |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
164 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
165 |
// switch ( iUserSelection.iResult ) |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
166 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
167 |
// case CMManager::EDestination: |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
168 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
169 |
// iSnapPreference.SetSnap( iUserSelection.iId ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
170 |
// iConnection.Start( iSnapPreference, iStatus ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
171 |
// aConnectionType = ESNAPConnection; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
172 |
// break; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
173 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
174 |
// default: // CMManager::EAlwaysAsk |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
175 |
// case CMManager::EDefaultConnection: |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
176 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
177 |
// iConnection.Start( iStatus ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
178 |
// break; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
179 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
180 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
181 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
182 |
// else |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
183 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
184 |
// TRequestStatus* status = &iStatus; |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
185 |
// User::RequestComplete(status, KErrCancel); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
186 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
187 |
// |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
188 |
// SetActive(); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
189 |
// } |
177
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
190 |
else if (aConnectionType == EIAPConnection) |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
191 |
{ |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
192 |
iCommdbPreference.SetIapId((iPodcastModel.SettingsEngine().SpecificIAP()& KUseIAPMask)); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
193 |
iCommdbPreference.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
194 |
iCommdbPreference.SetDirection(ECommDbConnectionDirectionOutgoing); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
195 |
iConnection.Start( iCommdbPreference, iStatus ); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
196 |
SetActive(); |
269e3f3e544a
Lots of fixes for 3rd edition. First test SIS file, 0.90(3)
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
176
diff
changeset
|
197 |
} |
176
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
198 |
// // Connect using SNAP |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
199 |
// else |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
200 |
// { |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
201 |
// iSnapPreference.SetSnap(iPodcastModel.SettingsEngine().SpecificIAP()); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
202 |
// iConnection.Start( iSnapPreference, iStatus ); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
203 |
// SetActive(); |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
204 |
// } |
1c8b56cb6409
Now compiles for 3rd ed, but does not launch due to malloc error in SQLite
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
164
diff
changeset
|
205 |
// |
2 | 206 |
iConnectionType = aConnectionType; |
207 |
iConnectionState = CConnectionEngine::EConnecting; |
|
208 |
} |
|
209 |
||
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
210 |
void CConnectionEngine::Stop() |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
211 |
{ |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
212 |
DP("CConnectionEngine::Stop"); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
213 |
iConnection.Stop(); |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
214 |
iConnectionState = CConnectionEngine::ENotConnected; |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
215 |
} |
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
216 |
|
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
217 |
|
2 | 218 |
RConnection& CConnectionEngine::Connection() |
219 |
{ |
|
220 |
return iConnection; |
|
221 |
} |
|
222 |
||
223 |
CConnectionEngine::TConnectionState CConnectionEngine::ConnectionState() |
|
224 |
{ |
|
225 |
TInt selectedConn = (TInt) iSnapPreference.Snap(); |
|
226 |
TInt specIAPSNAP = iPodcastModel.SettingsEngine().SpecificIAP(); |
|
227 |
// If we have IAP preference then get that from our current connection and mask out the selected iap |
|
228 |
if((specIAPSNAP&KUseIAPFlag)) |
|
229 |
{ |
|
230 |
selectedConn = iCommdbPreference.IapId(); |
|
231 |
specIAPSNAP = specIAPSNAP&KUseIAPMask; |
|
232 |
} |
|
233 |
||
234 |
// IAPSNAP must be > 0 and then if the IAP/Sel conn IAP differs |
|
235 |
if(specIAPSNAP >0 && specIAPSNAP != selectedConn ) |
|
236 |
{ |
|
237 |
if(iConnection.SubSessionHandle() != 0) |
|
238 |
{ |
|
239 |
iConnection.Stop(); |
|
240 |
} |
|
241 |
||
242 |
iConnectionState = CConnectionEngine::ENotConnected; |
|
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
// We have a user selection or default selction, check our current connection state. |
|
247 |
TNifProgress progress; |
|
248 |
if(iConnection.Progress(progress) == KErrNone) |
|
249 |
{ |
|
250 |
if(progress.iError == KErrNone && progress.iStage != 0) |
|
251 |
{ |
|
252 |
if(progress.iStage == KLinkLayerOpen) |
|
253 |
{ |
|
254 |
iConnectionState = CConnectionEngine::EConnected; |
|
255 |
} |
|
256 |
} |
|
257 |
else if(iConnectionState != CConnectionEngine::EConnecting) |
|
258 |
{ |
|
259 |
iConnectionState = CConnectionEngine::ENotConnected; |
|
260 |
} |
|
261 |
} |
|
262 |
else |
|
263 |
{ |
|
264 |
iConnectionState = CConnectionEngine::ENotConnected; |
|
265 |
} |
|
266 |
} |
|
267 |
||
268 |
return iConnectionState; |
|
269 |
} |
|
270 |
||
59
9569ea080d5a
Export the proper functions for DLL usage
Lars Persson <lars.persson@embeddev.se>
parents:
13
diff
changeset
|
271 |
EXPORT_C void CConnectionEngine::AddObserver(MConnectionObserver* aObserver) |
2 | 272 |
{ |
273 |
iObserverArray.Append(aObserver); |
|
274 |
} |
|
275 |
||
276 |
RSocketServ& CConnectionEngine::SockServ() |
|
277 |
{ |
|
278 |
return iSocketServer; |
|
279 |
} |
|
280 |
||
281 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
13
diff
changeset
|
282 |
void CConnectionEngine::ReportConnectionL(TInt aError) |
2 | 283 |
{ |
284 |
TInt noObservers = iObserverArray.Count(); |
|
285 |
while(noObservers) |
|
286 |
{ |
|
287 |
noObservers--; |
|
288 |
iObserverArray[noObservers]->ConnectCompleteL(aError); |
|
289 |
} |
|
290 |
} |
|
13 | 291 |
|
292 |
||
293 |
void CConnectionEngine::ReportConnectionSelectionStart() |
|
294 |
{ |
|
295 |
TInt noObservers = iObserverArray.Count(); |
|
296 |
while(noObservers) |
|
297 |
{ |
|
298 |
noObservers--; |
|
299 |
iObserverArray[noObservers]->ConnectionSelectionStart(); |
|
300 |
} |
|
301 |
} |
|
302 |
||
303 |
||
304 |
void CConnectionEngine::ReportConnectionSelectionEnd() |
|
305 |
{ |
|
306 |
TInt noObservers = iObserverArray.Count(); |
|
307 |
while(noObservers) |
|
308 |
{ |
|
309 |
noObservers--; |
|
310 |
iObserverArray[noObservers]->ConnectionSelectionEnd(); |
|
311 |
} |
|
312 |
} |