1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/extendedconnpref.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,331 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Implementation of Extended Connection Preferences API.
1.18 +*
1.19 +* This API defines extended connection parameters as a part of
1.20 +* custom preferences mechanism making possible for Symbian
1.21 +* licensees to define their own parameter extensions.
1.22 +*
1.23 +*/
1.24 +
1.25 +#if !(defined __EXTENDEDCONNPREF_H__)
1.26 +#define __EXTENDEDCONNPREF_H__
1.27 +
1.28 +#include <e32base.h>
1.29 +#include <comms-infras/metadata.h>
1.30 +#include <connpref.h>
1.31 +#include <cmmanagerdef.h>
1.32 +
1.33 +
1.34 +class TExtendedConnPref : public Meta::SMetaDataECom
1.35 +/**
1.36 +User of this API must remember to link against extendedconnpref.lib and
1.37 +netmeta.lib and add #include <extendedconnpref.h>.
1.38 +
1.39 +Set methods for the extended connection preference. This preference cannot be
1.40 +used with RConnection::Start as a TConnPref. It must be part of a
1.41 +TConnPrefList. The extented connection preference can be appeded to connection
1.42 +setup parameters before RConnection::Start() dispatch. Appending is carried
1.43 +out as follows.
1.44 +
1.45 +See connpref.h for more details.
1.46 +
1.47 +@code
1.48 +
1.49 +RSocketServ sockSvr;
1.50 +RConnection conn;
1.51 +
1.52 +sockSvr.Connect();
1.53 +User::LeaveIfError(conn.Open(sockSvr));
1.54 +CleanupClosePushL(conn);
1.55 +
1.56 +TConnPrefList prefList;
1.57 +TExtendedConnPref extPrefs;
1.58 +
1.59 +extPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet );
1.60 +extPrefs.SetNoteBehaviour( ENoteBehaviourConnSilent );
1.61 +
1.62 +prefList.AppendL(&extPrefs);
1.63 +
1.64 +TInt error = conn.Start(prefList);
1.65 +
1.66 +CleanupStack::PopAndDestroy(&conn);
1.67 +@endcode
1.68 +
1.69 +@see TConnPrefList
1.70 +@see RConnection::Start
1.71 +
1.72 +@publishedAll
1.73 +@released since S60 5.2
1.74 +*/
1.75 + {
1.76 +public:
1.77 +
1.78 + enum
1.79 + {
1.80 + /** UID for Extended Connection Preference API implementation. */
1.81 + EUid = 0x20016A82,
1.82 + /** Subidentifier. */
1.83 + ETypeId = 1
1.84 + };
1.85 +
1.86 + /**
1.87 + * ExtendedConnBearer enables application to request a specific bearer for
1.88 + * a connection.
1.89 + */
1.90 + enum TExtendedConnBearer
1.91 + {
1.92 + /** Bearer support unknown. */
1.93 + EExtendedConnBearerUnknown = 0x00000000,
1.94 + /** Support GPRS, 3G and Cdma2000 bearers. CSD not supported. */
1.95 + EExtendedConnBearerCellular = 0x00000001,
1.96 + /** WLAN bearer support. */
1.97 + EExtendedConnBearerWLAN = 0x00000002
1.98 + };
1.99 +
1.100 + /**
1.101 + * TNoteBehaviour enables application to request a specific behaviour from
1.102 + * the middleware regarding displaying of dialogs, notes and queries.
1.103 + */
1.104 + enum TNoteBehaviour
1.105 + {
1.106 + /** Displays notes and queries according to default settings. */
1.107 + ENoteBehaviourDefault = 0x00000000,
1.108 + /**
1.109 + * Starts connection and roams between different bearers without any
1.110 + * notes, i.e., notes about connection state are not shown to the user.
1.111 + */
1.112 + ENoteBehaviourConnDisableNotes = 0x00000001,
1.113 + /**
1.114 + * Roams between different bearers without displaying any queries to
1.115 + * the user but informs the user on the events with dialogs or notes.
1.116 + * User is able to see only notes about connection state but not any
1.117 + * queries which would need user's confirmation.
1.118 + */
1.119 + ENoteBehaviourConnDisableQueries = 0x00000002
1.120 + };
1.121 +
1.122 + /**
1.123 + * Starts connection and roams between different bearers without any
1.124 + * queries, dialogs or notes, i.e., nothing about connection is shown
1.125 + * to the user.
1.126 + */
1.127 + static const TUint32 ENoteBehaviourConnSilent =
1.128 + ENoteBehaviourConnDisableNotes | ENoteBehaviourConnDisableQueries;
1.129 +
1.130 + /**
1.131 + * Constructor.
1.132 + */
1.133 + IMPORT_C TExtendedConnPref();
1.134 +
1.135 + /**
1.136 + * Sets the purpose of the SNAP identifying where the connection is
1.137 + * requested to. This function enables applications to start a connection
1.138 + * to, e.g., Internet SNAP or intranet SNAP without iterating through all
1.139 + * SNAPs to find the ID of the right one.
1.140 + * Default value is ESnapPurposeUnknown meaning that any SNAP is fine.
1.141 + *
1.142 + * If SNAP purpose is set, IAP id shall be zero.
1.143 + * If SNAP purpose is set, SNAP id shall be zero.
1.144 + * If SNAP purpose is set, Connection selection dialog shall be disabled.
1.145 + * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
1.146 + * selection dialog shall be enabled.
1.147 + *
1.148 + * @param aSnapPurpose SNAP Purpose.
1.149 + */
1.150 + IMPORT_C void SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose );
1.151 +
1.152 + /**
1.153 + * Gets SNAP purpose.
1.154 + *
1.155 + * @return SNAP purpose.
1.156 + */
1.157 + IMPORT_C CMManager::TSnapPurpose SnapPurpose() const;
1.158 +
1.159 + /**
1.160 + * Sets SNAP id. If SNAP id is zero, it is interpreted as
1.161 + * client's request for not requesting any specific SNAP.
1.162 + * Default value is 0.
1.163 + *
1.164 + * If SNAP id is set, IAP id shall be zero.
1.165 + * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
1.166 + * If SNAP id is set, Connection selection dialog shall be disabled.
1.167 + * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
1.168 + * selection dialog shall be enabled.
1.169 + *
1.170 + * @param aSnap SNAP id.
1.171 + */
1.172 + IMPORT_C void SetSnapId( TUint32 aSnapId );
1.173 +
1.174 + /**
1.175 + * Gets SNAP id.
1.176 + *
1.177 + * @return SNAP id.
1.178 + */
1.179 + IMPORT_C TUint32 SnapId() const;
1.180 +
1.181 + /**
1.182 + * Sets IAP id.
1.183 + *
1.184 + * Setting IAP id means that the connection will be made utilizing given
1.185 + * IAP id no matter what existing connections are available.
1.186 + *
1.187 + * If IAP id is zero, it is interpreted as
1.188 + * client's request for not requesting any specific IAP.
1.189 + * Default value is 0.
1.190 + *
1.191 + * If IAP id is set, SNAP id shall be zero.
1.192 + * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown.
1.193 + * If IAP id is set, Connection selection dialog shall be disabled.
1.194 + * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown.
1.195 + * If IAP id is set, forced roaming is disabled automatically.
1.196 + * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
1.197 + * selection dialog shall be enabled.
1.198 + *
1.199 + * @param aIap IAP id.
1.200 + */
1.201 + IMPORT_C void SetIapId( TUint32 aIapId );
1.202 +
1.203 + /**
1.204 + * Gets IAP id.
1.205 + *
1.206 + * @return IAP id.
1.207 + */
1.208 + IMPORT_C TUint32 IapId() const;
1.209 +
1.210 + /**
1.211 + * Sets bearer, use combination of TExtendedConnBearer values.
1.212 + * Default value is KExtendedConnBearerUnknown.
1.213 + *
1.214 + * @param aBearerSet A set of bearers as a combination of
1.215 + * TExtendedConnBearer values.
1.216 + * Type is TUint32 due to bitfield character.
1.217 + */
1.218 + IMPORT_C void SetBearerSet( TUint32 aBearerSet );
1.219 +
1.220 + /**
1.221 + * Gets set of requested bearers.
1.222 + *
1.223 + * @return Set of requested bearers. Type is TUint32 due to bifield
1.224 + * character.
1.225 + */
1.226 + IMPORT_C TUint32 BearerSet() const;
1.227 +
1.228 + /**
1.229 + * Sets note behaviour, use combination of TNoteBehaviour values.
1.230 + * Default value is ENoteBehaviourDefault.
1.231 + * This method does not control connection selection dialog or disconnect
1.232 + * dialog. There are own methods for these purposes in this API.
1.233 + *
1.234 + * @param aNoteBehaviour Note behaviour as a combination of TNoteBehaviour
1.235 + * values. Type is TUint32 due to bitfield
1.236 + * character.
1.237 + */
1.238 + IMPORT_C void SetNoteBehaviour( TUint32 aNoteBehaviour );
1.239 +
1.240 + /**
1.241 + * Gets note behaviour.
1.242 + *
1.243 + * @return Note behaviour as a combination of TNoteBehaviour values.
1.244 + * Type is TUint32 due to bitfield character.
1.245 + */
1.246 + IMPORT_C TUint32 NoteBehaviour() const;
1.247 +
1.248 + /**
1.249 + * Enables or disables Disconnect dialog.
1.250 + * By default, Disconnect dialog is enabled.
1.251 + *
1.252 + * @param aEnableDisconnectDialog Indicates whether Disconnect dialog is
1.253 + * enabled or disabled.
1.254 + */
1.255 + IMPORT_C void SetDisconnectDialog( TBool aEnableDisconnectDialog );
1.256 +
1.257 + /**
1.258 + * Indicates whether Disconnect dialog is enabled.
1.259 + *
1.260 + * @return Indicates whether Disconnect dialog is enabled.
1.261 + */
1.262 + IMPORT_C TBool DisconnectDialog() const;
1.263 +
1.264 + /**
1.265 + * Enables or disables Connection selection dialog. Only the SNAPs/IAPs
1.266 + * matching with BearerSet are shown in the dialog.
1.267 + * By default, Connection selection dialog is disabled.
1.268 + *
1.269 + * If Connection selection dialog is enabled, SNAP id shall be zero.
1.270 + * If Connection selection dialog is enabled, IAP id shall be zero.
1.271 + * If Connection selection dialog is enabled, SNAP purpose shall be
1.272 + * CMManager::ESnapPurposeUnknown.
1.273 + * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection
1.274 + * selection dialog shall be enabled.
1.275 + *
1.276 + * @param aConnSelectionDialog Indicates whether Connection selection
1.277 + * dialog is enabled or disabled.
1.278 + */
1.279 + IMPORT_C void SetConnSelectionDialog( TBool aConnSelectionDialog );
1.280 +
1.281 + /**
1.282 + * Indicates whether Connection selection dialog is enabled.
1.283 + *
1.284 + * @return Indicates whether Connection selection dialog is enabled.
1.285 + */
1.286 + IMPORT_C TBool ConnSelectionDialog() const;
1.287 +
1.288 + /**
1.289 + * Enables or disables forced roaming.
1.290 + * By default, forced roaming is enabled.
1.291 + * Forced roaming only applies on connections made to Internet SNAP.
1.292 + *
1.293 + * Forced roaming means that the connection can be torn down by the
1.294 + * middleware when better one is available. E.g., when known WLAN IAP
1.295 + * becomes available, 3G connection is disconnected.
1.296 + *
1.297 + * @param aForcedRoaming Indicates whether forced roaming is enabled or
1.298 + * disabled.
1.299 + */
1.300 + IMPORT_C void SetForcedRoaming( TBool aForcedRoaming );
1.301 +
1.302 + /**
1.303 + * Indicates whether forced roaming is enabled.
1.304 + *
1.305 + * @return Indicates whether forced roaming is enabled.
1.306 + */
1.307 + IMPORT_C TBool ForcedRoaming() const;
1.308 +
1.309 +protected:
1.310 + /** SMetaData implied functions */
1.311 + EXPORT_DATA_VTABLE_AND_FN
1.312 +
1.313 +private:
1.314 +
1.315 + /** SNAP purpose. */
1.316 + CMManager::TSnapPurpose iSnapPurpose;
1.317 + /** SNAP id. */
1.318 + TUint32 iSnapId;
1.319 + /** IAP id. */
1.320 + TUint32 iIapId;
1.321 + /** Bearer set. */
1.322 + TUint32 iBearerSet;
1.323 + /** Note behaviour. */
1.324 + TUint32 iNoteBehaviour;
1.325 + /** Indicates whether UI disconnect dialog is shown. */
1.326 + TBool iDisconnectDialog;
1.327 + /** Indicates whether UI connection selection dialog is shown. */
1.328 + TBool iConnSelectionDialog;
1.329 + /** Indicates whether forced roaming is enabled. */
1.330 + TBool iForcedRoaming;
1.331 + };
1.332 +
1.333 +
1.334 +#endif __EXTENDEDCONNPREF_H__