engine/inc/ConnectionEngine.h
author teknolog
Sun, 28 Feb 2010 21:19:40 +0000
changeset 26 71493655568a
parent 13 f58e3c482bd9
child 35 66c5303f3610
child 59 9569ea080d5a
permissions -rw-r--r--
Workaround for long tap on selected item issue
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
 * Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
 *
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
 * All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
 * This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
 * under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
 * which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
 *
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
 * Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
 * EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
 *
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
 * Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
 *
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
 * Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
 *
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#ifndef PODCAST_CONNECTIONENGINE_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#define PODCAST_CONNECTIONENGINE_H
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
// Connect using mobility extension
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include <in_sock.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include <connpref.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include <commdbconnpref.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include <comms-infras/cs_mobility_apiext.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
// Using connection manager settings UI
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include <cmapplicationsettingsui.h>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
class CPodcastModel;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
class MConnectionObserver
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
public:
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    36
	virtual void ConnectionSelectionStart() = 0;
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    37
	virtual void ConnectionSelectionEnd() = 0;
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
	virtual void ConnectCompleteL(TInt aErrorCode) = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
	virtual void Disconnected() = 0;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
/**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
 * This class helps to connect using three available methods
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
 * SNAP, Mobility extension and Connection manager UI
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
 */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
class CConnectionEngine:public CActive, public MMobilityProtocolResp
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
public:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
	enum TConnectionType
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
		EUserSelectConnection,		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
		ESNAPConnection,		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
		EMobilityConnection,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
		EDefaultConnection,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
		EIAPConnection
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
		};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
	enum TConnectionState
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
		ENotConnected,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
		EConnecting,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
		EConnected
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
		};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	static CConnectionEngine* NewL(CPodcastModel& aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	~CConnectionEngine();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	void StartL(TConnectionType aConnectionType);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	RConnection& Connection();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	TConnectionState ConnectionState();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	void AddObserver(MConnectionObserver* aObserver);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	RSocketServ& SockServ();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
private: // Methods
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	CConnectionEngine(CPodcastModel& aPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	void ConstructL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
	// From CActive
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
	void RunL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
	void DoCancel();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
	TInt RunError( TInt aError );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
	// From MMobilityProtocolResp
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
	void PreferredCarrierAvailable( TAccessPointInfo aOldAPInfo,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
			TAccessPointInfo aNewAPInfo,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
			TBool aIsUpgrade,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
			TBool aIsSeamless );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
	void NewCarrierActive( TAccessPointInfo aNewAPInfo, TBool aIsSeamless );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
	void Error( TInt aError );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
protected:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
	// UI Setting
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
	TBool ConnectionSettingL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
	void ReportConnection(TInt aError);
13
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    94
	void ReportConnectionSelectionStart();
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    95
	void ReportConnectionSelectionEnd();
f58e3c482bd9 Toolbars now hide when connection query appears
teknolog
parents: 2
diff changeset
    96
	
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
private:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
	RConnection                   iConnection;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
	RSocketServ                   iSocketServer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
	// Connect using mobility extension
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
	CActiveCommsMobilityApiExt*   iMobility;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
	// Using connection manager settings UI
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
	TCmSettingSelection   iUserSelection;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
	// Connect using Commdb
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
	TCommDbConnPref iCommdbPreference;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
	// Connect using SNAP setting
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
	TConnSnapPref iSnapPreference;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
	TConnectionType iConnectionType;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
	TConnectionState iConnectionState;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
	RPointerArray<MConnectionObserver> iObserverArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
	CPodcastModel &iPodcastModel; 	// reference to the model
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
	};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
#endif // PODCAST_CONNECTIONENGINE_H