author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 2 | 2fe1408b6811 |
permissions | -rw-r--r-- |
williamr@2 | 1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 2 |
// All rights reserved. |
williamr@2 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@2 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@2 | 7 |
// |
williamr@2 | 8 |
// Initial Contributors: |
williamr@2 | 9 |
// Nokia Corporation - initial contribution. |
williamr@2 | 10 |
// |
williamr@2 | 11 |
// Contributors: |
williamr@2 | 12 |
// |
williamr@2 | 13 |
// Description: |
williamr@2 | 14 |
// |
williamr@2 | 15 |
|
williamr@2 | 16 |
#if !(defined COMMDBCONNPREF_H) |
williamr@2 | 17 |
#define COMMDBCONNPREF_H |
williamr@2 | 18 |
|
williamr@2 | 19 |
#include <connpref.h> |
williamr@2 | 20 |
#include <cdbcols.h> |
williamr@2 | 21 |
|
williamr@4 | 22 |
class TCommDbConnPref : public TConnPref |
williamr@4 | 23 |
/** Connection preferences which override the contents of the ConnectionPreferences |
williamr@4 | 24 |
tables in CommsDat. The only mandatory field is IAP. |
williamr@2 | 25 |
|
williamr@4 | 26 |
An Internet Access Point(IAP) represents a IP bound bearer and a set of parameters |
williamr@4 | 27 |
on that bearer, which the device can use to make a connection to the Internet. |
williamr@2 | 28 |
|
williamr@4 | 29 |
A list of available IAPs and Networks can be retrieved from CommsDat using |
williamr@4 | 30 |
CommsDat::CCDIAPRecord and CCDNetworkRecord. |
williamr@2 | 31 |
|
williamr@4 | 32 |
@code |
williamr@4 | 33 |
RConnection conn; |
williamr@4 | 34 |
User::LeaveIfError(conn.Open(sockSvr)); |
williamr@4 | 35 |
CleanupClosePushL(conn); |
williamr@2 | 36 |
|
williamr@4 | 37 |
TCommDbConnPref prefs; |
williamr@4 | 38 |
prefs.SetIapId(3); |
williamr@4 | 39 |
TInt error = conn.Start(prefs); |
williamr@4 | 40 |
@endcode |
williamr@2 | 41 |
|
williamr@4 | 42 |
@see CommsDat::CCDNetworkRecord |
williamr@4 | 43 |
@see CommsDat::CCDIAPRecord |
williamr@4 | 44 |
@see TCommDbDialogPref |
williamr@4 | 45 |
@see TCommDbConnectionDirection |
williamr@4 | 46 |
@see TCommDbBearer |
williamr@4 | 47 |
@see RConnection::Start |
williamr@4 | 48 |
|
williamr@2 | 49 |
@publishedAll |
williamr@2 | 50 |
@released since v7.0s |
williamr@2 | 51 |
*/ |
williamr@2 | 52 |
{ |
williamr@2 | 53 |
friend class TCommDbMultiConnPref; |
williamr@2 | 54 |
public: |
williamr@2 | 55 |
IMPORT_C TCommDbConnPref(); |
williamr@2 | 56 |
IMPORT_C static TVersion Version(); |
williamr@2 | 57 |
|
williamr@2 | 58 |
IMPORT_C void SetIapId(TUint32 aIapId); |
williamr@2 | 59 |
IMPORT_C TUint32 IapId() const; |
williamr@2 | 60 |
|
williamr@2 | 61 |
IMPORT_C void SetNetId(TUint32 aNetId); |
williamr@2 | 62 |
IMPORT_C TUint32 NetId() const; |
williamr@2 | 63 |
|
williamr@2 | 64 |
IMPORT_C void SetDialogPreference(TCommDbDialogPref aDialogPref); |
williamr@2 | 65 |
IMPORT_C TCommDbDialogPref DialogPreference() const; |
williamr@2 | 66 |
|
williamr@2 | 67 |
IMPORT_C void SetDirection(TCommDbConnectionDirection aDirection); |
williamr@2 | 68 |
IMPORT_C TCommDbConnectionDirection Direction() const; |
williamr@2 | 69 |
|
williamr@2 | 70 |
IMPORT_C void SetBearerSet(TUint32 aBearerSet); |
williamr@2 | 71 |
IMPORT_C TUint32 BearerSet() const; |
williamr@2 | 72 |
|
williamr@2 | 73 |
IMPORT_C virtual TInt Compare(const TCommDbConnPref& aPref) const; |
williamr@2 | 74 |
inline TBool operator==(const TCommDbConnPref& aPref) const; |
williamr@2 | 75 |
inline TBool operator!=(const TCommDbConnPref& aPref) const; |
williamr@2 | 76 |
|
williamr@2 | 77 |
inline static TCommDbConnPref& Cast(const TConnPref& aPref); |
williamr@2 | 78 |
|
williamr@4 | 79 |
public: |
williamr@4 | 80 |
struct SCommDbConnPref |
williamr@4 | 81 |
{ |
williamr@4 | 82 |
TUint32 iIapId; |
williamr@4 | 83 |
TUint32 iNetId; |
williamr@4 | 84 |
TCommDbDialogPref iDialogPref; |
williamr@4 | 85 |
TCommDbConnectionDirection iDirection; |
williamr@4 | 86 |
TUint32 iBearerSet; |
williamr@4 | 87 |
}; |
williamr@2 | 88 |
inline SCommDbConnPref* PrefPtr() const; |
williamr@4 | 89 |
const static TInt8 KMajorVersionNumber = 8; |
williamr@4 | 90 |
const static TInt8 KMinorVersionNumber = 0; |
williamr@4 | 91 |
const static TInt16 KBuildVersionNumber = 1; |
williamr@2 | 92 |
}; |
williamr@2 | 93 |
|
williamr@2 | 94 |
|
williamr@2 | 95 |
|
williamr@2 | 96 |
class TCommDbMultiConnPref : public TConnPref |
williamr@4 | 97 |
/** A set of TCommDbConnPrefs which the device will use to attempt to connect |
williamr@4 | 98 |
to the internet. The preferences at index 1 will be used first, and if this fails |
williamr@4 | 99 |
the preferences at index 2 will be used, and so on until connection attempts |
williamr@4 | 100 |
are exhausted. |
williamr@4 | 101 |
|
williamr@4 | 102 |
The index counts from 1. There must be as many connection preferences as there |
williamr@4 | 103 |
are connection attempts. |
williamr@4 | 104 |
|
williamr@4 | 105 |
@code |
williamr@4 | 106 |
RConnection conn; |
williamr@4 | 107 |
User::LeaveIfError(conn.Open(sockSvr)); |
williamr@4 | 108 |
CleanupClosePushL(conn); |
williamr@4 | 109 |
|
williamr@4 | 110 |
TCommDbConnPref prefsA; |
williamr@4 | 111 |
prefsA.SetIapId(3); |
williamr@4 | 112 |
TCommDbConnPref prefsB; |
williamr@4 | 113 |
prefsB.SetIapId(5); |
williamr@4 | 114 |
|
williamr@4 | 115 |
TCommDbMultiConnPref prefs; |
williamr@4 | 116 |
prefs.SetPreference(1, prefsA); |
williamr@4 | 117 |
prefs.SetPreference(2, prefsB); |
williamr@4 | 118 |
prefs.SetConnectionAttempts(2); |
williamr@4 | 119 |
|
williamr@4 | 120 |
TInt error = conn.Start(prefs); |
williamr@4 | 121 |
@endcode |
williamr@4 | 122 |
|
williamr@4 | 123 |
@see TCommDbConnPref |
williamr@4 | 124 |
@see RConnection::Start |
williamr@4 | 125 |
|
williamr@2 | 126 |
@publishedAll |
williamr@2 | 127 |
@released since v7.0s |
williamr@2 | 128 |
*/ |
williamr@2 | 129 |
{ |
williamr@2 | 130 |
public: |
williamr@2 | 131 |
IMPORT_C TCommDbMultiConnPref(); |
williamr@2 | 132 |
IMPORT_C static TVersion Version(); |
williamr@2 | 133 |
|
williamr@2 | 134 |
IMPORT_C TInt SetPreference(TInt aIndex, const TCommDbConnPref& aPref); |
williamr@2 | 135 |
IMPORT_C TInt GetPreference(TInt aIndex, TCommDbConnPref& aPref); |
williamr@2 | 136 |
|
williamr@2 | 137 |
IMPORT_C void SetConnectionAttempts(TInt aNumAttempts); |
williamr@2 | 138 |
IMPORT_C TInt ConnectionAttempts(); |
williamr@2 | 139 |
|
williamr@2 | 140 |
inline static TCommDbMultiConnPref& Cast(const TConnPref& aPref); |
williamr@2 | 141 |
|
williamr@4 | 142 |
public: |
williamr@4 | 143 |
const static TInt KMaxMultiConnPrefCount = 2; |
williamr@4 | 144 |
struct SCommDbMultiConnPref |
williamr@4 | 145 |
{ |
williamr@4 | 146 |
TInt iNumAttempts; |
williamr@4 | 147 |
struct TCommDbConnPref::SCommDbConnPref iPrefs[KMaxMultiConnPrefCount]; |
williamr@4 | 148 |
}; |
williamr@2 | 149 |
inline struct SCommDbMultiConnPref* PrefPtr() const; |
williamr@4 | 150 |
const static TInt8 KMajorVersionNumber = 8; |
williamr@4 | 151 |
const static TInt8 KMinorVersionNumber = 0; |
williamr@4 | 152 |
const static TInt16 KBuildVersionNumber = 1; |
williamr@2 | 153 |
}; |
williamr@2 | 154 |
|
williamr@2 | 155 |
#include <commdbconnpref.inl> |
williamr@2 | 156 |
|
williamr@2 | 157 |
#endif |
williamr@2 | 158 |
// COMMDBCONNPREF_H |