williamr@4: /* williamr@4: * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: Implementation of Extended Connection Preferences API. williamr@4: * williamr@4: * This API defines extended connection parameters as a part of williamr@4: * custom preferences mechanism making possible for Symbian williamr@4: * licensees to define their own parameter extensions. williamr@4: * williamr@4: */ williamr@4: williamr@4: #if !(defined __EXTENDEDCONNPREF_H__) williamr@4: #define __EXTENDEDCONNPREF_H__ williamr@4: williamr@4: #include <e32base.h> williamr@4: #include <comms-infras/metadata.h> williamr@4: #include <connpref.h> williamr@4: #include <cmmanagerdef.h> williamr@4: williamr@4: williamr@4: class TExtendedConnPref : public Meta::SMetaDataECom williamr@4: /** williamr@4: User of this API must remember to link against extendedconnpref.lib and williamr@4: netmeta.lib and add #include <extendedconnpref.h>. williamr@4: williamr@4: Set methods for the extended connection preference. This preference cannot be williamr@4: used with RConnection::Start as a TConnPref. It must be part of a williamr@4: TConnPrefList. The extented connection preference can be appeded to connection williamr@4: setup parameters before RConnection::Start() dispatch. Appending is carried williamr@4: out as follows. williamr@4: williamr@4: See connpref.h for more details. williamr@4: williamr@4: @code williamr@4: williamr@4: RSocketServ sockSvr; williamr@4: RConnection conn; williamr@4: williamr@4: sockSvr.Connect(); williamr@4: User::LeaveIfError(conn.Open(sockSvr)); williamr@4: CleanupClosePushL(conn); williamr@4: williamr@4: TConnPrefList prefList; williamr@4: TExtendedConnPref extPrefs; williamr@4: williamr@4: extPrefs.SetSnapPurpose( CMManager::ESnapPurposeInternet ); williamr@4: extPrefs.SetNoteBehaviour( ENoteBehaviourConnSilent ); williamr@4: williamr@4: prefList.AppendL(&extPrefs); williamr@4: williamr@4: TInt error = conn.Start(prefList); williamr@4: williamr@4: CleanupStack::PopAndDestroy(&conn); williamr@4: @endcode williamr@4: williamr@4: @see TConnPrefList williamr@4: @see RConnection::Start williamr@4: williamr@4: @publishedAll williamr@4: @released since S60 5.2 williamr@4: */ williamr@4: { williamr@4: public: williamr@4: williamr@4: enum williamr@4: { williamr@4: /** UID for Extended Connection Preference API implementation. */ williamr@4: EUid = 0x20016A82, williamr@4: /** Subidentifier. */ williamr@4: ETypeId = 1 williamr@4: }; williamr@4: williamr@4: /** williamr@4: * ExtendedConnBearer enables application to request a specific bearer for williamr@4: * a connection. williamr@4: */ williamr@4: enum TExtendedConnBearer williamr@4: { williamr@4: /** Bearer support unknown. */ williamr@4: EExtendedConnBearerUnknown = 0x00000000, williamr@4: /** Support GPRS, 3G and Cdma2000 bearers. CSD not supported. */ williamr@4: EExtendedConnBearerCellular = 0x00000001, williamr@4: /** WLAN bearer support. */ williamr@4: EExtendedConnBearerWLAN = 0x00000002 williamr@4: }; williamr@4: williamr@4: /** williamr@4: * TNoteBehaviour enables application to request a specific behaviour from williamr@4: * the middleware regarding displaying of dialogs, notes and queries. williamr@4: */ williamr@4: enum TNoteBehaviour williamr@4: { williamr@4: /** Displays notes and queries according to default settings. */ williamr@4: ENoteBehaviourDefault = 0x00000000, williamr@4: /** williamr@4: * Starts connection and roams between different bearers without any williamr@4: * notes, i.e., notes about connection state are not shown to the user. williamr@4: */ williamr@4: ENoteBehaviourConnDisableNotes = 0x00000001, williamr@4: /** williamr@4: * Roams between different bearers without displaying any queries to williamr@4: * the user but informs the user on the events with dialogs or notes. williamr@4: * User is able to see only notes about connection state but not any williamr@4: * queries which would need user's confirmation. williamr@4: */ williamr@4: ENoteBehaviourConnDisableQueries = 0x00000002 williamr@4: }; williamr@4: williamr@4: /** williamr@4: * Starts connection and roams between different bearers without any williamr@4: * queries, dialogs or notes, i.e., nothing about connection is shown williamr@4: * to the user. williamr@4: */ williamr@4: static const TUint32 ENoteBehaviourConnSilent = williamr@4: ENoteBehaviourConnDisableNotes | ENoteBehaviourConnDisableQueries; williamr@4: williamr@4: /** williamr@4: * Constructor. williamr@4: */ williamr@4: IMPORT_C TExtendedConnPref(); williamr@4: williamr@4: /** williamr@4: * Sets the purpose of the SNAP identifying where the connection is williamr@4: * requested to. This function enables applications to start a connection williamr@4: * to, e.g., Internet SNAP or intranet SNAP without iterating through all williamr@4: * SNAPs to find the ID of the right one. williamr@4: * Default value is ESnapPurposeUnknown meaning that any SNAP is fine. williamr@4: * williamr@4: * If SNAP purpose is set, IAP id shall be zero. williamr@4: * If SNAP purpose is set, SNAP id shall be zero. williamr@4: * If SNAP purpose is set, Connection selection dialog shall be disabled. williamr@4: * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection williamr@4: * selection dialog shall be enabled. williamr@4: * williamr@4: * @param aSnapPurpose SNAP Purpose. williamr@4: */ williamr@4: IMPORT_C void SetSnapPurpose( CMManager::TSnapPurpose aSnapPurpose ); williamr@4: williamr@4: /** williamr@4: * Gets SNAP purpose. williamr@4: * williamr@4: * @return SNAP purpose. williamr@4: */ williamr@4: IMPORT_C CMManager::TSnapPurpose SnapPurpose() const; williamr@4: williamr@4: /** williamr@4: * Sets SNAP id. If SNAP id is zero, it is interpreted as williamr@4: * client's request for not requesting any specific SNAP. williamr@4: * Default value is 0. williamr@4: * williamr@4: * If SNAP id is set, IAP id shall be zero. williamr@4: * If SNAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. williamr@4: * If SNAP id is set, Connection selection dialog shall be disabled. williamr@4: * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection williamr@4: * selection dialog shall be enabled. williamr@4: * williamr@4: * @param aSnap SNAP id. williamr@4: */ williamr@4: IMPORT_C void SetSnapId( TUint32 aSnapId ); williamr@4: williamr@4: /** williamr@4: * Gets SNAP id. williamr@4: * williamr@4: * @return SNAP id. williamr@4: */ williamr@4: IMPORT_C TUint32 SnapId() const; williamr@4: williamr@4: /** williamr@4: * Sets IAP id. williamr@4: * williamr@4: * Setting IAP id means that the connection will be made utilizing given williamr@4: * IAP id no matter what existing connections are available. williamr@4: * williamr@4: * If IAP id is zero, it is interpreted as williamr@4: * client's request for not requesting any specific IAP. williamr@4: * Default value is 0. williamr@4: * williamr@4: * If IAP id is set, SNAP id shall be zero. williamr@4: * If IAP id is set, SNAP purpose shall be CMManager::ESnapPurposeUnknown. williamr@4: * If IAP id is set, Connection selection dialog shall be disabled. williamr@4: * If IAP id is set, bearer set shall be EExtendedConnBearerUnknown. williamr@4: * If IAP id is set, forced roaming is disabled automatically. williamr@4: * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection williamr@4: * selection dialog shall be enabled. williamr@4: * williamr@4: * @param aIap IAP id. williamr@4: */ williamr@4: IMPORT_C void SetIapId( TUint32 aIapId ); williamr@4: williamr@4: /** williamr@4: * Gets IAP id. williamr@4: * williamr@4: * @return IAP id. williamr@4: */ williamr@4: IMPORT_C TUint32 IapId() const; williamr@4: williamr@4: /** williamr@4: * Sets bearer, use combination of TExtendedConnBearer values. williamr@4: * Default value is KExtendedConnBearerUnknown. williamr@4: * williamr@4: * @param aBearerSet A set of bearers as a combination of williamr@4: * TExtendedConnBearer values. williamr@4: * Type is TUint32 due to bitfield character. williamr@4: */ williamr@4: IMPORT_C void SetBearerSet( TUint32 aBearerSet ); williamr@4: williamr@4: /** williamr@4: * Gets set of requested bearers. williamr@4: * williamr@4: * @return Set of requested bearers. Type is TUint32 due to bifield williamr@4: * character. williamr@4: */ williamr@4: IMPORT_C TUint32 BearerSet() const; williamr@4: williamr@4: /** williamr@4: * Sets note behaviour, use combination of TNoteBehaviour values. williamr@4: * Default value is ENoteBehaviourDefault. williamr@4: * This method does not control connection selection dialog or disconnect williamr@4: * dialog. There are own methods for these purposes in this API. williamr@4: * williamr@4: * @param aNoteBehaviour Note behaviour as a combination of TNoteBehaviour williamr@4: * values. Type is TUint32 due to bitfield williamr@4: * character. williamr@4: */ williamr@4: IMPORT_C void SetNoteBehaviour( TUint32 aNoteBehaviour ); williamr@4: williamr@4: /** williamr@4: * Gets note behaviour. williamr@4: * williamr@4: * @return Note behaviour as a combination of TNoteBehaviour values. williamr@4: * Type is TUint32 due to bitfield character. williamr@4: */ williamr@4: IMPORT_C TUint32 NoteBehaviour() const; williamr@4: williamr@4: /** williamr@4: * Enables or disables Disconnect dialog. williamr@4: * By default, Disconnect dialog is enabled. williamr@4: * williamr@4: * @param aEnableDisconnectDialog Indicates whether Disconnect dialog is williamr@4: * enabled or disabled. williamr@4: */ williamr@4: IMPORT_C void SetDisconnectDialog( TBool aEnableDisconnectDialog ); williamr@4: williamr@4: /** williamr@4: * Indicates whether Disconnect dialog is enabled. williamr@4: * williamr@4: * @return Indicates whether Disconnect dialog is enabled. williamr@4: */ williamr@4: IMPORT_C TBool DisconnectDialog() const; williamr@4: williamr@4: /** williamr@4: * Enables or disables Connection selection dialog. Only the SNAPs/IAPs williamr@4: * matching with BearerSet are shown in the dialog. williamr@4: * By default, Connection selection dialog is disabled. williamr@4: * williamr@4: * If Connection selection dialog is enabled, SNAP id shall be zero. williamr@4: * If Connection selection dialog is enabled, IAP id shall be zero. williamr@4: * If Connection selection dialog is enabled, SNAP purpose shall be williamr@4: * CMManager::ESnapPurposeUnknown. williamr@4: * Either SNAP purpose, SNAP id, or IAP id shall be given, or Connection williamr@4: * selection dialog shall be enabled. williamr@4: * williamr@4: * @param aConnSelectionDialog Indicates whether Connection selection williamr@4: * dialog is enabled or disabled. williamr@4: */ williamr@4: IMPORT_C void SetConnSelectionDialog( TBool aConnSelectionDialog ); williamr@4: williamr@4: /** williamr@4: * Indicates whether Connection selection dialog is enabled. williamr@4: * williamr@4: * @return Indicates whether Connection selection dialog is enabled. williamr@4: */ williamr@4: IMPORT_C TBool ConnSelectionDialog() const; williamr@4: williamr@4: /** williamr@4: * Enables or disables forced roaming. williamr@4: * By default, forced roaming is enabled. williamr@4: * Forced roaming only applies on connections made to Internet SNAP. williamr@4: * williamr@4: * Forced roaming means that the connection can be torn down by the williamr@4: * middleware when better one is available. E.g., when known WLAN IAP williamr@4: * becomes available, 3G connection is disconnected. williamr@4: * williamr@4: * @param aForcedRoaming Indicates whether forced roaming is enabled or williamr@4: * disabled. williamr@4: */ williamr@4: IMPORT_C void SetForcedRoaming( TBool aForcedRoaming ); williamr@4: williamr@4: /** williamr@4: * Indicates whether forced roaming is enabled. williamr@4: * williamr@4: * @return Indicates whether forced roaming is enabled. williamr@4: */ williamr@4: IMPORT_C TBool ForcedRoaming() const; williamr@4: williamr@4: protected: williamr@4: /** SMetaData implied functions */ williamr@4: EXPORT_DATA_VTABLE_AND_FN williamr@4: williamr@4: private: williamr@4: williamr@4: /** SNAP purpose. */ williamr@4: CMManager::TSnapPurpose iSnapPurpose; williamr@4: /** SNAP id. */ williamr@4: TUint32 iSnapId; williamr@4: /** IAP id. */ williamr@4: TUint32 iIapId; williamr@4: /** Bearer set. */ williamr@4: TUint32 iBearerSet; williamr@4: /** Note behaviour. */ williamr@4: TUint32 iNoteBehaviour; williamr@4: /** Indicates whether UI disconnect dialog is shown. */ williamr@4: TBool iDisconnectDialog; williamr@4: /** Indicates whether UI connection selection dialog is shown. */ williamr@4: TBool iConnSelectionDialog; williamr@4: /** Indicates whether forced roaming is enabled. */ williamr@4: TBool iForcedRoaming; williamr@4: }; williamr@4: williamr@4: williamr@4: #endif __EXTENDEDCONNPREF_H__