author | Sebastian Brannstrom <sebastianb@symbian.org> |
Tue, 16 Nov 2010 10:39:20 +0000 | |
branch | symbian1 |
changeset 364 | 998e9d114bd5 |
parent 284 | 69385a7c9810 |
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 |
#ifndef PODCAST_CONNECTIONENGINE_H |
|
20 |
#define PODCAST_CONNECTIONENGINE_H |
|
21 |
||
22 |
||
23 |
// Connect using mobility extension |
|
24 |
#include <in_sock.h> |
|
25 |
#include <connpref.h> |
|
26 |
#include <commdbconnpref.h> |
|
27 |
#include <comms-infras/cs_mobility_apiext.h> |
|
28 |
||
29 |
// Using connection manager settings UI |
|
30 |
#include <cmapplicationsettingsui.h> |
|
31 |
class CPodcastModel; |
|
32 |
||
33 |
class MConnectionObserver |
|
34 |
{ |
|
35 |
public: |
|
13 | 36 |
virtual void ConnectionSelectionStart() = 0; |
37 |
virtual void ConnectionSelectionEnd() = 0; |
|
2 | 38 |
virtual void ConnectCompleteL(TInt aErrorCode) = 0; |
39 |
virtual void Disconnected() = 0; |
|
40 |
}; |
|
41 |
||
42 |
/** |
|
43 |
* This class helps to connect using three available methods |
|
44 |
* SNAP, Mobility extension and Connection manager UI |
|
45 |
*/ |
|
46 |
class CConnectionEngine:public CActive, public MMobilityProtocolResp |
|
47 |
{ |
|
48 |
public: |
|
49 |
enum TConnectionType |
|
50 |
{ |
|
51 |
EUserSelectConnection, |
|
52 |
ESNAPConnection, |
|
53 |
EMobilityConnection, |
|
54 |
EDefaultConnection, |
|
55 |
EIAPConnection |
|
56 |
}; |
|
57 |
||
58 |
enum TConnectionState |
|
59 |
{ |
|
60 |
ENotConnected, |
|
61 |
EConnecting, |
|
62 |
EConnected |
|
63 |
}; |
|
64 |
||
65 |
static CConnectionEngine* NewL(CPodcastModel& aPodcastModel); |
|
66 |
~CConnectionEngine(); |
|
67 |
void StartL(TConnectionType aConnectionType); |
|
68 |
RConnection& Connection(); |
|
69 |
TConnectionState ConnectionState(); |
|
59
9569ea080d5a
Export the proper functions for DLL usage
Lars Persson <lars.persson@embeddev.se>
parents:
13
diff
changeset
|
70 |
IMPORT_C void AddObserver(MConnectionObserver* aObserver); |
284
69385a7c9810
Significant robustness improvements for ConnectionEngine
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
90
diff
changeset
|
71 |
IMPORT_C void RemoveObserver(MConnectionObserver* aObserver); |
69385a7c9810
Significant robustness improvements for ConnectionEngine
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
90
diff
changeset
|
72 |
|
2 | 73 |
RSocketServ& SockServ(); |
90
d0c0c3e6f7a1
Added support for launching music and video player when tapping on a downloaded show
teknolog
parents:
65
diff
changeset
|
74 |
void Stop(); |
2 | 75 |
private: // Methods |
76 |
CConnectionEngine(CPodcastModel& aPodcastModel); |
|
77 |
void ConstructL(); |
|
78 |
protected: |
|
79 |
// From CActive |
|
80 |
void RunL(); |
|
81 |
void DoCancel(); |
|
82 |
TInt RunError( TInt aError ); |
|
83 |
protected: |
|
84 |
// From MMobilityProtocolResp |
|
85 |
void PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo, |
|
86 |
TAccessPointInfo aNewAPInfo, |
|
87 |
TBool aIsUpgrade, |
|
88 |
TBool aIsSeamless ); |
|
89 |
||
90 |
void NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless ); |
|
91 |
void Error( TInt aError ); |
|
92 |
protected: |
|
93 |
// UI Setting |
|
94 |
TBool ConnectionSettingL(); |
|
95 |
||
35
66c5303f3610
A ton of CodeScanner fixes (high issues) - but not all
Brendan Donegan <brendand@symbian.org>
parents:
13
diff
changeset
|
96 |
void ReportConnectionL(TInt aError); |
13 | 97 |
void ReportConnectionSelectionStart(); |
98 |
void ReportConnectionSelectionEnd(); |
|
99 |
||
2 | 100 |
private: |
101 |
RConnection iConnection; |
|
102 |
RSocketServ iSocketServer; |
|
103 |
// Connect using mobility extension |
|
104 |
CActiveCommsMobilityApiExt* iMobility; |
|
105 |
||
106 |
// Using connection manager settings UI |
|
107 |
TCmSettingSelection iUserSelection; |
|
108 |
||
109 |
// Connect using Commdb |
|
110 |
TCommDbConnPref iCommdbPreference; |
|
111 |
||
112 |
// Connect using SNAP setting |
|
113 |
TConnSnapPref iSnapPreference; |
|
114 |
||
115 |
TConnectionType iConnectionType; |
|
116 |
TConnectionState iConnectionState; |
|
117 |
RPointerArray<MConnectionObserver> iObserverArray; |
|
118 |
CPodcastModel &iPodcastModel; // reference to the model |
|
119 |
}; |
|
120 |
||
121 |
#endif // PODCAST_CONNECTIONENGINE_H |