1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
22 #if !(defined __CONNPREF_H__)
23 #define __CONNPREF_H__
25 #define TCommSnapPref TConnSnapPref
27 #include <comms-infras/metadata.h>
28 #include <comms-infras/metacontainer.h>
36 const TUint KMaxConnPrefSize = 0x40;
43 TInt16 iExtensionId; //< Extension ID
47 class TConnPref : public TBuf8<KMaxConnPrefSize>
49 Overrides the connection preferences.
57 EConnPrefUnknown = 0x00, //< Unknown Connection preference
58 EConnPrefCommDb = 0x01, //< CommDb Connection preference
59 EConnPrefCommDbMulti = 0x02, //< CommDbMulti Connection preferenc
61 EConnPrefIdList = 0x04,
62 EConnPrefSip = 0x05, //< Sip Connection preference
63 EConnPrefProviderInfo = 0x06,
64 EConnPrefEComList = 0x07
68 IMPORT_C TConnPref(TInt aExtensionId);
70 IMPORT_C TInt ExtensionId() const;
71 IMPORT_C TInt GetUserLen();
74 IMPORT_C void SetExtensionId(TInt aExtensionId);
75 IMPORT_C void SetUserLen(TInt aLen);
76 inline TUint8* UserPtr() const;
79 inline SConnPref* BasePtr() const;
82 inline SConnPref* TConnPref::BasePtr() const
84 return (SConnPref*)iBuf;
87 inline TUint8* TConnPref::UserPtr() const
89 return (TUint8*)(BasePtr()+1);
92 class TConnSnapPref : public TConnPref
94 An instance of the class is passed to RConnection::Start when user wants to start connection using
95 a Service Network Access Point. A Service Network Access Point is an access point in the KAfInet
98 A list of available access points can be retrieved from CommsDat using CCDAccessPointRecord. It is
99 recommended that users only attempt to start access points whose tier is KAfInet. Access points in
100 the KAfInet can use multiple access points on lower tiers to access the internet.
104 User::LeaveIfError(conn.Open(sockSvr));
105 CleanupClosePushL(conn);
107 TCommSnapPref pref(52);
109 TInt error = conn.Start(pref);
112 @see CommsDat::CCDAccessPointRecord
113 @see RConnection::Start
121 IMPORT_C TConnSnapPref();
122 IMPORT_C TConnSnapPref(TUint32 aSnap);
124 IMPORT_C void SetSnap(TUint32 aSnap);
125 IMPORT_C TUint32 Snap() const;
128 class TConnPrefList : public TConnPref
130 This class is used to send a collection of connection preferences expressed
131 as SMetaData objects between RConnection and Comms server which uses them to
134 Each tier will look up the preferences it understands, act of them, consume them
135 if applicable (see individual preferences) and pass the rest down to the next
140 User::LeaveIfError(conn.Open(sockSvr));
141 CleanupClosePushL(conn);
143 TConnPrefList* prefs = TConnPrefList::NewL();
144 CleanupStack::PushL(prefs);
145 TConnAPPref* APPref = TConnAPPref::NewL(aPara->iAp);
146 CleanupStack::PushL(APPref);
147 prefs->AppendL(APPref);
149 error = conn.Start(pref);
153 @see TConnAutoStartPref
155 @see RConnection::Start
162 IMPORT_C static TConnPrefList* NewL();
163 IMPORT_C static TConnPrefList* LoadL(TDesC8& aDes);
165 IMPORT_C TConnPrefList();
166 IMPORT_C ~TConnPrefList();
168 IMPORT_C TInt Length();
169 IMPORT_C TInt Load(TDesC8& aDes);
170 IMPORT_C TInt Store(TDes8& aDes);
172 IMPORT_C void AppendL(SMetaDataECom* aFamily);
173 IMPORT_C SMetaData* operator[](TInt aIndex);
174 IMPORT_C void Remove(TInt aIndex);
176 IMPORT_C TInt Count();
179 Meta::RMetaDataEComContainer iPrefs;
182 #endif // __CONNPREF_H__