epoc32/include/connpref.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedAll
       
    19  @released
       
    20 */
       
    21 
    16 #if !(defined __CONNPREF_H__)
    22 #if !(defined __CONNPREF_H__)
    17 #define __CONNPREF_H__
    23 #define __CONNPREF_H__
    18 
    24 
    19 #define TCommSnapPref TConnSnapPref
    25 #define TCommSnapPref TConnSnapPref
    20 #include <e32std.h>
    26 #include <e32std.h>
       
    27 #include <comms-infras/metadata.h>
       
    28 #include <comms-infras/metacontainer.h>
       
    29 
       
    30 using namespace Meta;
    21 
    31 
    22 /**
    32 /**
    23 @publishedAll
    33 @publishedAll
    24 @released since v7.0s
    34 @released since v7.0s
    25 */
    35 */
    28 /**
    38 /**
    29 @internalTechnology
    39 @internalTechnology
    30 */
    40 */
    31 struct SConnPref
    41 struct SConnPref
    32 	{
    42 	{
    33 	TInt16 iExtensionId; ///< Extension ID
    43 	TInt16 iExtensionId; //< Extension ID
    34 	TInt16 iSpare;
    44 	TInt16 iSpare;
    35 	};
    45 	};
    36 
    46 
    37 class TConnPref : public TBuf8<KMaxConnPrefSize>
    47 class TConnPref : public TBuf8<KMaxConnPrefSize>
    38 /**
    48 /**
    42 */
    52 */
    43 	{
    53 	{
    44 public:
    54 public:
    45 	enum
    55 	enum
    46 		{
    56 		{
    47 		EConnPrefUnknown = 0x00,     ///< Unknown Connection preference
    57 		EConnPrefUnknown = 0x00,     //< Unknown Connection preference
    48 		EConnPrefCommDb = 0x01,      ///< CommDb Connection preference
    58 		EConnPrefCommDb = 0x01,      //< CommDb Connection preference
    49 		EConnPrefCommDbMulti = 0x02, ///< CommDbMulti Connection preferenc
    59 		EConnPrefCommDbMulti = 0x02, //< CommDbMulti Connection preferenc
    50 		EConnPrefSnap = 0x03,
    60 		EConnPrefSnap = 0x03,
    51 		EConnPrefIdList = 0x04,
    61 		EConnPrefIdList = 0x04,
    52 		EConnPrefSip = 0x05          ///< Sip Connection preference
    62 		EConnPrefSip = 0x05,         //< Sip Connection preference
       
    63 		EConnPrefProviderInfo = 0x06,
       
    64 		EConnPrefEComList = 0x07
    53 		};
    65 		};
    54 
    66 
    55 	IMPORT_C TConnPref();
    67 	IMPORT_C TConnPref();
    56 	IMPORT_C TConnPref(TInt aExtensionId);
    68 	IMPORT_C TConnPref(TInt aExtensionId);
    57 	
    69 
    58 	IMPORT_C TInt ExtensionId() const;
    70 	IMPORT_C TInt ExtensionId() const;
    59 	IMPORT_C TInt GetUserLen();
    71 	IMPORT_C TInt GetUserLen();
    60 
    72 
    61 protected:
    73 protected:
    62 	IMPORT_C void SetExtensionId(TInt aExtensionId);
    74 	IMPORT_C void SetExtensionId(TInt aExtensionId);
    77 	return (TUint8*)(BasePtr()+1);
    89 	return (TUint8*)(BasePtr()+1);
    78 	}
    90 	}
    79 
    91 
    80 class TConnSnapPref : public TConnPref
    92 class TConnSnapPref : public TConnPref
    81 /**
    93 /**
    82 An instance of the class is passed to RConnection::Start when user wants to start connection based on
    94 An instance of the class is passed to RConnection::Start when user wants to start connection using
    83 Service Network Access Point that represents a collection of AP to try out.
    95 a Service Network Access Point. A Service Network Access Point is an access point in the KAfInet
       
    96 tier.
       
    97 
       
    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.
       
   101 
       
   102 @code
       
   103 RConnection conn;
       
   104 User::LeaveIfError(conn.Open(sockSvr));
       
   105 CleanupClosePushL(conn);
       
   106 
       
   107 TCommSnapPref pref(52);
       
   108 
       
   109 TInt error = conn.Start(pref);
       
   110 @endcode
       
   111 
       
   112 @see CommsDat::CCDAccessPointRecord
       
   113 @see RConnection::Start
       
   114 @see TConnAPPref
    84 
   115 
    85 @publishedAll
   116 @publishedAll
    86 @released since v9.1
   117 @released since v9.1
    87 @see RConnection::Start
       
    88 */
   118 */
    89 	{
   119 	{
    90 public:
   120 public:
    91 	IMPORT_C TConnSnapPref();
   121 	IMPORT_C TConnSnapPref();
    92 	IMPORT_C TConnSnapPref(TUint32 aSnap);
   122 	IMPORT_C TConnSnapPref(TUint32 aSnap);
    93 
   123 
    94 	IMPORT_C void SetSnap(TUint32 aSnap);
   124 	IMPORT_C void SetSnap(TUint32 aSnap);
    95 	IMPORT_C TUint32 Snap() const;
   125 	IMPORT_C TUint32 Snap() const;
    96 	};
   126 	};
    97 
   127 
       
   128 class TConnPrefList : public TConnPref
       
   129 /**
       
   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
       
   132 construct it stack.
       
   133 
       
   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
       
   136 tier.
       
   137 
       
   138 @code
       
   139 RConnection conn;
       
   140 User::LeaveIfError(conn.Open(sockSvr));
       
   141 CleanupClosePushL(conn);
       
   142 
       
   143 TConnPrefList* prefs = TConnPrefList::NewL();
       
   144 CleanupStack::PushL(prefs);
       
   145 TConnAPPref* APPref = TConnAPPref::NewL(aPara->iAp);
       
   146 CleanupStack::PushL(APPref);
       
   147 prefs->AppendL(APPref);
       
   148 
       
   149 error = conn.Start(pref);
       
   150 @endcode
       
   151 
       
   152 @see TConnAPPref
       
   153 @see TConnAutoStartPref
       
   154 @see TConnSnapPref
       
   155 @see RConnection::Start
       
   156 
       
   157 @publishedAll
       
   158 @released
       
   159 */
       
   160 	{
       
   161 public:
       
   162 	IMPORT_C static TConnPrefList* NewL();
       
   163 	IMPORT_C static TConnPrefList* LoadL(TDesC8& aDes);
       
   164 
       
   165 	IMPORT_C TConnPrefList();
       
   166 	IMPORT_C ~TConnPrefList();
       
   167 
       
   168 	IMPORT_C TInt Length();
       
   169 	IMPORT_C TInt Load(TDesC8& aDes);
       
   170 	IMPORT_C TInt Store(TDes8& aDes);
       
   171 
       
   172 	IMPORT_C void AppendL(SMetaDataECom* aFamily);
       
   173 	IMPORT_C SMetaData* operator[](TInt aIndex);
       
   174 	IMPORT_C void Remove(TInt aIndex);
       
   175 
       
   176 	IMPORT_C TInt Count();
       
   177 
       
   178 private:
       
   179 	Meta::RMetaDataEComContainer iPrefs;
       
   180 	};
       
   181 
    98 #endif // __CONNPREF_H__
   182 #endif // __CONNPREF_H__
       
   183