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();
|
|
70 |
void AddObserver(MConnectionObserver* aObserver);
|
|
71 |
RSocketServ& SockServ();
|
|
72 |
private: // Methods
|
|
73 |
CConnectionEngine(CPodcastModel& aPodcastModel);
|
|
74 |
void ConstructL();
|
|
75 |
protected:
|
|
76 |
// From CActive
|
|
77 |
void RunL();
|
|
78 |
void DoCancel();
|
|
79 |
TInt RunError( TInt aError );
|
|
80 |
protected:
|
|
81 |
// From MMobilityProtocolResp
|
|
82 |
void PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo,
|
|
83 |
TAccessPointInfo aNewAPInfo,
|
|
84 |
TBool aIsUpgrade,
|
|
85 |
TBool aIsSeamless );
|
|
86 |
|
|
87 |
void NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless );
|
|
88 |
void Error( TInt aError );
|
|
89 |
protected:
|
|
90 |
// UI Setting
|
|
91 |
TBool ConnectionSettingL();
|
|
92 |
|
|
93 |
void ReportConnection(TInt aError);
|
13
|
94 |
void ReportConnectionSelectionStart();
|
|
95 |
void ReportConnectionSelectionEnd();
|
|
96 |
|
2
|
97 |
private:
|
|
98 |
RConnection iConnection;
|
|
99 |
RSocketServ iSocketServer;
|
|
100 |
// Connect using mobility extension
|
|
101 |
CActiveCommsMobilityApiExt* iMobility;
|
|
102 |
|
|
103 |
// Using connection manager settings UI
|
|
104 |
TCmSettingSelection iUserSelection;
|
|
105 |
|
|
106 |
// Connect using Commdb
|
|
107 |
TCommDbConnPref iCommdbPreference;
|
|
108 |
|
|
109 |
// Connect using SNAP setting
|
|
110 |
TConnSnapPref iSnapPreference;
|
|
111 |
|
|
112 |
TConnectionType iConnectionType;
|
|
113 |
TConnectionState iConnectionState;
|
|
114 |
RPointerArray<MConnectionObserver> iObserverArray;
|
|
115 |
CPodcastModel &iPodcastModel; // reference to the model
|
|
116 |
};
|
|
117 |
|
|
118 |
#endif // PODCAST_CONNECTIONENGINE_H
|