# HG changeset patch # User hgs # Date 1282560012 -10800 # Node ID dd6aaa97e7b19ca6b6e38950a1abc7d828698c27 # Parent bbe4544dfd31264641ad452961c241cc3d36ae5b 201033 diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/group/mpmserver.mmp --- a/bearermanagement/mpm/group/mpmserver.mmp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/group/mpmserver.mmp Mon Aug 23 13:40:12 2010 +0300 @@ -50,6 +50,8 @@ SOURCE mpmdialogbase.cpp SOURCE mpmdatausagewatcher.cpp SOURCE mpmvpntogglewatcher.cpp +SOURCE mpmexpirytimer.cpp +SOURCE mpmconnpermquerytimer.cpp USERINCLUDE ../inc diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/inc/mpmconnmonevents.h --- a/bearermanagement/mpm/inc/mpmconnmonevents.h Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/inc/mpmconnmonevents.h Mon Aug 23 13:40:12 2010 +0300 @@ -293,6 +293,13 @@ inline TBool DiscardAvailabilityNotification(); /** + * Returns the setting whether IAP availability notification has been discarded by MPM. + * @since 3.2 + * @return ETrue if availability notifications have been discarded. + */ + inline TBool AvailabilityNotificationDiscarded(); + + /** * Creates preferred carrier available notification when needed. * @since 5.1 * @param aCaller Identifies the calling context @@ -343,6 +350,9 @@ // until MPM initiated WLAN scan request has completed. TBool iDiscardAvailabilityNotification; + // ConnMon's IAP availability event has been discarded. + TBool iAvailabilityNotificationDiscarded; + #ifdef _DEBUG TBool iFilterEvents; // by default off. (CBase) public: @@ -378,6 +388,15 @@ return iDiscardAvailabilityNotification; } +// ----------------------------------------------------------------------------- +// CMPMConnMonEvents::AvailabilityNotificationDiscarded +// ----------------------------------------------------------------------------- +// +inline TBool CMPMConnMonEvents::AvailabilityNotificationDiscarded() + { + return iAvailabilityNotificationDiscarded; + } + #endif // MPMCONNMONEVENTS_H // End of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/inc/mpmconnpermquerytimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bearermanagement/mpm/inc/mpmconnpermquerytimer.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class CMPMConnPermQueryTimer. +* +*/ + +#ifndef MPMCONNPERMQUERYTIMER_H +#define MPMCONNPERMQUERYTIMER_H + +// INCLUDES +#include +#include "mpmexpirytimercallback.h" + +class CMPMServer; +class CMPMExpiryTimer; + +/** +* Class that implements Connection permission query's cancellation delay timer +* and callback. +* @since 5.2 +*/ +class CMPMConnPermQueryTimer : public CBase, public MMPMExpiryTimerCallback + { + +public: + + /** + * New for calling the two-phased constructor. + * @since 5.2 + * @param aServer Pointer to the MPM server object, for callback purposes + * @return Pointer to created object instance + */ + static CMPMConnPermQueryTimer* NewL( CMPMServer* aServer ); + + /** + * Destructor. + * @since 5.2 + */ + virtual ~CMPMConnPermQueryTimer(); + + /** + * Start the timer. + * @since 5.2 + */ + void StartTimer(); + + /** + * Dialog expiration timeout callback, inherited from MMPMExpiryTimerCallback. + * @since 5.2 + */ + void HandleTimedOut(); + +private: + + /** + * C++ default constructor. + * @since 5.2 + * @param aServer Pointer to the MPM server object, for callback purposes + */ + CMPMConnPermQueryTimer( CMPMServer* aServer ); + + /** + * Symbian 2nd phase constructor. + * @since 5.2 + */ + void ConstructL(); + + +private: // data + + /** + * Pointer to the MPM Server object. Not own. + */ + CMPMServer* iServer; + + /** + * Pointer to the common MPM expiry timer object. + */ + CMPMExpiryTimer* iExpiryTimer; + + /** + * Timeout constant. + */ + static const TInt KTimeout = 10000000; // 10 sec + + }; + +#endif // MPMCONNPERMQUERYTIMER_H diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/inc/mpmexpirytimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bearermanagement/mpm/inc/mpmexpirytimer.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class CMPMExpiryTimer. +* +*/ + +#ifndef MPMEXPIRYTIMER_H +#define MPMEXPIRYTIMER_H + +// INCLUDES +#include +#include + +#include "mpmexpirytimercallback.h" + +/** +* Class that implements simple microsecond timer and callback. +* @since 5.2 +*/ +NONSHARABLE_CLASS( CMPMExpiryTimer ): public CTimer + { +public: + + /** + * New for calling the two-phased constructor. + * @since 5.2 + * @param aCallback Pointer to the class where callback goes + * @param aTimeout Timeout value in microseconds + * @return Pointer to created object instance + */ + static CMPMExpiryTimer* NewL( MMPMExpiryTimerCallback& aCallback, + TInt aTimeout); + + /** + * Starts up the timer. + * @since 5.2 + */ + void Start(); + +private: + /** + * C++ constructor. + * @since 5.2 + * @param aCallback Pointer to the class where callback goes + * @param aTimer Timeout value in microseconds + */ + CMPMExpiryTimer( MMPMExpiryTimerCallback& aCallback, + TInt aTimeout ); + + /** + * ConstructL. + * @since 5.2 + */ + void ConstructL(); + + /** + * RunL. Inherited from CTimer. + * @since 5.2 + */ + void RunL(); + +private: + /** + * Callback reference. + */ + MMPMExpiryTimerCallback& iCallback; + + /** + * Timeout value in microseconds. + */ + TInt iTimeout; + }; + +#endif // MPMEXPIRYTIMER_H diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/inc/mpmexpirytimercallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bearermanagement/mpm/inc/mpmexpirytimercallback.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of class MMPMExpiryTimerCallback. +* +*/ + +#ifndef MPMEXPIRYTIMERCALLBACK_H +#define MPMEXPIRYTIMERCALLBACK_H + +// INCLUDES +#include + +/** +* Callback class for timer expiration. +* @since 5.2 +*/ +class MMPMExpiryTimerCallback + { +public: + /** + * Callback function for handling the timeout. + * @since 5.2 + */ + virtual void HandleTimedOut() = 0; + }; + +#endif // MPMEXPIRYTIMERCALLBACK_H diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/inc/mpmserver.h --- a/bearermanagement/mpm/inc/mpmserver.h Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/inc/mpmserver.h Mon Aug 23 13:40:12 2010 +0300 @@ -191,6 +191,7 @@ class CMPMConfirmDlgRoaming; class CMPMConfirmDlgStarting; class CMPMDefaultConnection; +class CMPMConnPermQueryTimer; // CLASS DECLARATION /** @@ -861,6 +862,27 @@ */ void SetOfflineWlanQueryResponse( TOfflineWlanQueryResponse aResponse); + /** + * Starts the connection permission query timer. + * During the timer, no connection permission query can be initiated. + * @since 5.2 + */ + void StartConnPermQueryTimer(); + + /** + * Resets the connection permission query timer. + * @since 5.2 + */ + void ResetConnPermQueryTimer(); + + /** + * Returns true if the connection permission query timer is running. + * During the timer, no connection permission query can be initiated. + * @since 5.2 + * @return ETrue if timer is running, EFalse otherwise. + */ + TBool IsConnPermQueryTimerOn(); + private: /** @@ -989,6 +1011,9 @@ // TConnMonIapInfo Info about available IAPs TConnMonIapInfo iConnMonIapInfo; + + // Connection permission query cancellation delay timer + CMPMConnPermQueryTimer* iConnPermQueryTimer; }; #include "mpmserver.inl" diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp --- a/bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -197,6 +197,9 @@ { MPMLOGSTRING3( "CMPMConfirmDlgStarting<0x%x>::UserSelectedCancel:\ Complete %d", iConnId, aError ) + // User cancelled the connection permission query, + // don't try again until the timer expires. + iServer.StartConnPermQueryTimer(); iIapSelection.ChooseIapComplete( aError, NULL ); } diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmconnmonevents.cpp --- a/bearermanagement/mpm/src/mpmconnmonevents.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmconnmonevents.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -51,7 +51,8 @@ // CMPMConnMonEvents::CMPMConnMonEvents( CMPMServer& aServer ) : iMyServer( aServer ), - iDiscardAvailabilityNotification( EFalse ) + iDiscardAvailabilityNotification( EFalse ), + iAvailabilityNotificationDiscarded( EFalse ) { } @@ -466,6 +467,7 @@ if ( ( iAvailableIAPs.Count() > 0 ) && !DiscardAvailabilityNotification() ) { + iAvailabilityNotificationDiscarded = EFalse; // Remove temporary blacklistings as fresh availability // info is available. // @@ -479,6 +481,7 @@ } else { + iAvailabilityNotificationDiscarded = ETrue; MPMLOGSTRING2( "CMPMConnMonEvents::EventL - IAPs count: %d", iAvailableIAPs.Count() ) MPMLOGSTRING2( diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmconnmonreqs.cpp --- a/bearermanagement/mpm/src/mpmconnmonreqs.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmconnmonreqs.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -349,6 +349,12 @@ // iParent.IapAvailabilityChange( EConnMon ); } + + if ( iParent.AvailabilityNotificationDiscarded() ) + { + MPMLOGSTRING( "CMPMConnMonReqs::RunL: AvailabilityNotificationDiscarded, roaming logic triggered" ) + iParent.IapAvailabilityChange( EConnMonEvent ); + } } // check which callback function to use // diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmconnpermquerytimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bearermanagement/mpm/src/mpmconnpermquerytimer.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Implementation of class CMPMConnPermQueryTimer. + * This timer is used for preventing excessive connection permission queries, + * when the used has cancelled the previous connection permission query. + * + */ + +#include "mpmlogger.h" +#include "mpmserver.h" +#include "mpmexpirytimer.h" +#include "mpmconnpermquerytimer.h" + +// --------------------------------------------------------------------------- +// Creates a new object by calling the two-phased constructor. +// --------------------------------------------------------------------------- +// +CMPMConnPermQueryTimer* CMPMConnPermQueryTimer::NewL( CMPMServer* aServer ) + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::NewL" ) + + CMPMConnPermQueryTimer* self = new( ELeave ) CMPMConnPermQueryTimer( aServer ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Default C++ constructor. +// --------------------------------------------------------------------------- +// +CMPMConnPermQueryTimer::CMPMConnPermQueryTimer( CMPMServer* aServer ) : + iServer( aServer ) + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::CMPMConnPermQueryTimer" ) + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CMPMConnPermQueryTimer::ConstructL() + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::ConstructL" ) + iExpiryTimer = CMPMExpiryTimer::NewL( *this, KTimeout ); + } + +// --------------------------------------------------------------------------- +// Destructor. +// --------------------------------------------------------------------------- +// +CMPMConnPermQueryTimer::~CMPMConnPermQueryTimer() + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::~CMPMConnPermQueryTimer" ) + if ( iExpiryTimer ) + { + iExpiryTimer->Cancel(); + delete iExpiryTimer; + } + } + +// --------------------------------------------------------------------------- +// Start the timer. +// --------------------------------------------------------------------------- +// +void CMPMConnPermQueryTimer::StartTimer() + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::StartTimer" ) + if ( iExpiryTimer ) + { + iExpiryTimer->Cancel(); + iExpiryTimer->Start(); + } + } + +// --------------------------------------------------------------------------- +// Handles the timeout. +// --------------------------------------------------------------------------- +// +void CMPMConnPermQueryTimer::HandleTimedOut() + { + MPMLOGSTRING( "CMPMConnPermQueryTimer::HandleTimedOut" ) + iServer->ResetConnPermQueryTimer(); + } diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmexpirytimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bearermanagement/mpm/src/mpmexpirytimer.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of class CMPMExpiryTimer, a common timer class for MPM. +* +*/ + +#include "mpmexpirytimer.h" +#include "mpmexpirytimercallback.h" + +// --------------------------------------------------------------------------- +// Constructs and returns the class object. +// --------------------------------------------------------------------------- +// +CMPMExpiryTimer* CMPMExpiryTimer::NewL( MMPMExpiryTimerCallback& aCallback, TInt aTimeout ) + { + CMPMExpiryTimer* self = new( ELeave ) CMPMExpiryTimer( aCallback, aTimeout ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// Default C++ constructor. +// --------------------------------------------------------------------------- +// + +CMPMExpiryTimer::CMPMExpiryTimer( MMPMExpiryTimerCallback& aCallback, TInt aTimeout ): + CTimer( CActive::EPriorityStandard ), + iCallback( aCallback ), + iTimeout( aTimeout ) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor. +// --------------------------------------------------------------------------- +// + +void CMPMExpiryTimer::ConstructL() + { + CTimer::ConstructL(); + } + +// --------------------------------------------------------------------------- +// RunL, from CTimer, starts up the timer. +// --------------------------------------------------------------------------- +// + +void CMPMExpiryTimer::Start() + { + After( iTimeout ); + } + +// --------------------------------------------------------------------------- +// RunL, from CTimer, called when the timer expires. +// --------------------------------------------------------------------------- +// + +void CMPMExpiryTimer::RunL() + { + iCallback.HandleTimedOut(); + } diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmiapselection.cpp --- a/bearermanagement/mpm/src/mpmiapselection.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmiapselection.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -353,12 +353,12 @@ if ( iSession->IsConfirmFirstL( validateIapId ) && !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) )) { - - // Check whether queries are enabled + // Check that queries aren't disabled and + // enough time has elapsed from the last query cancelled by the user. if ( !( iChooseIapPref.NoteBehaviour() - & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) + & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && + !iSession->MyServer().IsConnPermQueryTimerOn() ) { - TConnectionId connId = iSession->ConnectionId(); // Set confirmation type based on roaming status @@ -512,8 +512,10 @@ ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) && !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ) ) { - // Check whether queries are disabled - if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) + // Check that queries aren't disabled and + // enough time has elapsed from the last query cancelled by the user. + if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && + !iSession->MyServer().IsConnPermQueryTimerOn() ) { if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) { @@ -791,8 +793,10 @@ // to the user in this country if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) { - // Check whether queries are enabled - if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) + // Check that queries aren't disabled and + // enough time has elapsed from the last query cancelled by the user. + if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && + !iSession->MyServer().IsConnPermQueryTimerOn() ) { TConnectionId connId = iSession->ConnectionId(); diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmserver.cpp --- a/bearermanagement/mpm/src/mpmserver.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmserver.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -42,6 +42,7 @@ #include "mpmvpntogglewatcher.h" #include "mpmdatausagewatcher.h" #include "mpmpropertydef.h" +#include "mpmconnpermquerytimer.h" static const TUint32 KUidKmdServer = 0x1000088A; @@ -99,7 +100,8 @@ iConnUiUtils( NULL ), iOfflineMode( ECoreAppUIsNetworkConnectionAllowed ), iOfflineWlanQueryResponse( EOfflineResponseUndefined ), - iRoamingToWlanPeriodic( NULL ) + iRoamingToWlanPeriodic( NULL ), + iConnPermQueryTimer( NULL ) { } @@ -270,6 +272,8 @@ delete iCommsDatAccess; delete iConnUiUtils; + + delete iConnPermQueryTimer; } // ----------------------------------------------------------------------------- @@ -383,19 +387,13 @@ "CMPMServer::AppendBMConnection - aConnId = 0x%x, aSnap = %i", aConnId, aSnap ) - // Set the Connection Id, SNAP, Iap Id and connection state - // - TConnectionInfo connInfo; - connInfo.iConnId = aConnId; - connInfo.iSnap = aSnap; - connInfo.iIapId = aIapId; - connInfo.iState = aState; - connInfo.iAppUid = aSession.AppUid(); - - // Package into TActiveBMConn //TODO Redundant.. remove the other one. - // + // Set the Connection Id, SNAP, Iap Id and connection state, into TActiveBMConn TActiveBMConn conn; - conn.iConnInfo = connInfo; + conn.iConnInfo.iConnId = aConnId; + conn.iConnInfo.iSnap = aSnap; + conn.iConnInfo.iIapId = aIapId; + conn.iConnInfo.iState = aState; + conn.iConnInfo.iAppUid = aSession.AppUid(); TInt index1 = iActiveBMConns.Find( conn, TActiveBMConn::MatchConnInfo ); @@ -1482,7 +1480,7 @@ MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" ) // cancel the periodic object - if ( iRoamingToWlanPeriodic != NULL ) + if ( iRoamingToWlanPeriodic ) { iRoamingToWlanPeriodic->Cancel(); } @@ -1554,6 +1552,11 @@ MPMLOGSTRING( "CMPMServer::StartForcedRoamingToConnectedWlanL" ); static_cast( aUpdater )->StartForcedRoamingToWlanL( static_cast( aUpdater )->iConnMonIapInfo ); + // Added also execution of policy based roaming logic because + // connections that are in EStarting state, when WLAN signal + // gets weak, would remain in WLAN as long as signal is weak. + static_cast( aUpdater )->StartForcedRoamingFromWlanL( + static_cast( aUpdater )->iConnMonIapInfo ); return 0; } @@ -2018,6 +2021,61 @@ iOfflineWlanQueryResponse = aResponse; } +// --------------------------------------------------------------------------- +// CMPMServer::StartConnPermQueryTimer +// Starts the connection permission query timer. +// --------------------------------------------------------------------------- +// +void CMPMServer::StartConnPermQueryTimer() + { + MPMLOGSTRING( "CMPMServer::StartConnPermQueryTimer" ) + + if ( !iConnPermQueryTimer ) + { + TRAPD( err, iConnPermQueryTimer = CMPMConnPermQueryTimer::NewL( this ) ); + if ( err == KErrNone ) + { + iConnPermQueryTimer->StartTimer(); + MPMLOGSTRING( "CMPMServer::StartConnPermQueryTimer: Ok." ) + } + } + } + +// --------------------------------------------------------------------------- +// CMPMServer::ResetConnPermQueryTimer +// Resets the connection permission query timer. +// --------------------------------------------------------------------------- +// +void CMPMServer::ResetConnPermQueryTimer() + { + MPMLOGSTRING( "CMPMServer::ResetConnPermQueryTimer" ) + + if ( iConnPermQueryTimer ) + { + delete iConnPermQueryTimer; + iConnPermQueryTimer = NULL; + MPMLOGSTRING( "CMPMServer::ResetConnPermQueryTimer: Ok." ) + } + } + +// --------------------------------------------------------------------------- +// CMPMServer::IsConnPermQueryTimerOn +// Tells if the connection permission query timer is on. +// --------------------------------------------------------------------------- +// +TBool CMPMServer::IsConnPermQueryTimerOn() + { + MPMLOGSTRING( "CMPMServer::IsConnPermQueryTimerOn" ) + + TBool retval = EFalse; + if ( iConnPermQueryTimer ) + { + retval = ETrue; + MPMLOGSTRING( "CMPMServer::IsConnPermQueryTimerOn: Yes." ) + } + return retval; + } + // ----------------------------------------------------------------------------- // TMPMBlackListConnId::Append // ----------------------------------------------------------------------------- diff -r bbe4544dfd31 -r dd6aaa97e7b1 bearermanagement/mpm/src/mpmserversession.cpp --- a/bearermanagement/mpm/src/mpmserversession.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/bearermanagement/mpm/src/mpmserversession.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -913,7 +913,10 @@ //Display confirm dialog only if we are moving to cellular IAP if ( MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap ) == ENotWlanIap ) { - if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) ) + // Check that connection preferences don't deny queries, and + // enough time has elapsed from the last query cancelled by the user. + if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) && + !MyServer().IsConnPermQueryTimerOn() ) { if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming ) { @@ -1015,6 +1018,10 @@ { if( aResponse == EMsgQueryCancelled ) { + // User cancelled the connection permission query, + // don't try again until the timer expires. + MyServer().StartConnPermQueryTimer(); + if( !aReconnect ) { // Send a preferred IAP notification diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cmapplsettingsui/cmapplsettingsui.pro --- a/cmmanager/cmapplsettingsui/cmapplsettingsui.pro Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cmapplsettingsui/cmapplsettingsui.pro Mon Aug 23 13:40:12 2010 +0300 @@ -31,6 +31,8 @@ CONFIG += hb RESOURCES = res/cmapplsettingsui.qrc +DOCML += res/cmradiodialog.docml + TRANSLATIONS = cmapplsettingsui.ts #Store generated files to their own directory diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cmapplsettingsui/res/cmapplsettingsui.qrc --- a/cmmanager/cmapplsettingsui/res/cmapplsettingsui.qrc Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cmapplsettingsui/res/cmapplsettingsui.qrc Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,5 @@ - cmradiodialog.docml + cmradiodialog.docml.bin diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/res/tst_applsettingsui.qrc --- a/cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/res/tst_applsettingsui.qrc Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/res/tst_applsettingsui.qrc Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,5 @@ - tst_applsettingsui.docml + tst_applsettingsui.docml.bin diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/tst_applsettingsui.pro --- a/cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/tst_applsettingsui.pro Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cmapplsettingsui/tsrc/tst_applsettingsui/tst_applsettingsui.pro Mon Aug 23 13:40:12 2010 +0300 @@ -23,8 +23,9 @@ inc \ ../../inc \ ../../../../inc -load(hb.prf) +CONFIG += hb RESOURCES = res/tst_applsettingsui.qrc +DOCML += res/tst_applsettingsui.docml MOC_DIR = moc # Input @@ -35,10 +36,8 @@ src/tst_applsettingsui.cpp symbian*: { - CONFIG -= symbian_i18n LIBS += -lcmapplsettingsui TARGET.UID3 = 0x2002E69A - SYMBIAN_PLATFORMS = WINSCW ARMV5 } symbian: { diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/cpdestinationplugin.pro --- a/cmmanager/cpdestinationplugin/cpdestinationplugin.pro Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/cpdestinationplugin.pro Mon Aug 23 13:40:12 2010 +0300 @@ -25,6 +25,8 @@ symbian*::LIBS += -lcmmanager RESOURCES = res/cpdestinationplugin.qrc +DOCML += res/cpdestinationplugindialogs.docml + # Sources HEADERS += inc/cpiapitem.h \ inc/cpdestinationplugin.h \ diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/inc/cpdestinationgroup.h --- a/cmmanager/cpdestinationplugin/inc/cpdestinationgroup.h Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/inc/cpdestinationgroup.h Mon Aug 23 13:40:12 2010 +0300 @@ -12,8 +12,8 @@ * Contributors: * * Description: -* CpDestinationGroup contains all destination UI items as well as -* items for uncategorized access points and adding new destinations. +* CpDestinationGroup contains all destination UI items as well as +* items for uncategorized access points and adding new destinations. */ #ifndef CPDESTINATIONGROUP_H @@ -44,7 +44,9 @@ CpDestinationGroup(CpItemDataHelper &itemDataHelper); ~CpDestinationGroup(); - void addDestination(const QString &dest, int destId); + void addDestination( + const QString &name, + QSharedPointer dest); void deleteDestination(int destId); CpBearerApPluginInterface *findBearerPlugin(int apId); diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/res/cpdestinationplugin.qrc --- a/cmmanager/cpdestinationplugin/res/cpdestinationplugin.qrc Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/res/cpdestinationplugin.qrc Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,6 @@ - + + - cpdestinationplugindialogs.docml + cpdestinationplugindialogs.docml.bin diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp --- a/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -1,36 +1,41 @@ /* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0"" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * Data item for representing "Add Destination" button in UI. - */ +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Data item for representing "Add Destination" button in UI. +*/ // System includes + #include #include #include #include + #include #include #include // User includes + #include "cpadddestinationentryitemdata.h" #include "cpdestinationgroup.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cpadddestinationentryitemdataTraces.h" #endif + /*! \class CpAddDestinationEntryItemData \brief This class is a dummy destination. It does not contain @@ -48,17 +53,18 @@ /*! - Constructor. @param[in] itemDataHelper Helper from Control Panel for making connections. @param[in] parent Parent object. */ -CpAddDestinationEntryItemData::CpAddDestinationEntryItemData(CpItemDataHelper &itemDataHelper, - CpDestinationGroup *parent) - : CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), +CpAddDestinationEntryItemData::CpAddDestinationEntryItemData( + CpItemDataHelper &itemDataHelper, + CpDestinationGroup *parent) : + CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), mParent(parent), - mDialog(0) + mDialog(0), + mOkAction(NULL) { OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_CPADDDESTINATIONENTRYITEMDATA_ENTRY); OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_CPADDDESTINATIONENTRYITEMDATA_EXIT); @@ -80,6 +86,7 @@ void CpAddDestinationEntryItemData::onLaunchView() { OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_ONLAUNCHVIEW_ENTRY); + mDialog = new HbInputDialog(); mDialog->setAttribute(Qt::WA_DeleteOnClose); mDialog->lineEdit()->setMaxLength(CMManagerShim::CmNameLength); @@ -89,10 +96,11 @@ mOkAction = new HbAction( hbTrId("txt_common_button_ok"), mDialog); - bool connected = connect(mOkAction, - SIGNAL(triggered()), - this, - SLOT(setNewDestinationName())); + bool connected = connect( + mOkAction, + SIGNAL(triggered()), + this, + SLOT(setNewDestinationName())); Q_ASSERT(connected); HbAction *cancelAction = new HbAction( hbTrId("txt_common_button_cancel"), @@ -100,6 +108,7 @@ mDialog->addAction(mOkAction); mDialog->addAction(cancelAction); mDialog->show(); + OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_ONLAUNCHVIEW_EXIT); } @@ -112,33 +121,37 @@ void CpAddDestinationEntryItemData::setNewDestinationName() { OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_SETNEWDESTINATIONNAME_ENTRY); + QString destinationName = mDialog->value().toString(); - bool destinationNameInvalid = true; - CmManagerShim *cmm = NULL; - CmDestinationShim *destination = NULL; + bool destinationNameValid = false; + QSharedPointer cmm; + QSharedPointer destination; try { - cmm = new CmManagerShim(); - if (isDestinationNameValid(destinationName, cmm)) { + cmm = QSharedPointer(new CmManagerShim()); + if (isDestinationNameValid(destinationName, cmm.data())) { // Destination name OK. Create new destination. - destination = cmm->createDestination(destinationName); - destinationNameInvalid = false; + destination = QSharedPointer( + cmm->createDestination(destinationName)); + destinationNameValid = true; } } catch (const std::exception&) { - OstTrace0( TRACE_NORMAL, DUP2_CPADDDESTINATIONENTRYITEMDATA_SETNEWDESTINATIONNAME, "CpAddDestinationEntryItemData::setNewDestinationName: exception caught" ); + OstTrace0( + TRACE_NORMAL, + DUP2_CPADDDESTINATIONENTRYITEMDATA_SETNEWDESTINATIONNAME, + "CpAddDestinationEntryItemData::setNewDestinationName: exception caught"); return; } - if (!destinationNameInvalid) { + if (destinationNameValid) { // Update view if (mParent != 0) { - mParent->addDestination(destinationName, destination->id()); + mParent->addDestination(destinationName, destination); } } else { showErrorNote(); } - delete destination; - delete cmm; + OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_SETNEWDESTINATIONNAME_EXIT); } @@ -163,9 +176,12 @@ @param[in] cmm Pointer to CmManagerShim for accessing data in commsdat. \return true if name is valid. */ -bool CpAddDestinationEntryItemData::isDestinationNameValid(const QString dest, CmManagerShim *cmm) const +bool CpAddDestinationEntryItemData::isDestinationNameValid( + const QString dest, + CmManagerShim *cmm) const { OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_ISDESTINATIONNAMEVALID_ENTRY); + bool retVal = true; if (dest.length() > 0) { @@ -173,17 +189,17 @@ cmm->allDestinations(destinationList); for (int i = 0; i < destinationList.count(); i ++) { - CmDestinationShim *destination = cmm->destination(destinationList[i]); + QScopedPointer destination( + cmm->destination(destinationList[i])); if (0 == dest.compare(destination->name())) { retVal = false; - delete destination; break; } - delete destination; } } else { retVal = false; } + OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_ISDESTINATIONNAMEVALID_EXIT); return retVal; } @@ -195,6 +211,7 @@ void CpAddDestinationEntryItemData::showErrorNote() { OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_SHOWERRORNOTE_ENTRY); + // Destination name NOK. Inform user and ask again. HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation); note->clearActions(); @@ -213,5 +230,6 @@ Q_ASSERT(connected); note->addAction(errorOk); note->show(); + OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_SHOWERRORNOTE_EXIT); } diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp --- a/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -344,7 +345,8 @@ OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CONFIRMDESTINATIONDELETE_ENTRY); HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeQuestion); note->setAttribute(Qt::WA_DeleteOnClose); - note->setText(hbTrId("txt_occ_info_delete_snap").arg(mDestinationName)); + note->setText(HbParameterLengthLimiter( + "txt_occ_info_delete_snap").arg(mDestinationName)); note->clearActions(); HbAction *okAction = new HbAction( hbTrId("txt_common_button_yes"), diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp --- a/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -12,18 +12,21 @@ * Contributors: * * Description: -* CpDestinationGroup contains all destination UI items as well as -* items for uncategorized access points and adding new destinations. +* CpDestinationGroup contains all destination UI items as well as +* items for uncategorized access points and adding new destinations. */ // System includes + #include #include #include + #include #include #include #include + #include #include #include @@ -34,9 +37,11 @@ #include // User includes + #include "cpdestinationgroup.h" #include "cpdestinationentryitem.h" #include "cpadddestinationentryitemdata.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cpdestinationgroupTraces.h" @@ -63,14 +68,16 @@ @param[in] itemDataHelper Helper for connecting signals and slots. */ CpDestinationGroup::CpDestinationGroup(CpItemDataHelper &itemDataHelper) : - CpSettingFormItemData(HbDataFormModelItem::GroupItem, + CpSettingFormItemData( + HbDataFormModelItem::GroupItem, hbTrId("txt_occ_subhead_destinations_access_points")), - mItemDataHelper(&itemDataHelper), - mUncategorisedShown(false) + mItemDataHelper(&itemDataHelper), + mUncategorisedShown(false), + mCmManager(new CmManagerShim()), + mBearerPlugins(new QList()) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_CPDESTINATIONGROUP_ENTRY); - mCmManager = new CmManagerShim(); - mBearerPlugins = new QList(); + this->loadBearerPlugins(); QList > destinationList; @@ -90,10 +97,11 @@ destDataItem->setDestinationName(destinationList.at(i)->name()); HbIcon destIcon(resolveDestinationIcon(destinationList.at(i))); destDataItem->setEntryItemIcon(destIcon); - bool connected = connect(destDataItem, - SIGNAL(destChanged()), - this, - SLOT(updateDestinationInformation())); + bool connected = connect( + destDataItem, + SIGNAL(destChanged()), + this, + SLOT(updateDestinationInformation())); Q_ASSERT(connected); this->appendChild(destDataItem); } @@ -102,9 +110,14 @@ createUncategorisedDestination(); // "Add Destination" button - CpSettingFormEntryItemData *addDest = new CpAddDestinationEntryItemData(itemDataHelper, this); - addDest->setContentWidgetData(QString("text"), hbTrId("txt_occ_button_add_destination")); + CpSettingFormEntryItemData *addDest = new CpAddDestinationEntryItemData( + itemDataHelper, + this); + addDest->setContentWidgetData( + QString("text"), + hbTrId("txt_occ_button_add_destination")); this->appendChild(addDest); + OstTraceFunctionExit0(CPDESTINATIONGROUP_CPDESTINATIONGROUP_EXIT); } @@ -114,8 +127,10 @@ CpDestinationGroup::~CpDestinationGroup() { OstTraceFunctionEntry0(DUP1_CPDESTINATIONGROUP_CPDESTINATIONGROUP_ENTRY); + delete mBearerPlugins; delete mCmManager; + OstTraceFunctionExit0(DUP1_CPDESTINATIONGROUP_CPDESTINATIONGROUP_EXIT); } @@ -123,25 +138,34 @@ addDestination() creates new destination item to Destinations group item. The new destination is shown in the UI immediately. */ -void CpDestinationGroup::addDestination(const QString &dest, int destId) +void CpDestinationGroup::addDestination( + const QString &name, + QSharedPointer dest) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_ADDDESTINATION_ENTRY); // Create UI item for new destination CpDestinationEntryItemData *destDataItem; destDataItem = new CpDestinationEntryItemData(*mItemDataHelper); - destDataItem->setContentWidgetData(QString("text"), dest); + destDataItem->setContentWidgetData(QString("text"), name); destDataItem->setContentWidgetData( QString("additionalText"), hbTrId("txt_occ_dblist_internet_val_no_access_points")); - destDataItem->setDestinationId(destId); - destDataItem->setDestinationName(dest); - connect(destDataItem, SIGNAL(destChanged()), this, SLOT(updateDestinationInformation())); + destDataItem->setDestinationId(dest->id()); + destDataItem->setDestinationName(name); + HbIcon destIcon(resolveDestinationIcon(dest)); + destDataItem->setEntryItemIcon(destIcon); + connect( + destDataItem, + SIGNAL(destChanged()), + this, + SLOT(updateDestinationInformation())); // Insert Child to correct position QList > destinationList; fetchDestinations(destinationList); insertChild(destinationList.count() - 1, destDataItem); + OstTraceFunctionExit0(CPDESTINATIONGROUP_ADDDESTINATION_EXIT); } @@ -151,6 +175,7 @@ void CpDestinationGroup::deleteDestination(int destId) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_DELETEDESTINATION_ENTRY); + // "Add Destination" child is removed from count (childCount() -1) for (int i = 0; i < this->childCount() - 1; i++) { CpDestinationEntryItemData *destDataItem = @@ -166,6 +191,7 @@ } } } + OstTraceFunctionExit0(CPDESTINATIONGROUP_DELETEDESTINATION_EXIT); } @@ -179,6 +205,7 @@ CpBearerApPluginInterface *CpDestinationGroup::findBearerPlugin(int apId) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_FINDBEARERPLUGIN_ENTRY); + CpBearerApPluginInterface *retVal = NULL; try { CmConnectionMethodShim *cm = mCmManager->connectionMethod(apId); @@ -193,9 +220,13 @@ delete cm; } catch (const std::exception&) { - OstTrace0(TRACE_NORMAL, CPDESTINATIONGROUP_FINDBEARERPLUGIN, "CpDestinationGroup::findBearerPlugin: Exception caught"); + OstTrace0( + TRACE_NORMAL, + CPDESTINATIONGROUP_FINDBEARERPLUGIN, + "CpDestinationGroup::findBearerPlugin: Exception caught"); // Let return value be NULL. } + OstTraceFunctionExit0(CPDESTINATIONGROUP_FINDBEARERPLUGIN_EXIT); return retVal; } @@ -207,10 +238,11 @@ void CpDestinationGroup::updateDestinationInformation() { OstTraceFunctionEntry0(CPDESTINATIONGROUP_UPDATEDESTINATIONINFORMATION_ENTRY); + // "Add Destination" child is removed from count (childCount() -1) for (int i = 0; i < childCount() - 1; i++) { CpDestinationEntryItemData *destDataItem = - static_cast(this->childAt(i)); + static_cast(this->childAt(i)); if (destDataItem->destinationId() == 0) { // Uncategrised Iaps @@ -228,6 +260,7 @@ destDataItem->setContentWidgetData(QString("additionalText"), iapCount); destDataItem->setContentWidgetData(QString("text"), destDataItem->destinationName()); } + OstTraceFunctionExit0(CPDESTINATIONGROUP_UPDATEDESTINATIONINFORMATION_EXIT); } @@ -238,6 +271,7 @@ void CpDestinationGroup::createUncategorisedDestination() { OstTraceFunctionEntry0(CPDESTINATIONGROUP_CREATEUNCATEGORISEDDESTINATION_ENTRY); + QList apList; mCmManager->connectionMethod(apList); if (apList.count() > 0) { @@ -263,6 +297,7 @@ insertChild(destinationList.count(), destDataItem); mUncategorisedShown = true; } + OstTraceFunctionExit0(CPDESTINATIONGROUP_CREATEUNCATEGORISEDDESTINATION_EXIT); } @@ -274,6 +309,7 @@ QList > &destinationList) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_FETCHDESTINATIONS_ENTRY); + try { QList destArray; mCmManager->allDestinations(destArray); @@ -288,8 +324,12 @@ } } } catch (const std::exception&) { - OstTrace0(TRACE_NORMAL, CPDESTINATIONGROUP_FETCHDESTINATIONS, "CpDestinationGroup::fetchDestinations: exception caught, Reading destinations"); + OstTrace0( + TRACE_NORMAL, + CPDESTINATIONGROUP_FETCHDESTINATIONS, + "CpDestinationGroup::fetchDestinations: exception caught, Reading destinations"); } + OstTraceFunctionExit0(CPDESTINATIONGROUP_FETCHDESTINATIONS_EXIT); } @@ -301,17 +341,19 @@ void CpDestinationGroup::loadBearerPlugins() { OstTraceFunctionEntry0(CPDESTINATIONGROUP_LOADBEARERPLUGINS_ENTRY); + // Load bearer plugins QDir pluginsDir("\\resource\\qt\\plugins\\controlpanel\\bearerap"); foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); CpBearerApPluginInterface *plugin = - qobject_cast(loader.instance()); + qobject_cast(loader.instance()); if (plugin) { mBearerPlugins->append(plugin); } - } + } + OstTraceFunctionExit0(CPDESTINATIONGROUP_LOADBEARERPLUGINS_EXIT); } @@ -323,6 +365,7 @@ QString CpDestinationGroup::getDestinationAdditionalText(QSharedPointer destination) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT_ENTRY); + QString result = ""; int iapCount = destination->connectionMethodCount(); int counter = 0; @@ -340,6 +383,7 @@ } else { result = hbTrId("txt_occ_dblist_internet_val_no_access_points"); } + OstTrace0(TRACE_FLOW, CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT_EXIT, "Exit"); return result; } @@ -352,6 +396,7 @@ QString CpDestinationGroup::getDestinationAdditionalText(int destinationId) { OstTraceFunctionEntry0(CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT2_ENTRY); + QString result = ""; int iapCount = 0; int counter = 0; @@ -386,6 +431,7 @@ } else { result = hbTrId("txt_occ_dblist_internet_val_no_access_points"); } + OstTrace0(TRACE_FLOW, CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT2_EXIT, "Exit"); return result; } @@ -406,20 +452,25 @@ case CMManagerShim::SnapPurposeInternet: result = "qtg_small_internet"; break; + case CMManagerShim::SnapPurposeIntranet: result = "qtg_small_intranet"; break; + case CMManagerShim::SnapPurposeMMS: result = "qtg_small_mms"; break; + case CMManagerShim::SnapPurposeOperator: result = "qtg_small_operator"; break; + default: // CMManagerShim::SnapPurposeUnknown result = "qtg_small_favorite"; break; } } + return result; } diff -r bbe4544dfd31 -r dd6aaa97e7b1 cmmanager/cpdestinationplugin/src/cpiapitem.cpp --- a/cmmanager/cpdestinationplugin/src/cpiapitem.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/cmmanager/cpdestinationplugin/src/cpiapitem.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -172,7 +173,8 @@ HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeQuestion); note->clearActions(); note->setAttribute(Qt::WA_DeleteOnClose); - note->setText(hbTrId("txt_occ_info_delete_access_point_1").arg(mIapName)); + note->setText(HbParameterLengthLimiter( + "txt_occ_info_delete_access_point_1").arg(mIapName)); HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_yes")); bool connected = connect( primaryAction, diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUi.iby --- a/connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUi.iby Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for ConnectionMonitorUi application - * -*/ - - -#ifndef __CONNECTIONMONITORUI_IBY__ -#define __CONNECTIONMONITORUI_IBY__ - -S60_APP_EXE(ConnectionMonitorUi) -S60_APP_BITMAP(ConnectionMonitorUi) -S60_APP_AIF_ICONS(ConnectionMonitorUi) -S60_APP_AIF_RSC(ConnectionMonitorUi) - -#endif // __CONNECTIONMONITORUI_IBY__ - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUiResources.iby --- a/connectionmonitoring/connectionmonitorui/ROM/ConnectionMonitorUiResources.iby Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for those parts of ConnectionMonitorUi that needs localization - * -*/ - - -#ifndef __CONNECTIONMONITORUIRESOURCES_IBY__ -#define __CONNECTIONMONITORUIRESOURCES_IBY__ - -S60_APP_RESOURCE(ConnectionMonitorUi) -S60_APP_CAPTION(ConnectionMonitorUi) - -#endif // __CONNECTIONMONITORUIRESOURCES_IBY__ - -// End of File - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/aif/ConnectionMonitorUiaif.rss --- a/connectionmonitoring/connectionmonitorui/aif/ConnectionMonitorUiaif.rss Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - - -#include - -RESOURCE AIF_DATA - { - app_uid=0x101F84D0; - num_icons=2; - embeddability=KAppNotEmbeddable; - newfile=KAppDoesNotSupportNewFile; - } - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/aif/context_pane_icon.bmp Binary file connectionmonitoring/connectionmonitorui/aif/context_pane_icon.bmp has changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/aif/context_pane_icon_mask.bmp Binary file connectionmonitoring/connectionmonitorui/aif/context_pane_icon_mask.bmp has changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/aif/list_icon.bmp Binary file connectionmonitoring/connectionmonitorui/aif/list_icon.bmp has changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/aif/list_icon_mask.bmp Binary file connectionmonitoring/connectionmonitorui/aif/list_icon_mask.bmp has changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi.rss --- a/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi.rss Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This file contains all the resources for the ConnectionMonitorUi. -* -* -*/ - - -// RESOURCE IDENTIFIER -NAME CMUI // 4 letter ID -// -// INCLUDES - -#include -#include -#include "ConnectionMonitorUi.hrh" -#include -#include -#include -#include -#include -#include - -#include -#include - -// CONSTANTS -//#define ?constant ?value - -// MACROS -//#define ?macro - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf="ConnectionMonitorUi"; } - -RESOURCE EIK_APP_INFO - { - status_pane = r_connmonui_status_pane; - } - -RESOURCE STATUS_PANE_APP_MODEL r_connmonui_status_pane - { - panes = - { - SPANE_PANE - { - id = EEikStatusPaneUidTitle; - type = EAknCtTitlePane; - resource = r_connmonui_title_pane; - } - }; - } - -RESOURCE TITLE_PANE r_connmonui_title_pane - { - txt = qtn_cmon_title; - } - -RESOURCE TBUF r_qtn_cmon_no_active_connections { buf=qtn_cmon_no_active_connections; } -RESOURCE TBUF r_qtn_cmon_navi_one_active_conn { buf=qtn_cmon_navi_one_active_conn; } -RESOURCE TBUF r_qtn_cmon_navi_many_active_conns { buf=qtn_cmon_navi_many_active_conns; } - -RESOURCE TBUF r_qtn_set_bearer_data_call { buf=qtn_set_bearer_data_call; } -RESOURCE TBUF r_qtn_set_bearer_packet_data { buf=qtn_set_bearer_packet_data; } -RESOURCE TBUF r_qtn_cmon_bearer_hscsd { buf=qtn_cmon_bearer_hscsd; } -RESOURCE TBUF r_qtn_wlan_sett_bearer_wlan { buf=qtn_wlan_sett_bearer_wlan; } - - -RESOURCE TBUF r_qtn_cmon_heading_conn_name { buf=qtn_cmon_heading_conn_name; } -RESOURCE TBUF r_qtn_cmon_heading_bearer { buf=qtn_cmon_heading_bearer; } -RESOURCE TBUF r_qtn_cmon_heading_status { buf=qtn_cmon_heading_status; } -RESOURCE TBUF r_qtn_cmon_heading_data_total { buf=qtn_cmon_heading_data_total; } -RESOURCE TBUF r_qtn_cmon_heading_data_received { buf=qtn_cmon_heading_data_received; } -RESOURCE TBUF r_qtn_cmon_heading_data_sent { buf=qtn_cmon_heading_data_sent; } -RESOURCE TBUF r_qtn_cmon_heading_duration { buf=qtn_cmon_heading_duration; } -RESOURCE TBUF r_qtn_cmon_heading_speed { buf=qtn_cmon_heading_speed; } -RESOURCE TBUF r_qtn_cmon_heading_csd_number { buf=qtn_cmon_heading_csd_number; } -RESOURCE TBUF r_qtn_cmon_heading_gprs_apn { buf=qtn_cmon_heading_gprs_apn; } -RESOURCE TBUF r_qtn_cmon_heading_sharing_info { buf=qtn_cmon_heading_sharing_info; } - -RESOURCE TBUF r_qtn_cmon_status_creating { buf=qtn_cmon_status_creating; } -RESOURCE TBUF r_qtn_cmon_status_idle { buf=qtn_cmon_status_idle; } -RESOURCE TBUF r_qtn_cmon_status_active { buf=qtn_cmon_status_active; } -RESOURCE TBUF r_qtn_cmon_status_suspended { buf=qtn_cmon_status_suspended; } -RESOURCE TBUF r_qtn_cmon_status_closing { buf=qtn_cmon_status_closing; } -RESOURCE TBUF r_qtn_cmon_status_closed { buf=qtn_cmon_status_closed; } - -RESOURCE TBUF r_qtn_cmon_status_details_creating { buf=qtn_cmon_status_details_creating; } -RESOURCE TBUF r_qtn_cmon_status_details_idle { buf=qtn_cmon_status_details_idle; } -RESOURCE TBUF r_qtn_cmon_status_details_active { buf=qtn_cmon_status_details_active; } -RESOURCE TBUF r_qtn_cmon_status_details_suspended { buf=qtn_cmon_status_details_suspended; } -RESOURCE TBUF r_qtn_cmon_status_details_closing { buf=qtn_cmon_status_details_closing; } -RESOURCE TBUF r_qtn_cmon_status_details_closed { buf=qtn_cmon_status_details_closed; } - -RESOURCE TBUF r_qtn_log_gprs_amount_b { buf=qtn_log_gprs_amount_b; } -RESOURCE TBUF r_qtn_log_gprs_amount_kb { buf=qtn_log_gprs_amount_kb; } -RESOURCE TBUF r_qtn_log_gprs_amount_mb { buf=qtn_log_gprs_amount_mb; } -RESOURCE TBUF r_qtn_log_gprs_amount_gb { buf=qtn_log_gprs_amount_gb; } - -RESOURCE TBUF r_qtn_cmon_data_transf_rate_dl { buf=qtn_cmon_data_transf_rate_dl; } -RESOURCE TBUF r_qtn_cmon_data_transf_rate_ul { buf=qtn_cmon_data_transf_rate_ul; } - -RESOURCE TBUF r_qtn_cmon_ul_dl_data_amounts { buf=qtn_cmon_ul_dl_data_amounts; } -RESOURCE TBUF r_qtn_cmon_navi_nof_connection { buf=qtn_cmon_navi_nof_connection; } - -RESOURCE TBUF r_text_calc_decimal_separator { buf=text_calc_decimal_separator; } - -RESOURCE TBUF r_qtn_cmon_item_conn_name_modem { buf=qtn_cmon_item_conn_name_modem; } - -RESOURCE TBUF r_qtn_cmon_conf_end_single_conn { buf=qtn_cmon_conf_end_single_conn; } -RESOURCE TBUF r_qtn_cmon_conf_end_all_conns { buf=qtn_cmon_conf_end_all_conns; } -RESOURCE TBUF r_qtn_cmon_conf_end_modem_conn { buf=qtn_cmon_conf_end_modem_conn; } -RESOURCE TBUF r_qtn_cmon_duration_over_24h { buf=qtn_cmon_duration_over_24h; } -RESOURCE TBUF r_qtn_cmon_info_conn_already_end { buf=qtn_cmon_info_conn_already_end; } - -RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_low { buf=qtn_cmon_wlan_singal_strength_low; } -RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_medium { buf=qtn_cmon_wlan_singal_strength_medium; } -RESOURCE TBUF r_qtn_cmon_wlan_singal_strength_good { buf=qtn_cmon_wlan_singal_strength_good; } -RESOURCE TBUF r_qtn_cmon_wlan_signal_strength_no_signal - { buf=qtn_cmon_wlan_signal_strength_no_signal; } - -RESOURCE TBUF r_qtn_cmon_wlan_newtwork_mode_adhoc { buf=qtn_cmon_wlan_newtwork_mode_adhoc; } -RESOURCE TBUF r_qtn_cmon_wlan_newtwork_mode_infra { buf=qtn_cmon_wlan_newtwork_mode_infra; } - -RESOURCE TBUF r_qtn_cmon_wlan_security_mode_open { buf=qtn_cmon_wlan_security_mode_open; } -RESOURCE TBUF r_qtn_cmon_wlan_security_mode_wep { buf=qtn_cmon_wlan_security_mode_wep; } -RESOURCE TBUF r_qtn_cmon_wlan_security_mode_802_1x { buf=qtn_cmon_wlan_security_mode_802_1x; } -RESOURCE TBUF r_qtn_cmon_wlan_security_mode_wpa { buf=qtn_cmon_wlan_security_mode_wpa; } - -RESOURCE TBUF r_qtn_cmon_wlan_tx_power_level { buf=qtn_cmon_wlan_tx_power_level; } - -RESOURCE TBUF r_qtn_cmon_heading_wlan_network_name { buf=qtn_cmon_heading_wlan_network_name; } -RESOURCE TBUF r_qtn_cmon_heading_wlan_signal_strength - { buf=qtn_cmon_heading_wlan_signal_strength; } -RESOURCE TBUF r_qtn_cmon_heading_wlan_network_mode { buf=qtn_cmon_heading_wlan_network_mode; } -RESOURCE TBUF r_qtn_cmon_heading_wlan_security_mode { buf=qtn_cmon_heading_wlan_security_mode; } -RESOURCE TBUF r_qtn_cmon_heading_wlan_tx_power { buf=qtn_cmon_heading_wlan_tx_power; } - -RESOURCE TBUF r_qtn_cmon_parameter_unavailable { buf=qtn_cmon_parameter_unavailable; } - -RESOURCE TBUF r_qtn_cmon_sharing_app_msg_server { buf=qtn_cmon_sharing_app_msg_server; } -RESOURCE TBUF r_qtn_cmon_sharing_app_dl_mg { buf=qtn_cmon_sharing_app_dl_mg; } -RESOURCE TBUF r_qtn_cmon_sharing_app_rss_server { buf=qtn_cmon_sharing_app_rss_server; } -RESOURCE TBUF r_qtn_cmon_sharing_app_java_midlet { buf=qtn_cmon_sharing_app_java_midlet; } -RESOURCE TBUF r_qtn_cmon_sharing_app_unknown { buf=qtn_cmon_sharing_app_unknown; } -RESOURCE TBUF r_qtn_cmon_sharing_app_supl { buf=qtn_cmon_sharing_app_supl; } - - -//---------------------------------------------------- -// -// r_connectionmonitorui_title -// -//---------------------------------------------------- -// -RESOURCE TBUF r_connectionmonitorui_title - { - buf = qtn_cmon_title_active_conns; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_hotkeys -// -//---------------------------------------------------- -// -RESOURCE HOTKEYS r_connectionmonitorui_hotkeys - { - control= - { - HOTKEY { command=EAknCmdExit; key='e'; } - }; - } - -#ifdef RD_CONTROL_PANEL - -//---------------------------------------------------- -// -// r_connectionmonitorui_view_buttons -// -//---------------------------------------------------- -// -RESOURCE CBA r_cp_connectionmonitorui_view_buttons - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyExit; txt=text_softkey_back;}, - CBA_BUTTON {id=EAknSoftkeyDetails; txt=qtn_msk_cmon_details;} - }; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_cp_connectionmonitorui_view - { - hotkeys=r_connectionmonitorui_hotkeys; - menubar=r_connectionmonitorui_menubar_view; - cba=r_cp_connectionmonitorui_view_buttons; - } - -#endif // RD_CONTROL_PANEL - -//---------------------------------------------------- -// -// r_connectionmonitorui_view_buttons -// -//---------------------------------------------------- -// -RESOURCE CBA r_connectionmonitorui_view_buttons - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyExit; txt=text_softkey_exit;}, - CBA_BUTTON {id=EAknSoftkeyDetails; txt=qtn_msk_cmon_details;} - }; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_connectionmonitorui_view - { - hotkeys=r_connectionmonitorui_hotkeys; - menubar=r_connectionmonitorui_menubar_view; - cba=r_connectionmonitorui_view_buttons; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_menubar_view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_connectionmonitorui_menubar_view - { - titles= - { - MENU_TITLE { menu_pane=r_connectionmonitorui_app_menu; txt="App"; }, - MENU_TITLE { menu_pane=r_connectionmonitorui_view_menu; txt="View"; } - }; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_view_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_connectionmonitorui_view_menu - { - items= - { - MENU_ITEM { command=EConnectionMonitorUiCmdAppDetails; - txt = qtn_cmon_list_options_details; flags = EEikMenuItemSpecific;}, - MENU_ITEM { command=EConnectionMonitorUiCmdAppEndConn; - txt = qtn_cmon_list_options_end_conn; flags = EEikMenuItemSpecific;}, - MENU_ITEM { command=EConnectionMonitorUiCmdAppEndAll; - txt = qtn_cmon_list_options_end_all; } - }; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_detailsview -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_connectionmonitorui_detailsview - { - hotkeys=r_connectionmonitorui_hotkeys; - cba=R_AVKON_SOFTKEYS_OK_EMPTY__OK; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_app_menu -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_connectionmonitorui_app_menu - { - items= - { - MENU_ITEM { command=EAknCmdHelp; txt = qtn_options_help; }, - MENU_ITEM { command=EAknCmdExit; txt=qtn_options_exit; } - }; - } - -// ICONARRAYS - -RESOURCE AKN_ICON_ARRAY r_listbox_icons - { - bmpfile = APP_BITMAP_DIR"\\ConnectionMonitorUi.mbm"; - icons = - { - AKN_ICON - { - iconId = EMbmConnectionmonitoruiQgn_prop_wml_gprs; - maskId = EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask; - }, - AKN_ICON - { - iconId = EMbmConnectionmonitoruiQgn_prop_wml_csd; - maskId = EMbmConnectionmonitoruiQgn_prop_wml_csd_mask; - }, - AKN_ICON - { - iconId = EMbmConnectionmonitoruiQgn_prop_wml_hscsd; - maskId = EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask; - }, - AKN_ICON - { - iconId = EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended; - maskId = EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask; - } - }; - } - -RESOURCE TBUF r_qtn_appl_option_item { buf=qtn_appl_option_item; } - -RESOURCE DIALOG r_end_conn_confirmation_query - { - flags=EGeneralQueryFlags; - buttons=R_AVKON_SOFTKEYS_YES_NO__YES; - items= - { - DLG_LINE - { - type=EAknCtQuery; - id = EGeneralQuery; - control= AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_qtn_cmon_connection_summary_note_text -// -//---------------------------------------------------- -// -RESOURCE TBUF r_qtn_cmon_connection_summary_note_text { buf = - qtn_cmon_summary_heading"\n"qtn_cmon_summary_transferred"\n%0U\n"qtn_cmon_summary_duration"\n%1U"; } - -//---------------------------------------------------- -// -// r_qtn_cmon_connection_summary_note -// -//---------------------------------------------------- -// -RESOURCE DIALOG r_qtn_cmon_connection_summary_note - { - flags = EAknInformationNoteFlags; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control= AVKON_NOTE - { - layout = ETextualNotificationLayout; - singular_label = ""; - plural_label = ""; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_connectionmonitorui_localisable_app_info -// -//---------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_connectionmonitorui_localisable_app_info - { - short_caption = qtn_apps_cmon_grid; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_apps_cmon_list; -#ifdef __SCALABLE_ICONS - number_of_icons = 1; - icon_file = "Z:"APP_BITMAP_DIR"\\connectionmonitorui_aif.mif"; -#else - number_of_icons = 2; - icon_file = "Z:"APP_BITMAP_DIR"\\connectionmonitorui_aif.mbm"; -#endif - }; - } - - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_caption.rss --- a/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_caption.rss Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* Caption file for ConnectionMonitorUi. -* -* -*/ - - -#include -#include - -RESOURCE CAPTION_DATA - { - caption=qtn_apps_cmon_list; - shortcaption=qtn_apps_cmon_grid; - } - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_reg.rss --- a/connectionmonitoring/connectionmonitorui/data/ConnectionMonitorUi_reg.rss Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include - -UID2 KUidAppRegistrationResourceFile -UID3 0x101F84D0 // Define your application UID here - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "ConnectionMonitorUi"; - - localisable_resource_file = APP_RESOURCE_DIR"\\ConnectionMonitorUi"; - localisable_resource_id = R_CONNECTIONMONITORUI_LOCALISABLE_APP_INFO; - embeddability = KAppNotEmbeddable; - newfile = KAppDoesNotSupportNewFile; - - } - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/group/ConnectionMonitorUI.mmp --- a/connectionmonitoring/connectionmonitorui/group/ConnectionMonitorUI.mmp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* This is the project specification file for ConnectionMonitorUi. -* -* -*/ - -#include -#include - - -TARGET ConnectionMonitorUi.exe -TARGETTYPE exe - - -UID 0x100039CE 0x101F84D0 - -CAPABILITY CAP_APPLICATION NetworkControl ProtServ - -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE ConnectionMonitorUiApp.cpp -SOURCE ConnectionMonitorUiAppUi.cpp -SOURCE ConnectionMonitorUiDocument.cpp -SOURCE ConnectionMonitorUiContainer.cpp -SOURCE ConnectionMonitorUiView.cpp -SOURCE ConnectionMonitorUiDetailsView.cpp -SOURCE ConnectionMonitorUiDetailsContainer.cpp -SOURCE ConnectionInfoBase.cpp -SOURCE CsdConnectionInfo.cpp -SOURCE GprsConnectionInfo.cpp -SOURCE ConnectionArray.cpp -SOURCE FeatureManagerWrapper.cpp -SOURCE WlanConnectionInfo.cpp -SOURCE EasyWLANConnectionInfo.cpp -SOURCE ActiveWrapper.cpp - - -START RESOURCE ../data/ConnectionMonitorUi.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -// Component specific internal headers -USERINCLUDE ../inc - -// ADO-SUBSYSTEM specific internal headers -SYSTEMINCLUDE ../../inc - -// ADO specific internal headers -SYSTEMINCLUDE ../../../inc - -//Macro to /epoc32 headers -MW_LAYER_SYSTEMINCLUDE - -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -APP_LAYER_SYSTEMINCLUDE -#endif - - -SYSTEMINCLUDE /epoc32/include/libc - - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY eikctl.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY connmon.lib -LIBRARY estlib.lib -LIBRARY egul.lib -LIBRARY apgrfx.lib -LIBRARY hlplch.lib -LIBRARY AknSkins.lib -LIBRARY AKNNOTIFY.LIB -LIBRARY FeatMgr.lib -LIBRARY commsdat.lib -LIBRARY cmmanager.lib - -DEBUGLIBRARY flogger.lib -DEBUGLIBRARY efsrv.lib - - -epocstacksize 0x5000 - -// DEFFILE ?filename - - -START RESOURCE ../data/ConnectionMonitorUi_reg.rss -DEPENDS connectionmonitorui.rsg -// Do not change the UID below. -TARGETPATH /private/10003a3f/apps -END - - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/group/bld.inf --- a/connectionmonitoring/connectionmonitorui/group/bld.inf Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -// Help exports -#include "../help/group/bld.inf" - -PRJ_EXPORTS -// export iby files -../ROM/ConnectionMonitorUi.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ConnectionMonitorUi.iby) -../ROM/ConnectionMonitorUiResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(ConnectionMonitorUiResources.iby) - -// export localised loc file -../loc/connectionmonitorui.loc MW_LAYER_LOC_EXPORT_PATH(connectionmonitorui.loc) - -PRJ_MMPFILES -./ConnectionMonitorUI.mmp - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv -OPTION TARGETFILE ConnectionMonitorUi.mif -OPTION HEADERFILE ConnectionMonitorUi.mbg -OPTION SOURCES -c8,1 qgn_prop_wml_gprs.bmp \ - -c8,1 qgn_prop_wml_csd.bmp \ - -c8,1 qgn_prop_wml_hscsd.bmp \ - -c8,1 qgn_prop_empty.bmp \ - -c8,1 qgn_prop_cmon_gprs_suspended.bmp \ - -c8,8 qgn_prop_cmon_conn_active.bmp \ - -c8,8 qgn_prop_cmon_wlan_avail.bmp \ - -c8,1 qgn_prop_wlan_bearer.bmp \ - -c8,1 qgn_prop_cmon_wlan_conn.bmp \ - -c8,1 qgn_indi_wlan_signal_low_add.bmp \ - -c8,1 qgn_indi_wlan_signal_med_add.bmp \ - -c8,1 qgn_indi_wlan_signal_good_add.bmp \ - -c8,1 qgn_indi_wlan_secure_network_add.bmp -END - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv - OPTION TARGETFILE ConnectionMonitorUi_aif.mif - OPTION SOURCES -c8,8 qgn_prop_cp_conn_man.bmp -END - -//PRJ_TESTMMPFILES \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/help/data/xhtml.zip Binary file connectionmonitoring/connectionmonitorui/help/data/xhtml.zip has changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/help/group/bld.inf --- a/connectionmonitoring/connectionmonitorui/help/group/bld.inf Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* -* -* Description: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/cmon.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/cmon.hlp.hrh) -../rom/connectionmonitoruihelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(connectionmonitoruihelps_variant.iby) diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/help/inc/cmon.hlp.hrh --- a/connectionmonitoring/connectionmonitorui/help/inc/cmon.hlp.hrh Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// -// cmon.hlp.hrh generated by CSXHelp Utilities. -// - -#ifndef __CMON_HLP_HRH__ -#define __CMON_HLP_HRH__ - -_LIT(KCMON_HLP_CMON_MAIN_VIEW, "CMON_HLP_CMON_MAIN_VIEW"); // -_LIT(KCMON_HLP_CMON_WLAN_VIEW, "CMON_HLP_CMON_WLAN_VIEW"); // - -#endif \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/help/rom/connectionmonitoruihelps_variant.iby --- a/connectionmonitoring/connectionmonitorui/help/rom/connectionmonitoruihelps_variant.iby Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for ConnectionMonitorUi helps - * -*/ - - -#ifndef __CONNECTIONMONITORUIHELPS_VARIANT_IBY__ -#define __CONNECTIONMONITORUIHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101F84D0\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101F84D0\meta.xml) -#endif - -#endif \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ActiveWrapper.h --- a/connectionmonitoring/connectionmonitorui/inc/ActiveWrapper.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CActiveWrapper header file -* -*/ - - -#ifndef __ACTIVE_WRAPPER_H__ -#define __ACTIVE_WRAPPER_H__ - -// INCLUDES -#include -#include - -// CONSTANTS - -// CLASS DECLARATION - -/** -* Definition of CActiveWrapper -* -* @since S60 v3.2 -*/ -NONSHARABLE_CLASS( CActiveWrapper ) : public CActive - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CActiveWrapper* NewL(); - - /** - * Destructor. - */ - virtual ~CActiveWrapper(); - - public: // New functions - - /** - * Starts the active object and gets the value for a string attribute. - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aAttribute Identifies the attribute to be retrived. - * @param aValue On completion, contains the requested string. - */ - void StartGetStringAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TDes& aValue ); - - /** - * Starts the active object and gets the value for a TInt attribute. - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aAttribute Identifies the attribute to be retrived. - * @param aValue On completion, contains the requested TInt attribute. - */ - void StartGetIntAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TInt& aValue ); - - /** - * Starts the active object and gets the value for a TUint attribute. - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aAttribute Identifies the attribute to be retrived. - * @param aValue On completion, contains the requested TUint attribute. - */ - void StartGetUintAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TUint& aValue ); - - /** - * Starts the active object and gets the value for a packaged - * attribute (TConnMonClientEnumBuf). - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aValue On completion, contains the requested packaged attribute. - */ - void StartGetConnSharings( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonClientEnumBuf& aValue ); - - /** - * Starts the active object and gets the value for a packaged - * attribute (TConnMonTimeBuf). - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aValue On completion, contains the requested packaged attribute. - */ - void StartGetConnTime( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonTimeBuf& aValue ); - - /** - * Starts the active object and gets the value for a TInt attribute - * for the used Bearer type. - * @param aConnectionId Connection id. - * @param aConnectionMonitor RConnectionMonitor - * @param aAttribute Identifies the attribute to be retrived. - * @param aValue On completion, contains the requested TInt attribute. - */ - void StartGetBearerType( TInt const aConnectionId, - RConnectionMonitor& aConnectionMonitor, - TUint const aAttribute, - TInt& aValue ); - - /** - * Starts the active object and gathers information on - * currently active connections. - * @param aConnectionCount On completion, contains the number of active connections. - * @param aConnectionMonitor RConnectionMonitor - */ - void StartGetConnectionCount( TUint& aConnectionCount, - RConnectionMonitor& aConnectionMonitor ); - - public: // Functions from base classes (CActive) - - void DoCancel(); - void RunL(); - - private: - - /** - * C++ default constructor. - */ - CActiveWrapper(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // data - - /** - * Own: sync. helper in async. requests - */ - CActiveSchedulerWait iWait; - }; - -#endif // __ACTIVE_WRAPPER_H__ - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionArray.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionArray.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contains and handles CConnectionInfo instances -* -* -*/ - - -#ifndef CONNECTIONARRAY_H_INCLUDED -#define CONNECTIONARRAY_H_INCLUDED - -// INCLUDES -#include "ConnectionInfoBase.h" - - -// CONSTANTS - -// FORWARD DECLARATIONS - -// CLASS DECLARATION -/** -* Contains and handles CConnectionInfo instances. -*/ -class CConnectionArray : public CBase, public MDesCArray - { - public: - /** - * Constructor. - */ - CConnectionArray(); - - /** - * Destructor. - */ - virtual ~CConnectionArray(); - - /** - * Contructs dynamic data members - */ - virtual void ConstructL(); - - public: // from MDesCArray - /** - * Returns the number of descriptor elements in a descriptor array. - * @return The number of descriptor elements in a descriptor array. - */ - virtual TInt MdcaCount() const; - - /** - * Indexes into a descriptor array. - * @param aIndex The position of the descriptor element within a - * descriptor array. - * The position is relative to zero; i.e. zero implies the first - * descriptor element in a descriptor array. - * @return A non-modifiable pointer descriptor representing - * the descriptor element located at position aIndex within a - * descriptor array. - */ - virtual TPtrC MdcaPoint( TInt aIndex ) const; - - public: - - /** - * Give back a copy of connectionarray. - */ - virtual CConnectionArray* DeepCopyL(); - - /** - * Returns the index of the given connection - * @param aConnectionId connection id - * @return index value of connection in the array, or -1 if there - * is no connection the given Id - */ - TInt GetArrayIndex( TUint aConnectionId ) const; - - /** - * Returns the index of the given connection - * @param aConnection connection - * @return index value of connection in the array, or -1 if there - * is no the given connection - */ - TInt GetArrayIndex( CConnectionInfoBase* aConnection ) const; - - /** - * Add only new connection to the array - * @param aConnection the connection to be added to the array - */ - void AppendL( CConnectionInfoBase* aConnection ); - - /** - * Delete connection from the array - * @param aConnectionId id of connection to be removed from the array - */ - void Delete( TUint aConnectionId ); - - /** - * Delete connection from the array - * @param aConnection the connection to be removed from the array - */ - void Delete( CConnectionInfoBase* aConnection ); - - /** - * Destroys the connection array - */ - void Reset(); - - /** - * Returns info object of connection given by index value in the array - * @param aIndex index value of connection in the array - * @return CConnectionInfo* pointer to the connection info object - */ - CConnectionInfoBase* operator[]( TUint aIndex ) const; - - /** - * Returns info object of connection given by index value in the array - * Checks the boundaries of array. - * @param aIndex index value of connection in the array - * @return CConnectionInfoBase* pointer to the connection info object if - * the given index is valid, NULL otherwise - */ - CConnectionInfoBase* At( TInt aIndex ) const; - - /** - * Gives back the number of active connections (created or suspended) - * @return the number of active connections - */ - TInt NumberOfActiveConnections() const; - - /** - * Gives back the number of suspended connections - * @return the number of suspended connections - */ - TInt NumberOfSuspendedConnections() const; - - protected: - /** - * Contains the connections. - */ - CArrayPtrFlat* iConnectionArray; ///< Owned. - }; - -#endif // CONNECTIONARRAY_H_INCLUDED \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionInfoBase.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionInfoBase.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,486 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a connection -* -* -*/ - - -#ifndef CONNECTIONINFOBASE_H_INCLUDED -#define CONNECTIONINFOBASE_H_INCLUDED - -// INCLUDES -#include -#include -#include -#include -#include - -// CONSTANTS -LOCAL_D const TUint KConnectionListItemText = 64; -LOCAL_D const TUint KDetailsListItemText = 64; - -_LIT( KConnectonListItemTextFormat, "%o\t%S\t%S" ); -_LIT( KDetailsListItemTextFormat, "%S\t%S" ); - -// FORWARD DECLARATIONS - -class CActiveWrapper; - -// CLASS DECLARATION - -enum TConnectionStatus - { - EConnectionUninitialized, - EConnectionCreating, - EConnectionCreated, - EConnectionSuspended, - EConnectionClosing, - EConnectionClosed - }; - -/** -* Order of icons in icon array of containers -*/ -enum TIconsOrder - { - EGprs = 0, - ECsd, - EHscsd, - EEmpty, - ESuspended, - EWlan - }; - - -/** -* Represents a connection. -*/ -class CConnectionInfoBase : public CBase - { - public: // Constructors, Desturctor - - /** - * Destructor - */ - virtual ~CConnectionInfoBase(); - - protected: - /** - * Constructor - * @param aConnectionId The id of the given connection. - * @param aConnectionMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - CConnectionInfoBase( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase construction - */ - void ConstructL(); - - public: // New functions - - /** - * Give back a copy of connection. - */ - virtual CConnectionInfoBase* DeepCopyL() = 0; - - - /** - * Refresh required details of connection. - */ - virtual void RefreshDetailsL() = 0; - - /** - * Refresh iListBoxItemText text, connection ListBox has a reference to - * this text. - */ - virtual void RefreshConnectionListBoxItemTextL() = 0; - - /** - * Refresh details array of connection. DetailsListBox has a reference - * to this array. - */ - virtual void RefreshDetailsArrayL() = 0; - - /** - * Called, if the status of connection is changed. - */ - void StatusChangedL(); - - /** - * Gives back the connection is alive or not. - * @return ETrue if connection is created or suspended, - * EFalse otherwise - */ - TBool IsAlive() const; - - /** - * Gives back the connection is suspended or not. - * @return ETrue if connection is suspended, - * EFalse otherwise - */ - TBool IsSuspended() const; - - /** - * @return ETrue if deletion of connection started form CMUI, - * EFalse otherwise - */ - TBool GetDeletedFromCMUI() const; - - /** - * Sets status of connection to EConnectionClosing - */ - void SetAllDeletedFromCMUI(); - - /** - * Sets iDeletedFromCMUI to ETrue, means dletion of connection - * was established from CMUI - */ - void SetDeletedFromCMUI(); - - /** - * Gives back a pointer to the DetailsArray of connection. - * @return CDesCArraySeg* iDetailsArray of connection - */ - CDesCArrayFlat* GetDetailsArray() const; - - /** - * Gives back the id of connection - * @return the id of connection. - */ - TUint GetConnectionId() const; - - /** - * Gives back the icon id of connection - * @return the icon id of connection - */ - virtual TUint GetIconId() const = 0; - - /** - * Gives back the connection is EasyWLAN or not. - * @return ETrue if the selected conenction EasyWLAN, - * EFalse otherwise - */ - virtual TBool IsEasyWLAN() const { return EFalse; }; - - /** - * Gives back current Name of Network ( SSID ) - * @return iNetworkName - */ - virtual HBufC* GetWlanNetworkNameLC() const { return NULL; }; - - /** - * Gives back the status of connection - * @return the status of connection - */ - TConnectionStatus GetStatus() const; - - /** - * Refresh status of connection - * @param aConnectionStatus new status of connection - */ - void RefreshConnectionStatus( - const TInt aConnectionStatus ); - - /** - * Gives back the name of connection - * @return the name of connection - */ - HBufC* GetNameLC() const; - - /** - * Gives back the bearertype of connection - * @return the bearertype of connection - */ - TConnMonBearerType GetBearerType() const; - - /** - * Gives back a pointer the iListBoxItemText of connection - * @return the iListBoxItemText of connection - */ - TPtrC GetConnectionListBoxItemText() const; - - /** - * Check if connection name is starts with "mRouter" string or not. - * ( if this connection is not IR/BT ) - * @retrun ETrue if starts wiht "mRouter", EFalse otherwise. - */ - TBool CheckMrouterIap(); - - protected: - /** - * Creates a string for DetailsListBoxItem, title came from resource - * and value from aValueText - * @param aResourceId a resource id - * @param aValueText the value of text - * @retrun a string consist of resource and value text - */ - HBufC* ToDetailsListBoxItemTextL( const TUint aResourceId, - const HBufC* aValueText ) const; - - /** - * Creates a string for DetailsListBoxItem, title came from resource - * and value from aValueText, and Appends to iDetailsArray - * @param aResourceId a resource id - * @param aValueText the value of text - */ - void ToDetailsListBoxItemTextWithAppendL( const TUint aResourceId, - const HBufC* aValueText ); - - /** - * Creates a string for DetailsListBoxItem, title came from resource - * and value from aValueText, and Replaces the given element with it - * @param aResourceId a resource id - * @param aValueText the value of text - */ - void ToDetailsListBoxItemTextWithReplaceL( const TUint aResourceId, - const HBufC* aValueText, - TInt aIndex ); - - - /** - * Creates an array with requrired details of connection to - * the listbox which visulaize details of connection. This member - * is called at initialization. - */ - virtual void ToArrayDetailsL() = 0; - - /** - * Refresh status of connection - */ - void RefreshConnectionStatus(); - - /** - * Refresh amount of sent and received data of connection - */ - void RefreshSentReceivedDataL(); - - /** - * Refresh the value of transfer speeds (Up/Down) of connection - */ - void RefreshTransferSpeedsL(); - - /** - * Refresh the duration of connection. - */ - void RefreshDuration(); - - /** - * Refresh the applications names which uses the connection - * @return the count of applications use connection - * (from the user point of view) - */ - TInt RefreshAppNamesL(); - - - public: // New functions - - /** - * Creates a string from bearer of connection - * @return string representation of bearer of connection. - */ - HBufC* ToStringBearerLC() const; - - /** - * Creates a string from status of connection - * @param aIsDetailsView is ETrue then get localised resources - * to details view otherwise to connections view - * @return string representation of status of connection. - */ - HBufC* ToStringStatusLC( TBool aIsDetailsView = ETrue ) const; - - /** - * Creates a string from amount of received data - * and sent data combined/summarized. - * @return string representation of summarized of - * Received and Sent data. - */ - HBufC* ToStringTotalTransmittedDataLC() const; - - /** - * Creates a string from amount of Sent data - * @param aToBeThreeDigit the shown digits numbers limited to three - * @return string representation of Sent data. - */ - HBufC* ToStringSentDataLC( TBool aToBeThreeDigit = EFalse ) const; - - /** - * Creates a string from amount of Received data - * @param aToBeThreeDigit the shown digits numbers limited to three - * @return string representation of Received data. - */ - HBufC* ToStringReceivedDataLC( TBool aToBeThreeDigit = EFalse ) const; - - /** - * Creates a string from transfer speed Up of connection - * @return string representation of transfer speed Up of - * connection. - */ - HBufC* ToStringTransferSpeedUpLC() const; - - /** - * Creates a string from transfer speed Down of connection - * @return string representation of transfer speed Down of - * connection. - */ - HBufC* ToStringTransferSpeedDownLC() const; - - /** - * Creates a string from duraion of the connection. - * @return string representation duraion of the connection. - */ - HBufC* ToStringDurationLC() const; - - /** - * Remove directional markers from a string. - * @param aStringHolder the string which markers has to remove. - */ - void StringMarkerRemoval( HBufC* aStringHolder ); - - /** - * Remove directional markers from a string. - * @param aAppIndex the index of Applicaions names array. - * @return string representation of used app. name - */ - HBufC* ToStringAppNameLC( TInt aAppIndex ); - - - private: - /** - * Creates a string from aLoadedData, extended with measure - * @param aLoadedData the data is converted to string - * @param aToBeThreeDigit the shown digits numbers limited to three - * @param aArrowChar the character representation of arrow (Up/Down) - * @return string representation of loaded data - */ - HBufC* ToStringLoadedDataLC( TUint aLoadedData, - TBool aToBeThreeDigit = EFalse, - const TUint aArrowChar = 0 ) const; - - - /** - * Creates a string from transfer speed of connection - * @param aSpeed the speed is converted to string - * @param aArrowChar the character representation of arrow (Up/Down) - * @return string representation of transfer speed of - * connection, extended with measure - */ - HBufC* ToStringTransferSpeedLC( div_t aSpeed, - const TUint aArrowChar ) const; - - /** - * Called if iConnectionStatus is changed to created. Initializes - * changable details of connection. - */ - void InitializeConnectionInfoL(); - - - protected: - - /** - * Used for refreshing details of connection. - */ - RConnectionMonitor* const iConnectionMonitor; - - /** - * The id of connection, given by RConnectionMonitor. - */ - TUint iConnectionId; - - /** - * The name of connection - */ - TName iConnectionName; // IAPName - - /** - * BearerType of connection - */ - TConnMonBearerType iConnectionBearerType; - - /** - * The status of connection - */ - TConnectionStatus iConnectionStatus; - - /** - * The amount of Uploaded data - */ - TUint iUploaded; - - /** - * The amount of Downloaded data - */ - TUint iDownloaded; - - /** - * The start time of connection - */ - TTime iStartTime; - - /** - * The duration of connection - */ - TTime iDuration; - - /** - * Used for calculating speed data - */ - TTime iLastSpeedUpdate; - - /** - * The speed of transferring Uploaded data - */ - div_t iUpSpeed; - - /** - * The speed of transferring Downloaded data - */ - div_t iDownSpeed; - - /** - * The text of list item. - */ - TBuf iListBoxItemText; - - /** - * Descriptor array, contains details of connection. Owned. - */ - CDesCArrayFlat* iDetailsArray; - - /** - * ETrue if deletion of connection started form CMUI, EFalse otherwise - */ - TBool iDeletedFromCMUI; - - /** - * The names of applications use connection.Owned. - */ - CDesCArrayFlat* iAppNames; - - /** - * The active object for info. refreshing. NOT Owned. - */ - CActiveWrapper* iActiveWrapper; - }; - - -#endif //CONNECTIONINFOBASE_H_INCLUDED - -// End of File \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUi.hrh --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUi.hrh Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: resource header file -* -* -*/ - - -#ifndef CONNECTIONMONITORUI_HRH -#define CONNECTIONMONITORUI_HRH - -// Command ID-s for Option menu items -enum TConnectionMonitorUiCommandIds - { - EConnectionMonitorUiCmdAppDetails = 1, - EConnectionMonitorUiCmdAppEndConn, - EConnectionMonitorUiCmdAppEndAll - }; - -// Tab view Id-s -enum TConnectionMonitorUiTabViewId - { - EConnectionMonitorUiMainViewTab = 2, - EConnectionMonitorUiDetailsViewTab - }; - - -#endif // CONNECTIONMONITORUI_HRH diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiApp.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiApp.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CConnectionMonitorUiApp application class -* -* -*/ - - -#ifndef CONNECTIONMONITORUIAPP_H -#define CONNECTIONMONITORUIAPP_H - -// INCLUDES -#include - -// CONSTANTS -// UID of the application -const TUid KUidConnectionMonitorUi = { 0x101F84D0 }; - -const TInt KErrUnknownConnectionState = -50000; -const TInt KErrCorruptedBearerType = -50001; - -/** -* Global panic function -*/ -extern void Panic( TInt aReason ); - -// CLASS DECLARATION - -/** -* CConnectionMonitorUiApp application class. -* Provides factory to create concrete document object. -* -*/ -class CConnectionMonitorUiApp : public CAknApplication - { - public: - - public: // Functions from base classes - - private: - - /** - * From CApaApplication, creates CConnectionMonitorUiDocument - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID - * @return The value of KUidConnectionMonitorUi. - */ - TUid AppDllUid() const; - - }; - -#endif // CONNECTIONMONITORUIAPP_H - -// End of File - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiAppUi.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiAppUi.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application UI class -* -* -*/ - - -#ifndef CONNECTIONMONITORUIAPPUI_H -#define CONNECTIONMONITORUIAPPUI_H - -// INCLUDES -#include -#include -#include - -#include "ConnectionMonitorUiLogger.h" - -// FORWARD DECLARATIONS -class CConnectionMonitorUiContainer; -class CConnectionArray; -class CConnectionInfoBase; - -class CFeatureManagerWrapper; -class CActiveWrapper; - -// CONSTANTS - -/** -* For iPeriodic Timer. The interval between events generated -* after the initial delay, in microseconds. -*/ -LOCAL_D const TInt KTickInterval = 1000000; - - -// CLASS DECLARATION - -/** -* -*/ -class MActiveEventObserverInterface - { - public: - /** - * Called if MConnectionMonitorObserver is raised EventL event. - * @param aConnMonEvent The event information. - * @param aIndex The index of connection in the iConnectionArray. - */ - virtual void OnEventL( const CConnMonEventBase& aConnMonEvent, - const TInt aIndex ) = 0; - - /** - * Called by iPeriodic. It refreshes details of connections. - */ - virtual void OnTimerEventL() = 0; - }; - -/** -* -*/ -class MTimerExpiredObserverInterface - { - public: - /** - * Called by iPeriodic. - */ - virtual void OnTimerExpiredL() = 0; - - /** - * Gives back Timer interval. - */ - virtual TInt GetTickInerval() const = 0; - }; - -/** -* Application UI class. -* Provides support for the following features: -* - EIKON control architecture -* - view architecture -* - status pane -* -*/ -class CConnectionMonitorUiAppUi : public CAknViewAppUi, - public MConnectionMonitorObserver, - public MTimerExpiredObserverInterface - { - public: // Constructors and destructor - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CConnectionMonitorUiAppUi(); - - public: - /** - * Returns pointer to AppUi object. - */ - static CConnectionMonitorUiAppUi* Static(); - - /** - * from MConnectionMonitorObserver - */ - void EventL( const CConnMonEventBase &aConnMonEvent ); - - public: - /** - * Register and start connection monitor engine callback notification, - * and starts periodic timer. - * @param aObserver Observer object - */ - void StartConnEventNotification( - MActiveEventObserverInterface* aObserver ); - - /** - * Stops connection monitor notification and periodic timer - * @param aObserver Observer object - */ - void StopConnEventNotification( - MActiveEventObserverInterface* aObserver ); - - /** - * Starts iPeriodic. - * @param aInterval Refresh interval - */ - void StartTimerL( const TInt aInterval = KTickInterval ); - - /** - * Stops iPeriodic. - */ - void StopTimer(); - - /** - * Timer callback of iPeridoc. - */ - static TInt Tick( TAny* aObject ); - - /** - * called by Tick( TAny* aObject ). - */ - TInt Tick(); - - /** - * Delete and remove a connection from the View - * @param aConnId the id of the currect selected connection - * @param aConnInfo pointer to the current selected connection - */ - void DeleteDetailsView( - TInt aConnId, CConnectionInfoBase* aConnInfo ); - -#ifdef RD_CONTROL_PANEL - - /** - * This function is used for querying whether the application - * is launched in embedded mode or not. - * @return ETrue: The application is launched in embedded mode. - * EFalse: The application is launched in standalone mode. - */ - TBool IsEmbedded() const; - -#endif // RD_CONTROL_PANEL - - protected: - /** - * from CCoeAppUi, for icon skinning - */ - void HandleForegroundEventL( TBool aForeground ); - - private: - /** - * From MEikMenuObserver - */ - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - - /** - * From CEikAppUi, takes care of command handling. - * @param aCommand command to be handled - */ - void HandleCommandL( TInt aCommand ); - - /** - * From CEikAppUi, handles key events. - * @param aKeyEvent Event to handled. - * @param aType Type of the key event. - * @return Response code ( EKeyWasConsumed, EKeyWasNotConsumed ). - */ - virtual TKeyResponse HandleKeyEventL( - const TKeyEvent& aKeyEvent, TEventCode aType ); - - /** - * Called by Tick. - */ - void OnTimerExpiredL( ); - - /** - * Gives back Timer interval. - */ - TInt GetTickInerval() const; - - /** - * Call one after the other RefreshDetails() function of connections - * which are contained by iConnectionArray. - */ - void RefreshAllConnectionsL(); - - /** - * Creates a CConnectionInfBase class, the given connection id. - * The Dynamic type of the returned class depends on the bearer type - * of the connection. - * @params aConnectionId the id of the connection - * @params aBearerType the bearer type of the connection - * @return CConnectionInfBase instance, The Dynamic type of the returned - * class depends on the bearer type of the connection. - */ - CConnectionInfoBase* CreateConnectionInfoL( TUint aConnectionId, TConnMonBearerType aBearerType ); - - /** - * Initialize connection array - */ - void InitializeConnectionArrayL(); - - /** - * Gets the IAP of Easy Wlan access point - */ - void GetEasyWlanIAPNameL(); - - /** - * Shows connection summary note. - * @param aConnection - */ - void ShowConnectionSummaryInformationNoteL( - const CConnectionInfoBase* aConnection ); - private: // Data - - /** - * For refresh details of connections. - */ - RConnectionMonitor iMonitor; - - /** - * Contains CConnectionInfoBase instances, which are represents - * the connections in the system. - */ - CConnectionArray* iConnectionArray; // Owned - - /** - * Timer, to refresh details of connections - */ - CPeriodic* iPeriodic; // Owned - - /** - * Actual observer instance. This observer handles refreshing details - * of connection on the screen. - */ - MActiveEventObserverInterface* iObserver; // Not owned - - /** - * CFeatureManagerWrapper wraps FeatureManager to eliminate maintenance - * of existance of FeatureManager. - * Owned. - */ - CFeatureManagerWrapper* iFeatureManagerWrapper; - - /** - * The active object for info. refreshing. Owned. - */ - CActiveWrapper* iActiveWrapper; - - /** - * the name of Easy Wlan access point it there is, otherwise NULL - */ - HBufC* iEasyWlanIAPName; - - /** - * A pointer to actual timer observer instance - */ - MTimerExpiredObserverInterface* iTimerObserver; - - /** - * Should the Main View be activeted during HandleForegroundEventL() method - */ - TBool activateMainView; - - /** - * An array to hold the connectionIds in situations when creating - * connectionInfo object fails - */ - RArray iNewConnectionIdArray; - - /** - * Connections waiting for first event - */ - RArray iConnectionsWaitingFirstEvent; - }; - -#endif // CONNECTIONMONITORUIAPPUI_H - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiContainer.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiContainer.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: container control class -* -* -*/ - - -#ifndef CONNECTIONMONITORUICONTAINER_H -#define CONNECTIONMONITORUICONTAINER_H - -// INCLUDES -#include -#include "ConnectionMonitorUiAppUi.h" - -// FORWARD DECLARATIONS -class CConnectionArray; -class RConnectionMonitor; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; -class CActiveWrapper; - -// CLASS DECLARATION -/** -* CConnectionMonitorUiContainer container control class. -*/ -class CConnectionMonitorUiContainer : public CCoeControl, - public MActiveEventObserverInterface - { - public: // Constructors and destructor - /** - * Constructor - * @param aConnectionArray array contains connection infos - * @param aMonitor to handlin connection details - * @param aActiveWrapper the for refreshing - */ - CConnectionMonitorUiContainer( - CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase constructor. - * @param aSelectedItem index of selected item in the list - * @param aRect Frame rectangle for container. - */ - void ConstructL( TInt aSelectedItem, const TRect& aRect ); - - /** - * Destructor. - */ - ~CConnectionMonitorUiContainer(); - - public: // Functions from base classes - - /** - * From CCoeControl, gets the control's help context. - * @param aContext help context. - */ - virtual void GetHelpContext( TCoeHelpContext& aContext ) const; - - /** - * From CoeControl OfferKeyEventL. - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * From CoeControl,CountComponentControls. - */ - TInt CountComponentControls() const; - - /** - * From CCoeControl, ComponentControl. - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * From CCoeControl - */ - void HandleResourceChange( TInt aType ) ; - - public: - /** - * from MActiveEventObserverInterface - */ - void OnEventL( const CConnMonEventBase& aConnMonEvent, - const TInt aIndex ); - /** - * from MActiveEventObserverInterface - */ - void OnTimerEventL(); - - /** - * Returns the item index of selected connection - * @return index of selected connection - */ - TInt SelectedConnection(); - - /** - * Close the selected connection. - */ - void EndConnectionL(); - - /** - * Close all connection - */ - void EndAllConnectionL(); - - /** - * Returns pointer to the listbox. - * @return pointer to the listbox. - */ - CAknDoubleGraphicStyleListBox* ListBox() const; - - /** - * Refresh the content of Navi pane and - * Push it to stack. Called by View DoActivateL() - */ - void PushAndRefreshNaviPaneL(); - - /** - * Pop and destroy the NaviPane from stack. - * Called by View DoDeactivateL() - */ - void PopNaviPane(); - - /** - * Called by HandleForegroundEventL, draw all item of list box. - */ - void DrawFirstAllListBoxItem(); - - protected: - /** - * From CoeControl,SizeChanged. - */ - void SizeChanged(); - - /** - * From CoeControl,SizeChanged. - */ - virtual void FocusChanged(TDrawNow aDrawNow); - - protected: // New functions - /** - * Sets the icons of listbox - */ - void SetIconsL(); - - /** - * Gets the title panes. - */ - void GetPanesL(); - - protected: // data - /** - * List box contains connection items - */ - CAknDoubleGraphicStyleListBox* iListBox; - - /** - * To handling details of connections - */ - RConnectionMonitor* iMonitor; - - /** - * Contins connections info - */ - CConnectionArray* const iConnectionArray; - - /** - * Owned. For NaviPane. - */ - CAknNavigationDecorator* iNaviDecorator; - - /** - * Not Owned. For NaviPane. - */ - CAknNavigationControlContainer* iNaviPane; - - private: // data - - /** - * ETrue if Wlan connection is supported, EFalse otherwise. - */ - TBool isWlanSupported; - - /** - * The active object for info. refreshing. NOT Owned. - */ - CActiveWrapper* iActiveWrapper; - }; - -#endif // CONNECTIONMONITORUICONTAINER_H - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsContainer.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsContainer.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,201 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: container control class -* -* -*/ - -#ifndef CONNECTIONMONITORUIDETAILSCONTAINER_H -#define CONNECTIONMONITORUIDETAILSCONTAINER_H - -// INCLUDES -#include -#include "ConnectionMonitorUiAppUi.h" - -// FORWARD DECLARATIONS -class CConnectionArray; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; -class CConnectionMonitorUiDetailsView; - -// CLASS DECLARATION -/** -* CConnectionMonitorUiDetailsContainer container control class. -*/ -class CConnectionMonitorUiDetailsContainer : - public CCoeControl, - public MActiveEventObserverInterface, - public MAknNaviDecoratorObserver - { - public: // Constructors and destructor - /** - * Constructor - * @param aConnectionArray array containing connection list - */ - CConnectionMonitorUiDetailsContainer( - const CConnectionArray* const aConnectionArray ); - - /** - * EPOC second-phase constructor. - * @param aRect Frame rectangle for container. - * @param aParentView ParentView of the container - */ - void ConstructL( const TRect& aRect, - CConnectionMonitorUiDetailsView* aParentView ); - - /** - * Destructor. - */ - ~CConnectionMonitorUiDetailsContainer(); - - public: // New functions - /** - * Sets iConnectionInfo and iConnectionId to the selected - * connection - * @param aConnectionIndex the index of selected connection - */ - void SetSelectedConnectionL( TUint aConnectionIndex ); - - /** - * Returns pointer to the listbox. - * @return pointer to the listbox. - */ - CAknSingleHeadingStyleListBox* ListBox() const; - - /** - * Refresh the content of Navi pane and - * Push it to stack. Called by View DoActivateL() - */ - void PushAndRefreshNaviPaneL(); - - /** - * Pop the NaviPane from stack. Called by View DoDeactivateL() - */ - void PopNaviPane(); - - - public: - /** - * Handler for pointer events, when the Navi Pane arrows have been tapped (from MAknNaviDecoratorObserver) - * - * @param aEventID The enum indicating wether right or left arrow was tapped - */ - void HandleNaviDecoratorEventL( TInt aEventID ); - - /** - * from MActiveEventObserverInterface - */ - virtual void OnEventL( const CConnMonEventBase& aConnMonEvent, - const TInt aIndex ); - - /** - * from MActiveEventObserverInterface - */ - void OnTimerEventL(); - - /** - * From CCoeControl - */ - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - - /** - * Called by HandleForegroundEventL, draw all item of list box. - */ - void DrawFirstAllListBoxItem(); - - /** - * From CCoeControl,ComponentControl. - */ - CCoeControl* ComponentControl( TInt aIndex ) const; - - /** - * From CCoeControl, used for sclable ui and landscape support. - */ - void HandleResourceChange( TInt aType ); - - /** - * Gets index of the selected item - * @return the index of selected item - */ - TInt GetIndexOfSelectedItem(); - - /** - * Gets iConnectionInfo of the selected connection - * @return CConnectionInfoBase* pointer to the connection info object - */ - CConnectionInfoBase* GetSelectedConnectionInfo() const; - - protected: - /** - * Gets the title panes. - */ - void GetPanesL(); - - private: // Functions from base classes - /** - * From CoeControl,SizeChanged. - */ - void SizeChanged(); - - /** - * From CoeControl,CountComponentControls. - */ - TInt CountComponentControls() const; - - /** - * From CoeControl,SizeChanged. - */ - virtual void FocusChanged(TDrawNow aDrawNow); - - protected: // data - /** - * Listbox contains details a connection - */ - CAknSingleHeadingStyleListBox* iListBox; - - /** - * Refers to the current selected connection - */ - CConnectionInfoBase* iConnectionInfo; // Not Owned. - - /** - * The index of selected connection - */ - TUint iConnectionIndex; - - /** - * A pointer to connections array - */ - const CConnectionArray* const iConnectionArray; // Not Owned. - - /** - * Owned. For NaviPane. - */ - CAknNavigationDecorator* iNaviDecorator; - - /** - * Not Owned. For NaviPane. - */ - CAknNavigationControlContainer* iNaviPane; - - /** - * Not Owned. A pointer to DetailsView - */ - CConnectionMonitorUiDetailsView* iParentView; // Not Owned. - }; - -#endif - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsView.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDetailsView.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: view class -* -* -*/ - - -#ifndef CONNECTIONMONITORUIDETAILSVIEW_H -#define CONNECTIONMONITORUIDETAILSVIEW_H - -// INCLUDES -#include -#include - -// CONSTANTS - -/** -* UID of view -*/ -const TUid KDetailsViewId = {3}; - -// FORWARD DECLARATIONS -class CConnectionMonitorUiDetailsContainer; -class CConnectionInfo; -class CConnectionInfoBase; -class CConnectionArray; - -// CLASS DECLARATION -/** -* CConnectionMonitorUiDetailsView view class. -*/ -class CConnectionMonitorUiDetailsView : public CAknView, - public MEikListBoxObserver - { - public: // Constructors and destructor - /** - * Constructor - * @param aConnectionArray array containing connection list - */ - CConnectionMonitorUiDetailsView( - CConnectionArray* const aConnectionArray ); - - /** - * EPOC second phase constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CConnectionMonitorUiDetailsView(); - - public: // Functions from base classes - /** - * From CAknView - */ - TUid Id() const; - - /** - * From CAknView - */ - void HandleCommandL( TInt aCommand ); - - public: // New functions - /** - * Call SetSelectedConnection function of iContrainer - * @param aIndex index of connection in the connection array - */ - void SetSelectedConnection( TUint aIndex ); - - /** - * Returns index of selected connection - * @return index of selected connection in the connection array - */ - TUint GetSelectedConnection(); - - /** - * Returns ETrue if the refreshing stopped for the View - * @return the staus of View refreshing - */ - TBool GetViewRefreshState(); - - /** - * Set the View the refreshing status. Stopped or not - * @param aViewRefreshState staus of View refreshing - */ - void SetViewRefreshState( TBool aViewRefreshState ); - - /** - * Closes the Details View. - */ - void CloseViewL(); - - /** - * Activate the Main View - */ - void ActivateMainViewL(); - - protected: - /** - * From AknView - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From AknView - */ - void DoDeactivate(); - - /** - * From MEikListBoxObserver - */ - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - - private: // Data - /** - * Container of View - */ - CConnectionMonitorUiDetailsContainer* iContainer; - - /** - * Array contains connections - */ - CConnectionArray* const iConnectionArray; // Not Owned. - - /** - * The index of selected connection - */ - TUint iConnectionId; - - /** - * Staus of View refreshing. If the refreshing stopped its ETrue - */ - TBool iViewRefreshState; - }; - -#endif // CONNECTIONMONITORUIDETAILSVIEW_H - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDocument.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiDocument.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: application class -* -* -*/ - - -#ifndef CONNECTIONMONITORUIDOCUMENT_H -#define CONNECTIONMONITORUIDOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; - -// CLASS DECLARATION - -/** -* CConnectionMonitorUiDocument application class. -*/ -class CConnectionMonitorUiDocument : public CAknDocument - { - public: // Constructors and destructor - /** - * Two-phased constructor. - * @param aApp Eikon Application - */ - static CConnectionMonitorUiDocument* NewL(CEikApplication& aApp); - - /** - * Destructor. - */ - virtual ~CConnectionMonitorUiDocument(); - - public: // New functions - - private: - - /** - * EPOC default constructor. - * @param aApp Eikon Application - */ - CConnectionMonitorUiDocument(CEikApplication& aApp); - void ConstructL(); - - private: - - /** - * From CEikDocument, create CConnectionMonitorUiAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - }; - -#endif // CONNECTIONMONITORUIDOCUMENT_H - -// End of File - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiLogger.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiLogger.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Logging support for R&D purposes -* -* -*/ - - -#ifndef CONNECTIONMONITORUILOGGER_H_INCLUDED -#define CONNECTIONMONITORUILOGGER_H_INCLUDED - -// ========== INCLUDE FILES ================================ - -#include -#include - -// ========== CONSTANTS ==================================== - -#ifdef _DEBUG - -_LIT( KCMUILogDir, "CMUI"); -_LIT( KCMUILogFile, "CMUI.txt"); -_LIT(KCMUILogBanner, "CMUI 0.1.0"); -_LIT(KCMUILogEnterFn, "CMUI: -> %S"); -_LIT(KCMUILogLeaveFn, "CMUI: <- %S"); -_LIT(KCMUILogExit, "CMUI: Application exit"); -_LIT( KCMUILogTimeFormatString, "%H:%T:%S:%*C2"); - -// ========== MACROS ======================================= - -#define CMUILOGGER_CREATE {FCreate();} -#define CMUILOGGER_DELETE {RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogExit);} -#define CMUILOGGER_ENTERFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogEnterFn, &temp);} -#define CMUILOGGER_LEAVEFN(a) {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, KCMUILogLeaveFn, &temp);} -#define CMUILOGGER_WRITE(a) {_LIT(temp, a); RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, temp);} -#define CMUILOGGER_WRITE_F(a, b) {_LIT(temp, a); RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, temp, b);} -#define CMUILOGGER_WRITE_TIMESTAMP(a) {_LIT(temp, a); TTime time; time.HomeTime(); TBuf<256> buffer; time.FormatL( buffer, KCMUILogTimeFormatString ); buffer.Insert(0, temp); RFileLogger::Write(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, buffer); } -#define CMUILOGGER_WRITEF FPrint - - -inline void FPrint(const TRefByValue aFmt, ...) - { - VA_LIST list; - VA_START(list,aFmt); - RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, aFmt, list); - } - -inline void FPrint(const TDesC& aDes) - { - RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, aDes); - } - -inline void FHex(const TUint8* aPtr, TInt aLen) - { - RFileLogger::HexDump(KCMUILogDir, KCMUILogFile, EFileLoggingModeAppend, 0, 0, aPtr, aLen); - } - -inline void FHex(const TDesC8& aDes) - { - FHex(aDes.Ptr(), aDes.Length()); - } - -inline void FCreate() - { - TFileName path(_L("c:\\logs\\")); - path.Append(KCMUILogDir); - path.Append(_L("\\")); - RFs& fs = CEikonEnv::Static()->FsSession(); - fs.MkDirAll(path); - RFileLogger::WriteFormat(KCMUILogDir, KCMUILogFile, EFileLoggingModeOverwrite, KCMUILogBanner); - } - -#else // ! _DEBUG - -inline void FPrint(const TRefByValue /*aFmt*/, ...) { }; - -#define CMUILOGGER_CREATE -#define CMUILOGGER_DELETE -#define CMUILOGGER_ENTERFN(a) -#define CMUILOGGER_LEAVEFN(a) -#define CMUILOGGER_WRITE(a) -#define CMUILOGGER_WRITE_F(a, b) -#define CMUILOGGER_WRITEF 1 ? ((void)0) : FPrint -#define CMUILOGGER_WRITE_TIMESTAMP(a) - -#endif // _DEBUG - -// ========== DATA TYPES =================================== - -// ========== FUNCTION PROTOTYPES ========================== - -// ========== FORWARD DECLARATIONS ========================= - -// ========== CLASS DECLARATION ============================ - -#endif // CONNECTIONMONITORUILOGGER_H_INCLUDED \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiView.h --- a/connectionmonitoring/connectionmonitorui/inc/ConnectionMonitorUiView.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: view class -* -* -*/ - - -#ifndef CONNECTIONMONITORUI_VIEW_H -#define CONNECTIONMONITORUI_VIEW_H - -// INCLUDES -#include -#include - -// CONSTANTS - -// UID of view -const TUid KConnectionsViewId = {2}; - -// FORWARD DECLARATIONS -class CConnectionMonitorUiContainer; -class CConnectionArray; -class CActiveWrapper; - -// CLASS DECLARATION -/** -* CConnectionMonitorUiView view class. -*/ -class CConnectionMonitorUiView : public CAknView, public MEikListBoxObserver - { - public: // Constructors and destructor - /** - * Constructor - * @param aConnectionArray array contains connection infos - * @param aMonitor Connection Monitor engine session - * @param aActiveWrapper the for refreshing - */ -#ifdef RD_CONTROL_PANEL - CConnectionMonitorUiView( CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - TBool aIsEmbedded, - CActiveWrapper* aActiveWrapper ); -#else - CConnectionMonitorUiView( CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - CActiveWrapper* aActiveWrapper ); -#endif // RD_CONTROL_PANEL - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CConnectionMonitorUiView(); - - public: // Functions from base classes - /** - * From AknView - */ - TUid Id() const; - - /** - * From AknView - */ - void HandleCommandL( TInt aCommand ); - - /** - * From MEikMenuObserver - * Dynamic handling of menus. - */ - virtual void DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ); - - /** - * Observe the connection stat and set the right Soft Keys. - */ - void ConnectionKeyObserver() const; - - protected: - /** - * from MEikListBoxObserver - */ - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); - - protected: - /** - * From AknView - */ - void DoActivateL( const TVwsViewId& aPrevViewId, - TUid aCustomMessageId, - const TDesC8& aCustomMessage ); - - /** - * From AknView - */ - void DoDeactivate(); - - /** - * Sets the tile pane to the given resource. - * @param aResourceId the id of resource string - */ - void SetTitlePaneTextL( TInt aResourceId ); - - private: - /** - * Brings up details view. - */ - void BringupDetailsViewL(); - - /** - * Check if selecred connection is Alilve or not - * @return if the selected connection is alive ETrue, oterwise EFalse - */ - TBool IsSelectedConnectionAlive() const; - - /** - * Check if selecred connection is Suspended or not - * @return if the selected connection is alive ETrue, oterwise EFalse - */ - TBool IsSelectedConnectionSuspended() const; - - private: // Data - /** - * Continer instance of view. - */ - CConnectionMonitorUiContainer* iContainer; // Owned - - /** - * Constant pointe to array of connections. - */ - CConnectionArray* const iConnectionArray; // Not Owned - - /** - * Pointer to RConnectionMonitor for deleting connection(s). - */ - RConnectionMonitor* iMonitor; // Not Owned - - /** - * ETrue if Help is supported, EFalse otherwise. - */ - TBool isHelpSupported; - -#ifdef RD_CONTROL_PANEL - - /** - * ETrue: The application is launched in embedded mode. - * EFalse: The application is launched in standalone mode. - */ - TBool iIsEmbedded; - -#endif // RD_CONTROL_PANEL - - /** - * The active object for info. refreshing. NOT Owned. - */ - CActiveWrapper* iActiveWrapper; - }; - -#endif // CONNECTIONMONITORUI_VIEW_H - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/CsdConnectionInfo.h --- a/connectionmonitoring/connectionmonitorui/inc/CsdConnectionInfo.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a connection -* -* -*/ - - -#ifndef CSDCONNECTIONINFO_H_INCLUDED -#define CSDCONNECTIONINFO_H_INCLUDED - -// INCLUDES -#include -#include -#include "ConnectionInfoBase.h" - -// CONSTANTS - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* Represents a connection. -*/ -class CCsdConnectionInfo : public CConnectionInfoBase - { - public: - /** - * Static constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - static CCsdConnectionInfo* NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Destructor - */ - virtual ~CCsdConnectionInfo(); - public: - - /** - * Give back a copy of connection. - */ - virtual CConnectionInfoBase* DeepCopyL(); - - /** - * Refresh required details of connection. - */ - virtual void RefreshDetailsL(); - - /** - * Refresh iListBoxItemText text, connection ListBox has a reference to - * this text. - */ - virtual void RefreshConnectionListBoxItemTextL(); - - /** - * Refresh details array of connection. DetailsListBox has a reference - * to this array. - */ - virtual void RefreshDetailsArrayL(); - - /** - * Gives back the icon id of connection type - * @return the icon id of connection type - */ - virtual TUint GetIconId() const; - - protected: - /** - * Constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - CCsdConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase construction - */ - void ConstructL(); - - protected: - /** - * Creates an array with requrired details of connection to - * the listbox which visulaize details of connection. This member - * is called at initialization. - */ - virtual void ToArrayDetailsL(); - - /** - * Creates a string from dialup number of the connection. - * @return string representation count of sharigs of the connection. - */ - HBufC* ToStringDialupNumberLC() const; - - private: - - protected: // Data members - - TBuf iDialupNumber; ///< DialupNumber of connection - - }; - - -#endif // CSDCONNECTIONINFO_H_INCLUDED - -// Enf of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/EasyWLANConnectionInfo.h --- a/connectionmonitoring/connectionmonitorui/inc/EasyWLANConnectionInfo.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a WLAN connection -* -* -*/ - - -#ifndef EASYWLANCONNECTIONINFO_H_INCLUDED -#define EASYWLANCONNECTIONINFO_H_INCLUDED - -// INCLUDES -#include "WlanConnectionInfo.h" - -// CONSTANTS - -// FORWARD DECLARATIONS -class RConnectionMonitor; - -// CLASS DECLARATION -/** -* Represents a WLAN connection. -*/ -class CEasyWlanConnectionInfo : public CWlanConnectionInfo - { - public: - /** - * Static constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - static CEasyWlanConnectionInfo* NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Destructor - */ - virtual ~CEasyWlanConnectionInfo(); - - public: - /** - * Give back a copy of connection. - */ - virtual CConnectionInfoBase* DeepCopyL(); - - /** - * Refresh iListBoxItemText text, connection ListBox has a - * reference to this text. - */ - virtual void RefreshConnectionListBoxItemTextL(); - - /** - * Refresh details array of connection. - * DetailsListBox has a reference to this array. - */ - virtual void RefreshDetailsArrayL(); - - protected: // Constructors - /** - * Constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - CEasyWlanConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase construction - */ - void ConstructL(); - - protected: - /** - * Creates an array with requrired details of connection to - * the listbox which visulaize details of connection. This member - * is called at initialization. - */ - virtual void ToArrayDetailsL(); - - }; - -#endif // EASYWLANCONNECTIONINFO_H_INCLUDED -//End of File. \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/FeatureManagerWrapper.h --- a/connectionmonitoring/connectionmonitorui/inc/FeatureManagerWrapper.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of class CFeatureManagerWrapper. -* -*/ - - -#ifndef FEATURE_MANAGER_WRAPPER_H -#define FEATURE_MANAGER_WRAPPER_H - -// INCLUDE FILES -#include //CBase -#include - -// CLASS DECLARATION - -/** -* CFeatureManagerWrapper wraps FeatureManager to ease its usage -*/ -class CFeatureManagerWrapper : public CBase - { - - public: - - /** - * Destructor. Uninitalize FeatureManager. - */ - virtual ~CFeatureManagerWrapper(); - - /** - * Static constructor. - */ - static CFeatureManagerWrapper* NewL(); - - protected: - - /** - * Default constructor. - */ - CFeatureManagerWrapper(); - - /** - * Second-phase constructor. Initialize FeatureManager - */ - void ConstructL(); - - private: - - /** - * Indicates Featuremanger is initialized or not. - */ - TBool iIsFeatureMgrInitialized; - - }; - -#endif - -// End of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/GprsConnectionInfo.h --- a/connectionmonitoring/connectionmonitorui/inc/GprsConnectionInfo.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a connection -* -* -*/ - - -#ifndef GPRSCONNECTIONINFO_H_INCLUDED -#define GPRSCONNECTIONINFO_H_INCLUDED - -// INCLUDES -#include -#include -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include -#endif -#include "ConnectionInfoBase.h" - -// CONSTANTS - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* Represents a connection. -*/ -class CGprsConnectionInfo : public CConnectionInfoBase - { - public: - /** - * Static constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - static CGprsConnectionInfo* NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Destructor - */ - virtual ~CGprsConnectionInfo(); - public: - /** - * Give back a copy of connection. - */ - virtual CConnectionInfoBase* DeepCopyL(); - - /** - * Refresh required details of connection. - */ - virtual void RefreshDetailsL(); - - /** - * Refresh iListBoxItemText text, connection ListBox has a reference to - * this text. - */ - virtual void RefreshConnectionListBoxItemTextL(); - - /** - * Refresh details array of connection. DetailsListBox has a reference - * to this array. - */ - virtual void RefreshDetailsArrayL(); - - /** - * Gives back the icon id of connection type - * @return the icon id of connection type - */ - virtual TUint GetIconId() const; - - protected: - /** - * Constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - CGprsConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase construction - */ - void ConstructL(); - - protected: - /** - * Creates an array with requrired details of connection to - * the listbox which visulaize details of connection. This member - * is called at initialization. - */ - virtual void ToArrayDetailsL(); - - /** - * Creates a string from Access Point name of the connection. - * @return string representation count of Access Point name of - * the connection. - */ - HBufC* ToStringApNameLC() const; - - private: - - protected: // Data members - - TBuf iApName; ///< Used AccessPoint name - - }; - - -#endif // GPRSCONNECTIONINFO_H_INCLUDED - -// Enf of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/inc/WlanConnectionInfo.h --- a/connectionmonitoring/connectionmonitorui/inc/WlanConnectionInfo.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,272 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a WLAN connection -* -* -*/ - - -#ifndef WLANCONNECTIONINFO_H_INCLUDED -#define WLANCONNECTIONINFO_H_INCLUDED - -// INCLUDES -#include "ConnectionInfoBase.h" - -// CONSTANTS - -// FORWARD DECLARATIONS -class RConnectionMonitor; - -// Calibration of WLAN signal strength -enum TWlanSignalStrength - { - EWlanSignalStrengthMax = 60, - EWlanSignalStrengthGood = 74, - EWlanSignalStrengthLow = 87, - EWlanSignalStrengthMin = 100, - EWlanSignalUnavailable = 9999 - }; - -// WLAN Network modes -enum TWlanNetworkMode - { - EWlanNetworkModeInfrastructure = 0, - EWlanNetworkModeAdHoc, - EWlanNetworkModeSecInfrastructure, - EWlanNetworkModeUnavailable - }; - -// WLAN security modes -enum TWlanSecurityMode - { - EWlanSecurityModeOpenNetwork = 0, - EWlanSecurityModeWEP, - EWlanSecurityMode8021x, - EWlanSecurityModeWPA, - EWlanSecurityWpaPsk, - EWlanSecurityModeUnavailable - }; - -// CONSTANTS - -const TReal32 KDiffOfWlanSignalStrength = - EWlanSignalStrengthMin - EWlanSignalStrengthMax; - - -// CLASS DECLARATION -/** -* Represents a WLAN connection. -*/ -class CWlanConnectionInfo : public CConnectionInfoBase - { - public: - /** - * Static constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aEasyWlanIAPName Name of the Easy WLAN access point - * @param aActiveWrapper the for refreshing - */ - static CWlanConnectionInfo* NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - const HBufC* aEasyWlanIAPName, - CActiveWrapper* aActiveWrapper ); - - /** - * Destructor - */ - virtual ~CWlanConnectionInfo(); - - public: - /** - * Give back a copy of connection. - */ - virtual CConnectionInfoBase* DeepCopyL(); - - /** - * Refreshing all details of connection. Leaves if refreshing - * any of detais is failed. - */ - virtual void RefreshDetailsL(); - - /** - * Refresh iListBoxItemText text, connection ListBox has a - * reference to this text. - */ - virtual void RefreshConnectionListBoxItemTextL(); - - /** - * Refresh details array of connection. DetailsListBox has a - * reference to this array. - */ - virtual void RefreshDetailsArrayL(); - - /** - * Gives back the icon id of connection - * @return the icon id of connection - */ - virtual TUint GetIconId() const; - - /** - * Gives back the connection is EasyWLAN or not. - * @return ETrue if the selected conenction EasyWLAN, - * EFalse otherwise - */ - virtual TBool IsEasyWLAN() const; - - /** - * Gives back current Name of Network ( SSID ) - * @return iNetworkName - */ - virtual HBufC* GetWlanNetworkNameLC() const; - - /** - * Gives back current SignalStrength - * @return iSignalStrength - */ - TWlanSignalStrength GetWlanSignalStrength() const; - - /** - * Gives back current NetworkMode - * @return iNetworkMode - */ - TWlanNetworkMode GetWlanNetworkMode() const; - - /** - * Gives back current SecurityMode - * @return iSecurityMode - */ - TWlanSecurityMode GetWlanSecurityMode() const; - - /** - * Gives back current TxPower - * @return iTxPower - */ - TUint GetWlanTxPower() const; - - protected: // Constructors - /** - * Constructor - * @param aConnectionId The id of the given connection. - * @param aMonitor for refreshing details - * @param aConnectionBearerType the bearer type of connection - * @param aActiveWrapper the for refreshing - */ - CWlanConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ); - - /** - * Second phase construction - */ - void ConstructL(); - - protected: - /** - * Creates an array with requrired details of connection to - * the listbox which visulaize details of connection. This member - * is called at initialization. - */ - virtual void ToArrayDetailsL(); - - /** - * Refreshing NetworkName. Leaves if did not get valid data from - * ConnectionMonitor. - */ - void RefreshNetworkNameL(); - - /** - * Refreshing SignalStrength. Leaves if did not get valid data from - * ConnectionMonitor. - */ - void RefreshSignalStrength(); - - /** - * Refreshing NetworkMode. Leaves if did not get valid data from - * ConnectionMonitor. - */ - void RefreshNetworkMode(); - - /** - * Refreshing SecurityMode. Leaves if did not get valid data from - * ConnectionMonitor. - */ - void RefreshSecurityMode(); - - /** - * Refreshing TxPower. Leaves if did not get valid data from - * ConnectionMonitor. - */ - void RefreshTxPowerL(); - - /** - * Gives back the string representation of SignalStrength. - */ - HBufC* ToStringSignalStrengthLC() const; - - /** - * Gives back the string representation of Mode. - */ - HBufC* ToStringNetworkModeLC() const; - - /** - * Gives back the string representation of Security. - */ - HBufC* ToStringSecurityModeLC() const; - - /** - * Gives back the string representation of TxPower. - */ - HBufC* ToStringTxPowerLC() const; - - private: - - protected: - - /** - * The name of network (SSID) - */ - TName iWlanNetworkName; - - /** - * Signale strength of WLAN connection - */ - TWlanSignalStrength iSignalStrength; - - /** - * Network mode of WLAN conenction - */ - TWlanNetworkMode iNetworkMode; - - /** - * Security mode of WLAN conenction - */ - TWlanSecurityMode iSecurityMode; - - /** - * TxPower of WLAN conenction - */ - TUint iTxPower; - - /** - * ETrue if the selected conenction EasyWLAN - */ - TBool iEasyWlan; - }; - -#endif // WLANCONNECTIONINFO_H_INCLUDED -//End of File. \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/loc/connectionmonitorui.loc --- a/connectionmonitoring/connectionmonitorui/loc/connectionmonitorui.loc Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,762 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localization texts for ConnectionMonitorUi -* -* -*/ - - - -// LOCALISATION STRINGS -//d:Title pane text in main view -//l:title_pane_t2/opt9 -//w: -//r:1.0 -// - -#define qtn_cmon_title "Conn. Manager" - -//d:No active connection in main view -//l:main_list_empty_pane -//w: -//r:1.0 -// - -#define qtn_cmon_no_active_connections "(no active connections)" - -//d:Title pane text in main view. -//l:navi_navi_text_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_navi_one_active_conn "1 active connection" - -//d:Title pane text in main view. -//l:navi_navi_text_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_navi_many_active_conns "%N active connections" - -//d:downloaded / uploaded data amounts with two decimal -//d:digits (for GPRS connections) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_ul_dl_data_amounts "%0U / %1U" - -//d:duration of the connection over 24h (for CSD and HSCSD connections) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_duration_over_24h "%0Ud %1U" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_creating "Creating connection" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_idle "Idle" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_active "Active" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_suspended "On hold" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_closing "Closing connection" - -//d:Connection status (main view) -//l:list_double_graphic_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_status_closed "Closed" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_creating "Creating connection" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_idle "Idle" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_active "Active" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_suspended "On hold" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_closing "Closing connection" - -//d:Connection status (details view) -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_status_details_closed "Closed" - -//d:The navi pane displays the “serial number” (%1N) of the -//d:connection in question and the total amount of the -//d:connections. -//l:navi_navi_text_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_navi_nof_connection "%0N/%1N" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_conn_name "Name" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_bearer "Bearer" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_status "Status" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_data_received "Received" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_data_sent "Sent" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_duration "Duration" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_speed "Speed" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_csd_number "Dial-up no." - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_gprs_apn "APN" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:1.0 -// - -#define qtn_cmon_heading_sharing_info "Sharing" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_set_bearer_data_call "Data call" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_set_bearer_packet_data "Packet data" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_bearer_hscsd "High speed GSM" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_log_gprs_amount_b "%U B" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_log_gprs_amount_kb "%U kB" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_log_gprs_amount_mb "%U MB" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_log_gprs_amount_gb "%U GB" - -//d: -//l:list_double_number_pane_t3 -//w: -//r:1.0 -// - -#define qtn_cmon_data_transf_rate_dl "%U kB/s" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_sharing_information "Between %N instances" - -//d:Confirmation query to close selected connection -//l:popup_note_window -//w: -//r:1.0 -// - -#define qtn_cmon_conf_end_single_conn "End connection ’%U’?" - -//d:Confirmation query to close all connections -//l:popup_note_window -//w: -//r:1.0 -// - -#define qtn_cmon_conf_end_all_conns "%N connections active. End all connections?" - -//d:Main view menu item -//l:list_single_pane_t1_cp2 -//w: -//r:1.0 -// - -#define qtn_cmon_list_options_details "Details" - -//d:Main view menu item -//l:list_single_pane_t1_cp2 -//w: -//r:1.0 -// - -#define qtn_cmon_list_options_end_conn "End connection" - -//d:Main view menu item -//l:list_single_pane_t1_cp2 -//w: -//r:1.0 -// - -#define qtn_cmon_list_options_end_all "End all connections" - -//d:Application name -//l:list_single_large_graphic_pane_t1 -//w: -//r:1.0 -// - -#define qtn_apps_cmon_list "Conn. manager" - -//d:Application name -//l:cell_app_pane_t1 -//w: -//r:1.0 -// - -#define qtn_apps_cmon_grid "Conn. manager" - -//d:Transferred KBytes -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_data_transf_rate_ul "%U kB/s" - -//d: -//l:list_single_heading_pane_t1 -//w: -//r:1.0 -// - -#define qtn_cmon_item_conn_name_modem "Modem connection" - -//d:Confirmation query to close modem connection -//l:popup_note_window -//w: -//r:1.0 -// - -#define qtn_cmon_conf_end_modem_conn "End modem connection?" - -//d:when user rejects the query, an information note -//l:popup_note_window -//w: -//r:1.0 -// - -#define qtn_cmon_info_conn_already_end "Connection was already closed." - -//d:Connection Manager’s Active connections main view -//l:list_double2_large_graphic_pane -//w: -//r:3.0 -// -#define qtn_cmon_active_data_connections "Active data connections" - -//d:Connection Manager’s Available WLAN networks main view -//l:list_double2_large_graphic_pane -//w: -//r:3.0 -// -#define qtn_cmon_available_wlan_networks "Available WLAN networks" - -//d: WLAN network mode value text,mode, terminal is connected to another terminal or multiple -//d:terminals (point-to-multipoint) without utilising any physical access points. -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_newtwork_mode_adhoc "Ad-hoc" - -//d: WLAN network mode value text, the terminal is connected over WLAN to a physical WLAN access point. -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_newtwork_mode_infra "Infrastructure" - - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_security_mode_wep "WEP" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_security_mode_802_1x "802.1x" - -//d: WLAN network security mode value text, this is the abbrevation of a kind of security mode -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_security_mode_wpa "WPA/WPA2" - -//d:Title of Active connections main view -//l:title_pane_t2/opt9 -//w: -//r:3.0 -// -#define qtn_cmon_title_active_conns "Active data connections" - -//d: Title of Available WLAN networks main view -//l:title_pane_t2/opt9 -//w: -//r:3.0 -// -#define qtn_cmon_title_available_wlan "Available WLAN networks" - -//d: WLAN network bearer type value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_wlan_sett_bearer_wlan "Wireless LAN" - -//d: WLAN network security mode value text -//l:list_single_heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_wlan_security_mode_open "Open network" - -//d: WLAN network name (SSID) detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_network_name "Network" - -//d: WLAN network signal strength detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_signal_strength "Signal" - -//d: WLAN network mode detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_network_mode "Mode" - -//d:WLAN network Security mode used by the WLAN network detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_security_mode "Security" - -//d:WLAN network Current transmit (TX) power level detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_tx_power "TX power" - -//d:WLAN network Amount of physical WLAN access points detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_nw_ap_amount "Coverage" - -//d:WLAN network Maximum data rate detail of the network -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_wlan_nw_max_rate "Max. rate" - -//d:WLAN network Amount of physical WLAN access points (AP) in range, if a single AP is in range -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_ap_amount_in_range "1 access point" - -//d:WLAN network Amount of physical WLAN access points (AP) in range, if multiple APs in range (%N is the amount) -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_ap_amount_in_range_many "%N access points" - -//d:WLAN network Current transmit (TX) power level in milliwatts (mW -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_tx_power_level "%N mW" - -//d:WLAN network Maximum data rate in network (of best AP in range) -//d:in megabits per secondin -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_max_data_rate "%U Mbit/s" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_singal_strength_low "Low (%N%)" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_singal_strength_medium "Medium (%N%)" - -//d: WLAN network signal strength value text -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_singal_strength_good "Good (%N%)" - -//d: WLAN network signal strength text if the network in question becomes unavailable while -//d:in details view, -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_wlan_signal_strength_no_signal "No signal" - -//d:Navi pane text in Available WLAN networks main view, if only one network is available. -//l:navi_navi_text_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_navi_one_wlan_nw_available "1 network available" - -//d:Navi pane text in Available WLAN networks main view, if more than one network is available -//d:(%N is the amount of networks). -//l:navi_navi_text_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_navi_many_wlan_nws_available "%N networks available" - -//d:Navi pane text in Available WLAN networks details view. -//d:The navi pane displays the “serial number” (%0N) of the -//d:network in question and the total amount of the connections -//d:(%1N) using the navigation text component: %0N/%1N -//l:navi_navi_text_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_navi_nof_wlan_network "%0N/%1N" - -//d:Available WLAN networks main view — No networks available -//l:main_list_empty_pane -//w: -//r:3.0 -// -#define qtn_cmon_no_wlan_networks_available "(no available WLAN networks)" - -//d:Available WLAN networks main view options menu item. -//l:list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_cmon_options_create_wlan_iap "Create internet access point" - -//d:Available WLAN networks main view options menu - create internet access point item -//d:was selected this confirmation query note is displayed. -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_cmon_quest_create_wlan_iap "Create internet access point for WLAN network '%U'?" - -//d:Available WLAN networks main view options menu - create internet access point item -//d:and secure network was selected this information note is poped up. -//l:popup_note_window -//w: -//r:3.0 -// -#define qtn_cmon_info_wlan_secure_nw_iap_create "You can create an internet access point for a secure WLAN network via Connection settings, Access points." - -//d:Available WLAN networks main view — One or more networks available, options menu item -//l:list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_cmon_options_refresh "Refresh" - - -//d: Unavailable attribute (details view) -//l:list_single_heading_pane_t1 -//w: -//r:3.0 -// -#define qtn_cmon_parameter_unavailable "(unavailable)" - -//d: -//l:list_single_heading_pane_t2 -//w: -//r:3.0 -// -#define qtn_cmon_heading_data_total "Total" - - -//d:"Connection summary note" note- info text -//l:heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_summary_heading "Connection summary" - -//d:First line topic of "Connection summary note" note -//d:displays the total transferred data amount (received and sent summarized) -//l:heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_summary_transferred "Transferred data:" - -//d:Third line topic of "Connection summary note" note, -//d:displays the duration of the connection -//l:heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_cmon_summary_duration "Duration:" - -//d:Available WLAN networks main view options menu - create internet access point item -//d:final confirmation note is poped up when access point item has been created successfully -//l:popup_note_window -//w: -//r:3.1 -// -#define qtn_cmon_conf_wlan_iap_created "Internet access point defined for WLAN network '%U'." - -//d:Text in middle soft key (opens a view for detailed information) -//l:control_pane_t3/opt7 -//w: -//r:3.2 -// -#define qtn_msk_cmon_details "Details" - -//d:The name of the application which uses the connection (MessagingServer) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_msg_server "Messaging" - -//d:The name of the application which uses the connection (DownaloadMgrServer) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_dl_mg "Downloads" - -//d:The name of the application which uses the connection (Feeds Server) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_rss_server "Web Feeds" - -//d:The name of the application which uses the connection (Java MIDlets) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_java_midlet "Application" - -//d:The name of the application which uses the connection (Unknown instance) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_unknown "(unknown)" - -//d:The name of the application which uses the connection -//d:(SUPL (Secure User Plane Location) server) -//l:list_single_heading_pane_t1 -//w: -//r:3.2 -// -#define qtn_cmon_sharing_app_supl "Positioning server" - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/sis/ConnectionMonitorUI.pkg --- a/connectionmonitoring/connectionmonitorui/sis/ConnectionMonitorUI.pkg Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: ; Installation file for ConnectionMonitorUi application -; -; Installation file for ConnectionMonitorUi application -; Installation file for ConnectionMonitorUi application - -;Languages -&EN - -; Package header -#{"ConnectionMonitorUi"},(0x101F84D0),0,2,0,TYPE=SA - -%{"some vendor"} -; Unique Vendor name -:"Unique Vendor NameXXXX" - -;Key and certificate -*"rd-key.pem","rd.cer" - - -; Entries - files to install - -"\Epoc32\release\armv5\udeb\CONNECTIONMONITORUI.exe" -"!:\sys\bin\CONNECTIONMONITORUI.exe" -"\epoc32\data\Z\Resource\apps\CONNECTIONMONITORUI.rsc" -"!:\resource\apps\CONNECTIONMONITORUI.rsc" -"\epoc32\data\Z\private\10003a3f\apps\CONNECTIONMONITORUI_reg.rsc" -"!:\private\10003a3f\import\apps\CONNECTIONMONITORUI_reg.rsc" diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ActiveWrapper.cpp --- a/connectionmonitoring/connectionmonitorui/src/ActiveWrapper.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CActiveWrapper implementation file -* -*/ - - -#include - -#include "ActiveWrapper.h" -#include "ConnectionMonitorUiLogger.h" - -// LOCAL CONSTANTS AND MACROS - -// --------------------------------------------------------- -// CActiveWrapper::NewL -// -// Two-phased constructor. -// --------------------------------------------------------- -// -CActiveWrapper* CActiveWrapper::NewL() - { - CMUILOGGER_ENTERFN( "CActiveWrapper::NewL()" ); - - CActiveWrapper* self = new ( ELeave ) CActiveWrapper(); - CleanupStack::PushL( self ); - - self->ConstructL(); - - CleanupStack::Pop( self ); - - CMUILOGGER_LEAVEFN( "CActiveWrapper::NewL()" ); - return self; - } - -// --------------------------------------------------------- -// CActiveWrapper::ConstructL -// -// Symbian OS default constructor can leave. -// --------------------------------------------------------- -// -void CActiveWrapper::ConstructL() - { - CMUILOGGER_ENTERFN( "CActiveWrapper::ConstructL()" ); - - CActiveScheduler::Add( this ); - - CMUILOGGER_LEAVEFN( "CActiveWrapper::ConstructL()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::CActiveWrapper -// -// C++ constructor can NOT contain any code, that -// might leave. -// --------------------------------------------------------- -// -CActiveWrapper::CActiveWrapper() : CActive( CActive::EPriorityStandard ) - { - } - - -// --------------------------------------------------------- -// CActiveWrapper::~CActiveWrapper -// -// Destructor -// --------------------------------------------------------- -// -CActiveWrapper::~CActiveWrapper() - { - CMUILOGGER_ENTERFN( "CActiveWrapper::~CActiveWrapper()" ); - - Cancel(); - - CMUILOGGER_WRITE( "CActiveWrapper::~CActiveWrapper Canceled" ); - - CMUILOGGER_LEAVEFN( "CActiveWrapper::~CActiveWrapper()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::RunL -// -// From active object framework -// --------------------------------------------------------- -// -void CActiveWrapper::RunL() - { - CMUILOGGER_ENTERFN( "CActiveWrapper::RunL()" ); - - if ( iWait.IsStarted() ) - { - CMUILOGGER_WRITE( "AsyncStop" ); - - iWait.AsyncStop(); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::RunL()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::DoCancel -// -// From active object framework -// --------------------------------------------------------- -// -void CActiveWrapper::DoCancel() - { - CMUILOGGER_ENTERFN( "CActiveWrapper::DoCancel()" ); - - if ( iWait.IsStarted() ) - { - CMUILOGGER_WRITE( "AsyncStop" ); - - iWait.AsyncStop(); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::DoCancel()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetStringAttribute -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetStringAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TDes& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetStringAttribute()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor->GetStringAttribute( aConnectionId, 0, aAttribute, - aValue, iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetStringAttribute()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetIntAttribute -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetIntAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TInt& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetIntAttribute()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor->GetIntAttribute( aConnectionId, - 0, - aAttribute, - aValue, - iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetIntAttribute()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetUintAttribute -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetUintAttribute( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TUint const aAttribute, - TUint& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetUintAttribute()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor->GetUintAttribute( aConnectionId, - 0, - aAttribute, - aValue, - iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetUintAttribute()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetConnSharings -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetConnSharings( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonClientEnumBuf& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnSharings()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor->GetPckgAttribute( aConnectionId, - 0, - KClientInfo, - aValue, - iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnSharings()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetConnTime -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetConnTime( TInt const aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonTimeBuf& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnTime()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor->GetPckgAttribute( aConnectionId, - 0, - KStartTime, - aValue, - iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnTime()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetBearerType -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetBearerType( TInt const aConnectionId, - RConnectionMonitor& aConnectionMonitor, - TUint const aAttribute, - TInt& aValue ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetBearerType()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor.GetIntAttribute( aConnectionId, - 0, - aAttribute, - aValue, - iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetBearerType()" ); - } - - -// --------------------------------------------------------- -// CActiveWrapper::StartGetConnectionCount -// -// Starts the active object -// --------------------------------------------------------- -// -void CActiveWrapper::StartGetConnectionCount( TUint& aConnectionCount, - RConnectionMonitor& aConnectionMonitor ) - { - CMUILOGGER_ENTERFN( "CActiveWrapper::StartGetConnectionCount()" ); - - if ( IsActive() == EFalse ) - { - CMUILOGGER_WRITE( "NOT active" ); - aConnectionMonitor.GetConnectionCount( aConnectionCount, iStatus ); - SetActive(); - iWait.Start(); - } - else - { - CMUILOGGER_WRITE( "Already active" ); - } - - CMUILOGGER_LEAVEFN( "CActiveWrapper::StartGetConnectionCount()" ); - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionArray.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionArray.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,333 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contains and handles CConnectionInfo instances -* -* -*/ - - -// INCLUDE FILES - -#include "ConnectionArray.h" -#include "ConnectionMonitorUiLogger.h" - -// CONSTANTS -/** -* Count of allowed connections. -*/ -const TUint KConnArrayGranuality = KConnMonMaxClientUids; - - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CConnectionArray::~CConnectionArray -// --------------------------------------------------------- -// -CConnectionArray::~CConnectionArray() - { - if ( iConnectionArray ) - { - iConnectionArray->ResetAndDestroy(); - } - delete iConnectionArray; - } - - -// --------------------------------------------------------- -// CConnectionArray::CConnectionArray -// --------------------------------------------------------- -// -CConnectionArray::CConnectionArray() - { - } - - -// --------------------------------------------------------- -// CConnectionArray::ConstructL -// --------------------------------------------------------- -// -void CConnectionArray::ConstructL() - { - iConnectionArray = new ( ELeave ) - CArrayPtrFlat( KConnArrayGranuality ); - } - - -// --------------------------------------------------------- -// CConnectionArray::MdcaCount -// --------------------------------------------------------- -// -TInt CConnectionArray::MdcaCount() const - { - return iConnectionArray->Count(); - } - - -// --------------------------------------------------------- -// CConnectionArray::MdcaPoint -// --------------------------------------------------------- -// -TPtrC CConnectionArray::MdcaPoint( TInt aIndex ) const - { - return ( *iConnectionArray )[aIndex]->GetConnectionListBoxItemText(); - } - - -// --------------------------------------------------------- -// CConnectionArray::DeepCopyL -// --------------------------------------------------------- -// -CConnectionArray* CConnectionArray::DeepCopyL() - { - CConnectionArray* temp = new ( ELeave ) CConnectionArray(); - CleanupStack::PushL( temp ); - temp->ConstructL(); - TInt count = iConnectionArray->Count(); - CConnectionInfoBase* tempConnInfo = NULL; - for ( TInt i = 0; i < count; ++i ) - { - tempConnInfo = ( *iConnectionArray )[i]->DeepCopyL(); - CleanupStack::PushL( tempConnInfo ); - temp->AppendL( tempConnInfo ); - CleanupStack::Pop( tempConnInfo ); - } - CleanupStack::Pop( temp ); - return temp; - } - -// --------------------------------------------------------- -// CConnectionArray::GetArrayIndex -// --------------------------------------------------------- -// -TInt CConnectionArray::GetArrayIndex( TUint aConnectionId ) const - { - CMUILOGGER_WRITE_F( "GetArrayIndex: %d", aConnectionId ); - TBool found( EFalse ); - TInt index( 0 ); - TInt count = iConnectionArray->Count(); - TUint connectionId( 0 ); - - while ( ( index < count ) && !found ) - { - connectionId = ( *iConnectionArray )[index]->GetConnectionId(); - if ( connectionId == aConnectionId ) - { - found = ETrue; - } - else - { - ++index; - } - } - - CMUILOGGER_WRITE_F( "Found: %d", found ); - - return ( found ? index : KErrNotFound ); - } - - -// --------------------------------------------------------- -// CConnectionArray::GetArrayIndex -// --------------------------------------------------------- -// -TInt CConnectionArray::GetArrayIndex( CConnectionInfoBase* aConnection ) const - { - CMUILOGGER_WRITE_F( "GetArrayIndex: %d", - aConnection->GetConnectionId() ); - TBool found( EFalse ); - TInt index( 0 ); - TInt count = iConnectionArray->Count(); - - while ( ( index < count ) && !found ) - { - if ( ( *iConnectionArray )[index] == aConnection ) - { - found = ETrue; - } - else - { - ++index; - } - } - - CMUILOGGER_WRITE_F( "Found: %d", found ); - - return ( found ? index : KErrNotFound ); - } - - -// --------------------------------------------------------- -// CConnectionArray::AppendL -// --------------------------------------------------------- -// -void CConnectionArray::AppendL( CConnectionInfoBase* aConnection ) - { - CMUILOGGER_ENTERFN( "CConnectionArray::AppendL" ); - if ( aConnection ) - { - TUint connectionId = aConnection->GetConnectionId(); - TInt index = GetArrayIndex( connectionId ); - - if ( index == KErrNotFound ) - { - if ( aConnection->GetStatus() != EConnectionClosed && - aConnection->GetStatus() != EConnectionUninitialized ) - { - iConnectionArray->AppendL( aConnection ); - } - } - } - - CMUILOGGER_LEAVEFN( "CConnectionArray::AppendL" ); - } - - -// --------------------------------------------------------- -// CConnectionArray::Delete -// --------------------------------------------------------- -// -void CConnectionArray::Delete( TUint aConnectionId ) - { - CMUILOGGER_WRITE_F( "Deleting connection: %d", aConnectionId ); - TInt count = iConnectionArray->Count(); - TUint connectionId( 0 ); - TBool deleted( EFalse ); - for ( TInt i = 0; (i < count) && !deleted; ++i ) - { - connectionId = ( *iConnectionArray )[i]->GetConnectionId(); - if ( connectionId == aConnectionId ) - { - delete ( *iConnectionArray )[i]; - iConnectionArray->Delete( i ); - iConnectionArray->Compress(); - deleted = ETrue; - } - } - CMUILOGGER_WRITE_F( "Found and deleted: %b", deleted ); - } - - -// --------------------------------------------------------- -// CConnectionArray::Delete -// --------------------------------------------------------- -// -void CConnectionArray::Delete( CConnectionInfoBase* aConnection ) - { - CMUILOGGER_WRITE_F( "Deleting connection: %d", - aConnection->GetConnectionId() ); - TInt count = iConnectionArray->Count(); - TBool deleted( EFalse ); - for ( TInt i = 0; (i < count) && !deleted; ++i ) - { - if ( ( *iConnectionArray )[i] == aConnection ) - { - delete ( *iConnectionArray )[i]; - iConnectionArray->Delete( i ); - iConnectionArray->Compress(); - deleted = ETrue; - } - } - CMUILOGGER_WRITE_F( "Found and deleted: %b", deleted ); - } - - -// --------------------------------------------------------- -// CConnectionArray::Reset -// --------------------------------------------------------- -// -void CConnectionArray::Reset() - { - iConnectionArray->ResetAndDestroy(); - } - -// --------------------------------------------------------- -// CConnectionArray::operator[] -// --------------------------------------------------------- -// -CConnectionInfoBase* CConnectionArray::operator[]( TUint aIndex ) const - { - return ( *iConnectionArray )[aIndex]; - } - -// --------------------------------------------------------- -// CConnectionArray::At -// --------------------------------------------------------- -// -CConnectionInfoBase* CConnectionArray::At( TInt aIndex ) const - { - CMUILOGGER_ENTERFN( "CConnectionArray::At()" ); - CConnectionInfoBase* temp( NULL ); - TInt count = iConnectionArray->Count(); - CMUILOGGER_WRITE_F( "count %d", count ); - - if ( count && ( aIndex < count ) ) - { - temp = ( *iConnectionArray )[aIndex]; - } - - CMUILOGGER_LEAVEFN( "CConnectionArray::At()" ); - return temp; - } - -// --------------------------------------------------------- -// CConnectionArray::NumberOfActiveConnections -// --------------------------------------------------------- -// -TInt CConnectionArray::NumberOfActiveConnections() const - { - TInt count( 0 ); - - CMUILOGGER_WRITE_F( - "NumberOfActiveConnections: all in array: [%d]\n", - MdcaCount() ); - - // we need to count all and only the open connection - for ( TInt i = 0; i < MdcaCount(); ++i ) - { - if ( ( *iConnectionArray )[i]->IsAlive() ) - { - ++count; - } - } - - CMUILOGGER_WRITE_F( "Active connections: [%d]\n", count ); - return count; - } - -// --------------------------------------------------------- -// CConnectionArray::NumberOfSuspendedConnections -// --------------------------------------------------------- -// -TInt CConnectionArray::NumberOfSuspendedConnections() const - { - TInt count( 0 ); - - CMUILOGGER_WRITE_F( - "Number of all connection in array: [%d]\n", MdcaCount() ); - - // we need to count all and only the open connection - for ( TInt i = 0; i < MdcaCount(); ++i ) - { - if ( ( *iConnectionArray )[i]->IsSuspended() ) - { - ++count; - } - } - - CMUILOGGER_WRITE_F( "Suspended connections: [%d]\n", count ); - return count; - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionInfoBase.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionInfoBase.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1201 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a connection -* -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include - -#include "ConnectionMonitorUiLogger.h" -#include "ConnectionInfoBase.h" -#include "ActiveWrapper.h" - -// CONSTANTS - -const TUint KUpArrowChar = 0x2191; ///< ASCII code of UpArrow -const TUint KDownArrowChar = 0x2193; ///< ASCII code of DownArrow -const TUint KBannedServerUID = 0x101fd9c5; // Banned DHCP server UID - -const TInt KFeedsServerUid = 0x1020728E; -const TInt KDownloadMgrServerUid = 0x10008D60; -const TInt KMessagingServerUid = 0x1000484b; -const TInt KJavaVMUid = 0x102033E6; -const TInt KSUPLServerUid = 0x102073CA; - -LOCAL_D const TInt KStringsGranularity = 5; - -_LIT( KMrouterName, "mRouter"); ///< see CheckMrouteIap -_LIT( KEmpty, ""); ///< Empty string - - - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CConnectionInfoBase::~CConnectionInfoBase -// --------------------------------------------------------- -// -CConnectionInfoBase::~CConnectionInfoBase() - { - delete iDetailsArray; - delete iAppNames; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::CConnectionInfoBase -// --------------------------------------------------------- -// -CConnectionInfoBase::CConnectionInfoBase( - TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) : - iConnectionMonitor( aConnectionMonitor ), - iStartTime( NULL ), - iDeletedFromCMUI( EFalse ), - iActiveWrapper( aActiveWrapper ) - { - CMUILOGGER_WRITE( "CConnectionInfoBase constuctor - start " ); - iConnectionStatus = EConnectionUninitialized; - iConnectionId = aConnectionId; - iConnectionBearerType = aConnectionBearerType; - iLastSpeedUpdate.UniversalTime(); - CMUILOGGER_WRITE( "CConnectionInfoBase constuctor - end " ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ConstructL -// --------------------------------------------------------- -// -void CConnectionInfoBase::ConstructL() - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::ConstructL() start" ); - - if ( iConnectionBearerType >= EBearerExternalCSD ) - { - StringLoader::Load( iConnectionName, - R_QTN_CMON_ITEM_CONN_NAME_MODEM ); - } - else - { - iActiveWrapper->StartGetStringAttribute( iConnectionId, - iConnectionMonitor, - KIAPName, - iConnectionName ); - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "CConnectionInfoBase::ConstructL() status: %d", - err ); - CMUILOGGER_WRITE_F( "iConnectionName : %S", &iConnectionName ); - CMUILOGGER_WRITE_F( "iConnectionId : %d", iConnectionId ); - CMUILOGGER_WRITE_F( "iConnectionBearerType : %d", - ( TInt )iConnectionBearerType ); - if ( err != KErrNone ) - { - User::Leave( err ); - } - } - - if ( !iAppNames ) - { - iAppNames = new( ELeave ) CDesCArrayFlat( KStringsGranularity ); - } - - StatusChangedL(); - if ( GetStatus() == EConnectionSuspended ) - { - InitializeConnectionInfoL(); - } - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::ConstructL() end" ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::StatusChangedL -// --------------------------------------------------------- -// -void CConnectionInfoBase::StatusChangedL() - { - CMUILOGGER_WRITE( "CConnectionInfoBase::StatusChangedL() start" ); - - RefreshConnectionStatus(); - - switch ( iConnectionStatus ) - { - case EConnectionCreated: - { - InitializeConnectionInfoL(); - break; - } - case EConnectionSuspended: - { - RefreshDetailsL(); - if ( !iDetailsArray ) - { - ToArrayDetailsL(); - } - RefreshDetailsArrayL(); - break; - } - case EConnectionClosing: - case EConnectionClosed: - case EConnectionUninitialized: - { - if ( iDetailsArray ) // if there is details array - { - RefreshDetailsArrayL(); - } - break; - } - case EConnectionCreating: - default : - { - break; - } - } - - RefreshConnectionListBoxItemTextL(); - - CMUILOGGER_WRITE( "CConnectionInfoBase::StatusChangedL() end" ); - } - -// --------------------------------------------------------- -// CConnectionInfoBase::IsAlive -// --------------------------------------------------------- -// -TBool CConnectionInfoBase::IsAlive() const - { - TBool alive( EFalse ); - if ( ( iConnectionStatus == EConnectionSuspended ) || - ( iConnectionStatus == EConnectionCreated ) ) - { - alive = ETrue; - } - return alive; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::IsSuspended -// --------------------------------------------------------- -// -TBool CConnectionInfoBase::IsSuspended() const - { - TBool suspended( EFalse ); - if ( iConnectionStatus == EConnectionSuspended ) - { - suspended = ETrue; - } - return suspended; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetConnectionId -// --------------------------------------------------------- -// -CDesCArrayFlat* CConnectionInfoBase::GetDetailsArray() const - { - return iDetailsArray; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetConnectionId -// --------------------------------------------------------- -// -TUint CConnectionInfoBase::GetConnectionId() const - { - return iConnectionId; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetStatus -// --------------------------------------------------------- -// -TConnectionStatus CConnectionInfoBase::GetStatus() const - { - return iConnectionStatus; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetName -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::GetNameLC() const - { - HBufC* name = iConnectionName.AllocLC(); - return name; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetBearerType -// --------------------------------------------------------- -// -TConnMonBearerType CConnectionInfoBase::GetBearerType() const - { - return iConnectionBearerType; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::GetConnectionListBoxItemText -// --------------------------------------------------------- -// -TPtrC CConnectionInfoBase::GetConnectionListBoxItemText() const - { - return iListBoxItemText; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshConnectionStatus -// --------------------------------------------------------- -// -void CConnectionInfoBase::RefreshConnectionStatus() - { - TConnectionStatus connStatus( EConnectionUninitialized ); - iActiveWrapper->StartGetIntAttribute( iConnectionId, - iConnectionMonitor, - KConnectionStatus, - ( ( TInt& )( connStatus ) ) ); - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "RefreshConnectionStatus status : %d", - err ); - if ( err == KErrNone ) - { - RefreshConnectionStatus( connStatus ); - } - else - { - iActiveWrapper->Cancel(); - } - } - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshConnectionStatus -// --------------------------------------------------------- -// -void CConnectionInfoBase::RefreshConnectionStatus( - const TInt aConnectionStatus ) - { - CMUILOGGER_ENTERFN( "RefreshConnectionStatus" ); - CMUILOGGER_WRITE_F( "RefreshConnectionStatus aConnectionStatus %d", - ( TInt )aConnectionStatus ); - CMUILOGGER_WRITE_F( "iConnectionStatus before %d", - ( TInt )iConnectionStatus ); - - - if ( ( aConnectionStatus == KLinkLayerOpen ) || - ( ( aConnectionStatus == KConnectionOpen ) && - ( iConnectionBearerType >= EBearerExternalCSD ) ) ) - { - CMUILOGGER_WRITE("1"); - iConnectionStatus = EConnectionCreated; - } - else if ( ( aConnectionStatus == KConnectionClosed ) || - ( aConnectionStatus == KLinkLayerClosed ) ) - { - CMUILOGGER_WRITE("2"); - iConnectionStatus = EConnectionClosed; - } - else if ( ( ( aConnectionStatus >= KMinAgtProgress ) && - ( aConnectionStatus <= KConnectionOpen ) ) || - ( aConnectionStatus == KStartingSelection ) || - ( aConnectionStatus == KFinishedSelection ) || - ( aConnectionStatus == KConfigDaemonStartingRegistration ) || - ( aConnectionStatus == KConfigDaemonFinishedRegistration ) ) - // creating - { - CMUILOGGER_WRITE("5"); - iConnectionStatus = EConnectionCreating; - } - else if ( aConnectionStatus == KDataTransferTemporarilyBlocked ) - { - CMUILOGGER_WRITE("6"); - iConnectionStatus = EConnectionSuspended; - } - else if ( ( iConnectionStatus == EConnectionCreated ) && - ( ( aConnectionStatus >= KConnectionStartingClose ) && - ( aConnectionStatus < KConnectionClosed ) || - ( aConnectionStatus == KConfigDaemonFinishedDeregistrationStop ) || - ( aConnectionStatus == KConfigDaemonStartingDeregistration ) || - ( aConnectionStatus == KLinkLayerClosed ) || - ( aConnectionStatus == KConnectionUninitialised ) - ) ) - // closing - { - CMUILOGGER_WRITE("7"); - iConnectionStatus = EConnectionClosing; - } - else if ( ( aConnectionStatus == KConnectionUninitialised ) && - ( iConnectionStatus == EConnectionSuspended ) ) - { // Back to created from suspended - CMUILOGGER_WRITE("4"); - iConnectionStatus = EConnectionCreated; - } - else if ( aConnectionStatus == KConnectionUninitialised ) - { - CMUILOGGER_WRITE("3"); - iConnectionStatus = EConnectionUninitialized; - } - - else - { - CMUILOGGER_WRITE_F( " else iConnectionStatus %d", - ( TInt )iConnectionStatus ); - CMUILOGGER_WRITE_F( "else aConnectionStatus %d", - ( TInt )aConnectionStatus ); - - CMUILOGGER_WRITE("else"); - } - - - CMUILOGGER_WRITE_F( "iConnectionStatus after %d", - ( TInt )iConnectionStatus ); - CMUILOGGER_LEAVEFN( "RefreshConnectionStatus" ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshSentReceivedDataL -// --------------------------------------------------------- -// -void CConnectionInfoBase::RefreshSentReceivedDataL() - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshSentReceivedDataL" ); - // Downloaded - CMUILOGGER_WRITE("Downloaded before"); - iActiveWrapper->StartGetUintAttribute( iConnectionId, - iConnectionMonitor, - KDownlinkData, - iDownloaded ); - TInt errDownload( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "Download status: %d", errDownload ); - if ( errDownload != KErrNone ) - { - iActiveWrapper->Cancel(); - User::Leave( errDownload ); - } - CMUILOGGER_WRITE("Downloaded after"); - // Uploaded - CMUILOGGER_WRITE("Uploaded before"); - iActiveWrapper->StartGetUintAttribute( iConnectionId, - iConnectionMonitor, - KUplinkData, - iUploaded ); - TInt errUpload( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "Upload status: %d", errUpload ); - if ( errUpload != KErrNone ) - { - iActiveWrapper->Cancel(); - User::Leave( errUpload ); - } - CMUILOGGER_WRITE("Uploaded after"); - - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshSentReceivedDataL" ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshTransferSpeedsL -// --------------------------------------------------------- -// -void CConnectionInfoBase::RefreshTransferSpeedsL() - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshTransferSpeedsL" ); - TUint up = iUploaded; - TUint down = iDownloaded; - - RefreshSentReceivedDataL(); - - TTime now; - now.UniversalTime(); - - // 100 * 1/1000sec - const TUint KOnesec = 1000; - TUint diffTime = I64LOW( now.MicroSecondsFrom( iLastSpeedUpdate ).Int64() / - TInt64( 1000 ) ); - - if ( iLastSpeedUpdate.Int64() == 0 ) - { - iLastSpeedUpdate = now; - - // speed cannot be calculated at the first time - iUpSpeed.quot = 0; - iUpSpeed.rem = 0; - iDownSpeed.quot = 0; - iDownSpeed.rem = 0; - } - else if ( diffTime > 500 ) - // at least 1/2sec passed - { - // bytes/sec - div_t upSpeed = div( ( iUploaded - up ) * KOnesec, diffTime ); - div_t downSpeed = div( ( iDownloaded - down ) * KOnesec, diffTime ); - // kbytes/sec - iUpSpeed = div( upSpeed.quot, 1024 ); - iDownSpeed = div( downSpeed.quot, 1024 ); - - iLastSpeedUpdate = now; - } - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshTransferSpeedsL" ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshDuration -// --------------------------------------------------------- -// -void CConnectionInfoBase::RefreshDuration() - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshDuration" ); - TTime now; - now.UniversalTime(); - - // passed time since connection established. - iDuration = now.MicroSecondsFrom( iStartTime ).Int64(); - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshDuration" ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::RefreshAppNamesL -// --------------------------------------------------------- -// -TInt CConnectionInfoBase::RefreshAppNamesL() - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::RefreshAppNamesL" ); - - TInt sharings( 0 ); - -if ( IsAlive() ) - { - if ( iAppNames ) - { - iAppNames->Reset(); - HBufC* actAppName = NULL; - // Check whether it is an internal or external (modem) connection - // External (modem) connections does not need application name - if ( iConnectionBearerType < EBearerExternalCSD ) - { - TInt count( 0 ); - TConnMonClientEnumBuf clientBuf; - iActiveWrapper->StartGetConnSharings( iConnectionId, - iConnectionMonitor, - clientBuf ); - - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "RefreshSharings status: %d", err ); - - if ( !err ) - { - count = clientBuf().iCount; - } - - CMUILOGGER_WRITE_F( "clientBuf().iCount: %d", count ); - -#ifndef __WINS__ // Appl. uid is always zero in emulator - - RApaLsSession appSess; - TApaAppInfo appInfo; - - // The connection could be shared by several applications - User::LeaveIfError( appSess.Connect() ); - - TUint i; - for ( i = 0; i < count; i++ ) - { - actAppName = NULL; - appInfo.iCaption.Zero(); - - TInt result = appSess.GetAppInfo( appInfo, - clientBuf().iUid[i] ); - - //================================ - CMUILOGGER_WRITE_F( "result: %d", result ); - CMUILOGGER_WRITE_F( "iClientInfo.iUid[i].iUid: %x", - clientBuf().iUid[i].iUid ); - - if ( result != KErrNone ) - { - TInt resId = 0; - switch ( clientBuf().iUid[i].iUid ) - { - case KMessagingServerUid: // Messaging - { - resId = R_QTN_CMON_SHARING_APP_MSG_SERVER; - break; - } - case KDownloadMgrServerUid: // Downloads - { - resId = R_QTN_CMON_SHARING_APP_DL_MG; - break; - } - case KFeedsServerUid: // Web Feeds - { - resId = R_QTN_CMON_SHARING_APP_RSS_SERVER; - break; - } - case KJavaVMUid: // Application - { - resId = R_QTN_CMON_SHARING_APP_JAVA_MIDLET; - break; - } - case KBannedServerUID: - { // Forget about DHCP server! - break; - } - case KSUPLServerUid: - { - resId = R_QTN_CMON_SHARING_APP_SUPL; - break; - } - default: // (unknown) - { - resId = R_QTN_CMON_SHARING_APP_UNKNOWN; - break; - } - } - - if ( resId ) - { - actAppName = StringLoader::LoadL( resId ); - } - } - else - { - actAppName = HBufC::NewL( appInfo.iCaption.Length() ); - TPtr actAppNameBuf = actAppName->Des(); - actAppNameBuf.Append( appInfo.iCaption ); - } - - if ( actAppName ) - { - iAppNames->AppendL( actAppName->Des() ); - delete actAppName; - } - } - - iAppNames->Sort(); - appSess.Close(); -#else - TInt countBan( 0 ); - - if ( !err ) - { - // remove the DHCP server is not actually - // an owner of the connection - for ( TUint tmp = 0; tmp < count; ++tmp ) - { - TUid uid = clientBuf().iUid[tmp]; - - if ( uid.iUid == KBannedServerUID ) - { - ++countBan; - } - } // end - } - - _LIT( KStrApplication, "Application" ); - // Give a dummy name of the application - for ( TInt i = 0; i < ( count - countBan ); i++ ) - { - iAppNames->AppendL( KStrApplication ); - } - -#endif // __WINS__ - - } - /* modem connections does not need application name - else - { - } - */ - sharings = iAppNames->Count(); - } - } - - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::RefreshAppNamesL" ); - return sharings; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToDetailsListBoxItemTextL -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToDetailsListBoxItemTextL( - const TUint aResourceId, - const HBufC* aValueText ) const - { - CMUILOGGER_ENTERFN( "CConnectionInfoBase::ToDetailsListBoxItemTextL" ); - - HBufC* columnName = NULL; - if ( aResourceId ) - { - columnName = StringLoader::LoadLC( aResourceId ); - } - else - { - columnName = KEmpty().AllocLC(); - } - - HBufC* listBoxItemText = HBufC::NewL( KDetailsListItemText ); - - TPtr ptrToListBoxItemText = listBoxItemText->Des(); - - ptrToListBoxItemText.Format( KDetailsListItemTextFormat, - columnName, aValueText ); - CleanupStack::PopAndDestroy( columnName ); - - - CMUILOGGER_LEAVEFN( "CConnectionInfoBase::ToDetailsListBoxItemTextL" ); - - return listBoxItemText; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::ToDetailsListBoxItemTextWithAppendL -// --------------------------------------------------------- -// -void CConnectionInfoBase::ToDetailsListBoxItemTextWithAppendL( - const TUint aResourceId, - const HBufC* aValueText ) - { - HBufC* listBoxItemText = ToDetailsListBoxItemTextL( aResourceId, - aValueText ); - CleanupStack::PushL( listBoxItemText ); - CMUILOGGER_WRITE_F( "LISTBOXITEM: %S", listBoxItemText ); - iDetailsArray->AppendL( *listBoxItemText ); - CleanupStack::PopAndDestroy( listBoxItemText ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL -// --------------------------------------------------------- -// -void CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL( - const TUint aResourceId, - const HBufC* aValueText, - TInt aIndex ) - { - CMUILOGGER_ENTERFN - ( "CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL" ); - CMUILOGGER_WRITE_F( "aValueText: %S", aValueText ); - - if ( /*( iDetailsArray ) && */ - ( aIndex < iDetailsArray->Count() ) && - ( aIndex > KErrNotFound ) ) - { - HBufC* listBoxItemText = ToDetailsListBoxItemTextL( aResourceId, - aValueText ); - iDetailsArray->Delete( aIndex ); - CleanupStack::PushL( listBoxItemText ); - iDetailsArray->InsertL( aIndex, *listBoxItemText ); - CleanupStack::PopAndDestroy( listBoxItemText ); - iDetailsArray->Compress(); - } - CMUILOGGER_LEAVEFN - ( "CConnectionInfoBase::ToDetailsListBoxItemTextWithReplaceL" ); - - } - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringBearerLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringBearerLC() const - { - HBufC* bearer = NULL; - TUint resourceId( 0 ); - - // Bearer type - if ( iConnectionBearerType == EBearerHSCSD || - iConnectionBearerType == EBearerExternalHSCSD ) - { - resourceId = R_QTN_CMON_BEARER_HSCSD; - - } - else if ( iConnectionBearerType == EBearerCSD || - iConnectionBearerType == EBearerExternalCSD || - iConnectionBearerType == EBearerWcdmaCSD || - iConnectionBearerType == EBearerExternalWcdmaCSD ) - { - resourceId = R_QTN_SET_BEARER_DATA_CALL; - } - else if ( iConnectionBearerType == EBearerWLAN ) - { - resourceId = R_QTN_WLAN_SETT_BEARER_WLAN; - } - else - { - resourceId = R_QTN_SET_BEARER_PACKET_DATA; - } - - bearer = StringLoader::LoadLC( resourceId ); - - return bearer; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringStatusLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringStatusLC( TBool aIsDetailsView ) const - { - HBufC* status = NULL; - TUint resourceId( 0 ); - switch ( iConnectionStatus ) - { - case EConnectionCreated: - { - if ( iUpSpeed.quot || iUpSpeed.rem || - iDownSpeed.quot || iDownSpeed.rem ) - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_ACTIVE - : R_QTN_CMON_STATUS_ACTIVE; - } - else - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_IDLE - : R_QTN_CMON_STATUS_IDLE; - } - break; - } - case EConnectionUninitialized: - case EConnectionClosed: - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CLOSED - : R_QTN_CMON_STATUS_CLOSED; - break; - } - case EConnectionClosing: - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CLOSING - : R_QTN_CMON_STATUS_CLOSING; - break; - } - case EConnectionSuspended: - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_SUSPENDED - : R_QTN_CMON_STATUS_SUSPENDED; - break; - } - case EConnectionCreating: - default : - { - resourceId = aIsDetailsView ? R_QTN_CMON_STATUS_DETAILS_CREATING - : R_QTN_CMON_STATUS_CREATING; - break; - } - } - - status = StringLoader::LoadLC( resourceId ); - - return status; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringTotalTransmittedDataLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringTotalTransmittedDataLC() const - { - TUint total = iUploaded + iDownloaded; - CMUILOGGER_WRITE_F( "iUploaded : %d", iUploaded ); - CMUILOGGER_WRITE_F( "iDownloaded : %d", iDownloaded ); - CMUILOGGER_WRITE_F( "total : %d", total ); - - return ToStringLoadedDataLC( total ); - } - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringSentDataLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringSentDataLC( TBool aToBeThreeDigit ) const - { - return ToStringLoadedDataLC( iUploaded, aToBeThreeDigit, KUpArrowChar ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringReceivedDataLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringReceivedDataLC( TBool aToBeThreeDigit ) const - { - return ToStringLoadedDataLC( iDownloaded, aToBeThreeDigit, KDownArrowChar ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringTransferSpeedUpLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringTransferSpeedUpLC() const - { - return ToStringTransferSpeedLC( iUpSpeed, KUpArrowChar ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringTransferSpeedDownLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringTransferSpeedDownLC() const - { - return ToStringTransferSpeedLC( iDownSpeed, KDownArrowChar ); - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringDurationLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringDurationLC() const - { - const TUint KTimeStringLength = 64; - const TUint KTimeFormatBuf = 16; - const TUint KDateFormatBuf = 16; - _LIT( KDayFormat, "%d" ); - - - TTime now; - now.UniversalTime(); - HBufC* timeString = NULL; - - TTimeIntervalDays days = NULL; - - if ( iStartTime != NULL ) - { - // calculate days passed since connection started - days = now.DaysFrom( iStartTime ); - CMUILOGGER_WRITEF( _L( "ToStringDurationLC days before: %d" ), - days.Int() ); - } - - // passed time since connection established. - if ( days.Int() <= 0 ) - // it's still within 1 day - { - timeString = HBufC::NewLC( KTimeStringLength ); - TPtr16 tempBuf( timeString->Des() ); - - HBufC* temp = StringLoader::LoadLC( R_QTN_TIME_DURAT_LONG_WITH_ZERO ); - - iDuration.FormatL( tempBuf, *temp ); - CleanupStack::PopAndDestroy( temp ); - } - else - // more than 1 day - { - CMUILOGGER_WRITEF( _L( "ToStringDurationLC days after: %d" ), - days.Int() ); - - TBuf dayFormat; - dayFormat.Format( KDayFormat, days.Int() ); - - // format time format string - HBufC* tempFormat = StringLoader::LoadLC( - R_QTN_TIME_DURAT_SHORT_WITH_ZERO ); - TBuf tempBuf; - - // format hours:mins - iDuration.FormatL( tempBuf, *tempFormat ); - - CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 ); - CleanupStack::PushL( strings ); - - strings->AppendL( dayFormat ); - strings->AppendL( tempBuf ); - - timeString = StringLoader::LoadL( R_QTN_CMON_DURATION_OVER_24H, - *strings ); - - CleanupStack::PopAndDestroy( strings ); - CleanupStack::PopAndDestroy( tempFormat ); - CleanupStack::PushL( timeString ); - } - - CMUILOGGER_WRITE_F( "duration time1: %S", timeString ); - - TPtr temp( timeString->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - CMUILOGGER_WRITE_F( "duration temp: %S", &temp ); - - CMUILOGGER_WRITE_F( "duration time2: %S", timeString ); - - - return timeString; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::CheckMrouterIap -// --------------------------------------------------------- -// -TBool CConnectionInfoBase::CheckMrouterIap() - { - CMUILOGGER_ENTERFN( "CheckMrouterIap" ); - TBool result( ETrue ); - - CMUILOGGER_WRITE_F( "IAP name: %S", &iConnectionName ); - iConnectionName.Trim(); - if ( iConnectionName.Left( - KMrouterName().Length() ).CompareF( KMrouterName ) ) - { - result = EFalse; - } - CMUILOGGER_LEAVEFN( "CheckMrouterIap" ); - return result; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringLoadedDataLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringLoadedDataLC( TUint aLoadedData, - TBool aToBeThreeDigit, - const TUint aArrowChar ) const - { - const TUint KTransferedBytesFormatBuf = 16; - const TUint KTransferedBytesWidth = 10; - TUint transferedBytesDecimalPlaces(2); - TUint resId; - HBufC* loadedTxt = NULL; - - TBuf buf; - - if ( aLoadedData < 1000 ) // bytes - { - if ( aToBeThreeDigit ) // added arrow to listbox - { - _LIT( KUdLinkFormatBytes, "%c%d" ); - - buf.Format( KUdLinkFormatBytes, aArrowChar, aLoadedData ); - } - else - { - _LIT( KUdLinkFormatBytes, "%d" ); - - buf.Format( KUdLinkFormatBytes, aLoadedData ); - } - resId = R_QTN_LOG_GPRS_AMOUNT_B; - } - else - { // KB, MB, GB - TUint denom; - - if ( aLoadedData < 1000 * 1024 ) - { - denom = 1024; - resId = R_QTN_LOG_GPRS_AMOUNT_KB; - } - else if ( aLoadedData < 1000 * 1024 * 1024 ) - { - denom = 1024 * 1024; - resId = R_QTN_LOG_GPRS_AMOUNT_MB; - } - else - { - denom = 1024 * 1024 * 1024; - resId = R_QTN_LOG_GPRS_AMOUNT_GB; - } - - TReal value = STATIC_CAST( TReal, aLoadedData ) / - STATIC_CAST( TReal, denom ); - - if ( aToBeThreeDigit ) - { - if ( value < 10 ) // number of decimal places - { - transferedBytesDecimalPlaces = 2; - } - else if ( value < 100 ) - { - transferedBytesDecimalPlaces = 1; - } - else - { - transferedBytesDecimalPlaces = 0; - } - } - - TRealFormat Format( KTransferedBytesWidth, - transferedBytesDecimalPlaces ); - - HBufC* number = HBufC::NewLC( KTransferedBytesWidth ); - number->Des().Num( value, Format ); - - if ( aToBeThreeDigit ) // added arrow to listbox - { - _LIT( KUdFormatLarge, "%c%S" ); - buf.Format( KUdFormatLarge, aArrowChar, number ); - } - else - { - _LIT( KUdFormatLarge, "%S" ); - buf.Format( KUdFormatLarge, number ); - } - CleanupStack::PopAndDestroy( number ); - } - - loadedTxt = StringLoader::LoadLC( resId, buf ); - - TPtr temp( loadedTxt->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - return loadedTxt; - } - - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringTransferSpeedLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringTransferSpeedLC( div_t aSpeed, - const TUint aArrowChar ) const - { - const TUint KUpDownSpeedBufSize = 16; - _LIT( KUdSpeedFmt, "%c%d%S%02d" ); - - TBuf buf; - TInt resId; - - HBufC* decSep = StringLoader::LoadLC( R_TEXT_CALC_DECIMAL_SEPARATOR ); - - resId = R_QTN_CMON_DATA_TRANSF_RATE_UL; - buf.Format( KUdSpeedFmt, aArrowChar, aSpeed.quot, decSep, aSpeed.rem ); - - CleanupStack::PopAndDestroy( decSep ); - - HBufC* speedTxt = StringLoader::LoadLC( resId, buf ); - - TPtr temp( speedTxt->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - return speedTxt; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::InitializeConnectionInfoL -// --------------------------------------------------------- -// -void CConnectionInfoBase::InitializeConnectionInfoL() - { - CMUILOGGER_WRITE( "InitializeConnectionInfoL - start " ); - TConnMonTimeBuf timeBuf; - iActiveWrapper->StartGetConnTime( iConnectionId, - iConnectionMonitor, - timeBuf ); - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "IntiConnectionInfo() status: %d", err ); - if ( err != KErrNone ) - { - User::Leave( err ); - } - - iStartTime = timeBuf(); - TDateTime dt = iStartTime.DateTime(); - CMUILOGGER_WRITE_F( "Day : %d", dt.Day() ); - CMUILOGGER_WRITE_F( "Hour : %d", dt.Hour() ); - CMUILOGGER_WRITE_F( "Minute : %d", dt.Minute() ); - CMUILOGGER_WRITE_F( "Second : %d", dt.Second() ); - - - RefreshDetailsL(); - if ( !iDetailsArray ) - { - ToArrayDetailsL(); - } - CMUILOGGER_WRITE( "InitializeConnectionInfoL - end " ); - } - -// --------------------------------------------------------- -// CConnectionInfoBase::StringMarkerRemoval -// --------------------------------------------------------- -// -void CConnectionInfoBase::StringMarkerRemoval( HBufC* aStringHolder ) - { - TPtr bufPtr = aStringHolder->Des(); - - const TText KLRMarker = 0x200E; - const TText KRLMarker = 0x200F; - - TBuf<2> markers; - markers.Append( KLRMarker ); - markers.Append( KRLMarker ); - - // This function is requested to remove directional markers, because they - // cause a display error in languages such Hebrew. Directional markers will - // be correctly added later, when the one or two parts of the time string - // are merged, again with StringLoader functions. - AknTextUtils::StripCharacters( bufPtr, markers ); - } - -// --------------------------------------------------------- -// CConnectionInfoBase::ToStringAppNameLC -// --------------------------------------------------------- -// -HBufC* CConnectionInfoBase::ToStringAppNameLC( TInt aAppIndex ) - { - HBufC* appName = ( iAppNames->MdcaPoint( aAppIndex ) ).AllocLC(); - - return appName; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::GetDeletedFromCMUI -// --------------------------------------------------------- -// -TBool CConnectionInfoBase::GetDeletedFromCMUI() const - { - return iDeletedFromCMUI; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::SetAllDeletedFromCMUI -// --------------------------------------------------------- -// -void CConnectionInfoBase::SetAllDeletedFromCMUI() - { - iConnectionStatus = EConnectionClosing; - } - -// --------------------------------------------------------- -// CConnectionInfoBase::SetDeletedFromCMUI -// --------------------------------------------------------- -// -void CConnectionInfoBase::SetDeletedFromCMUI() - { - iConnectionStatus = EConnectionClosing; - - iDeletedFromCMUI = ETrue; - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiApp.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiApp.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CConnectionMonitorUiApp application class -* -* -*/ - - -// INCLUDE FILES -#include -#include "ConnectionMonitorUiApp.h" -#include "ConnectionMonitorUiDocument.h" - -// --------------------------------------------------------- -// Panic -// --------------------------------------------------------- -// -void Panic( TInt aReason ) - { - _LIT( KAppName, "Conn. Monitor" ); - User::Panic( KAppName, aReason ); - } - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CConnectionMonitorUiApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CConnectionMonitorUiApp::AppDllUid() const - { - return KUidConnectionMonitorUi; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiApp::CreateDocumentL() -// Creates CConnectionMonitorUiDocument object -// --------------------------------------------------------- -// -CApaDocument* CConnectionMonitorUiApp::CreateDocumentL() - { - return CConnectionMonitorUiDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== - - -LOCAL_C CApaApplication* NewApplication() - { - return new CConnectionMonitorUiApp; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication( NewApplication ); - } - - -// End of File - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiAppUi.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiAppUi.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,972 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Application UI class -* -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include "ConnectionMonitorUi.hrh" -#include "ConnectionMonitorUiAppUi.h" -#include "ConnectionMonitorUiView.h" -#include "ConnectionMonitorUiDetailsView.h" -#include "ConnectionArray.h" -#include "CsdConnectionInfo.h" -#include "GprsConnectionInfo.h" -#include "WlanConnectionInfo.h" -#include "EasyWLANConnectionInfo.h" -#include "FeatureManagerWrapper.h" -#include "ActiveWrapper.h" - - -// CONSTANTS - -// ================= MEMBER FUNCTIONS ======================= - -// ---------------------------------------------------------- -// CConnectionMonitorUiAppUi::ConstructL() -// ---------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::ConstructL() - { - CMUILOGGER_CREATE; - - CMUILOGGER_WRITE( "Constructing CConnectionMonitorUiAppUi" ); - - BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible); - -#ifdef RD_CONTROL_PANEL - - TBool isEmbeddedApp = IsEmbedded(); - CMUILOGGER_WRITE_F( "IsEmbedded(): %d", isEmbeddedApp ); - -#endif // RD_CONTROL_PANEL - - iFeatureManagerWrapper = CFeatureManagerWrapper::NewL(); - TBool isWlanSupported = FeatureManager::FeatureSupported( - KFeatureIdProtocolWlan ); - - CMUILOGGER_WRITE_F( "isWlanSupported: %b", isWlanSupported ); - - // connect to connection monitor engine - CMUILOGGER_WRITE( "Connection monitor engine" ); - iMonitor.ConnectL(); - CMUILOGGER_WRITE( "Connected" ); - - CMUILOGGER_WRITE( "Creating connection array" ); - iConnectionArray = new ( ELeave ) CConnectionArray(); - iConnectionArray->ConstructL(); - - iActiveWrapper = CActiveWrapper::NewL(); // start ActiveWrapper - - if ( isWlanSupported ) - { - GetEasyWlanIAPNameL(); - } - - InitializeConnectionArrayL(); - - CMUILOGGER_WRITE( "Created" ); - - CMUILOGGER_WRITE( "Creating main view" ); - -#ifdef RD_CONTROL_PANEL - CConnectionMonitorUiView* mainView = - new ( ELeave ) CConnectionMonitorUiView( iConnectionArray, - &iMonitor, - isEmbeddedApp, - iActiveWrapper ); -#else - CConnectionMonitorUiView* mainView = - new ( ELeave ) CConnectionMonitorUiView( iConnectionArray, - &iMonitor, - iActiveWrapper ); -#endif // RD_CONTROL_PANEL - - CleanupStack::PushL( mainView ); - CMUILOGGER_WRITE( "Constructing main view" ); - mainView->ConstructL(); - CMUILOGGER_WRITE( "Adding main view" ); - AddViewL( mainView ); // transfer ownership to CAknViewAppUi - - SetDefaultViewL( *mainView ); - iTimerObserver = this; - - CleanupStack::Pop( mainView ); - CMUILOGGER_WRITE( "Done" ); - - CMUILOGGER_WRITE( "Creating details view" ); - CConnectionMonitorUiDetailsView* detailsView = - new ( ELeave ) CConnectionMonitorUiDetailsView( iConnectionArray ); - CleanupStack::PushL( detailsView ); - CMUILOGGER_WRITE( "Constructing details view" ); - detailsView->ConstructL(); - CMUILOGGER_WRITE( "Adding details view" ); - AddViewL( detailsView ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop( detailsView ); - CMUILOGGER_WRITE( "Done" ); - - // from this point we can listen to events of RConnectionMonitor server - iMonitor.NotifyEventL( *this ); - - activateMainView = EFalse; - } - -// ---------------------------------------------------- -// CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi() -// Destructor -// Frees reserved resources -// ---------------------------------------------------- -// -CConnectionMonitorUiAppUi::~CConnectionMonitorUiAppUi() - { - CMUILOGGER_ENTERFN( "~CConnectionMonitorUiAppUi" ); - - StopTimer(); - delete iConnectionArray; - delete iEasyWlanIAPName; - delete iActiveWrapper; - delete iFeatureManagerWrapper; - - // it's needed because views are still active here - // and a call from handleforegroundevent from them - // can cause exception in StopConnEventNotificationL - iMonitor.CancelNotifications(); - iMonitor.Close(); - iNewConnectionIdArray.Close(); - iConnectionsWaitingFirstEvent.Close(); - CMUILOGGER_LEAVEFN( "~CConnectionMonitorUiAppUi" ); - - CMUILOGGER_DELETE; - } - -// --------------------------------------------------------------------------- -// CConnectionMonitorUiAppUi::InitializeConnectionArrayL -// --------------------------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::InitializeConnectionArrayL() - { - CMUILOGGER_ENTERFN( "InitializeConnectionArrayL" ); - - CConnectionInfoBase* connectionInfo = NULL; - TUint connectionNumber( 0 ); - TUint connectionId( 0 ); - TUint subConnectionCount; - - TUint wlanConnectionCounter( 0 ); - TUint wlanConnectionId( 0 ); - TConnMonBearerType bearerType( EBearerUnknown ); - RArray connIds; - RArray bearers; - CleanupClosePushL( connIds ); - CleanupClosePushL( bearers ); - - iActiveWrapper->StartGetConnectionCount( connectionNumber, iMonitor ); - - if ( !iActiveWrapper->iStatus.Int() ) - { - CMUILOGGER_WRITE_F( "Number of connections: %d", - connectionNumber ); - - for ( TUint i = 1; i <= connectionNumber; ++i ) - { - iMonitor.GetConnectionInfo( i, connectionId, subConnectionCount ); - connIds.AppendL( connectionId ); - - iActiveWrapper->StartGetBearerType( connectionId, - iMonitor, - KBearer, - ( TInt& )bearerType ); - CMUILOGGER_WRITE_F( "status.Int(): %d", - iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType ); - bearers.AppendL( (TInt)bearerType ); - - if ( bearerType == EBearerWLAN ) - { - wlanConnectionCounter++; - wlanConnectionId = connectionId; - } - } - - for ( TInt i = 0; i < connectionNumber; i++ ) - { - if ( bearers[i] != EBearerWLAN || wlanConnectionCounter < 2 || connIds[i] == wlanConnectionId ) - { - TInt err; - TRAP(err, connectionInfo = CreateConnectionInfoL( connIds[i], (TConnMonBearerType)bearers[i] )); - - if ( !err && connectionInfo ) - { - CleanupStack::PushL( connectionInfo ); - iConnectionArray->AppendL( connectionInfo ); - CleanupStack::Pop( connectionInfo ); - } - else - { - iNewConnectionIdArray.Append( connIds[i] ); - } - } - else - { - CMUILOGGER_WRITE( "Fake WLAN connection, skipping" ); - } - } - } - else - { - CMUILOGGER_WRITE_F( "GetConnectionCount status: %d", - iActiveWrapper->iStatus.Int() ); - } - - CleanupStack::Pop( &bearers ); - bearers.Close(); - CleanupStack::Pop( &connIds ); - connIds.Close(); - - CMUILOGGER_LEAVEFN( "InitializeConnectionArrayL Done" ); - } - -// --------------------------------------------------------------------------- -// CConnectionMonitorUiAppUi::EventL -// --------------------------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::EventL( - const CConnMonEventBase &aConnMonEvent ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::EventL" ); - - CMUILOGGER_WRITE_F( "EventL type: %d", aConnMonEvent.EventType() ); - - CConnectionInfoBase* connectionInfo = NULL; - TInt index( 0 ); - TConnMonEvent event = ( TConnMonEvent ) aConnMonEvent.EventType(); - TInt connectionId = aConnMonEvent.ConnectionId(); - - CMUILOGGER_WRITE_F( "Connection Id: %d", connectionId ); - - switch ( event ) - { - case EConnMonCreateConnection: - { - CMUILOGGER_WRITE( "EConnMonCreateConnection" ); - - if ( connectionId > 0 ) - { - iConnectionsWaitingFirstEvent.AppendL( connectionId ); - } - break; - } - case EConnMonDeleteConnection: - { - CMUILOGGER_WRITE( "EConnMonDeleteConnection" ); - TInt count = iNewConnectionIdArray.Count(); - TInt i = 0; - TBool newConn = EFalse; - - for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ ) - { - if ( iConnectionsWaitingFirstEvent[cindex] == connectionId ) - { - newConn = ETrue; - iConnectionsWaitingFirstEvent.Remove(cindex); - break; - } - } - - if ( newConn ) - { - // Job done - break; - } - - while ( i < count ) - { - if ( iNewConnectionIdArray[i] == connectionId ) - { - iNewConnectionIdArray.Remove( i ); - CMUILOGGER_WRITE_F( "Removed id %d from array", ( TUint )connectionId ); - count--; - } - else - { - i++; - } - } - - index = iConnectionArray->GetArrayIndex( connectionId ); - if ( index >= 0 ) - { - connectionInfo = ( *iConnectionArray )[index]; - - if ( iView->Id() == KDetailsViewId ) - { - // Mark the connection as closed and refresh details view. - // It will change the status there. - connectionInfo->RefreshConnectionStatus( KConnectionClosed ); - connectionInfo->RefreshDetailsArrayL(); - } - else // MainView - { - TBool deleting = connectionInfo->GetDeletedFromCMUI(); - if ( deleting ) - { - ShowConnectionSummaryInformationNoteL( connectionInfo ); - } - // Mark the connection as closed. When the timer ticks the next - // time the marked connection is deleted and removed from the main view. - connectionInfo->RefreshConnectionStatus( KConnectionClosed ); - } - CMUILOGGER_WRITE_F( "Deleted: %d", connectionId ); - } - break; - } - case EConnMonConnectionStatusChange: - { - CMUILOGGER_WRITE( "EConnMonConnectionStatusChange" ); - - TBool newConn = EFalse; - - for ( TInt cindex = 0; cindex < iConnectionsWaitingFirstEvent.Count(); cindex++ ) - { - if ( iConnectionsWaitingFirstEvent[cindex] == connectionId ) - { - newConn = ETrue; - iConnectionsWaitingFirstEvent.Remove(cindex); - break; - } - } - - index = iConnectionArray->GetArrayIndex( connectionId ); - - if ( newConn || ( index < 0 ) ) - { - if ( connectionId > 0) - { - TConnMonBearerType bearerType( EBearerUnknown ); - iActiveWrapper->StartGetBearerType( connectionId, - iMonitor, - KBearer, - ( TInt& )bearerType ); - CMUILOGGER_WRITE_F( "status.Int(): %d", - iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType ); - if ( bearerType == 0 ) - { - if ( connectionId ) - { - iNewConnectionIdArray.AppendL( connectionId ); - CMUILOGGER_WRITE_F( "id %d added to array", ( TUint )connectionId ); - break; - } - } - - connectionInfo = CreateConnectionInfoL( connectionId, bearerType ); - } - - if ( connectionInfo ) - { - CleanupStack::PushL( connectionInfo ); - iConnectionArray->AppendL( connectionInfo ); - CleanupStack::Pop( connectionInfo ); - } - } - - index = iConnectionArray->GetArrayIndex( connectionId ); - CMUILOGGER_WRITE_F( "Found index : %d", index ); - - if ( index >= 0 ) - { - ( *iConnectionArray )[index]->StatusChangedL(); - } - break; - } - case EConnMonCreateSubConnection: - case EConnMonDeleteSubConnection: - { - CMUILOGGER_WRITE( "SubConnection" ); - index = iConnectionArray->GetArrayIndex( connectionId ); - if ( index >= 0) - { - ( *iConnectionArray )[index]->RefreshDetailsL(); - } - break; - } - default: - { - CMUILOGGER_WRITE( "On event default" ); - break; - } - } - - if ( iObserver && ( index >= 0 ) ) - { - CMUILOGGER_WRITE( "EventL calls observer" ); - iObserver->OnEventL( aConnMonEvent, index ); - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::EventL" ); - } - -// --------------------------------------------------------------------------- -// CConnectionMonitorUiAppUi::Static -// --------------------------------------------------------------------------- -// -CConnectionMonitorUiAppUi* CConnectionMonitorUiAppUi::Static() - { - return REINTERPRET_CAST( CConnectionMonitorUiAppUi*, - CEikonEnv::Static()->EikAppUi() ); - } - -// --------------------------------------------------------------------------- -// CConnectionMonitorUiAppUi::::DynInitMenuPaneL( TInt aResourceId, -// CEikMenuPane* aMenuPane ) -// This function is called by the EIKON framework just before it displays -// a menu pane. Its default implementation is empty, and by overriding it, -// the application can set the state of menu items dynamically according -// to the state of application data. -// --------------------------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::DynInitMenuPaneL( - TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) - { - } - -// ---------------------------------------------------- -// CConnectionMonitorUiAppUi::HandleKeyEventL( -// const TKeyEvent& aKeyEvent, TEventCode /*aType*/ ) -// ---------------------------------------------------- -// -TKeyResponse CConnectionMonitorUiAppUi::HandleKeyEventL( - const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) - { - return EKeyWasNotConsumed; - } - -// ---------------------------------------------------- -// CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand ) -// ---------------------------------------------------- -// -void CConnectionMonitorUiAppUi::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EEikCmdExit: - case EAknCmdExit: - case EAknSoftkeyExit: - { - Exit(); - break; - } - default: - break; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::StartConnEventNotification -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::StartConnEventNotification( - MActiveEventObserverInterface* aObserver ) - { - CMUILOGGER_ENTERFN - ( "CConnectionMonitorUiAppUi::StartConnEventNotification" ); - - iObserver = aObserver; - - CMUILOGGER_LEAVEFN - ( "CConnectionMonitorUiAppUi::StartConnEventNotification" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::StopConnEventNotification -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::StopConnEventNotification( - MActiveEventObserverInterface* aObserver ) - { - CMUILOGGER_ENTERFN - ( "CConnectionMonitorUiAppUi::StopConnEventNotification" ); - - if ( iObserver == aObserver ) - { - iObserver = NULL; - } - - CMUILOGGER_LEAVEFN - ( "CConnectionMonitorUiAppUi::StopConnEventNotification" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::StartTimerL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::StartTimerL( const TInt aInterval ) - { - CMUILOGGER_WRITE( "Starting timer" ); - - if ( !iPeriodic ) - { - iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); - CMUILOGGER_WRITE_F( "aInterval : %d", aInterval ); - - iPeriodic->Start( aInterval, aInterval, - TCallBack( Tick, this ) ); - } - - CMUILOGGER_WRITE( "Timer started" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::StopTimer -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::StopTimer() - { - CMUILOGGER_WRITE( "Stopping timer" ); - if ( iPeriodic ) - { - CMUILOGGER_WRITE( "Timer existing" ); - iPeriodic->Cancel(); - delete iPeriodic; - iPeriodic = NULL; - } - - CMUILOGGER_WRITE( "Timer stopped" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::Tick -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiAppUi::Tick( TAny* aObject ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" ); - - CConnectionMonitorUiAppUi* myself = - static_cast( aObject ); - myself->Tick(); - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick(TAny* aObject)" ); - return 1; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::Tick -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiAppUi::Tick() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::Tick()" ); - - if ( iTimerObserver ) - { - TInt error( KErrNone ); - - TRAP( error, iTimerObserver->OnTimerExpiredL() ); - CMUILOGGER_WRITE_F( "OnTimerExpiredL error id : %d", error ); - - // refresh listboxes - if ( !error && ( iObserver ) ) - { - CMUILOGGER_WRITE( "Tick !error && ( iObserver )" ); - TRAP( error, iObserver->OnTimerEventL() ); - } - CMUILOGGER_WRITE( "after Tick !error && ( iObserver )" ); - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::Tick()" ); - return 1; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::OnTimerExpiredL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::OnTimerExpiredL() - { - CMUILOGGER_WRITE_F( "MdcaCount: %d", iConnectionArray->MdcaCount()); - // First check if there are connections that need to be deleted. - // The conditions for deletion are: - // 1. Connection status must be closed - // 2. Main view must be active (details view should be shown also for closed connections) - // 3. There must not be active request ongoing (otherwise deletion might cause crash) - for(TUint i = 0; i < iConnectionArray->MdcaCount(); i++) - { - CMUILOGGER_WRITE_F( "i: %d", i ); - CMUILOGGER_WRITE_F( "Status: %d", (*iConnectionArray)[i]->GetStatus() ); - CMUILOGGER_WRITE_F( "active: %d", iActiveWrapper->IsActive() ); - if( (*iConnectionArray)[i]->GetStatus() == EConnectionClosed - && !iActiveWrapper->IsActive() - && iView->Id() != KDetailsViewId) - { - CMUILOGGER_WRITE_F( "Delete conn id: %d", (*iConnectionArray)[i]->GetConnectionId() ); - iConnectionArray->Delete( (*iConnectionArray)[i]->GetConnectionId() ); - i--; - } - } - - - TInt count = iNewConnectionIdArray.Count(); - if ( count > 0 ) - { - for ( TInt i = 0; i < count; i++ ) - { - TConnMonBearerType bearerType( EBearerUnknown ); - iActiveWrapper->StartGetBearerType( iNewConnectionIdArray[i], - iMonitor, - KBearer, - ( TInt& )bearerType ); - CMUILOGGER_WRITE_F( "status.Int(): %d", - iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType ); - if ( bearerType == 0 ) - { - continue; - } - CConnectionInfoBase* connectionInfo = NULL; - TInt err; - TRAP(err, connectionInfo = CreateConnectionInfoL( iNewConnectionIdArray[i], bearerType )); - if ( err ) - { - continue; - } - - - if ( connectionInfo ) - { - CleanupStack::PushL( connectionInfo ); - iConnectionArray->AppendL( connectionInfo ); - CleanupStack::Pop( connectionInfo ); - - iNewConnectionIdArray.Remove( i ); - count--; - i--; - CMUILOGGER_WRITE_F( "Removed index %d from array", ( TInt )i ); - } - - } - } - RefreshAllConnectionsL(); - if ( iView ) - { - CMUILOGGER_WRITE_F( "iView->Id() %d", iView->Id() ); - if ( iView->Id() == KConnectionsViewId ) - { - CConnectionMonitorUiView* view = - ( CConnectionMonitorUiView* )iView; - view->ConnectionKeyObserver(); - } - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::GetTickInerval -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiAppUi::GetTickInerval() const - { - return KTickInterval; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::RefreshAllConnectionsL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::RefreshAllConnectionsL() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" ); - TUint index( 0 ); - CConnectionInfoBase* connection = NULL; - if ( iConnectionArray ) - { - TUint count = iConnectionArray->MdcaCount(); - while ( index < count ) - { - connection = ( *iConnectionArray )[index]; - // MainView Refresh - if ( ( connection->IsAlive() ) && - ( !connection->IsSuspended() ) ) - { - CMUILOGGER_WRITE( "MainView Refresh" ); - CMUILOGGER_WRITE_F( "RefreshAllConnectionsL index: %d", - index ); - CMUILOGGER_WRITE_F( "RefreshAllConnectionsL connId: %d", - connection->GetConnectionId() ); - connection->RefreshDetailsL(); - } - // DetailsView Refresh - if ( ( connection->IsAlive() && - ( iView->Id() == KDetailsViewId ) ) ) - { - CMUILOGGER_WRITE( "DetailsView Refresh" ); - connection->RefreshDetailsArrayL(); - } - connection->RefreshConnectionListBoxItemTextL(); - count = iConnectionArray->MdcaCount(); - ++index; - } - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::RefreshAllConnectionsL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::HandleForegroundEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::HandleForegroundEventL( TBool aForeground ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" ); - - CAknViewAppUi::HandleForegroundEventL( aForeground ); - if ( aForeground ) - { - CMUILOGGER_WRITE( "Foreground" ); - if ( activateMainView && iView != NULL && iView->Id() == KDetailsViewId ) - { - ((CConnectionMonitorUiDetailsView*) iView)->ActivateMainViewL(); - activateMainView = EFalse; - } - - TInt interval( KTickInterval ); - if ( iTimerObserver ) - { - interval = iTimerObserver->GetTickInerval(); - } - StartTimerL( interval ); - } - else - { - CMUILOGGER_WRITE( "Background" ); - StopTimer(); - activateMainView = EFalse; - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::HandleForegroundEventL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::CreateConnectionInfoL -// --------------------------------------------------------- -// -CConnectionInfoBase* CConnectionMonitorUiAppUi::CreateConnectionInfoL( - TUint aConnectionId, - TConnMonBearerType aBearerType ) - { - CMUILOGGER_ENTERFN( "CreateConnectionInfoL - start " ); - - CConnectionInfoBase* connection = NULL; - - if ( aConnectionId > 0 ) - { - -#ifdef __WINS__ - if ( aBearerType == EBearerLAN ) - { - aBearerType = EBearerGPRS; - } -#endif - switch ( aBearerType ) - { - case EBearerGPRS: - case EBearerWCDMA: - case EBearerEdgeGPRS: - case EBearerExternalGPRS: - case EBearerExternalWCDMA: - case EBearerExternalEdgeGPRS: - { - CMUILOGGER_WRITE( "CGprsConnectionInfo" ); - - connection = CGprsConnectionInfo::NewL( - aConnectionId, - &iMonitor, - aBearerType, - iActiveWrapper ); - break; - } - case EBearerCSD: - case EBearerHSCSD: - case EBearerWcdmaCSD: - case EBearerExternalCSD: - case EBearerExternalHSCSD: - case EBearerExternalWcdmaCSD: - { - CMUILOGGER_WRITE( "CCsdConnectionInfo" ); - - connection = CCsdConnectionInfo::NewL( - aConnectionId, - &iMonitor, - aBearerType, - iActiveWrapper ); - break; - } - case EBearerWLAN: - //case EBearerExternalWLAN: - { - CMUILOGGER_WRITE( "CWlanConnectionInfo" ); - - connection = CWlanConnectionInfo::NewL( - aConnectionId, - &iMonitor, - aBearerType, - iEasyWlanIAPName, - iActiveWrapper ); - break; - } - default : - { - CMUILOGGER_WRITE( "CreateConnectionInfoL, default" ); - break; - } - } - CMUILOGGER_WRITE_F( "Connection created: %d", aConnectionId ); - - if ( connection && connection->CheckMrouterIap() ) - { - CMUILOGGER_WRITE_F( "Connection deleted: %d", aConnectionId ); - delete connection; - connection = NULL; - } - } - else - { - CMUILOGGER_WRITE( "Connection id is invalid" ); - } - - CMUILOGGER_LEAVEFN( "CreateConnectionInfoL - end " ); - - return connection; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" ); - - delete iEasyWlanIAPName; - iEasyWlanIAPName = NULL; - - RCmManagerExt cmManagerExt; - cmManagerExt.OpenL(); - CleanupClosePushL( cmManagerExt ); - - TUint32 easyWlanId = cmManagerExt.EasyWlanIdL(); - if ( easyWlanId ) - { - CMUILOGGER_WRITE_F( "easyWlanId %d", easyWlanId ); - iEasyWlanIAPName = cmManagerExt - .GetConnectionMethodInfoStringL( - easyWlanId, - CMManager::ECmName ); - CMUILOGGER_WRITE_F( "iEasyWlanIAPName: %S", iEasyWlanIAPName ); - } - - CleanupStack::PopAndDestroy( &cmManagerExt ); - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiAppUi::GetEasyWlanIAPNameL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::ShowConnectionSummaryInformationNoteL( - const CConnectionInfoBase* aConnection ) - { - CMUILOGGER_ENTERFN( - "CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" ); - - HBufC* total = aConnection->ToStringTotalTransmittedDataLC(); - HBufC* duration = aConnection->ToStringDurationLC(); - - CMUILOGGER_WRITE_F( "total: %S", total ); - CMUILOGGER_WRITE_F( "duration: %S", duration ); - - CDesCArrayFlat* strings = new( ELeave ) CDesCArrayFlat( 2 ); - CleanupStack::PushL( strings ); - - strings->AppendL( *total ); - strings->AppendL( *duration ); - - HBufC* informationText; - informationText = StringLoader::LoadLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE_TEXT, - *strings ); - - CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( - CAknNoteDialog::ENoTone, - CAknNoteDialog::TTimeout( 5000000 ) ); - dlg->PrepareLC( R_QTN_CMON_CONNECTION_SUMMARY_NOTE ); - dlg->SetTextWrapping( EFalse ); - - TPtr temp( informationText->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - dlg->SetCurrentLabelL( EGeneralNote, temp ); //SetTextL - - dlg->RunDlgLD(); - - CleanupStack::PopAndDestroy( informationText ); - CleanupStack::PopAndDestroy( strings ); - CleanupStack::PopAndDestroy( duration ); - CleanupStack::PopAndDestroy( total ); - - CMUILOGGER_LEAVEFN( - "CConnectionMonitorUiContainer::ShowConnectionSummaryInformationNoteL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiAppUi::DeleteDetailsView -// --------------------------------------------------------- -// -void CConnectionMonitorUiAppUi::DeleteDetailsView( - TInt aConnId, - CConnectionInfoBase* aConnInfo ) - { - CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView Start" ); - CMUILOGGER_WRITE_F( "aConnInfo: %d", aConnInfo ); - CMUILOGGER_WRITE_F( "aConnId: %d", aConnId ); - - TBool deleting = aConnInfo->GetDeletedFromCMUI(); - iConnectionArray->Delete( aConnId ); - - CMUILOGGER_WRITE_F( "Deleted: %d", aConnId ); - CMUILOGGER_WRITE( "CConnectionMonitorUiAppUi::DeleteDetailsView End" ); - } - -#ifdef RD_CONTROL_PANEL - -// ----------------------------------------------------------------------------- -// CConnectionMonitorUiAppUi::IsEmbedded -// ----------------------------------------------------------------------------- -// -TBool CConnectionMonitorUiAppUi::IsEmbedded() const - { - return iEikonEnv->StartedAsServerApp(); - } - -#endif // RD_CONTROL_PANEL - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiContainer.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiContainer.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,757 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: container control class -* -* -*/ - - -// INCLUDE FILES -#include //for CNaviPane -#include //for CAknNavigationDecorator - -#include -#include -#include -#include -#include -#include - -#include "ConnectionArray.h" -#include "ConnectionMonitorUiContainer.h" -#include "FeatureManagerWrapper.h" -#include "ActiveWrapper.h" - -#include -#include -#include - -#include -#include - -// CONSTANTS -/** -* UID of ConnectionMonitorUi App. -*/ -LOCAL_D const TUid KUidConnMonUI = { 0x101F84D0 }; - - -// CONSTANTS -// Granularity of the model array. -/** -* Granularity of icon array -*/ -LOCAL_D const TInt KGranularity = 5; - - -_LIT( KEmpty, ""); ///< Empty string - -// ROM folder -_LIT( KDriveZ, "z:" ); - -// Name of the MBM file containing bitmaps -_LIT( KConnectionMonitorUiMBMFile, "ConnectionMonitorUi.mbm" ); - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::CConnectionMonitorUiContainer -// --------------------------------------------------------- -// -CConnectionMonitorUiContainer::CConnectionMonitorUiContainer( - CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - CActiveWrapper* aActiveWrapper ) - : CCoeControl(), - iMonitor( aMonitor ), - iConnectionArray( aConnectionArray ), - isWlanSupported( EFalse ), - iActiveWrapper( aActiveWrapper ) - { - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::ConstructL -// EPOC two phased constructor -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::ConstructL( TInt aSelectedItem, const TRect& aRect ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::ConstructL" ); - - CreateWindowL(); - - iListBox = new( ELeave ) CAknDoubleGraphicStyleListBox; - TInt flags( EAknGenericListBoxFlags ); - iListBox->ConstructL( this, flags ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray - /*ELbmDoesNotOwnItemArray*/ ); - iListBox->Model()->SetItemTextArray( iConnectionArray ); - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - TInt actCount = iConnectionArray->MdcaCount() - 1; - - if ( actCount > KErrNotFound ) - { - iListBox->SetCurrentItemIndex( aSelectedItem > actCount ? actCount : aSelectedItem ); - } - - SetIconsL(); - - HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS, - iEikonEnv ); - - CListBoxView *lbview = iListBox->View(); - lbview->SetListEmptyTextL( *noConn ); - CleanupStack::PopAndDestroy( noConn ); - - GetPanesL(); - SetRect( aRect ); - ActivateL(); - - isWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::ConstructL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::OfferKeyEventL -// --------------------------------------------------------- -// -TKeyResponse CConnectionMonitorUiContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - TKeyResponse result( EKeyWasNotConsumed ); - if ( aType == EEventKey ) - { - TInt index = iListBox->CurrentItemIndex(); - if ( ( aKeyEvent.iCode == EKeyBackspace ) && ( index != -1 ) ) - { - if ( !( *iConnectionArray )[index]->IsSuspended() ) - { - EndConnectionL(); - result = EKeyWasConsumed; - } - } - else - { - result = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - } - return result; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer -// --------------------------------------------------------- -// -CConnectionMonitorUiContainer::~CConnectionMonitorUiContainer() - { - delete iListBox; - delete iNaviDecorator; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::SizeChanged() -// Called by framework when the view size is changed -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::SizeChanged() - { - iListBox->SetRect( Rect() ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::CountComponentControls -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiContainer::CountComponentControls() const - { - return 1; // only iListBox - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::ComponentControl( TInt aIndex ) const -// --------------------------------------------------------- -// -CCoeControl* CConnectionMonitorUiContainer::ComponentControl( - TInt aIndex ) const - { - switch ( aIndex ) - { - case 0: - return iListBox; - default: - return NULL; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::OnEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::OnEventL( - const CConnMonEventBase& aConnMonEvent, - const TInt aIndex ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::OnEventL" ); - CMUILOGGER_WRITE_F( "OnEventL type: %d", aConnMonEvent.EventType() ); - CMUILOGGER_WRITE_F( "OnEventL index: %d", aIndex ); - - TBool validIndex =( iListBox->Model()->NumberOfItems() > KErrNotFound ) && - ( aIndex > KErrNotFound ) && - ( iListBox->Model()->NumberOfItems() >= aIndex ); - - if ( aConnMonEvent.ConnectionId() ) - { - switch ( aConnMonEvent.EventType() ) - { - case EConnMonCreateConnection: - { - CMUILOGGER_WRITE( "OnEventL EConnMonCreateConnection" ); - iListBox->HandleItemAdditionL(); - break; - } - case EConnMonDeleteConnection: - { - CMUILOGGER_WRITE( "OnEventL EConnMonDeleteConnection" ); - CMUILOGGER_WRITE_F( "validIndex: %b", validIndex ); - - if ( validIndex ) - { - TBool current - ( aIndex == ( TUint )iListBox->CurrentItemIndex() ); - AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( - iListBox, aIndex, ETrue ); - } - iListBox->UpdateScrollBarsL(); - break; - } - case EConnMonConnectionStatusChange: - case EConnMonCreateSubConnection: - case EConnMonDeleteSubConnection: - { - CMUILOGGER_WRITE( "OnEventL StatusChange SubConnection" ); - if ( validIndex ) - { - iListBox->DrawItem( aIndex ); - } - break; - } - default: - { - CMUILOGGER_WRITE( "OnEventL default" ); - break; - } - } - } - PushAndRefreshNaviPaneL(); - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::OnEventL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::OnTimerEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::OnTimerEventL() - { - iListBox->DrawNow(); - PushAndRefreshNaviPaneL(); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::DrawFirstAllListBoxItem -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::DrawFirstAllListBoxItem() - { - TInt count = iListBox->Model()->NumberOfItems() - 1; - for ( TInt i = count; i > -1; --i ) - { - iListBox->DrawItem( i ); - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::SelectedConnection -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiContainer::SelectedConnection() - { - return iListBox->CurrentItemIndex(); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::EndConnectionL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::EndConnectionL() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::EndConnectionL " ); - TInt index = iListBox->CurrentItemIndex(); - if ( ( index >= 0 ) && ( index < iConnectionArray->MdcaCount() ) ) - { - CConnectionInfoBase* connection = ( *iConnectionArray )[index]; - TUint connectionId = connection->GetConnectionId(); - HBufC* connectionName = NULL; - HBufC* promptConnectionName = NULL; - - // Get the bearertype of a single connection - TConnMonBearerType bearer; - bearer = connection->GetBearerType(); - - if ( isWlanSupported ) // WLAN ON - { - if ( ( bearer == EBearerWLAN ) && connection->IsEasyWLAN() ) - { - /* check and load the SSID for EasyWLAN */ - connectionName = connection->GetWlanNetworkNameLC(); - CMUILOGGER_WRITE_F( "GetWlanNetworkNameLC: %S", - connectionName ); - } - else - { - connectionName = connection->GetNameLC(); - CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName ); - } - } - else // WLAN OFF - { - connectionName = connection->GetNameLC(); - CMUILOGGER_WRITE_F( "GetNameLC: %S", connectionName ); - } - - if ( bearer >= EBearerExternalCSD ) - { - CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_MODEM_CONN" ); - promptConnectionName = StringLoader::LoadLC( - R_QTN_CMON_CONF_END_MODEM_CONN ); - } - else - { - CMUILOGGER_WRITE( "R_QTN_CMON_CONF_END_SINGLE_CONN" ); - promptConnectionName = StringLoader::LoadLC( - R_QTN_CMON_CONF_END_SINGLE_CONN, - *connectionName ); - } - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY, - *promptConnectionName ); - - CleanupStack::PopAndDestroy( promptConnectionName ); - CleanupStack::PopAndDestroy( connectionName ); - - TInt connStatus; - iActiveWrapper->StartGetIntAttribute( connectionId, - iMonitor, - KConnectionStatus, - ( ( TInt& )( connStatus ) ) ); - CMUILOGGER_WRITE_F( "KConnectionStatus status.Int(): %d", - iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "KConnectionStatus connStatus: %d", - connStatus ); - CMUILOGGER_WRITE_F( "ret ret: %d", ret ); - - if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) - { - if ( KErrNone == iActiveWrapper->iStatus.Int() ) - { - connection->SetDeletedFromCMUI(); - - connection->RefreshConnectionListBoxItemTextL(); - DrawFirstAllListBoxItem(); - - iMonitor->SetBoolAttribute( connectionId, 0, - KConnectionStop, ETrue ); - CMUILOGGER_WRITE( "after SetBoolAttribute" ); - } - } - else - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - /* It is already closed */ - /* An information note must be displayed */ - CAknGlobalNote * note = CAknGlobalNote::NewL(); - CleanupStack::PushL( note ); - HBufC* informationText = - StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END ); - - note->ShowNoteL(EAknGlobalInformationNote, *informationText ); - CleanupStack::PopAndDestroy( informationText ); - CleanupStack::PopAndDestroy( note ); - CMUILOGGER_WRITE( "It is already closed" ); - } - } - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::EndConnectionL " ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::EndAllConnectionL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::EndAllConnectionL() - { - CMUILOGGER_ENTERFN( "EndAllConnectionL - start" ); - - const TInt KOnlyOneConnection = 1; - const TInt KFirstConnection = 0; - CConnectionArray* tempConnArray = iConnectionArray->DeepCopyL(); - CleanupStack::PushL( tempConnArray ); - - TInt connectionCount = tempConnArray->MdcaCount(); - HBufC* promptTxt = NULL; - if ( connectionCount == KOnlyOneConnection ) - { - HBufC* temp = ( *tempConnArray )[KFirstConnection]->GetNameLC(); - TName iapName = *temp; - CleanupStack::PopAndDestroy( temp ); - promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_SINGLE_CONN, - iapName ); - } - else - { - promptTxt = StringLoader::LoadLC( R_QTN_CMON_CONF_END_ALL_CONNS, - connectionCount ); - TPtr temp( promptTxt->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - } - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt ret = dlg->ExecuteLD( R_END_CONN_CONFIRMATION_QUERY, *promptTxt ); - CleanupStack::PopAndDestroy( promptTxt ); - - CConnectionInfoBase* connection = NULL; - TUint connectionId( 0 ); - - CMUILOGGER_WRITE_F( "ret: %d", ret ); - - /* End connections one by one, First CSD, after GPRS and WLAN. */ - if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) - { - for ( TUint i = 0; i < iConnectionArray->MdcaCount(); ++i ) - { - connection = ( *iConnectionArray )[i]; - connection->SetAllDeletedFromCMUI(); - connection->RefreshConnectionListBoxItemTextL(); - } - - DrawFirstAllListBoxItem(); - - TConnMonBearerType bearer; - for ( TUint i = 0; i < connectionCount; ++i ) - { - CMUILOGGER_WRITE_F( "i: %d", i ); - - connection = ( *tempConnArray )[i]; - - bearer = connection->GetBearerType(); - switch ( bearer ) - { - case EBearerCSD: - case EBearerExternalCSD: - case EBearerWcdmaCSD: - case EBearerExternalWcdmaCSD: - case EBearerHSCSD: - case EBearerExternalHSCSD: - { - connectionId = connection->GetConnectionId(); - iMonitor->SetBoolAttribute( connectionId, 0, - KConnectionStop, ETrue ); - CMUILOGGER_WRITE_F( "CSD i: %d", i ); - CMUILOGGER_WRITE_F( "connectionId: %d", connectionId ); - break; - } - default : - { - break; - } - } - } - - for ( TUint i = 0; i < connectionCount; ++i ) - { - CMUILOGGER_WRITE_F( "i: %d", i ); - - connection = ( *tempConnArray )[i]; - - bearer = connection->GetBearerType(); - switch ( bearer ) - { - case EBearerGPRS: - case EBearerWCDMA: - case EBearerEdgeGPRS: - case EBearerExternalGPRS: - case EBearerExternalWCDMA: - case EBearerExternalEdgeGPRS: - case EBearerWLAN: - { - connectionId = connection->GetConnectionId(); - iMonitor->SetBoolAttribute( connectionId, 0, - KConnectionStop, ETrue ); - CMUILOGGER_WRITE_F( "GPRS i: %d", i ); - CMUILOGGER_WRITE_F( "connectionId: %d", connectionId ); - break; - } - default : - { - break; - } - } - } - } - else - { - for ( TUint i = 0; - ( ( i < connectionCount ) && - ( KErrNotFound != iActiveWrapper->iStatus.Int() ) ); ++i ) - { - connection = ( *tempConnArray )[i]; - connectionId = connection->GetConnectionId(); - TInt connStatus; - iActiveWrapper->StartGetIntAttribute( connectionId, - iMonitor, - KConnectionStatus, - ( ( TInt& )( connStatus ) ) ); - } - - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - /* It is already closed */ - /* An information note must be displayed */ - CAknGlobalNote * note = CAknGlobalNote::NewL(); - CleanupStack::PushL( note ); - HBufC* informationText = - StringLoader::LoadLC( R_QTN_CMON_INFO_CONN_ALREADY_END ); - - note->ShowNoteL(EAknGlobalInformationNote, *informationText ); - CleanupStack::PopAndDestroy( informationText ); - CleanupStack::PopAndDestroy( note ); - CMUILOGGER_WRITE( "It is already closed in All" ); - } - } - - CleanupStack::PopAndDestroy( tempConnArray ); - - CMUILOGGER_LEAVEFN( "EndAllConnectionL - end" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::ListBox -// --------------------------------------------------------- -// -CAknDoubleGraphicStyleListBox* CConnectionMonitorUiContainer::ListBox() const - { - return iListBox; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::SetIconsL() -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::SetIconsL() - { - CMUILOGGER_ENTERFN( "SetIconsL" ); - - TFileName iconsFileName; - - iconsFileName.Append( KDriveZ ); - - iconsFileName.Append( KDC_APP_BITMAP_DIR ); - - iconsFileName.Append( KConnectionMonitorUiMBMFile ); - - CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( KGranularity ); - CleanupStack::PushL( icons ); - - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropWmlGprs, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_wml_gprs, - EMbmConnectionmonitoruiQgn_prop_wml_gprs_mask ) ); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropWmlCsd, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_wml_csd, - EMbmConnectionmonitoruiQgn_prop_wml_csd_mask ) ); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropWmlHscsd, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_wml_hscsd, - EMbmConnectionmonitoruiQgn_prop_wml_hscsd_mask ) ); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropEmpty, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_empty, - EMbmConnectionmonitoruiQgn_prop_empty_mask ) ); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropWmlSms, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended, - EMbmConnectionmonitoruiQgn_prop_cmon_gprs_suspended_mask ) ); - - icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, - KAknsIIDQgnPropWlanBearer, - iconsFileName, - EMbmConnectionmonitoruiQgn_prop_wlan_bearer, - EMbmConnectionmonitoruiQgn_prop_wlan_bearer_mask ) ); - - iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons ); - CleanupStack::Pop( icons ); // icons - CMUILOGGER_LEAVEFN( "SetIconsL" ); - - } - -// --------------------------------------------------------------------------- -// void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType ) -// Handle resource change events. -// --------------------------------------------------------------------------- -// -void CConnectionMonitorUiContainer::HandleResourceChange( TInt aType ) - { - CMUILOGGER_ENTERFN( "HandleResourceChange" ); - CMUILOGGER_WRITE_F( "aType: %d", aType ); - - CCoeControl::HandleResourceChange( aType ); - - if ( aType == KAknsMessageSkinChange ) - { - TInt error( KErrNone ); - TRAP( error, SetIconsL() ); - CMUILOGGER_WRITE_F( "KAknsMessageSkinChange error: %d", error ); - SizeChanged(); - } - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - SetRect( mainPaneRect ); - DrawNow(); - } - CMUILOGGER_LEAVEFN( "HandleResourceChange" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::GetPanesL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::GetPanesL() - { - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - - iNaviPane = STATIC_CAST( CAknNavigationControlContainer*, - statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) ); - - PushAndRefreshNaviPaneL(); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::PushAndRefreshNaviPaneL() - { - CMUILOGGER_ENTERFN( "PushAndRefreshNaviPaneL - start" ); - - HBufC* textOfNaviPane = NULL; - TUint countOfConnection = iConnectionArray->NumberOfActiveConnections(); - CMUILOGGER_WRITE_F( "countOfConnection: %d", countOfConnection ); - - if ( iNaviDecorator ) - { - PopNaviPane(); - } - - if ( countOfConnection ) - { - if ( countOfConnection == 1 ) - { - textOfNaviPane = StringLoader::LoadLC( - R_QTN_CMON_NAVI_ONE_ACTIVE_CONN ); - } - else - { - textOfNaviPane = StringLoader::LoadLC( - R_QTN_CMON_NAVI_MANY_ACTIVE_CONNS, - countOfConnection ); - } - } - else - { - textOfNaviPane = KEmpty().AllocLC(); - } - - TPtr temp( textOfNaviPane->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( *textOfNaviPane ); - CleanupStack::PopAndDestroy( textOfNaviPane ); - - iNaviPane->PushL( *iNaviDecorator ); - CMUILOGGER_LEAVEFN( "PushAndRefreshNaviPaneL - end" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::PopNaviPane -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::PopNaviPane() - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::FocusChanged -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::FocusChanged( TDrawNow aDrawNow ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiContainer::FocusChanged" ); - CCoeControl::FocusChanged( aDrawNow ); - if ( iListBox ) - { - iListBox->SetFocus( IsFocused() ); - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiContainer::FocusChanged" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::GetHelpContext() -// --------------------------------------------------------- -// -void CConnectionMonitorUiContainer::GetHelpContext( TCoeHelpContext& aContext) const - { - aContext.iMajor = KUidConnMonUI; - aContext.iContext = KCMON_HLP_CMON_MAIN_VIEW; - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsContainer.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsContainer.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,584 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: container control class -* -* -*/ - -// INCLUDE FILES -#include "ConnectionMonitorUiDetailsContainer.h" - -#include //for CNaviPane -#include //for CAknNavigationDecorator -#include -#include - -#include "ConnectionArray.h" -#include "ConnectionMonitorUiLogger.h" -#include "ConnectionMonitorUiDetailsView.h" -#include "ConnectionMonitorUi.hrh" - -// CONSTANTS - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::ConstructL( const TRect& aRect ) -// EPOC two phased constructor -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::ConstructL( const TRect& aRect, - CConnectionMonitorUiDetailsView* aParentView ) - { - CMUILOGGER_WRITE( "CConnectionMonitorUiDetailsContainer::ConstructL" ); - CreateWindowL(); - - iParentView = aParentView; - iListBox = new( ELeave ) CAknSingleHeadingStyleListBox; - iListBox->SetContainerWindowL( *this ); - TInt flags = 0; - flags |= EAknListBoxViewerFlags | EAknListBoxDisableItemSpecificMenu; - iListBox->ConstructL( this, flags ); - iListBox->CreateScrollBarFrameL( ETrue ); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); - - CMUILOGGER_WRITE( "Creating connection details array" ); - - iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - - SetRect( aRect ); - - HBufC* noConn = StringLoader::LoadLC( R_QTN_CMON_NO_ACTIVE_CONNECTIONS, - iEikonEnv ); - CListBoxView *lbview = iListBox->View(); - lbview->SetListEmptyTextL( *noConn ); - CleanupStack::PopAndDestroy( noConn ); - - - GetPanesL(); - - ActivateL(); - CMUILOGGER_WRITE( "CConnectionMonitorUiDetailsContainer::ConstructL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL( - TUint aConnectionIndex ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL" ); - CMUILOGGER_WRITE_F( "aConnectionIndex : %d", &aConnectionIndex ); - CMUILOGGER_WRITE_F( "iConnectionArray->MdcaCount() : %d", - iConnectionArray->MdcaCount() ); - - CConnectionInfoBase* temp = ( *iConnectionArray ).At( aConnectionIndex ); - CDesCArrayFlat* tempArray = temp ? temp->GetDetailsArray() : NULL ; - if ( tempArray ) - { - iConnectionIndex = aConnectionIndex; - iConnectionInfo = temp; - iListBox->Model()->SetItemTextArray( tempArray ); - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - iListBox->Reset(); - iListBox->UpdateScrollBarsL(); - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::SetSelectedConnectionL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::~CConnectionMonitorUiDetailsContainer -// --------------------------------------------------------- -// -CConnectionMonitorUiDetailsContainer::~CConnectionMonitorUiDetailsContainer() - { - delete iListBox; - delete iNaviDecorator; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiContainer::CConnectionMonitorUiContainer -// --------------------------------------------------------- -// -CConnectionMonitorUiDetailsContainer::CConnectionMonitorUiDetailsContainer( - const CConnectionArray* const aConnectionArray ) - : iConnectionArray( aConnectionArray ) - { - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::SizeChanged() -// Called by framework when the view size is changed -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::SizeChanged() - { - iListBox->SetRect( Rect() ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::CountComponentControls() const -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiDetailsContainer::CountComponentControls() const - { - return 1; // return nbr of controls inside this container - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::ComponentControl( TInt aIndex ) const -// --------------------------------------------------------- -// -CCoeControl* CConnectionMonitorUiDetailsContainer::ComponentControl( - TInt aIndex ) const - { - switch ( aIndex ) - { - case 0: - return iListBox; - default: - return NULL; - } - } - -// ---------------------------------------------------------------------------- -// CLogsDetailView::HandleNaviDecoratorEventL -// Handler for pointer events, when the Navi Pane arrows have been tapped -// ---------------------------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::HandleNaviDecoratorEventL( TInt aEventID ) - { - switch (aEventID) - { - case MAknNaviDecoratorObserver::EAknNaviDecoratorEventRightTabArrow: - if ( iConnectionIndex < (iConnectionArray->MdcaCount() - 1) ) { - SetSelectedConnectionL(iConnectionIndex + 1); - } - break; - - case MAknNaviDecoratorObserver::EAknNaviDecoratorEventLeftTabArrow: - if ( iConnectionIndex > 0 ) { - SetSelectedConnectionL(iConnectionIndex - 1); - } - break; - - default: - return; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::OfferKeyEventL -// --------------------------------------------------------- -// -TKeyResponse CConnectionMonitorUiDetailsContainer::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::OfferKeyEventL" ); - - TKeyResponse result( EKeyWasNotConsumed ); - TInt index = iConnectionIndex; - TInt index_closed = iConnectionIndex; - CConnectionInfoBase* connection = NULL; - if ( aType == EEventKey ) - { - if ( ( aKeyEvent.iCode == EKeyLeftArrow ) || - ( aKeyEvent.iCode == EKeyRightArrow ) ) - { - - TInt dir = 0; - switch (aKeyEvent.iCode) - { - case EKeyLeftArrow: - { - dir = -1; - break; - } - case EKeyRightArrow: - { - dir = 1; - break; - } - } - // Handle mirrored layout by negating the directionality - if (AknLayoutUtils::LayoutMirrored()) - { - dir = -1 * dir; - } - - index += dir; - - TBool step( EFalse ); - - CMUILOGGER_WRITE_F( "OfferKeyEventL index: %d", index ); - - while ( ( index > -1 ) && ( index < iConnectionArray->MdcaCount() - && !step ) ) - { - connection = ( *iConnectionArray )[index]; - TBool alive = connection->IsAlive(); - CMUILOGGER_WRITE_F( "OfferKeyEventL alive: %b", alive ); - - if ( alive ) - { - if ( ( index_closed > -1 ) && - ( index_closed < iConnectionArray->MdcaCount() ) ) - { - CConnectionInfoBase* connection_closed - = ( *iConnectionArray )[index_closed]; - - if ( iParentView->GetViewRefreshState() ) - { - step = ETrue; - CConnectionMonitorUiAppUi* appUi = - (CConnectionMonitorUiAppUi*) - iEikonEnv->EikAppUi(); - appUi->DeleteDetailsView( - GetSelectedConnectionInfo() - ->GetConnectionId(), - GetSelectedConnectionInfo() ); - appUi->StartTimerL(); - iParentView->SetViewRefreshState( EFalse ); - if ( index_closed > index ) - { - iConnectionInfo = connection; - iConnectionIndex = index; - } - iListBox->Model()->SetItemTextArray( - connection->GetDetailsArray() ); - iListBox->DrawNow(); - iListBox->UpdateScrollBarsL(); - PushAndRefreshNaviPaneL(); - } - else - { - step = ETrue; - iConnectionInfo = connection; - iConnectionIndex = index; - iListBox->Model()->SetItemTextArray( - connection->GetDetailsArray() ); - iListBox->DrawNow(); - iListBox->UpdateScrollBarsL(); - PushAndRefreshNaviPaneL(); - } - } - } - else - { - index += dir; - } - } - result = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - else if ( aKeyEvent.iCode == EKeyDevice3 ) - // selection key press -> go back to main view - { - CConnectionMonitorUiAppUi::Static()->ActivateLocalViewL( - TUid::Uid( EConnectionMonitorUiMainViewTab ) ); - result = EKeyWasConsumed; - } - else - { - result = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::OfferKeyEventL" ); - - return result; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::OnEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::OnEventL( - const CConnMonEventBase& aConnMonEvent, - const TInt aIndex ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::OnEventL()" ); - CMUILOGGER_WRITE_F( "aIndex : %d", aIndex ); - - switch ( aConnMonEvent.EventType() ) - { - case EConnMonDeleteConnection: - { - // Do nothing - } - break; - case EConnMonCreateConnection: - { - CMUILOGGER_WRITE_F( "iConnectionInfo : %d", iConnectionInfo ); - - if ( !iConnectionInfo ) - { - SetSelectedConnectionL( 0 ); - } - break; - } - default: - { - if ( !iConnectionInfo ) - { - SetSelectedConnectionL( 0 ); - } - else if ( ( aIndex == iConnectionIndex ) && ( iConnectionArray->MdcaCount() ) ) - { - iListBox->DrawNow(); - iListBox->UpdateScrollBarsL(); - } - break; - } - } - PushAndRefreshNaviPaneL(); - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::OnEventL()" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::OnTimerEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::OnTimerEventL() - { - if ( iConnectionArray->MdcaCount() ) - { - iListBox->DrawNow(); - - CMUILOGGER_WRITE_F( "CMUIDW GetStatus() before: %d", - iConnectionInfo->GetStatus() ); - if ( iConnectionInfo->GetStatus() == EConnectionClosing ) - { - CConnectionMonitorUiAppUi* tempApUi = - CConnectionMonitorUiAppUi::Static(); - iConnectionInfo->StatusChangedL(); - } - CMUILOGGER_WRITE_F( "CMUIDW GetStatus() after: %d", - iConnectionInfo->GetStatus() ); - } - PushAndRefreshNaviPaneL(); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::DrawFirstAllListBoxItem -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::DrawFirstAllListBoxItem() - { - TInt count = iListBox->Model()->NumberOfItems() - 1; - for ( TInt i = count; i > -1; --i ) - { - iListBox->DrawItem( i ); - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::ListBox -// --------------------------------------------------------- -// -CAknSingleHeadingStyleListBox* - CConnectionMonitorUiDetailsContainer::ListBox() const - { - return iListBox; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::GetPanesL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::GetPanesL() - { - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - - iNaviPane = STATIC_CAST( CAknNavigationControlContainer*, - statusPane->ControlL( TUid::Uid(EEikStatusPaneUidNavi ) ) ); - - PushAndRefreshNaviPaneL(); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::PushAndRefreshNaviPaneL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::PushAndRefreshNaviPaneL() - { - TUint countOfConnection = iConnectionArray->MdcaCount(); - - CMUILOGGER_WRITE_F( "countOfConnection : %d", countOfConnection ); - - if ( ( iConnectionIndex > countOfConnection ) && // spec. index update - ( countOfConnection == 0 ) ) - { - iConnectionIndex = iConnectionArray-> - GetArrayIndex( - GetSelectedConnectionInfo() - ->GetConnectionId() ); - } - - CMUILOGGER_WRITE_F( "iConnectionIndex : %d", iConnectionIndex ); - - if ( iNaviDecorator ) - { - PopNaviPane(); - } - - if ( iParentView->GetViewRefreshState() ) // connection closed - { - iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC ); - } - else // connection alive - { - HBufC* textOfNaviPane = NULL; - - CArrayFixFlat* array = new( ELeave ) CArrayFixFlat( 2 ); - CleanupStack::PushL( array ); - - if ( ( countOfConnection == 1 ) && - ( iConnectionIndex + 1 >= countOfConnection ) ) - { - array->AppendL( countOfConnection ); - } - else - { - array->AppendL( countOfConnection ? iConnectionIndex + 1 : 0 ); - } - - array->AppendL( countOfConnection ); - textOfNaviPane = StringLoader::LoadLC( - R_QTN_CMON_NAVI_NOF_CONNECTION, - *array ); - - iNaviDecorator = iNaviPane->CreateNavigationLabelL( - *textOfNaviPane ); - - CleanupStack::PopAndDestroy( textOfNaviPane ); - CleanupStack::PopAndDestroy( array ); - } - - iNaviDecorator->MakeScrollButtonVisible( ETrue ); - - CAknNavigationDecorator::TScrollButton left = CAknNavigationDecorator::ELeftButton; - CAknNavigationDecorator::TScrollButton right = CAknNavigationDecorator::ERightButton; - if ( AknLayoutUtils::LayoutMirrored() ) - { - left = CAknNavigationDecorator::ERightButton; - right = CAknNavigationDecorator::ELeftButton; - } - - if ( iParentView->GetViewRefreshState() ) - { - iNaviDecorator->SetScrollButtonDimmed( left, - ( ( iConnectionIndex == 0 ) || - ( countOfConnection == 0 ) ) ); - } - else - { - iNaviDecorator->SetScrollButtonDimmed( - left, - ( ( iConnectionIndex == 0 ) || - ( countOfConnection == 0 ) || - ( ( countOfConnection == 1 ) && - ( iConnectionIndex + 1 >= - countOfConnection ) ) ) ); - } - - if ( iParentView->GetViewRefreshState() ) - { - iNaviDecorator->SetScrollButtonDimmed( right, - iConnectionIndex >= countOfConnection ); - } - else - { - iNaviDecorator->SetScrollButtonDimmed( right, - iConnectionIndex + 1 >= countOfConnection ); - } - - iNaviDecorator->SetNaviDecoratorObserver( this ); - - iNaviPane->PushL( *iNaviDecorator ); - } - - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::PopNaviPane -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::PopNaviPane() - { - iNaviPane->Pop( iNaviDecorator ); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::HandleResourceChange -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::HandleResourceChange( TInt aType ) - { - CCoeControl::HandleResourceChange( aType ); - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect ); - SetRect( mainPaneRect ); - DrawNow(); - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::FocusChanged -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsContainer::FocusChanged( TDrawNow aDrawNow ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsContainer::FocusChanged" ); - CCoeControl::FocusChanged( aDrawNow ); - if ( iListBox ) - { - iListBox->SetFocus( IsFocused() ); - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsContainer::FocusChanged" ); - } - - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::GetIndexOfSelectedItem -// --------------------------------------------------------- -// -TInt CConnectionMonitorUiDetailsContainer::GetIndexOfSelectedItem() - { - CMUILOGGER_WRITE_F( - "CMUIDetailsContainer::GetIndexOfSelectedItem iConnectionIndex: %d", - iConnectionIndex ); - - return iConnectionIndex; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsContainer::GetSelectedConnectionInfo() -// --------------------------------------------------------- -// - CConnectionInfoBase* CConnectionMonitorUiDetailsContainer:: - GetSelectedConnectionInfo() const - { - return iConnectionInfo; - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsView.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDetailsView.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,238 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: view class -* -* -*/ - - -// INCLUDE FILES -#include -#include "ConnectionMonitorUiDetailsView.h" -#include "ConnectionMonitorUiDetailsContainer.h" -#include "ConnectionMonitorUi.hrh" -#include "ConnectionArray.h" - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// ConnectionMonitorUiDetailsView::ConnectionMonitorUiDetailsView( -// const CConnectionArray* aConnectionArray ) -// --------------------------------------------------------- -// -CConnectionMonitorUiDetailsView::CConnectionMonitorUiDetailsView( - CConnectionArray* const aConnectionArray ) - : CAknView(), - iConnectionArray( aConnectionArray ), - iViewRefreshState( EFalse ) - {} - -// --------------------------------------------------------- -// ConnectionMonitorUiDetailsView::ConstructL() -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::ConstructL() - { - BaseConstructL( R_CONNECTIONMONITORUI_DETAILSVIEW ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView() -// --------------------------------------------------------- -// -CConnectionMonitorUiDetailsView::~CConnectionMonitorUiDetailsView() - { - delete iContainer; - } - -// --------------------------------------------------------- -// TUid CConnectionMonitorUiDetailsView::Id() -// ?implementation_description -// --------------------------------------------------------- -// -TUid CConnectionMonitorUiDetailsView::Id() const - { - return KDetailsViewId; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand ) -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EAknSoftkeyOk: - { - CloseViewL(); - ActivateMainViewL(); - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::CloseViewL() -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::CloseViewL() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::CloseViewL" ); - - if ( GetViewRefreshState() ) - { - // Now delete this view - CConnectionMonitorUiAppUi* appUi = - (CConnectionMonitorUiAppUi*)AppUi(); - appUi->StartTimerL(); - SetViewRefreshState( EFalse ); - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsView::CloseViewL" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::SetSelectedConnectionId -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::SetSelectedConnection( TUint aIndex ) - { - iConnectionId = aIndex; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::GetSelectedConnection -// --------------------------------------------------------- -// -TUint CConnectionMonitorUiDetailsView::GetSelectedConnection() - { - TUint result( KErrNone ); - if ( iContainer ) - { - result = iContainer->GetIndexOfSelectedItem(); - } - return result; - } - - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::DoActivateL(...) -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoActivateL" ); - - if ( !iContainer ) - { - iContainer = new ( ELeave ) CConnectionMonitorUiDetailsContainer( - iConnectionArray ); - iContainer->SetMopParent( this ); - iContainer->ConstructL( ClientRect(), this ); - iContainer->SetSelectedConnectionL( iConnectionId ); - CConnectionMonitorUiAppUi::Static()->StartConnEventNotification( - iContainer ); - iContainer->DrawFirstAllListBoxItem(); - - iContainer->PushAndRefreshNaviPaneL(); - iContainer->MakeVisible( ETrue ); - AppUi()->AddToViewStackL( *this, iContainer ); - } - - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiDetailsView::DoActivateL" ); - - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::DoDeactivate -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::DoDeactivate() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiDetailsView::DoDeactivate" ); - - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - CConnectionMonitorUiAppUi::Static()->StopConnEventNotification( - iContainer ); - iContainer->PopNaviPane(); - iContainer->MakeVisible( EFalse ); - - delete iContainer; - iContainer = NULL; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::HandleListBoxEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::HandleListBoxEventL( - CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - switch ( aEventType ) - { - case EEventEnterKeyPressed: - //case EEventItemDoubleClicked: - case EEventItemSingleClicked: - { - AppUi()->ActivateLocalViewL( - TUid::Uid( EConnectionMonitorUiMainViewTab ) ); - } - break; - - default: - break; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::GetViewRefreshState -// --------------------------------------------------------- -// -TBool CConnectionMonitorUiDetailsView::GetViewRefreshState() - { - return iViewRefreshState; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::SetViewRefreshState -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::SetViewRefreshState( - TBool aViewRefreshState ) - { - iViewRefreshState = aViewRefreshState; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiDetailsView::ActivateMainViewL() -// --------------------------------------------------------- -// -void CConnectionMonitorUiDetailsView::ActivateMainViewL() - { - AppUi()->ActivateLocalViewL( TUid::Uid( EConnectionMonitorUiMainViewTab ) ); - } - - -// End of File - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDocument.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiDocument.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: application class -* -* -*/ - - -// INCLUDE FILES -#include "ConnectionMonitorUiDocument.h" -#include "ConnectionMonitorUiAppUi.h" - -// ================= MEMBER FUNCTIONS ======================= - -// constructor -CConnectionMonitorUiDocument::CConnectionMonitorUiDocument - ( - CEikApplication& aApp - ) -: CAknDocument(aApp) - { - } - -// destructor -CConnectionMonitorUiDocument::~CConnectionMonitorUiDocument() - { - } - -// EPOC default constructor can leave. -void CConnectionMonitorUiDocument::ConstructL() - { - } - -// Two-phased constructor. -CConnectionMonitorUiDocument* CConnectionMonitorUiDocument::NewL( - CEikApplication& aApp) // CConnectionMonitorUiApp reference - { - CConnectionMonitorUiDocument* myself = - new (ELeave) CConnectionMonitorUiDocument( aApp ); - CleanupStack::PushL( myself ); - myself->ConstructL(); - CleanupStack::Pop( myself ); - - return myself; - } - -// ---------------------------------------------------- -// CConnectionMonitorUiDocument::CreateAppUiL() -// constructs CConnectionMonitorUiAppUi -// ---------------------------------------------------- -// -CEikAppUi* CConnectionMonitorUiDocument::CreateAppUiL() - { - return new (ELeave) CConnectionMonitorUiAppUi; - } - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiView.cpp --- a/connectionmonitoring/connectionmonitorui/src/ConnectionMonitorUiView.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,421 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: view class -* -* -*/ - - -// INCLUDE FILES -#include -#include //for CAknTitlePane -#include -#include - -#include -#include - - -#include "ConnectionMonitorUiDetailsView.h" -#include "ConnectionMonitorUi.hrh" -#include "ConnectionMonitorUiAppUi.h" -#include "ConnectionMonitorUiView.h" -#include "ConnectionMonitorUiContainer.h" -#include "ConnectionArray.h" -#include "FeatureManagerWrapper.h" - - -// CONSTANTS - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CConnectionMonitorUiView::CConnectionMonitorUiView -// --------------------------------------------------------- -// -#ifdef RD_CONTROL_PANEL -CConnectionMonitorUiView::CConnectionMonitorUiView( - CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - TBool aIsEmbedded, - CActiveWrapper* aActiveWrapper ) - : CAknView(), - iConnectionArray( aConnectionArray ), - iMonitor( aMonitor ), - isHelpSupported( EFalse ), - iIsEmbedded( EFalse ), - iActiveWrapper( aActiveWrapper ) - { - iIsEmbedded = aIsEmbedded; - } -#else -CConnectionMonitorUiView::CConnectionMonitorUiView( - CConnectionArray* const aConnectionArray, - RConnectionMonitor* aMonitor, - CActiveWrapper* aActiveWrapper ) - : CAknView(), - iConnectionArray( aConnectionArray ), - iMonitor( aMonitor ), - isHelpSupported( EFalse ), - iActiveWrapper( aActiveWrapper ) - { - } -#endif // RD_CONTROL_PANEL - -// --------------------------------------------------------- -// CConnectionMonitorUiView::ConstructL -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::ConstructL() - { - isHelpSupported = FeatureManager::FeatureSupported( KFeatureIdHelp ); - - TInt actView( NULL ); - -#ifdef RD_CONTROL_PANEL - if ( iIsEmbedded ) - { - actView = R_CP_CONNECTIONMONITORUI_VIEW; - } - else - { - actView = R_CONNECTIONMONITORUI_VIEW; - } -#else - actView = R_CONNECTIONMONITORUI_VIEW; -#endif // RD_CONTROL_PANEL - - BaseConstructL( actView ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::~CConnectionMonitorUiView() -// --------------------------------------------------------- -// -CConnectionMonitorUiView::~CConnectionMonitorUiView() - { - delete iContainer; - } - -// --------------------------------------------------------- -// TUid CConnectionMonitorUiView::Id() -// --------------------------------------------------------- -// -TUid CConnectionMonitorUiView::Id() const - { - return KConnectionsViewId; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::HandleCommandL( TInt aCommand ) -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::HandleCommandL( TInt aCommand ) - { - switch ( aCommand ) - { - case EAknSoftkeyDetails: - { - if ( IsSelectedConnectionAlive() ) - { - BringupDetailsViewL(); - } - break; - } - case EConnectionMonitorUiCmdAppDetails: - { - BringupDetailsViewL(); - break; - } - case EConnectionMonitorUiCmdAppEndConn: - { - iContainer->EndConnectionL(); - break; - } - case EConnectionMonitorUiCmdAppEndAll: - { - iContainer->EndAllConnectionL(); - break; - } - case EAknCmdHelp: - { - if ( isHelpSupported ) - { - HlpLauncher::LaunchHelpApplicationL( - CEikonEnv::Static()->WsSession(), - CEikonEnv::Static()->EikAppUi()->AppHelpContextL() ); - } - break; - } - default: - { - AppUi()->HandleCommandL( aCommand ); - break; - } - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::DynInitMenuPaneL() -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::DynInitMenuPaneL( TInt aResourceId, - CEikMenuPane* aMenuPane ) - { - MEikMenuObserver::DynInitMenuPaneL( aResourceId, aMenuPane ); - // This is a security measure to prevent menu pane updates when - // the main view is not active. This should not happen but - // just to be safe it is checked. - if ( !iContainer ) - { - return; - } - switch ( aResourceId ) - { - case R_CONNECTIONMONITORUI_VIEW_MENU: - { - if ( !iConnectionArray->MdcaCount() ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppDetails ); - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndConn ); - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndAll ); - } - else if ( iConnectionArray->MdcaCount() == 1 ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndAll ); - if ( !IsSelectedConnectionAlive() ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppDetails ); - } - else if ( IsSelectedConnectionSuspended() ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndConn ); - } - } - else if ( iConnectionArray->NumberOfSuspendedConnections() >= 1 ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndAll ); - if ( IsSelectedConnectionSuspended() ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndConn ); - } - } - else - { - if ( !IsSelectedConnectionAlive() ) - { - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppDetails ); - aMenuPane->DeleteMenuItem( - EConnectionMonitorUiCmdAppEndConn ); - } - } - break; - } - case R_CONNECTIONMONITORUI_APP_MENU: - { - if ( !isHelpSupported ) - { - aMenuPane->DeleteMenuItem( EAknCmdHelp ); - } - break; - } - default: - { - break; - } - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::HandleListBoxEventL -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::HandleListBoxEventL( CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - switch ( aEventType ) - { - case EEventEnterKeyPressed: - //case EEventItemDoubleClicked: - case EEventItemSingleClicked: - { - if ( IsSelectedConnectionAlive() ) - { - BringupDetailsViewL(); - } - } - break; - default: - break; - } - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::DoActivateL -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/ ) - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiView::DoActivateL" ); - - if ( !iContainer ) - { - iContainer = new( ELeave ) CConnectionMonitorUiContainer( - iConnectionArray, - iMonitor, - iActiveWrapper ); - iContainer->SetMopParent( this ); - - - CConnectionMonitorUiDetailsView* view = - STATIC_CAST( CConnectionMonitorUiDetailsView*, - AppUi()->View( TUid::Uid( EConnectionMonitorUiDetailsViewTab ) ) ); - - TInt index = view->GetSelectedConnection(); - CMUILOGGER_WRITE_F( "index: %d", index ); - - iContainer->ConstructL( index, ClientRect() ); - iContainer->ListBox()->SetListBoxObserver( this ); - - CConnectionMonitorUiAppUi::Static()->StartConnEventNotification( - iContainer ); - iContainer->PushAndRefreshNaviPaneL(); - AppUi()->AddToViewStackL( *this, iContainer ); - ConnectionKeyObserver(); - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiView::DoActivateL" ); - - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::DoDeactivate -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::DoDeactivate() - { - CMUILOGGER_ENTERFN( "CConnectionMonitorUiView::DoDeactivate" ); - - if ( iContainer ) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - CConnectionMonitorUiAppUi::Static()->StopConnEventNotification( - iContainer ); - iContainer->PopNaviPane(); - delete iContainer; - iContainer = NULL; - } - CMUILOGGER_LEAVEFN( "CConnectionMonitorUiView::DoDeactivate" ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::SetTitlePaneTextL -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::SetTitlePaneTextL( TInt aResourceId ) - { - CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* titlePane = - ( CAknTitlePane* )statusPane->ControlL( - TUid::Uid( EEikStatusPaneUidTitle ) ); - HBufC* text = iEikonEnv->AllocReadResourceLC( aResourceId ); - titlePane->SetTextL( text->Des() ); - CleanupStack::PopAndDestroy( text ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::BringupDetailsViewL -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::BringupDetailsViewL() - { - CConnectionMonitorUiDetailsView* view = - STATIC_CAST( CConnectionMonitorUiDetailsView*, - AppUi()->View( TUid::Uid( - EConnectionMonitorUiDetailsViewTab ) ) ); - - TInt selIndex = iContainer->SelectedConnection(); - view->SetSelectedConnection( selIndex ); - AppUi()->ActivateLocalViewL( - TUid::Uid( EConnectionMonitorUiDetailsViewTab ) ); - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::IsSelectedConnectionAlive -// --------------------------------------------------------- -// -TBool CConnectionMonitorUiView::IsSelectedConnectionAlive() const - { - TInt selIndex = iContainer->SelectedConnection(); - TBool result( EFalse ); - if ( selIndex > -1 ) - { - result = ( *iConnectionArray )[selIndex]->IsAlive(); - } - - return result; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::IsSelectedConnectionSuspended -// --------------------------------------------------------- -// -TBool CConnectionMonitorUiView::IsSelectedConnectionSuspended() const - { - TInt selIndex = iContainer->SelectedConnection(); - TBool result( EFalse ); - if ( selIndex > -1 ) - { - result = ( *iConnectionArray )[selIndex]->IsSuspended(); - } - - return result; - } - -// --------------------------------------------------------- -// CConnectionMonitorUiView::ConnectionKeyObserver -// --------------------------------------------------------- -// -void CConnectionMonitorUiView::ConnectionKeyObserver() const - { - if ( !( iConnectionArray->MdcaCount() ) ) - { - Cba()->MakeCommandVisible( EAknSoftkeyDetails,EFalse ); - } - else - { - if ( iConnectionArray->NumberOfActiveConnections() ) - { - Cba()->MakeCommandVisible( EAknSoftkeyDetails,ETrue ); - } - else - { - Cba()->MakeCommandVisible( EAknSoftkeyDetails,EFalse ); - } - } - } - - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/CsdConnectionInfo.cpp --- a/connectionmonitoring/connectionmonitorui/src/CsdConnectionInfo.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,444 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a connection -* -* -*/ - - -// INCLUDE FILES -//#include -#include -#include -#include -#include - -#include "ConnectionMonitorUiLogger.h" -#include "CsdConnectionInfo.h" -#include "ActiveWrapper.h" - -// CONSTANTS - -LOCAL_D const TUint KDetailsArrayGranularityInternal = 9; -LOCAL_D const TUint KDetailsArrayGranularityExternal = 4; - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CCsdConnectionInfo::NewL -// --------------------------------------------------------- -// -CCsdConnectionInfo* CCsdConnectionInfo::NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) - { - CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - start " ); - - CCsdConnectionInfo* self = new ( ELeave ) CCsdConnectionInfo( - aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ); - CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - created " ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - CMUILOGGER_WRITE( "NewL, CCsdsConnectionInfo - end " ); - return self; - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::~CCsdConnectionInfo -// --------------------------------------------------------- -// -CCsdConnectionInfo::~CCsdConnectionInfo() - { - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::CCsdConnectionInfo -// --------------------------------------------------------- -// -CCsdConnectionInfo::CCsdConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) : - CConnectionInfoBase( aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ) - { - CMUILOGGER_WRITE( "CCsdConnectionInfo constuctor" ); - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::ConstructL -// --------------------------------------------------------- -// -void CCsdConnectionInfo::ConstructL() - { - CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() start" ); - - iActiveWrapper->StartGetStringAttribute( iConnectionId, - iConnectionMonitor, - KTelNumber, - iDialupNumber ); - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "CCsdConnectionInfo::ConstructL() status: %d", - err ); - if ( err != KErrNone ) - { - User::Leave( err ); - } - - CConnectionInfoBase::ConstructL(); - CMUILOGGER_WRITE( "CCsdConnectionInfo::ConstructL() end" ); - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::DeepCopyL -// --------------------------------------------------------- -// -CConnectionInfoBase* CCsdConnectionInfo::DeepCopyL() - { - CCsdConnectionInfo* temp = new ( ELeave ) CCsdConnectionInfo( - iConnectionId, - iConnectionMonitor, - iConnectionBearerType, - iActiveWrapper ); - - temp->iConnectionName = iConnectionName; - temp->iConnectionStatus = iConnectionStatus; - temp->iUploaded = iUploaded; - temp->iDownloaded = iDownloaded; - temp->iStartTime = iStartTime; - temp->iDuration = iDuration; - temp->iLastSpeedUpdate = iLastSpeedUpdate; - temp->iUpSpeed = iUpSpeed; - temp->iDownSpeed = iDownSpeed; - temp->iListBoxItemText = iListBoxItemText; - - temp->iDialupNumber = iDialupNumber; - - if ( iDetailsArray ) - { - CleanupStack::PushL( temp ); - temp->ToArrayDetailsL(); - CleanupStack::Pop( temp ); - } - - return temp; - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::GetIconId -// --------------------------------------------------------- -// -TUint CCsdConnectionInfo::GetIconId() const - { - TUint iconId = ECsd; - if ( ( iConnectionBearerType == EBearerHSCSD ) || - ( iConnectionBearerType == EBearerExternalHSCSD ) ) - { - iconId = EHscsd; - } - return iconId; - } - -// --------------------------------------------------------- -// CCsdConnectionInfo::RefreshDetailsL -// --------------------------------------------------------- -// -void CCsdConnectionInfo::RefreshDetailsL() - { - CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL start" ); - - CMUILOGGER_WRITE_F( "before iConnectionBearerType: %d", - ( TInt )iConnectionBearerType ); - - TConnMonBearerType bearerType; - - iActiveWrapper->StartGetIntAttribute( iConnectionId, - iConnectionMonitor, - KBearer, - ( TInt& )bearerType ); - - if ( !iActiveWrapper->iStatus.Int() ) - { - iConnectionBearerType = bearerType; - } - - CMUILOGGER_WRITE_F( "status.Int(): %d", iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "bearerType: %d", ( TInt )bearerType ); - CMUILOGGER_WRITE_F( "after iConnectionBearerType: %d", ( TInt )iConnectionBearerType ); - - if ( iConnectionBearerType < EBearerExternalCSD ) - { - RefreshTransferSpeedsL(); - } - RefreshDuration(); - CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsL end" ); - } - -// --------------------------------------------------------- -// CCsdConnectionInfo::ToStringDialupNumberLC -// --------------------------------------------------------- -// -HBufC* CCsdConnectionInfo::ToStringDialupNumberLC() const - { - HBufC* dialupNumber = iDialupNumber.AllocLC(); - TPtr temp( dialupNumber->Des() ); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( temp ); - - return dialupNumber; - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::RefreshConnectionListBoxItemTextL -// --------------------------------------------------------- -// -void CCsdConnectionInfo::RefreshConnectionListBoxItemTextL() - { - CMUILOGGER_WRITE( - "CCsdConnectionInfo::RefreshConnectionListBoxItemTextL start" ); - - TUint iconId; - HBufC* secondRow = NULL; - - iconId = GetIconId(); - - if ( iConnectionStatus == EConnectionCreated ) - { - secondRow = ToStringDurationLC(); - } - else // if connection has not created yet gives back the status of its. - { - secondRow = ToStringStatusLC( EFalse ); - } - - iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, - &iConnectionName, secondRow ); - CleanupStack::PopAndDestroy( secondRow ); - CMUILOGGER_WRITE( - "CCsdConnectionInfo::RefreshConnectionListBoxItemTextL end" ); - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::RefreshDetailsArrayL -// --------------------------------------------------------- -// -void CCsdConnectionInfo::RefreshDetailsArrayL() - { - CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL start" ); - if ( iDetailsArray ) - { - TBool internal = iConnectionBearerType < EBearerExternalCSD ; - HBufC* temp = NULL; - - if ( internal ) - { - temp = ToStringStatusLC(); - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS, - temp, 2 ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC(), - 3 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC(), - 4 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC(), - 5 - ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC(), 6 ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC(), - 7 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - 0, - ToStringTransferSpeedUpLC(), - 8 - ); - - CleanupStack::PopAndDestroy( 7, temp ); // ToString...LC() - - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - if ( iDetailsArray->Count() > 10 ) - { - iDetailsArray->Delete( 10, - iDetailsArray->Count() - 10 ); - iDetailsArray->Compress(); - } - - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); - // ToStringAppNameLC() - } - else - { - if ( iDetailsArray->Count() > 10 ) - { - iDetailsArray->Delete( 10, iDetailsArray->Count() - 10 ); - iDetailsArray->Compress(); - } - } - } - else - { - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC(), 2 ); - CleanupStack::PopAndDestroy( 1 ); // ToStringDurationLC() - } - } - CMUILOGGER_WRITE( "CCsdConnectionInfo::RefreshDetailsArrayL end" ); - } - - -// --------------------------------------------------------- -// CCsdConnectionInfo::ToArrayDetailsL -// --------------------------------------------------------- -// -void CCsdConnectionInfo::ToArrayDetailsL() - { - CMUILOGGER_ENTERFN("CCsdConnectionInfo::ToArrayDetailsL"); - TBool internal = iConnectionBearerType < EBearerExternalCSD ; - TUint granularity = KDetailsArrayGranularityExternal; - HBufC* temp = NULL; - - if ( internal ) - { - granularity = KDetailsArrayGranularityInternal; - } - delete iDetailsArray; - iDetailsArray = NULL; - iDetailsArray = new ( ELeave ) CDesCArrayFlat( granularity ); - - temp = iConnectionName.AllocLC(); - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CONN_NAME, - temp ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER, - ToStringBearerLC() ); - CleanupStack::PopAndDestroy( 2, temp ); // ToString...LC() - - - if ( internal ) - { - temp = ToStringStatusLC(); - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS, - temp ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC() ); - CleanupStack::PopAndDestroy( 4, temp ); // ToString...LC() - } - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC() ); - CleanupStack::PopAndDestroy( 1 ); // ToStringDurationLC() - - if ( internal ) - { - temp = ToStringTransferSpeedDownLC(); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED, - temp ); - - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringTransferSpeedUpLC() ); - CleanupStack::PopAndDestroy( 2, temp ); // ToString...LC() - } - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CSD_NUMBER, - ToStringDialupNumberLC() ); - CleanupStack::PopAndDestroy( 1 ); // ToStringDialupNumberLC() - - if ( internal ) - { - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); - // ToStringAppNameLC() - } - } - CMUILOGGER_LEAVEFN("CCsdConnectionInfo::ToArrayDetailsL"); - } - - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/EasyWLANConnectionInfo.cpp --- a/connectionmonitoring/connectionmonitorui/src/EasyWLANConnectionInfo.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,371 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a WLAN connection -* -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "EasyWLANConnectionInfo.h" -#include "ConnectionArray.h" -#include - -#include "ConnectionMonitorUiLogger.h" - - -// CONSTANTS -/** -* Count of details of WLAN connection -*/ -LOCAL_D const TUint KMaxNumOfListBoxItems = 14; - - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::NewL -// --------------------------------------------------------- -// -CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) - { - CMUILOGGER_ENTERFN( - "CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL" ); - CEasyWlanConnectionInfo* self = new ( ELeave ) CEasyWlanConnectionInfo( - aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - CMUILOGGER_LEAVEFN( - "CEasyWlanConnectionInfo* CEasyWlanConnectionInfo::NewL" ); - return self; - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::CEasyWlanConnectionInfo -// --------------------------------------------------------- -// -CEasyWlanConnectionInfo::CEasyWlanConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) - : CWlanConnectionInfo( aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ) - { - iEasyWlan= ETrue; - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::ConstructL -// --------------------------------------------------------- -// -void CEasyWlanConnectionInfo::ConstructL() - { - CMUILOGGER_ENTERFN( "void CEasyWlanConnectionInfo::ConstructL()" ); - - CWlanConnectionInfo::ConstructL(); - - CMUILOGGER_LEAVEFN( "void CEasyWlanConnectionInfo::ConstructL()" ); - } - - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::~CEasyWlanConnectionInfo -// --------------------------------------------------------- -// -CEasyWlanConnectionInfo::~CEasyWlanConnectionInfo() - { - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::DeepCopyL -// --------------------------------------------------------- -// -CConnectionInfoBase* CEasyWlanConnectionInfo::DeepCopyL() - { - CEasyWlanConnectionInfo* temp = new ( ELeave ) CEasyWlanConnectionInfo( - iConnectionId, - iConnectionMonitor, - iConnectionBearerType, - iActiveWrapper ); - - temp->iConnectionName = iConnectionName; - temp->iConnectionStatus = iConnectionStatus; - temp->iUploaded = iUploaded; - temp->iDownloaded = iDownloaded; - temp->iStartTime = iStartTime; - temp->iDuration = iDuration; - temp->iLastSpeedUpdate = iLastSpeedUpdate; - temp->iUpSpeed = iUpSpeed; - temp->iDownSpeed = iDownSpeed; - temp->iListBoxItemText = iListBoxItemText; - - temp->iWlanNetworkName = iWlanNetworkName; - temp->iSignalStrength = iSignalStrength; - temp->iNetworkMode = iNetworkMode; - temp->iSecurityMode = iSecurityMode; - temp->iTxPower = iTxPower; - - if ( iDetailsArray ) - { - CleanupStack::PushL( temp ); - temp->ToArrayDetailsL(); - CleanupStack::Pop( temp ); - } - - return temp; - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::ToArrayDetailsL -// --------------------------------------------------------- -// -void CEasyWlanConnectionInfo::ToArrayDetailsL() - { - CMUILOGGER_ENTERFN( "void CEasyWlanConnectionInfo::ToArrayDetailsL()" ); - - HBufC* temp = NULL; - delete iDetailsArray; - iDetailsArray = NULL; - - iDetailsArray = new ( ELeave ) CDesCArrayFlat - ( KMaxNumOfListBoxItems ); - - temp = ToStringBearerLC(); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER, - temp ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS, - ToStringStatusLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_NETWORK_NAME, - GetWlanNetworkNameLC() ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH, - ToStringSignalStrengthLC() - ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_NETWORK_MODE, - ToStringNetworkModeLC() ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_SECURITY_MODE, - ToStringSecurityModeLC() - ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_TX_POWER, - ToStringTxPowerLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC() ); - - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringTransferSpeedUpLC() ); - - CleanupStack::PopAndDestroy - ( - KMaxNumOfListBoxItems - 1, - temp - ); - - CMUILOGGER_WRITE_F( "KMaxNumOfListBoxItems + cCXSupported : %d", - KMaxNumOfListBoxItems ); - - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - for ( TInt i = 0; i < ( sharing ); i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC() - } - - CMUILOGGER_LEAVEFN( "void CEasyWlanConnectionInfo::ToArrayDetailsL()" ); - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::RefreshDetailsArrayL -// --------------------------------------------------------- -// -void CEasyWlanConnectionInfo::RefreshDetailsArrayL() - { - CMUILOGGER_ENTERFN( "CEasyWlanConnectionInfo::RefreshDetailsArrayL()" ); - - HBufC* temp = NULL; - - temp = ToStringStatusLC(); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS, - temp, 1 ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH, - ToStringSignalStrengthLC(), - 3 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_WLAN_TX_POWER, - ToStringTxPowerLC(), - 6 - ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC(), - 7 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC(), - 8 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC(), - 9 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC(), - 10 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC(), - 11 ); - - ToDetailsListBoxItemTextWithReplaceL( 0, - ToStringTransferSpeedUpLC(), - 12 ); - - CleanupStack::PopAndDestroy( 9, temp ); - - TInt count = iDetailsArray->Count(); - TInt realElementsMaxCount = KMaxNumOfListBoxItems; - - CMUILOGGER_WRITE_F( "count : %d", count ); - CMUILOGGER_WRITE_F( "realElementsMaxCount : %d", - realElementsMaxCount ); - - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - if ( count >= realElementsMaxCount ) - { - iDetailsArray->Delete( realElementsMaxCount - 1, - iDetailsArray->Count() - 13 ); - iDetailsArray->Compress(); - } - - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC() - } - else - { - if ( count >= realElementsMaxCount ) - { - iDetailsArray->Delete( realElementsMaxCount - 1, - iDetailsArray->Count() - 13 ); - iDetailsArray->Compress(); - } - } - - CMUILOGGER_LEAVEFN( - "void CEasyWlanConnectionInfo::RefreshDetailsArrayL()" ); - } - -// --------------------------------------------------------- -// CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL -// --------------------------------------------------------- -// -void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL() - { - CMUILOGGER_ENTERFN( - "void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); - - TUint iconId; - HBufC* secondRow = NULL; - - iconId = GetIconId(); - - if ( iConnectionStatus == EConnectionCreated ) - { - secondRow = ToStringDurationLC(); - } - else // if connection has not created yet gives back the status of its. - { - secondRow = ToStringStatusLC( EFalse ); - } - - iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, - &iWlanNetworkName, secondRow ); - CleanupStack::PopAndDestroy( secondRow ); - - CMUILOGGER_LEAVEFN( - "void CEasyWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); - } - - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/FeatureManagerWrapper.cpp --- a/connectionmonitoring/connectionmonitorui/src/FeatureManagerWrapper.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CFeatureManagerWrapper. -* -*/ - - -// INCLUDE FILES -#include "FeatureManagerWrapper.h" - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CFeatureManagerWrapper::CFeatureManagerWrapper -// --------------------------------------------------------- -// -CFeatureManagerWrapper::CFeatureManagerWrapper() : CBase() - { - } - -// --------------------------------------------------------- -// CFeatureManagerWrapper::~CFeatureManagerWrapper -// --------------------------------------------------------- -// -CFeatureManagerWrapper::~CFeatureManagerWrapper() - { - if ( iIsFeatureMgrInitialized ) - { - FeatureManager::UnInitializeLib(); - } - } - -// --------------------------------------------------------- -// CFeatureManagerWrapper::ConstructL -// --------------------------------------------------------- -// -void CFeatureManagerWrapper::ConstructL() - { - FeatureManager::InitializeLibL(); - iIsFeatureMgrInitialized = ETrue ; - } - -// --------------------------------------------------------- -// CFeatureManagerWrapper::NewL -// --------------------------------------------------------- -// -CFeatureManagerWrapper* CFeatureManagerWrapper::NewL() - { - CFeatureManagerWrapper* self = new ( ELeave ) CFeatureManagerWrapper; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -//End of file. - diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/GprsConnectionInfo.cpp --- a/connectionmonitoring/connectionmonitorui/src/GprsConnectionInfo.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,426 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a GPRS connection -* -* -*/ - - -// INCLUDE FILES -//#include -#include -#include -#include -//#include - -#include "ConnectionMonitorUiLogger.h" -#include "GprsConnectionInfo.h" -#include "ActiveWrapper.h" - -// CONSTANTS -LOCAL_D const TUint KDetailsArrayGranularityInternal = 11; -LOCAL_D const TUint KDetailsArrayGranularityExternal = 10; - - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CGprsConnectionInfo::NewL -// --------------------------------------------------------- -// -CGprsConnectionInfo* CGprsConnectionInfo::NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) - { - CGprsConnectionInfo* self = new ( ELeave ) CGprsConnectionInfo( - aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ); - CleanupStack::PushL( self ); - self->ConstructL(); // Have to call this ConstructL at first, - CleanupStack::Pop( self ); - CMUILOGGER_WRITE( "NewL, CGprsConnectionInfo" ); - return self; - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::~CGprsConnectionInfo -// --------------------------------------------------------- -// -CGprsConnectionInfo::~CGprsConnectionInfo() - { - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::CGprsConnectionInfo -// --------------------------------------------------------- -// -CGprsConnectionInfo::CGprsConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) : - CConnectionInfoBase( aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ) - { - CMUILOGGER_WRITE( "CGprsConnectionInfo constuctor" ); - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::ConstructL -// --------------------------------------------------------- -// -void CGprsConnectionInfo::ConstructL() - { - CMUILOGGER_ENTERFN( "CGprsConnectionInfo::ConstructL() start" ); - - iActiveWrapper->StartGetStringAttribute( iConnectionId, - iConnectionMonitor, - KAccessPointName, - iApName ); -#ifdef __WINS__ - iApName = _L( "LAN" ); -#else - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "CGprsConnectionInfo::ConstructL status: %d", err ); - if ( err != KErrNone ) - { - User::Leave( err ); - } -#endif - CMUILOGGER_WRITE_F( "iApName Connection name: %S", &iApName ); - - CConnectionInfoBase::ConstructL(); // and base class ConstructL next. - CMUILOGGER_WRITE( "CGprsConnectionInfo::ConstructL() end" ); - } - -// --------------------------------------------------------- -// CGprsConnectionInfo::DeepCopyL -// --------------------------------------------------------- -// -CConnectionInfoBase* CGprsConnectionInfo::DeepCopyL() - { - CGprsConnectionInfo* temp = new ( ELeave ) CGprsConnectionInfo( - iConnectionId, - iConnectionMonitor, - iConnectionBearerType, - iActiveWrapper ); - - temp->iConnectionName = iConnectionName; - temp->iConnectionStatus = iConnectionStatus; - temp->iUploaded = iUploaded; - temp->iDownloaded = iDownloaded; - temp->iStartTime = iStartTime; - temp->iDuration = iDuration; - temp->iLastSpeedUpdate = iLastSpeedUpdate; - temp->iUpSpeed = iUpSpeed; - temp->iDownSpeed = iDownSpeed; - temp->iListBoxItemText = iListBoxItemText; - - temp->iApName = iApName; - - if ( iDetailsArray ) - { - CleanupStack::PushL( temp ); - temp->ToArrayDetailsL(); - CleanupStack::Pop( temp ); - } - - return temp; - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::GetIconId -// --------------------------------------------------------- -// -TUint CGprsConnectionInfo::GetIconId() const - { - TUint iconId = EGprs; - if ( iConnectionStatus == EConnectionSuspended ) - { - iconId = ESuspended; - } - return iconId; - } - -// --------------------------------------------------------- -// CGprsConnectionInfo::RefreshDetailsL -// --------------------------------------------------------- -// -void CGprsConnectionInfo::RefreshDetailsL() - { - CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsL start" ); - - iActiveWrapper->StartGetStringAttribute( iConnectionId, - iConnectionMonitor, - KAccessPointName, - iApName ); -#ifdef __WINS__ - iActiveWrapper->Cancel(); - iApName = _L( "LAN" ); -#else - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "CGprsConnectionInfo::RefreshDetailsL status: %d", - err ); - if ( err != KErrNone ) - { - User::Leave( err ); - } -#endif - CMUILOGGER_WRITE_F( "iApName Connection name: %S", &iApName ); - - RefreshTransferSpeedsL(); - RefreshDuration(); - CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsL end" ); - } - -// --------------------------------------------------------- -// CGprsConnectionInfo::ToStringApNameLC -// --------------------------------------------------------- -// -HBufC* CGprsConnectionInfo::ToStringApNameLC() const - { - HBufC* apName = iApName.AllocLC(); - return apName; - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::RefreshConnectionListBoxItemTextL -// --------------------------------------------------------- -// -void CGprsConnectionInfo::RefreshConnectionListBoxItemTextL() - { - CMUILOGGER_WRITE( - "CGprsConnectionInfo::RefreshConnectionListBoxItemTextL start" ); - - TUint iconId; - HBufC* secondRow = NULL; - - iconId = GetIconId(); - - if ( iConnectionStatus == EConnectionCreated ) - { - CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(2); - CleanupStack::PushL( array ); - - HBufC* stringReceivedData = ToStringReceivedDataLC( ETrue ); - HBufC* stringSentData = ToStringSentDataLC( ETrue ); - - StringMarkerRemoval( stringReceivedData ); - StringMarkerRemoval( stringSentData ); - - array->AppendL( *stringReceivedData ); - array->AppendL( *stringSentData ); - - secondRow = StringLoader::LoadL( R_QTN_CMON_UL_DL_DATA_AMOUNTS, - *array ); - - CleanupStack::PopAndDestroy( stringSentData ); - CleanupStack::PopAndDestroy( stringReceivedData ); - CleanupStack::PopAndDestroy( array ); - } - else // if connection has not created yet gives back the status of its. - { - secondRow = ToStringStatusLC( EFalse ); - CleanupStack::Pop( secondRow ); - } - - iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, - &iConnectionName, secondRow ); - delete secondRow; - CMUILOGGER_WRITE( - "CGprsConnectionInfo::RefreshConnectionListBoxItemTextL end" ); - } - -// --------------------------------------------------------- -// CGprsConnectionInfo::RefreshDetailsArrayL -// --------------------------------------------------------- -// -void CGprsConnectionInfo::RefreshDetailsArrayL() - { - CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsArrayL start" ); - if ( iDetailsArray ) - { - TBool internal = iConnectionBearerType < EBearerExternalCSD ; - HBufC* temp = NULL; - - temp = ToStringStatusLC(); - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_STATUS, - temp, 2 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC(), - 3 ); - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC(), - 4 - ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC(), 5 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC(), 6 ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC(), - 7 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - 0, - ToStringTransferSpeedUpLC(), - 8 - ); - - CleanupStack::PopAndDestroy( 7, temp ); // ToString...LC() - - if ( internal ) - { - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - if ( iDetailsArray->Count() > 10 ) - { - iDetailsArray->Delete( 10, - iDetailsArray->Count() - 10 ); - iDetailsArray->Compress(); - } - - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); - // ToStringAppNameLC() - } - else - { - if ( iDetailsArray->Count() > 10 ) - { - iDetailsArray->Delete( 10, iDetailsArray->Count() - 10 ); - iDetailsArray->Compress(); - } - } - } - } - CMUILOGGER_WRITE( "CGprsConnectionInfo::RefreshDetailsArrayL end" ); - } - - -// --------------------------------------------------------- -// CGprsConnectionInfo::ToArrayDetailsL -// --------------------------------------------------------- -// -void CGprsConnectionInfo::ToArrayDetailsL() - { - CMUILOGGER_ENTERFN("CGprsConnectionInfo::ToArrayDetailsL"); - TBool internal = iConnectionBearerType < EBearerExternalCSD ; - TUint granularity = KDetailsArrayGranularityExternal; - HBufC* temp = NULL; - - - if ( internal ) - { - granularity = KDetailsArrayGranularityInternal; - } - delete iDetailsArray; - iDetailsArray = NULL; - iDetailsArray = new ( ELeave ) CDesCArrayFlat( granularity ); - - temp = iConnectionName.AllocLC(); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_CONN_NAME, - temp ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_BEARER, - ToStringBearerLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_STATUS, - ToStringStatusLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC() ); - - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringTransferSpeedUpLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_GPRS_APN, - ToStringApNameLC() ); - CleanupStack::PopAndDestroy( 10, temp ); // ToString...LC() - - if ( internal ) - { - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); - // ToStringAppNameLC() - } - } - CMUILOGGER_LEAVEFN("CGprsConnectionInfo::ToArrayDetailsL"); - } - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connectionmonitorui/src/WlanConnectionInfo.cpp --- a/connectionmonitoring/connectionmonitorui/src/WlanConnectionInfo.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,851 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Represents a WLAN connection -* -* -*/ - - -// INCLUDE FILES -#include -#include - -#include "ConnectionArray.h" -#include "WlanConnectionInfo.h" -#include "EasyWLANConnectionInfo.h" -#include "ActiveWrapper.h" - -#include - -#include "ConnectionMonitorUiLogger.h" - -// CONSTANTS - -/** -* Count of details of WLAN connection -*/ -LOCAL_D const TUint KDetailsArrayMaxGranularityCCX = 15; - -// ================= MEMBER FUNCTIONS ======================= -// --------------------------------------------------------- -// CWlanConnectionInfo::NewL -// --------------------------------------------------------- -// -CWlanConnectionInfo* CWlanConnectionInfo::NewL( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - const HBufC* aEasyWlanIAPName, - CActiveWrapper* aActiveWrapper ) - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" ); - - CWlanConnectionInfo* self = new ( ELeave ) CWlanConnectionInfo( - aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ); - CleanupStack::PushL( self ); - self->ConstructL(); - - if ( aEasyWlanIAPName ) - { - if ( self->iConnectionName.Compare( *aEasyWlanIAPName ) ) - { - CleanupStack::Pop( self ); - } - else - { - CEasyWlanConnectionInfo* temp = CEasyWlanConnectionInfo::NewL( - aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ); - CleanupStack::PopAndDestroy( self ); - self = temp; - } - } - else - { - CleanupStack::Pop( self ); - } - - - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo* CWlanConnectionInfo::NewL" ); - - return self; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::CWlanConnectionInfo -// --------------------------------------------------------- -// -CWlanConnectionInfo::CWlanConnectionInfo( TInt aConnectionId, - RConnectionMonitor* const aConnectionMonitor, - TConnMonBearerType aConnectionBearerType, - CActiveWrapper* aActiveWrapper ) - : CConnectionInfoBase( aConnectionId, - aConnectionMonitor, - aConnectionBearerType, - aActiveWrapper ), iEasyWlan( EFalse ) - { - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ConstructL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::ConstructL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ConstructL()" ); - - RefreshNetworkNameL(); - RefreshSignalStrength(); - RefreshSecurityMode(); - RefreshNetworkMode(); - RefreshTxPowerL(); - - CConnectionInfoBase::ConstructL(); // and base class ConstructL next. - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ConstructL()" ); - } - - -// --------------------------------------------------------- -// CWlanConnectionInfo::~CWlanConnectionInfo -// --------------------------------------------------------- -// -CWlanConnectionInfo::~CWlanConnectionInfo() - { - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::DeepCopyL -// --------------------------------------------------------- -// -CConnectionInfoBase* CWlanConnectionInfo::DeepCopyL() - { - CWlanConnectionInfo* temp = new ( ELeave ) CWlanConnectionInfo( - iConnectionId, - iConnectionMonitor, - iConnectionBearerType, - iActiveWrapper ); - - temp->iConnectionName = iConnectionName; - temp->iConnectionStatus = iConnectionStatus; - temp->iUploaded = iUploaded; - temp->iDownloaded = iDownloaded; - temp->iStartTime = iStartTime; - temp->iDuration = iDuration; - temp->iLastSpeedUpdate = iLastSpeedUpdate; - temp->iUpSpeed = iUpSpeed; - temp->iDownSpeed = iDownSpeed; - temp->iListBoxItemText = iListBoxItemText; - - temp->iWlanNetworkName = iWlanNetworkName; - temp->iSignalStrength = iSignalStrength; - temp->iNetworkMode = iNetworkMode; - temp->iSecurityMode = iSecurityMode; - temp->iTxPower = iTxPower; - - if ( iDetailsArray ) - { - CleanupStack::PushL( temp ); - temp->ToArrayDetailsL(); - CleanupStack::Pop( temp ); - } - - return temp; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetIconId -// --------------------------------------------------------- -// -TUint CWlanConnectionInfo::GetIconId() const - { - CMUILOGGER_ENTERFN( "TUint CWlanConnectionInfo::GetIconId() const" ); - - TUint iconId = EWlan; - - CMUILOGGER_LEAVEFN( "TUint CWlanConnectionInfo::GetIconId() const" ); - - return iconId; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::IsEasyWLAN -// --------------------------------------------------------- -// -TBool CWlanConnectionInfo::IsEasyWLAN() const - { - return iEasyWlan; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetWlanNetworkNameLC -// --------------------------------------------------------- -// -HBufC* CWlanConnectionInfo::GetWlanNetworkNameLC() const - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" ); - - HBufC* name = iWlanNetworkName.AllocLC(); - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::GetWlanNetworkNameLC()" ); - - return name; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetWlanSignalStrength -// --------------------------------------------------------- -// -TWlanSignalStrength CWlanConnectionInfo::GetWlanSignalStrength() const - { - return iSignalStrength; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetWlanNetworkMode -// --------------------------------------------------------- -// -TWlanNetworkMode CWlanConnectionInfo::GetWlanNetworkMode() const - { - return iNetworkMode; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetWlanSecurityMode -// --------------------------------------------------------- -// -TWlanSecurityMode CWlanConnectionInfo::GetWlanSecurityMode() const - { - return iSecurityMode; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::GetWlanTxPower -// --------------------------------------------------------- -// -TUint CWlanConnectionInfo::GetWlanTxPower() const - { - return iTxPower; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshDetailsL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshDetailsL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsL()" ); - - if ( IsAlive() ) - { - RefreshNetworkNameL(); - } - - if ( IsAlive() ) - { - RefreshNetworkMode(); - } - - if ( IsAlive() ) - { - RefreshSecurityMode(); - } - - if ( IsAlive() ) - { - RefreshTransferSpeedsL(); - } - - if ( IsAlive() ) - { - RefreshDuration(); - } - - if ( IsAlive() ) - { - RefreshSignalStrength(); - } - - if ( IsAlive() ) - { - RefreshTxPowerL(); - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsL()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshNetworkNameL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshNetworkNameL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" ); - - iActiveWrapper->StartGetStringAttribute( iConnectionId, - iConnectionMonitor, - KNetworkName, - iWlanNetworkName ); - - CMUILOGGER_WRITE_F( "RefreshNetworkName status : %d", - iActiveWrapper->iStatus.Int() ); - - if ( iActiveWrapper->iStatus.Int() ) - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - iConnectionStatus = EConnectionClosed; - } - HBufC* temp = StringLoader::LoadL( R_QTN_CMON_PARAMETER_UNAVAILABLE ); - iWlanNetworkName = *temp; - delete temp; - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkNameL()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshSignalStrength -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshSignalStrength() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSignalStrength()" ); - - iActiveWrapper->StartGetIntAttribute( iConnectionId, - iConnectionMonitor, - KSignalStrength, - ( TInt& )iSignalStrength ); - - CMUILOGGER_WRITE_F( "RefreshSignalStrengthL status : %d", - iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "iSignalStrength : %d", ( TInt )iSignalStrength ); - - if ( iActiveWrapper->iStatus.Int() ) - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - iConnectionStatus = EConnectionClosed; - } - iSignalStrength = EWlanSignalUnavailable; - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSignalStrength()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshSecurityMode -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshSecurityMode() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshSecurityMode()" ); - - iActiveWrapper->StartGetIntAttribute( iConnectionId, - iConnectionMonitor, - KSecurityMode, - ( TInt& )iSecurityMode ); - - CMUILOGGER_WRITE_F( "RefreshSecurityMode status: %d", - iActiveWrapper->iStatus.Int() ); - - if ( iActiveWrapper->iStatus.Int() ) - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - iConnectionStatus = EConnectionClosed; - } - iSecurityMode = EWlanSecurityModeUnavailable; - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshSecurityMode()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshNetworkMode -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshNetworkMode() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshNetworkMode()" ); - - iActiveWrapper->StartGetIntAttribute( iConnectionId, - iConnectionMonitor, - KNetworkMode, - ( TInt& )iNetworkMode ); - - CMUILOGGER_WRITE_F( "RefreshNetworkMode status : %d", - iActiveWrapper->iStatus.Int() ); - - if ( iActiveWrapper->iStatus.Int() ) - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - iConnectionStatus = EConnectionClosed; - } - iNetworkMode = EWlanNetworkModeUnavailable; - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshNetworkMode()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshTxPowerL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshTxPowerL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshTxPowerL()" ); - - iActiveWrapper->StartGetUintAttribute( iConnectionId, - iConnectionMonitor, - KTransmitPower, - iTxPower ); - - if ( iActiveWrapper->iStatus.Int() ) - { - if ( KErrNotFound == iActiveWrapper->iStatus.Int() ) - { - iConnectionStatus = EConnectionClosed; - } - iSignalStrength = EWlanSignalUnavailable; - } - - CMUILOGGER_WRITE_F( "iTxPower : %d", iTxPower ); - TInt err( iActiveWrapper->iStatus.Int() ); - CMUILOGGER_WRITE_F( "RefreshTxPowerL status: %d", err ); - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshTxPowerL()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ToStringSignalStrengthLC -// --------------------------------------------------------- -// -HBufC* CWlanConnectionInfo::ToStringSignalStrengthLC() const - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" ); - - HBufC* signalStrength = NULL; - TInt resourceId( 0 ); - - if ( iSignalStrength == EWlanSignalUnavailable ) - { - resourceId = R_QTN_CMON_WLAN_SIGNAL_STRENGTH_NO_SIGNAL; - signalStrength = StringLoader::LoadLC( resourceId ); - } - else if ( iSignalStrength < EWlanSignalStrengthGood ) - { - resourceId = R_QTN_CMON_WLAN_SINGAL_STRENGTH_GOOD; - } - else if ( iSignalStrength > EWlanSignalStrengthLow ) - { - resourceId = R_QTN_CMON_WLAN_SINGAL_STRENGTH_LOW; - } - else - { - resourceId = R_QTN_CMON_WLAN_SINGAL_STRENGTH_MEDIUM; - } - - TInt signalInPercent( 0 ); - if ( iSignalStrength <= EWlanSignalStrengthMax ) - { - signalInPercent = 100; - } - else if ( iSignalStrength >= EWlanSignalStrengthMin ) - { - signalInPercent = 0; - } - else - { - TInt diff = EWlanSignalStrengthMin - iSignalStrength; - signalInPercent = diff * 100 / KDiffOfWlanSignalStrength; - } - - if ( !signalStrength ) // there is connection to network - { - CMUILOGGER_WRITE_F( "signalInPercent : %d", signalInPercent ); - - signalStrength = StringLoader::LoadLC( resourceId, - signalInPercent ); - } - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSignalStrengthLC()" ); - - return signalStrength; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ToStringNetworkModeLC -// --------------------------------------------------------- -// -HBufC* CWlanConnectionInfo::ToStringNetworkModeLC() const - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" ); - - HBufC* networkMode = NULL; - TInt resourceId( 0 ); - - switch ( iNetworkMode ) - { - case EWlanNetworkModeInfrastructure: - case EWlanNetworkModeSecInfrastructure: - { - resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_INFRA; - break; - } - case EWlanNetworkModeAdHoc: - { - resourceId = R_QTN_CMON_WLAN_NEWTWORK_MODE_ADHOC; - break; - } - case EWlanNetworkModeUnavailable: - default: - { - resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE; - break; - } - } - - networkMode = StringLoader::LoadLC( resourceId ); - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringNetworkModeLC()" ); - - return networkMode; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ToStringSecurityModeLC -// --------------------------------------------------------- -// -HBufC* CWlanConnectionInfo::ToStringSecurityModeLC() const - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" ); - - HBufC* securityMode = NULL; - TInt resourceId( 0 ); - - switch ( iSecurityMode ) - { - case EWlanSecurityModeOpenNetwork: - { - resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_OPEN; - break; - } - case EWlanSecurityModeWEP: - { - resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WEP; - break; - } - case EWlanSecurityMode8021x: - { - resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_802_1X; - break; - } - case EWlanSecurityModeWPA: - { - resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA; - break; - } - case EWlanSecurityWpaPsk: - { - resourceId = R_QTN_CMON_WLAN_SECURITY_MODE_WPA; - break; - } - case EWlanSecurityModeUnavailable: - default: - { - resourceId = R_QTN_CMON_PARAMETER_UNAVAILABLE; - break; - } - } - - securityMode = StringLoader::LoadLC( resourceId ); - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringSecurityModeLC()" ); - - return securityMode; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ToStringTxPowerLC -// --------------------------------------------------------- -// -HBufC* CWlanConnectionInfo::ToStringTxPowerLC() const - { - CMUILOGGER_ENTERFN( "CWlanConnectionInfo::ToStringTxPowerLC()" ); - - HBufC* txPower = StringLoader::LoadLC( R_QTN_CMON_WLAN_TX_POWER_LEVEL, - iTxPower ); - - CMUILOGGER_LEAVEFN( "CWlanConnectionInfo::ToStringTxPowerLC()" ); - - return txPower; - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::ToArrayDetailsL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::ToArrayDetailsL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::ToArrayDetailsL()" ); - - HBufC* temp = NULL; - delete iDetailsArray; - iDetailsArray = NULL; - iDetailsArray = new ( ELeave ) CDesCArrayFlat - ( KDetailsArrayMaxGranularityCCX ); - - temp = iConnectionName.AllocLC(); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_CONN_NAME, - temp ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_BEARER, - ToStringBearerLC() - ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_STATUS, - ToStringStatusLC() - ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_NETWORK_NAME, - GetWlanNetworkNameLC() - ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH, - ToStringSignalStrengthLC() - ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_NETWORK_MODE, - ToStringNetworkModeLC() - ); - - ToDetailsListBoxItemTextWithAppendL - ( - R_QTN_CMON_HEADING_WLAN_SECURITY_MODE, - ToStringSecurityModeLC() - ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_WLAN_TX_POWER, - ToStringTxPowerLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC() ); - - ToDetailsListBoxItemTextWithAppendL( R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC() ); - - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringTransferSpeedUpLC() ); - - - CleanupStack::PopAndDestroy - ( - KDetailsArrayMaxGranularityCCX - 1, - temp ); - - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC() - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::ToArrayDetailsL()" ); - } - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshDetailsArrayL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshDetailsArrayL() - { - CMUILOGGER_ENTERFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" ); - - HBufC* temp = NULL; - - temp = ToStringStatusLC(); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_STATUS, - temp, - 2 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_WLAN_SIGNAL_STRENGTH, - ToStringSignalStrengthLC(), - 4 - ); - - ToDetailsListBoxItemTextWithReplaceL - ( - R_QTN_CMON_HEADING_WLAN_TX_POWER, - ToStringTxPowerLC(), - 7 - ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_TOTAL, - ToStringTotalTransmittedDataLC(), - 8 ); - - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_RECEIVED, - ToStringReceivedDataLC(), - 9 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DATA_SENT, - ToStringSentDataLC(), - 10 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_DURATION, - ToStringDurationLC(), - 11 ); - - ToDetailsListBoxItemTextWithReplaceL( R_QTN_CMON_HEADING_SPEED, - ToStringTransferSpeedDownLC(), - 12 ); - - ToDetailsListBoxItemTextWithReplaceL( 0, - ToStringTransferSpeedUpLC(), - 13 ); - - CleanupStack::PopAndDestroy( 9, temp ); - - - TInt count = iDetailsArray->Count(); - TInt realElementsMaxCount = KDetailsArrayMaxGranularityCCX; - - CMUILOGGER_WRITE_F( "count : %d", count ); - CMUILOGGER_WRITE_F( "realElementsMaxCount : %d", realElementsMaxCount ); - - TInt sharing = RefreshAppNamesL(); - - if ( sharing > 1 ) - { - if ( count >= realElementsMaxCount ) // 15 - { - iDetailsArray->Delete( realElementsMaxCount - 1, - iDetailsArray->Count() - 14 ); - iDetailsArray->Compress(); - } - - for ( TInt i = 0; i < sharing; i++ ) - { - if ( i == 0 ) - { - ToDetailsListBoxItemTextWithAppendL( - R_QTN_CMON_HEADING_SHARING_INFO, - ToStringAppNameLC( i ) ); - } - else - { - ToDetailsListBoxItemTextWithAppendL( 0, - ToStringAppNameLC( i ) ); - } - } - CleanupStack::PopAndDestroy( sharing ); // ToStringAppNameLC() - } - else - { - if ( count >= realElementsMaxCount ) - { - iDetailsArray->Delete( realElementsMaxCount - 1, - iDetailsArray->Count() - 14 ); - iDetailsArray->Compress(); - } - } - - CMUILOGGER_LEAVEFN( "void CWlanConnectionInfo::RefreshDetailsArrayL()" ); - } - - -// --------------------------------------------------------- -// CWlanConnectionInfo::RefreshConnectionListBoxItemTextL -// --------------------------------------------------------- -// -void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL() - { - CMUILOGGER_ENTERFN( - "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); - - TUint iconId; - HBufC* secondRow = NULL; - - iconId = GetIconId(); - - if ( iConnectionStatus == EConnectionCreated ) - { - secondRow = ToStringDurationLC(); - } - else // if connection has not created yet gives back the status of itself. - { - secondRow = ToStringStatusLC( EFalse ); - } - - iListBoxItemText.Format( KConnectonListItemTextFormat, iconId, - &iConnectionName, secondRow ); - CleanupStack::PopAndDestroy( secondRow ); - - CMUILOGGER_LEAVEFN( - "void CWlanConnectionInfo::RefreshConnectionListBoxItemTextL()" ); - } - - - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatcache.cpp --- a/connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatcache.cpp Fri Aug 06 19:11:03 2010 +0300 +++ b/connectionmonitoring/connmon/connectionmonitor/src/connmoncommsdatcache.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -524,7 +524,9 @@ TInt err( KErrNone ); TBool availabilityEventsEnabled( EFalse ); - if ( ( aBearerId == EBearerIdAll ) || ( aBearerId == EBearerIdVirtualVPN ) ) + if ( ( aBearerId == EBearerIdAll ) || + ( aBearerId == EBearerIdVirtualVPN ) || + ( aBearerId == EBearerIdWLAN ) ) { // If WLAN background scanning is on, and client is asking IAP // availability for all- or virtual IAPs, send IAP availability changed diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/connmon/dataconnectionlogger/inc/dclevent.h --- a/connectionmonitoring/connmon/dataconnectionlogger/inc/dclevent.h Fri Aug 06 19:11:03 2010 +0300 +++ b/connectionmonitoring/connmon/dataconnectionlogger/inc/dclevent.h Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003-2004 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,14 +11,13 @@ * * Contributors: * -* Description: Data Connection Logger. -* +* Description: +* Data Connection Logger. */ #ifndef DCLEVENT_H #define DCLEVENT_H -#include #include #include diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionmonitoring/group/bld.inf --- a/connectionmonitoring/group/bld.inf Fri Aug 06 19:11:03 2010 +0300 +++ b/connectionmonitoring/group/bld.inf Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2001-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,9 +11,8 @@ * * Contributors: * -* Description: Build information file for all projects in connectionmonitoring -* subsystem. -* +* Description: +* Build information file for all projects in connectionmonitoring subsystem. */ PRJ_PLATFORMS @@ -22,7 +21,6 @@ PRJ_EXPORTS PRJ_MMPFILES -#include "../connectionmonitorui/group/bld.inf" #include "../connmon/connectionmonitor/group/bld.inf" #include "../connmon/dataconnectionlogger/group/bld.inf" #include "../connmonext/group/bld.inf" diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionutilities/confirmqueries/confirmqueries.pro --- a/connectionutilities/confirmqueries/confirmqueries.pro Fri Aug 06 19:11:03 2010 +0300 +++ b/connectionutilities/confirmqueries/confirmqueries.pro Mon Aug 23 13:40:12 2010 +0300 @@ -45,4 +45,8 @@ } TRANSLATIONS = cellularpromptdialog.ts -RESOURCES += res/promptdialog.qrc \ No newline at end of file +RESOURCES += res/promptdialog.qrc + +DOCML += \ + res/prompt_home.docml \ + res/prompt_abroad.docml \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 connectionutilities/confirmqueries/res/promptdialog.qrc --- a/connectionutilities/confirmqueries/res/promptdialog.qrc Fri Aug 06 19:11:03 2010 +0300 +++ b/connectionutilities/confirmqueries/res/promptdialog.qrc Mon Aug 23 13:40:12 2010 +0300 @@ -1,6 +1,6 @@ - prompt_home.docml - prompt_abroad.docml + prompt_home.docml.bin + prompt_abroad.docml.bin \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 data/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/bld.inf Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build info for ipconnmgmt package. +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +// Export CommsDat to emulator +cccccc00_emulator.cre /epoc32/winscw/c/private/10202be9/persists/cccccc00.cre + +// Export default configuration options +../inc/meshpreface1.cfg /epoc32/release/winscw/udeb/z/system/data/meshpreface1.cfg diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcdatamobilitytables.h --- a/dbcreator/commsdatcreator/Inc/cdcdatamobilitytables.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CDataMobilityTables. -* -*/ - - - - -#ifndef DATAMOBILITYTABLESHANDLER_H -#define DATAMOBILITYTABLESHANDLER_H - - -// INCLUDES -#include -#include - -using namespace CommsDat; - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* CDataMobilityTables -* Capable of checking the existence of certain Data Mobility specific -* tables and - if necessary create them. -*/ -class CDataMobilityTables : public CBase - { - public: - - /** - * Static constructor - */ - static CDataMobilityTables* NewL(); - - /** - * Destructor - */ - virtual ~CDataMobilityTables(); - - /** - * Checks if Data Mobility ALR tables exist. Creates them if not. - */ - void CheckAndCreateAlrTablesL(); - - /** - * Checks if Data Mobility MIP tables exist. Creates them if not. - */ - void CheckAndCreateMipTablesL(); - - - private: - - /** - * C++ default constructor. - */ - CDataMobilityTables(); - - /** - * By default Symbian second phase constructor is private. - */ - void ConstructL(); - - /** - * Check if Global Bearer Type Priorization Table exists in CommsDat; - * create if not. - */ - void CreateGlobalBearerTypeTableL(); - - /** - * Check if Data Mobility Selection Policy Table exists in CommsDat; - * create if not. - */ - void CreateDataMobilitySelectionPolicyTableL(); - - /** - * Check if Virtual IAP Next Layer Table exists in CommsDat; - * create if not. - */ - void CreateVirtualIAPNextLayerTableL(); - - /** - * Check if MIP Service Table exists in CommsDat; create if not. - */ - void CreateMIPServiceTableL(); - - /** - * Check if MIP Service Table exists in CommsDat; create if not. - */ - void CreateMIP4TableL(); - - /** - * Check if MIP Service Table exists in CommsDat; create if not. - */ - void CreateMIP6TableL(); - - /** - * Check if SNAP Metadata Table exists in CommsDat; create if not. - */ - void CreateSNAPMetadataTableL(); - - /** - * Check if IAP Metadata Table exists in CommsDat; create if not. - */ - void CreateIAPMetadataTableL(); - - /** - * Check if WLAN Destination network Table exists in CommsDat; - * create if not. - */ - void CreateDestNetworkTableL(); - - /** - * Populates the Global Bearer Priorization table. - */ - void PopulateGlobalBearerTypeTableL(); - - private: // Data - - //@var session - Owned - CMDBSession* iSession; - - }; - -#endif // DATAMOBILITYTABLESHANDLER_H - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcdumptables.h --- a/dbcreator/commsdatcreator/Inc/cdcdumptables.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CDbCreator -* -*/ - - - - -#ifndef DUMP_TABLES_H -#define DUMP_TABLES_H - -// INCLUDE FILES - -#include -#include - -// CLASS DECLARATION - -class CMDBSession; - -/** -* CDumpTables writes data from CommsDat to CSV format file. -* CDumpTables dumps the CommsDat tables which are not dumped -* by any other application. -*/ -class CDumpTables : public CBase - { - - public: - - /** - * Two-phase constructor. - * @return CDumpTables instance. - */ - static CDumpTables* NewL(); - - /** - * Two-phase constructor. - * @return CDumpTables instance. Let the instance on the CleanupStack. - */ - static CDumpTables* NewLC(); - - /** - * Destructor. - */ - virtual ~CDumpTables(); - - /** - * Dumps the unsupported tables to CSV format file. - * @param outFileName name of the output file with full path. - */ - void DoDumpTablesL( const TFileName& aOutFileName ); - - protected: - - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - private: - - /** - * Constructor - */ - CDumpTables(); - - /** - * Template method for dumping one CommsDat table - * @param class T representing the table which is dumped. - */ - template void DumpTableL( const TDesC* aTableName ); - - /** - * Opens a output file for dumping. It tries to open the file - * and if it does not exist then a new one created. - * @param aFileName name of the file. It cannot be NULL. - */ - TInt OpenFileL( const TFileName& aFileName ); - - /** - * Writes 8 bit descriptor to 16 bit unicode file in CSV format. - * @param aDes the written text. It gets the ownership. - */ - void WriteL( HBufC8* aDes ); - - /** - * Writes 16 bit descriptor to 16 bit unicode file in CSV format. - * @param aDes the written text. It gets the ownership. - */ - void WriteL( HBufC16* aDes ); - - /** - * Transform the parameter field to CSV accepted format. - * @param aField the field that should be checked and transform - * to CSV format if it is necessary - * @return the CSV acceptable format. - */ - HBufC16* TransformToCSVFormatLC( const HBufC16* aField ); - - /** - * Checks the parameter field if transformation to CSV format is - * necessary. - * @param aField the field which should be checked. - * @return ETrue if transformation is necessary else EFalse. - */ - TBool CheckCSVTransformNeedL( HBufC16* aFiled ); - - - private: - - // Session for CommsDat - CommsDat::CMDBSession* iSession; - - // Fs for file handling - RFs iRfs; - - // Output file - RFileWriteStream iFile; - - // Counter for how many double qoutes are in the given text. - TInt iNumOfDQuotes; - - }; - -#endif DUMP_TABLES_H - - diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdclogfilename.h --- a/dbcreator/commsdatcreator/Inc/cdclogfilename.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: contains logger macros -* -*/ - - - - -#ifndef CDC_LOGFILE_NAME_H -#define CDC_LOGFILE_NAME_H - - -/// Directory where the log file can be found. -_LIT16( KLogDir, "cdc" ); - -/// Log file name. -_LIT16( KLogFile, "cdc.txt" ); - - -#endif // CDC_LOGFILE_NAME_H \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorbase.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorbase.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorBase. -* -*/ - - - - -#ifndef APFILE_PARSER_BASE_H -#define APFILE_PARSER_BASE_H - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include - -#include "cdcerrors.h" -#include "cdccommon.h" - -// FORWARD DECLARATION -class CTagContainer; -class CReaderBase; - -// CONSTANTS - -/** -* Max length of a line in the log file. -*/ -LOCAL_D const TInt KMaxLogLineLength = 256; - - -// CLASS DECLARATION -/** -* CProcessorBase -* Abstract base class for processor classes -*/ -class CProcessorBase : public CBase - { - - public: - /** - * Destructor. - */ - virtual ~CProcessorBase(); - - /** - * Processes the input files line by line. - */ - void ParseFileL(); - - - protected: - /** - * Constructor - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray array that holds the plugins - and so the CMs - * @param aPluginNames array that holds the CM names - */ - CProcessorBase( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames ); - - - /** - * Constructor - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray array that holds the plugins - and so the CMs - * @param aPluginNames array that holds the CM names - * @param aDestArray array that holds the Destination - * @param aDestNames array that holds the Destination names - */ - CProcessorBase( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ); - /** - * Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - */ - virtual void ProcessTagL( TBool aFieldIDPresent ); - - /** - * Processes the special fields of the tag. Every descendand can implement - * processes of their special fields - * @param aField ID of the field - * @param aTagPtr data conatining by the field - * @param aDx serial number of the field - */ - virtual void ProcessSpecialFieldsL( TInt /*aField*/, - HBufC* /*aTagPtr*/, - TInt /*aDx*/ ) {}; - - /** - * Does the necessary settings before processing tag. Every descendand - * can implement their special needs. - */ - virtual void Reset() {}; - - /** - * Calculates and sets the AddressFromServer field - */ - virtual void SetAddressFromServerL( TInt aIPField1, - TInt aIPField2, - TInt aAddrFromSField, - TInt aIPField1IP6, - TInt aIPField2IP6, - TInt aAddrFromSFieldIP6 ); - /** - * Virtual function. Processes the actual access point. - */ - virtual void ProcessAPL(); - - /** - * Writes the actual created access point to the log file. - */ - virtual void DoLogL(); - - /** - * Returns the TagContainer - * @return iTagContainer - */ - CTagContainer& TagContainer(); - - /** - * Adds one item to the plugin array. - */ - void AddToPluginArrayL(); - - /** - * Retrieves the last plugin from the plugin array. - * @return the last plugin in the plugin array - */ - RCmConnectionMethodExt& GetLastPluginL(); - - /** - * Retrieves the plugin in position from the plugin array. - * @param aPos position of the desired plugin. - * @return the plugin in position from the plugin array - */ - RCmConnectionMethodExt& GetPluginL( TInt aPos ); - - /** - * Retrieves count of plugins in the plugin array. - * @return count of plugins in the plugin array - */ - TInt PluginCount(); - - RCmDestinationExt* FindDestinationL( HBufC* aName ); - - TInt GetDestinationIdL( HBufC16* aName ); - - RCmConnectionMethodExt* FindPluginL( HBufC* aName ); - - RCmConnectionMethodExt* FindPluginL( HBufC* aName, TInt& aPos ); - - TInt GetPluginIdL( HBufC16* aName ); - - TBool ProcessTag( HBufC* aTag, RCmConnectionMethodExt* aPlugin ); - TBool SetGeneralFieldL( TInt aField, HBufC* aPtrTag ); - - private: - - - TInt CheckPluginName( HBufC* aName ); - - - protected: - - // @var Gives back AP data from the file. - CReaderBase* iFileReader; - - // @var Pointer to Connection Method Manager that is required to access - // Access Point data - RCmManagerExt* iCmManager; - - // @var Shows whether proxies have already been enabled or not. - TBool iProxyEnabled; - - // @var Indicates whether the connection method is protected or not - TBool iIsProtected; - - // @var Name of the actual IAP or Destination - HBufC* iName; - - // @var Actual IAP - RCmConnectionMethodExt iPlugin; - - // @var Actual Bearer Type - TUint iBearerType; - - protected: - - // @var Plugin array that is used to store pointers to access point data - RPointerArray< RCmConnectionMethodExt >* iPluginArray; - // @var Plugin array that is used to store names of access point data - RPointerArray< HBufC >* iPluginName; - - // @var Destination array that is used to store pointers to Destination data - RPointerArray< RCmDestinationExt >* iDestArray; - // @var Destination array that is used to store names of Destination - RPointerArray< HBufC >* iDestName; - - }; - - -#endif // APFILE_PARSER_BASE_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessordn.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessordn.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorDN. -* -*/ - - - - -#ifndef PROCESSOR_DN_H -#define PROCESSOR_DN_H - - -// INCLUDE FILES - -#include -#include -#include -#include -#include - -#include "cdcprocessorbase.h" - - -// FORWARD DECLARATION - -// CLASS DECLARATION - -/** -* CProcessorDN -* Inherits from the class CProcessorBase. -* Creates Destination Network Item from CTagContainer and -* adds it to the database -*/ -class CProcessorDN : public CProcessorBase - { - public: - /** - * Two-phase constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aCmArray Array of the processed connection methods - * @param aIsFirstRound ETrue if this is the first round of DN - * processing. In this case DNs are created. - * EFalse otherwise. This time connection methods - * are added. - * @return CProcessorDN instance. - */ - static CProcessorDN* NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& - aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames, - RArray< TBool >& aCmInDest, - TBool aIsFirstRound ); - /** - * Destructor. - */ - virtual ~CProcessorDN(); - - protected: - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aCmArray Array of the processed connection methods - * @param aIsFirstRound ETrue if this is the first round of DN - * processing. In this case DNs are created. - * EFalse otherwise. This time connection methods - * are added. - */ - CProcessorDN( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames, - RArray< TBool >& aCmInDest, - TBool aIsFirstRound ); - - /** - * From CProcessorBase. Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - * @return the result of the process, KErrNone if the actual tag is - * valid. - */ - virtual void ProcessTagL( TBool aFieldIDPresent ); - - /** - * From CProcessorBase. Processes the actual access point. - * @return the result of the process. - */ - virtual void ProcessAPL(); - - /** - * Writes the actual created access point to the log file. - */ - void DoLogL(); - - private: - - // @var The destiantion that is created - RCmDestinationExt iDestination; - - // @var Pointer to the destiantion that has been created and stored - // in iDestArray - RCmDestinationExt* iDest; - - // @var Stores the protection level of the destination - CMManager::TProtectionLevel iProtectionLevel; - - // @var Stores whether this is the first round of DN processing or not - TBool iIsFirstRound; - - // @var ETrue if the destination cannot processed so it is dropped away - TBool iDestinationDropped; - - RArray< TBool >* iCmInDest; - }; - - -#endif PROCESSOR_DN_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorGlobal. -* -*/ - - - - -#ifndef CDCPROCESSORGLOBAL_H -#define CDCPROCESSORGLOBAL_H - - -// INCLUDE FILES - -#include - -#include - -#include "cdcprocessorbase.h" - -using namespace CommsDat; - -// FORWARD DECLARATIONS -class RCmConnectionMethodExt; -class RCmDestinationExt; -class CReaderBase; -class CommsDat::CMDBSession; -struct TCmGenConnSettings; -class RCmManagerExt; - -// CLASS DECLARATION - -/** -* CProcessorGlobal -* Inhertits from the class CProcessorBase. -* Reads Access Points related settings from CTagContainer. -*/ -class CProcessorGlobal : public CProcessorBase - { - public: - /** - * Two-phase constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager - * @return CProcessorGlobal instance. - */ - static CProcessorGlobal* NewL( - CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ); - - /** - * Destructor. - */ - virtual ~CProcessorGlobal(); - - protected: - - /** - * Constructor. - * @param aFileReader pointer to the file reader - */ - CProcessorGlobal( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ); - - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * From CProcessorBase. Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - * @return TInt The result of the process, KErrNone if the actual tag is - * valid. - */ - virtual void ProcessTagL( TBool aFieldIDPresent ); - - /** - * From CProcessorBase. Processes the actual access point. - * @return The result of the processing - */ - virtual void ProcessAPL(); - - - private: - - /** - * Updates bearer priority array with the specified bearers priority or - * UI priority. - * @param aField Identifier of the the bearer whose priority/UI-priority - * is to be updated. - * @param aPrio The new priority. - */ - void UpdateGlobalBearerArrayL - ( TDbCreatorGlobalSettings aField, TUint32 aPrio ); - - - /** - * Sets the WLAN Usage parameter in general connection settings. - * @param aPtrTag string containing the parameter's value. - */ - void SetGenConnSettingWlanUsage( HBufC16* aPtrTag ); - - /** - * Sets the "cellular data usage in home networks" - * parameter in general connection settings. - * @param aPtrTag string containing the parameter's value. - */ - void SetGenConnSettingCellularDataUsageHome( HBufC16* aPtrTag ); - - /** - * Sets the "cellular data usage in visitor networks" - * parameter in general connection settings. - * @param aPtrTag string containing the parameter's value. - */ - void SetGenConnSettingCellularDataUsageVisitor( HBufC16* aPtrTag ); - - // Stores the general connection settings, using CMM - void SetGenConnSettingsL(); - - // Stores the WLAN parameters - void SaveGlobalWlanParameterL( const TUint32 aTableType, - const TDbCreatorGlobalSettings aField, - const HBufC16* const aValue ); - - private: - - - // @var GPRS attach mode : whenneeded/whenavailable - TBool iAttachWhenNeeded; - - RArray< TBearerPriority > iBearerArray; - TBool iBearerArrayChanged; - - // @var Stores the general connection settings - TCmGenConnSettings* iGenConnSettings; - - //@var session - Owned - CMDBSession* iSession; - - //@var WLAN supported flag - TBool iIsWlanS; - }; - -#endif CDCPROCESSORGLOBAL_H - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorlan.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorlan.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorLan. -* -*/ - - - - -#ifndef PROCESSOR_LAN_H -#define PROCESSOR_LAN_H - - -// INCLUDE FILES - -#include -#include -#include - -#include "cdcprocessorbase.h" - - -// FORWARD DECLARATION - -// CLASS DECLARATION - -/** -* CProcessorLan -* Inhertits from the class CProcessorBase. -* Creates internet Access Point Item from CTagContainer and -* adds AP item to database. -*/ -class CProcessorLan : public CProcessorBase - { - public: - /** - * Two-phase constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - * @return CProcessorLan instance. - */ - static CProcessorLan* NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames ); - /** - * Destructor. - */ - virtual ~CProcessorLan(); - - protected: - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - */ - CProcessorLan( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames ); - - /** - * From CProcessorBase. Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - * @return the result of the process, KErrNone if the actual tag is - * valid. - */ - virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); - }; - - -#endif PROCESSOR_LAN_H - - -// End of File. \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorpacketdata.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorpacketdata.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorPacketData. -* -*/ - - - - -#ifndef PROCESSOR_PACKET_DATA_H -#define PROCESSOR_PACKET_DATA_H - - -// INCLUDE FILES - -#include -#include -#include - -#include "cdcprocessorbase.h" - - -// FORWARD DECLARATION - -// CLASS DECLARATION - -/** - * CLingerElement is array element for linger value end corresponding CM name. - */ -NONSHARABLE_CLASS( CLingerElement ) : public CBase - { - public: - ~CLingerElement(); - HBufC* iName; - HBufC* iLinger; - }; - -/** -* CProcessorPacketData -* Inhertits from the class CProcessorBase. -* Creates internet Access Point Item from CTagContainer and -* adds AP item to database. -*/ -class CProcessorPacketData : public CProcessorBase - { - public: - /** - * Two-phase constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - * @param aLingerSettings stores processed GPRS linger values - * @return CProcessorPacketData instance. - */ - static CProcessorPacketData* NewL( - CReaderBase* aFileReader, - RCmManagerExt& aCmMnaager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< CLingerElement >& aLingerSettings); - /** - * Destructor. - */ - virtual ~CProcessorPacketData(); - - /** - * Maps previously stored linger values with connection ID's - * and writes them to repository. - */ - void SaveLingerSettingsL(); - - protected: - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - * @param aLingerSettings stores processed GPRS linger values - */ - CProcessorPacketData( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< CLingerElement >& aLingerSettings); - - /** - * From CProcessorBase. Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - * @return the result of the process, KErrNone if the actual tag is - * valid. - */ - virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); - - /** - * Writes connections linger value to repository. - * @param aIapId is the id of connection to which linger value is set. - * @param aLingerInterval linger value to set to connection. - */ - void AddLingerL( const TInt aIapId, const TInt aLingerInterval); - - private: - - // @var Stores linger values - RPointerArray< CLingerElement >* iLingerSettings; - }; - - -#endif PROCESSOR_PACKET_DATA_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorvpn.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorVpn. -* -*/ - - - - -#ifndef PROCESSOR_VPN_H -#define PROCESSOR_VPN_H - - -// INCLUDE FILES - -#include -#include -#include - -#include "cdcprocessorbase.h" - -// FORWARD DECLARATION - -// CLASS DECLARATION - -/** -* CProcessorVpn -* Inhertits from the class CProcessorBase. -* Creates internet Access Point Item from CTagContainer and -* adds AP item to database. -*/ -class CProcessorVpn : public CProcessorBase - { - public: - /** - * Two-phase constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - * @return CProcessorVpn instance. - */ - static CProcessorVpn* NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmMnaager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aUnderLying); - - void ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ); - - - /** - * Destructor. - */ - virtual ~CProcessorVpn(); - - protected: - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor. - * @param aFileReader pointer to the file reader - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - */ - CProcessorVpn( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aUnderLying ); - - /** - * From CProcessorBase. - */ - virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); - - private: - - // @var Stores whether this is the first round of VPN processing or not - TBool iIsFirstRound; - - // @var Stores the IAP name underLying IAP/SNAP name pairs - RPointerArray< HBufC >* iUnderLying; - }; - - -#endif PROCESSOR_VPN_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h --- a/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,322 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CProcessorWlan. -* -*/ - - - - -#ifndef PROCESSOR_WLAN_H -#define PROCESSOR_WLAN_H - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include - -#include "cdcprocessorbase.h" - -using namespace CommsDat; - -// FORWARD DECLARATIONS - - -// CLASS DECLARATION - - -/** - * CEapTypeElement is array element for several EapTypes - */ -class CEapTypeElement: public CBase - { - public: - ~CEapTypeElement(); - HBufC* iName; - EAPSettings* iEapSettings; - TEapExpandedType iEncapsulatingEapId; - }; - - -/** -* CProcessorWlan -* Inhertits from the class CProcessorBase. -* Creates WLAN Access Point Item from CTagContainer and -* adds AP item to database. -*/ -class CProcessorWlan : public CProcessorBase - { - public: - - /** - * Two-phase constructor. - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - * @return CProcessorWlan instance. - */ - static CProcessorWlan* NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aSecurityInfo, - RPointerArray< CEapTypeElement >& eapSettings ); - - void SaveSecurityInfoL(); - - /** - * Destructor. - */ - virtual ~CProcessorWlan(); - - protected: - - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor. - * @param aCmManager Connection Method Manager - * @param aPluginArray Array that stores the processed plugins - */ - CProcessorWlan( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aSecurityInfo, - RPointerArray< CEapTypeElement >& aEapSettings ); - - /** - * From CProcessorBase. Processes the actual tag. - * @param aFieldIDPresent shows if field id is read from input file - * @return TInt The result of the process, KErrNone if the actual tag is - * valid. - */ - virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); - - - /** - * From CProcessorBase. Processes the actual access point. - * @return TInt The result of the process. - */ - virtual void ProcessAPL(); - - void FillSecurityInfoL(); - - void FillSecurityInfoL( TBool aIsWep ); - - void SaveSecurityInfoL( TInt& aCounter, TInt aId ); - - /** - * Saves WEP security settings - * @param aIapId Access point id WEP security settings belongs to. - */ - void SaveWEPL( TUint32 aIapId ); - - /** - * Writes key data to CommsDat. - * @param aKeyField The field to be written to - * @param aKey The key data to be written - * @param aKeyformat The format of the key (ascii/hex) - */ - void WriteKeyL( CMDBField* aKeyField, - HBufC16* aKey, - const TInt aKeyFormat ); - - /** - * Gets WEP field value in text format from TagContainer - * @param aFieldId is the id of the field - * @return pointer to the data of the field - */ - HBufC16* WEPFieldData( TDbCreatorWEPFields aFieldId ); - - /** - * Gets Authentication type - * @return TWEPAuthentication - authentication type - * KErrNotFound - if authentication type is not present - */ - TInt WEPAuthentication(); - - /** - * Gets the WEP key in use - * @return TWEPKeyInUse - the WEP key in use - * KErrNotFound - if WEP key in use is not present - */ - TInt WEPKeyInUse(); - - /** - * Gets WEP key format - * @param aFieldId is the id of the field - * should be EWEPKeyXFormat - * @return TWEPKeyFormat - key format - * KErrNotFound - if WEP key format is not present - */ - TInt WEPKeyFormat( TDbCreatorWEPFields aFieldId ); - - /** - * Gets WEP key length - * @param aFieldId is the id of the length field - * should be EWEPKeyXLength - * @return TWEPKeyLength - WEP key length - */ - TWEPKeyLength WEPKeyLength( TDbCreatorWEPFields aFieldId ); - - /** - * Gets valid WEP key length in characters - * @param aFormat is the id of the field - should be EWEPKeyXFormat - * @param aLen is the WEP key length - should be TWEPKeyLength - * @return TInt - valid key length in characters - */ - TInt WEPKeyValidLen( TInt aFormat, TWEPKeyLength aLen ); - - /** - * Gets the TagContainer index that belongst to the given WEP field - * @param aFieldId is the id of the field - * @return index in TagContainer - */ - TInt WEPIndex( TDbCreatorWEPFields aFieldId ); - - /** - * Check the existence and validity of WEP fields - * @return - TRUE if all WEP fields are present and valid - * - FALSE if any of the fields is missing or invalid. - */ - TBool WEPFieldValidate(); - - /** - * Converts keyData enetered in Ascii format to hex format - * @param aSource Source string - * @param aDest destination string - */ - void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ); - - /** - * Veryfies hexadecimal format - * @param aHex hexadecimal key - * @return Etrue if hexadecimal key is valid, Efalse otherwise - */ - TBool VerifyHex( const TDesC8& aHex ); - - /** - * Saves WPA security settings - * @param aIapId Access point id WEP security settings belongs to. - */ - void SaveWPAL( TUint32 aIapId ); - - /** - * Gets the expanded EAP type - * @param aFieldId is the id of the field - * @return expanded EAP type - */ - TEapExpandedType GetExpandedEapTypeIdL( TDesC& aField ); - - /** - * Gets the TagContainer index that belongst to the given WPA field - * @param aFieldId is the id of the field - * @return index in TagContainer - */ - TInt WPAIndex( TDbCreatorWPAFields aFieldId ); - - /** - * Gets WPA field value in text format from TagContainer - * @param aFieldId is the id of the field - * @return pointer to the data of the field - */ - HBufC16* WPAFieldData( TDbCreatorWPAFields aFieldId ); - - /** - * Gets the use of preshared key - * @return ETrue - PSK is in use - * EFalse - PSK is not in use - */ - TBool WPAPresharedKeyInUse(); - - /** - * Gets WPA key length - * @return length of the key - */ - TInt WPAKeyLength(); - - /** - * Writes the actual created access point to the log file. - */ - void DoLogL(); - - private: - - /** - * Sets the necessary initial values - */ - virtual void Reset(); - - /* - * Sets the values of the expanded Eap lists to the database - * @param aServiceId for accessing the EAP data - */ - void SetExpandedEapListL( const TUint aServiceId ); - - private: - - void AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep ); - - void AddEAPSettingL( const TInt aField, HBufC16* aValue ); - - TBool EAPSetting( const TInt aField ); - - void FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex ); - - TEapExpandedType GetEapTypeIdFromSettingId( const TInt aField ); - - TUint FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ); - - void ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey); - - // @var Indicates the WLAN security mode - TDbCreatorSecurityMode iSecurityMode; - // @var Indicates the WLAN security mode name - HBufC* iSecurityModeString; - - // @var Stores WLAN security mode info - RPointerArray< HBufC >* iSecurityInfo; - - // @var Stores WLAN EAP settings - RPointerArray< CEapTypeElement >& iEapSettings; - - // @var access point is Easy WLAN if true - TBool iIsEasyWlan; - - // @var HBufC for empty WEP and WPA tags - HBufC* iEmptyTag; - - HBufC* iWepData[KWEPKeyNumOfFields]; - - HBufC* iWpaData[KWPAKeyNumOfFields]; - - TInt iDataStart; - - RArray< RPointerArray< HBufC > >* iTest; - - }; - - -#endif PROCESSOR_WLAN_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcreaderbase.h --- a/dbcreator/commsdatcreator/Inc/cdcreaderbase.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CReaderBase. -* -*/ - - - - -#ifndef READER_BASE_H -#define READER_BASE_H - - -// INCLUDE FILES -#include -#include -#include - -#include "cdccommon.h" -#include "cdcerrors.h" -#include "cdctagcontainer.h" - -// CLASS DECLARATION - -/** -* CReaderBase. -* Base class for XML and CSV reader. -*/ -class CReaderBase : public CBase - { - - public: - /** - * Destructor. - */ - virtual ~CReaderBase(); - - protected: - - /** - * Default constructor. - * @param TDbCreatorInputFile input file type (csv or xml) - * @param TDbCreatorFeatures feature type - relevant in case - * of csv input as feature is not detected by the reader. - */ - CReaderBase( TDbCreatorInputFile aFileType, - TDbCreatorFeatures aFeature ); - - /** - * Second phase constructor. Leaves on failure. - * @param aInFileName Name of the input file. - */ - void ConstructL( const TDesC& aInFileName ); - - public: - - /** - * Locates the next feature in input file. - */ - virtual void LocateFeatureL() = 0; - - /** - * Gives back the next line from the given buffer. - * @return EFalse if the end of buffer is accessed, ETrue otherwise. - */ - virtual TBool LocateAPL() = 0; - - /** - * Parses a line of the input file. - */ - virtual void ParseAPL() = 0; - - /** - * Resets the actual file position to the beginning of the file. - * @return One of the system-wide error codes if reset failed. - */ - virtual TInt Reset() = 0; - - /** - * Writes log to the log file. - */ - virtual void ToDoLog() = 0; - - /** - * Returns reference to the TagContainer - * @return CTagContainer - */ - CTagContainer& TagContainer(); - - /** - * Returns reference to the input file - * @return RFile - */ - RFile& InputFile(); - - /** - * Returns reference to the logger - * @return RFileLogger - */ - RFileLogger& FileLogger(); - - /** - * Checks if filed ID is read from the input file (otherwise it is - * calculated by reader according to the index of the tag) - * @return TRUE if reader reads the field id - */ - TBool FieldIDPresent(); - - /** - * Returns the feature currently being parsed - * @return TDbCreatorFeatures - * - EFeatureNone - No feature found - * - EFeatureAP - Internet access point - * - EFeatureWLAN - WLAN access point - * - EFeatureVPN - VPN access point - */ - TDbCreatorFeatures CurrentFeature(); - - protected: - // @var marks the found feature that is being processed - TDbCreatorFeatures iCurrentFeature; - - private: - - // @var contains the values read from input file - CTagContainer* iTagContainer; - // @var for file handling. - RFs iFs; - // @var Input file. - RFile iInputFile; - // @var Log file. - RFileLogger iLogFile; - // @var Input file type - TDbCreatorInputFile iFileType; - - }; - - - -#endif // READER_BASE_H - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcreaderxml.h --- a/dbcreator/commsdatcreator/Inc/cdcreaderxml.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,231 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CReaderXML. -* -*/ - - - - -#ifndef XML_READER_H -#define XML_READER_H - - -// INCLUDE FILES -#include - -#include "cdcreaderbase.h" - -// COSTANTS -enum TParamSegment - { - EParamName, - EParamValue - }; - -class EInputParams -{ - public: - - inline EInputParams( const TInt aId, const TDesC16& aParam ) : - iId( aId ), - iParam( aParam ) - { - //no implementation required - }; - - const TInt iId; - const TDesC16& iParam; -}; - - -// CLASS DECLARATION - -/** -* CReaderXML. -* Reads and parses XML input. Capable of locating and reading Internet, WLAN -* and VPN access points. -*/ -class CReaderXML : public CReaderBase - { - - public: - /** - * Two-phase constructor. - * @param aInFileName the input file name - * @param aCharSet the input characterset - * @return CReaderXML instance - */ - static CReaderXML* NewLC( const TDesC& aInFileName, - const TDbCreatorInputCharSet aCharSet ); - - /** - * Destructor. - */ - virtual ~CReaderXML(); - - protected: - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Default constructor. - */ - CReaderXML( const TDbCreatorInputCharSet aCharSet ); - - public: - - /** - * Locates the next feature in XML file. - */ - virtual void LocateFeatureL(); - - /** - * Gives back the next line from the given buffer. - * @return - EFalse if the end of buffer is accessed, - * - ETrue otherwise. - */ - virtual TBool LocateAPL(); - - /** - * Parses a line of the input file. - */ - virtual void ParseAPL(); - - /** - * Resets the actual file position to the beginning of the file. - * @return One of the system-wide error codes if reset failed. - */ - virtual TInt Reset(); - - /** - * Writes log to the log file. - */ - virtual void ToDoLog(); - - private: - /** - * Reads one line of the input file. - * @return - KErrNone if the whole line is read successfully. - * - KErrEof if end of file is reached - * - KErrNotFound if line delimiter is not found - * - KErrGenereal in case of any other error - */ - TInt ReadLineL(); - - /** - * Extracts one line from the buffer read by ReadLineL - * @param const TPtrC16& aBuffer reference to the buffer descriptor - * @param TPtrC16& aLine reference to the line descriptor - * @return - KErrNone if the whole line is read successfully. - * - KErrEof if end of file is reached - * - KErrNotFound if line delimiter is not found - * - KErrGenereal in case of any other error - */ - TInt ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine); - - /** - * Detects the head of feature segment - * @return the detected feature : - * - EFeatureNone : No feature found - * - EFeatureAP : Internet access point - * - EFeatureWLAN : WLAN access point - * - EFeatureVPN : VPN access point - */ - TDbCreatorFeatures DetectFeatureHead(); - - /** - * Detects the tail of feature segment - * @return TRUE if the current line contains the tail of feature - */ - TBool DetectFeatureTail(); - - /** - * Detects the tail of access point data segment - * @return TRUE if the current line contains the tail - */ - TBool DetectTailAP(); - - /** - * Detects the parameter of access point data segment - * @return TInt the ID the matching field id of the parameter - */ - TInt DetectParam(); - - /** - * Reads the parameter value - * @param aSegment - the required segment of the param - * EParamName - name - * EParamValue - value - * ParamValue - * @return pointer to the tag read from the input file. Memory is - * allocated by the function. NULL can be returned. - */ - HBufC16* ReadParam( TParamSegment aSegment ); - - /** - * Detects the encoding of the xml input. If detection fails leaves - * ECharSetAscii as default character set. - */ - void DetectEncodingL(); - - - /** - * Fills the parameter arrays with the id-name pairs - */ - void FillPacketDataParams(); - void FillLanParams(); - void FillWLanParams(); - void FillVpnParams(); - void FillGlobalParams(); - void FillDNParams(); - - /** - * Replace special XML chars in connecton method names - */ - void ConvertSpecialXMLChars( HBufC* aPtrTag ); - void ReplaceInString( HBufC* aPtrTag, const TDesC& aSpXML, - const TDesC& aSp ); - - private: - - // @var Holds the actual file position - TInt iFilePos; - - // @var Input character set - TDbCreatorInputCharSet iCharSet; - - // @var holds the line - HBufC16* iLine; - - // @var true if global settings are found - TBool iFoundGlobal; - - RArray iPDParams; - RArray iLanParams; - RArray iWLanParams; - RArray iVpnParams; - RArray iGlobalParams; - RArray iDNParams; - - - }; - - -#endif // XML_READER_H - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdctagcontainer.h --- a/dbcreator/commsdatcreator/Inc/cdctagcontainer.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CTagContainer. -* -*/ - - - -#ifndef TAG_CONTAINER_H -#define TAG_CONTAINER_H - -// INCLUDE FILES - -#include - -// CLASS DECLARATION -/** -* CTagContainer -* contains and manages the fields read form XML or CSV input file -*/ -class CTagContainer : public CBase - { - //TYPE DECLARATION - private: - - /** - * ETag - * contains one tag and the belonging field id - */ - class ETag - { - public: - //constructor & destructor - ETag( HBufC16* aTag, TInt aFieldId ); - ~ETag(); - - //attributes - TInt iFieldId; ///< field id tag belongs to - HBufC16* iTag; ///< tag is the data segment read from file - ///< created elsewhere but owned by ETag - ///< and deallocated by ETag's destructor - }; - - public: - - /** - * Two-phase constructor. - */ - static CTagContainer* NewL(); - - /** - * Destructor. - */ - ~CTagContainer(); - - private: - - /** - * Second phase constructor. Leaves on failure. - */ - void ConstructL(); - - /** - * Constructor - */ - CTagContainer(); - - public: - - /** - * Clears the array and deallocates all reserved memory - */ - void Clear(); - - /** - * Adds a new tag to the array - * @param aTag is a pointer to the tag - */ - void AddL(HBufC16* aTag, TInt aFieldId); - - /** - * Retrieves a tag identified by its index - * @param aIdx is the index of the tag - * @return HBufC16* pointer to the tag - */ - HBufC16* Tag(TUint aIdx); - - /** - * Retrieves the field ID - * @param aIdx is the index of the tag - * @return HBufC16* pointer to the tag - */ - TInt FieldId(TUint aIdx); - - /** - * Counts the number of tags - * @return TInt is the number of tags - */ - TInt Count(); - - private: - - // @var Dynamic array for holding tags - CArrayPtrSeg* iTags; - - }; - - -#endif //TAG_CONTAINER_H \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcwlandevicesettings.h --- a/dbcreator/commsdatcreator/Inc/cdcwlandevicesettings.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CWlanDeviceSettings. -* -*/ - - - -#ifndef WLANDEVICESETTINGS_H -#define WLANDEVICESETTINGS_H - -// INCLUDES -#include -#include - -#define DEBUG( a ) -#define DEBUG1( a, b ) - -using namespace CommsDat; - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** -* Interface to read and write WLAN device specific settings. -* The data is stored in CommsDB. -*/ -NONSHARABLE_CLASS( CWlanDeviceSettings ): public CBase - { -public: - - NONSHARABLE_STRUCT( SWlanDeviceSettings ) - { - //Is WLAN indication icon been showed in UI. - TUint32 backgroundScanInterval; - //Stores the previously set background scan interval. - TUint32 savedBgScanInterval; - //If - ETrue default values are being used, - // - EFalse use the user defined values. - TBool useDefaultSettings; - //How many times packets bigger than 'rts' are been resent. - TUint32 longRetry; - //How many times packets smaller than 'rts' are been resent. - TUint32 shortRetry; - //Min. size of a packet that CTS/RTS handshake is been used. - TUint32 rts; - //Transmission power level in use. In mWs. - TUint32 txPowerLevel; - //Are the radio measurements allowed. - TBool radioMeasurements; - //Is WLAN in power mode enabled - TBool powerMode; - }; - - public: // Methods - - // Constructors and destructor - - /** - * Static constructor. - */ - static CWlanDeviceSettings* NewL(); - - /** - * Destructor. - */ - virtual ~CWlanDeviceSettings(); - - // New methods - - /** - * Returns the default WLAN device settings. - * @param aSettings Default WLAN device settings - */ - static void GetDefaultSettings( SWlanDeviceSettings& aSettings ); - - private: //Methods - - /** - * C++ default constructor. - */ - CWlanDeviceSettings(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Fills a WLAN device settings record with default data. - * @param aTableType 0 for default settings, 1 for user settings. - * @param aRecord pointer to commsdat table view - */ - void FillRecordL( TUint32 aTableType, CMDBGenericRecord* aRecord ); - - /** - * Open database table. - */ - void OpenTableL(); - - private: // Data - - //@var session - Owned - CMDBSession* iSession; - }; - -#endif // WLANDEVICESETTINGS_H - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Inc/cdcwlantables.h --- a/dbcreator/commsdatcreator/Inc/cdcwlantables.h Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of the class CWlanTables. -* -*/ - - - - -#ifndef WLANTABLESHANDLER_H -#define WLANTABLESHANDLER_H - - -// INCLUDES -#include -#include -#include -#include - -using namespace CommsDat; - -// FORWARD DECLARATIONS - -// CONSTANTS - -// CLASS DECLARATION - -/** -* CWlanTables -* Capable of checking the existence of certain WLAN specific -* tables and - if necessry create them. -*/ -class CWlanTables : public CBase - { - public: - - /** - * Static constructor - */ - static CWlanTables* NewL(); - - /** - * Destructor - */ - virtual ~CWlanTables(); - - /** - * Checks if WLAN tables exist. Creates them if not. - */ - void CheckAndCreateTablesL(); - - - private: - - /** - * C++ default constructor. - */ - CWlanTables(); - - /** - * By default Symbian second phase constructor is private. - */ - void ConstructL(); - - /** - * Check if WLAN Service Table exists in CommsDat; create if not. - */ - void CreateWlanServiceTableL(); - - /** - * Check if WLAN Device Table exists in CommsDat; create if not. - */ - void CreateWlanDeviceSettingsTableL(); - - /** - * Check if WLAN Secondary SSID Table exists in CommsDat; create if not. - */ - void CreateWlanSecSSIDTableL(); - - /** - * Check if WLAN bearer record exists in LANBearer table in CommsDat; create if not. - */ - void CreateWlanBearerRecordL(); - - - - private: // Data - - //@var session - Owned - CMDBSession* iSession; - }; - -#endif // WLANTABLESHANDLER_H - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp --- a/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,638 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Module for creating CommsDat from an input file -* -*/ - - - - -// INCLUDE FILES - -#include "cdccommsdatcreator.h" -#include "cdclogger.h" -#include "cdcreaderxml.h" -#include "cdcprocessorpacketdata.h" -#include "cdcprocessorwlan.h" -#include "cdcprocessorlan.h" -#include "cdcprocessorvpn.h" -#include "cdcprocessordn.h" -#include "cdcprocessorglobal.h" -#include "cdcwlantables.h" -#include "cdcwlandevicesettings.h" -#include "cdcdatamobilitytables.h" -#include "cdcdumptables.h" -#include "centralrepository.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - -// CONSTANTS -//maximum length of access point name -const TInt KLengthOfExtention = 4; - -//extension -_LIT16( KExtensionXML, ".xml" ); //XML file - - -//----------------------------------------------------------------------------- -// CCdcCommsDatCreator::NewL() -//----------------------------------------------------------------------------- -// -EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewL() - { - CCdcCommsDatCreator* self = NewLC(); - CleanupStack::Pop( self ); // self - - return self; - } - - -//----------------------------------------------------------------------------- -// CCdcCommsDatCreator::NewLC() -//----------------------------------------------------------------------------- -// -EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewLC() - { - CCdcCommsDatCreator* self = new (ELeave) CCdcCommsDatCreator(); - CleanupStack::PushL( self ); - self->ConstructL(); - - return self; - } - - -//------------------------------------------------ -// CDbCreator::CreateTablesL -//------------------------------------------------ -// -EXPORT_C void CCdcCommsDatCreator::CreateTablesL() - { - CLOG_WRITE( "=====================\n" ) - CLOG_WRITE( "Creating tables ...\n" ) - CLOG_WRITE( "=====================\n" ) - - - //extends architecture of CommsDat - //creates WLAN tables - //------------------------------- - if ( iIsWlanS ) - { - CLOG_WRITE( "Creates WLAN service tables\n" ) - CLOG_WRITE( "---------------------------\n" ) - - CWlanTables* wlanTables = CWlanTables::NewL(); - CleanupStack::PushL( wlanTables ); - wlanTables->CheckAndCreateTablesL(); - - CleanupStack::PopAndDestroy( wlanTables ); - - // WLAN Device Settings Table. - CLOG_WRITE( "Writes Default settings to WLAN Device Settings Table.\n" ) - - // Creating a settings object does it all. - CWlanDeviceSettings* wlanDeviceSettings = CWlanDeviceSettings::NewL(); - delete wlanDeviceSettings; - } - - CLOG_WRITE( "CDataMobilityTables\n" ) - - //extends architecture of CommsDat - //creates Data Mobility tables - //---------------------------- - CDataMobilityTables* dmTables = CDataMobilityTables::NewL(); - CleanupStack::PushL( dmTables ); - - CLOG_WRITE( "Creates Data Mobility ALR tables\n" ) - CLOG_WRITE( "--------------------------------\n" ) - dmTables->CheckAndCreateAlrTablesL(); - - CLOG_WRITE( "Creates Data Mobility MIP tables\n" ) - CLOG_WRITE( "--------------------------------\n" ) - dmTables->CheckAndCreateMipTablesL(); - - CleanupStack::PopAndDestroy( dmTables ); - - //if there is only an "e" parameter then DbCreator extends CommsDat, but - //does not create access points. This functionality earlier was done - //by WlanToCDb modul. - } - - -//------------------------------------------------ -// CDbCreator::CreateCommsDatL -//------------------------------------------------ -// -EXPORT_C void CCdcCommsDatCreator::CreateCommsDatL( const TFileName& aInFileName ) - { - CLOG_WRITE( "=====================\n" ) - CLOG_WRITE( "Processing started...\n" ) - CLOG_WRITE( "=====================\n" ) - - TDbCreatorInputCharSet charSet( ECharSetUnknown );//input character set - - //Creates access points - //---------------------- - - if ( InputFileType( aInFileName ) == EFileXML ) - { - CLOG_WRITE( "Tries to open file"); - // Logs file name - HBufC *fileName = aInFileName.AllocLC(); - CLOG_WRITE_FORMAT( "Input file : %S\n", fileName ) - CleanupStack::PopAndDestroy( fileName ); - - delete iReader; - iReader = NULL; - iReader = CReaderXML::NewLC( aInFileName, charSet ); - CleanupStack::Pop(iReader); - - //locates feature in xml file - iReader->LocateFeatureL(); - } - else - { - User::Leave( KErrInvalidExtension ); - } - - - TBool found( EFalse ); - - // First, add all destinations to the database. Connection methods and - // embedded destinations are not added at this time. - while ( iReader->CurrentFeature() != EFeatureNone && !found ) - { - if( iReader->CurrentFeature() == EFeatureDN ) - { - ProcessDNL( iCmInDest, ETrue ); - } - iReader->LocateFeatureL(); - } - - // Reset input file - iReader->Reset(); - iReader->LocateFeatureL(); - - // Then add connection methods, and assign them to destinations if - // needed - while ( iReader->CurrentFeature() != EFeatureNone ) - { - switch ( iReader->CurrentFeature() ) - { - case EFeaturePacketData: - { - //creates GPRS access point - CLOG_WRITE( "Feature found : Packet Data Access point(s)\n" ) - - iFileProcessor = CProcessorPacketData::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iLingerSettings ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - - break; - } - - case EFeatureWLAN: - { - if( iIsWlanS ) - { - //creates WLAN access point - CLOG_WRITE( "Feature found : WLAN Access point(s)\n" ) - - // Reset the EAP settings just to be safe although it should be empty always here. - iEapSettings.ResetAndDestroy(); - - iFileProcessor = CProcessorWlan::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iWlanSecurity, - iEapSettings ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - - } - break; - } - - case EFeatureLAN: - { - //creates LAN access point - CLOG_WRITE( "Feature found : LAN Access point(s)\n" ) - - iFileProcessor = CProcessorLan::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - break; - } - - case EFeatureVPN: - { - //creates VPN access point - CLOG_WRITE( "Feature found : VPN Access point(s)\n" ) - CLOG_WRITE( "-----------------------------------\n" ) - - iFileProcessor = CProcessorVpn::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iUnderLying ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - - break; - } - - case EFeatureDN: - { - - ProcessDNL( iCmInDest, EFalse ); - - break; - } - - case EFeatureGlobal: - { - // Valid tag but does nothing now. - // Global can be processed at the last end. - - - //sets global settings - CLOG_WRITE( "Feature found : Global settings\n" ) - CLOG_WRITE( "-------------------------------\n" ) - - iFileProcessor = CProcessorGlobal::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iDestArray, - iDestNames ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - - break; - } - - default: - User::Panic( KPanicInvalidCase, KErrInvalidCase ); - - }//switch - - //gets next feature - iReader->LocateFeatureL(); - - }//while - - - // Updates the IAPs that are not in destinations. - UpdateUncatCmsL( iCmInDest ); - - // Sets the underlying IAP/SNAPS for vpn IAPs - SetUnderlyingIapL( iUnderLying ); - - for( TInt i(0); i < iWlanSecurity.Count(); i++ ) - { - CLOG_WRITE_FORMAT( "Sec Pos: %d", i ); - if( iWlanSecurity[i] != NULL ) - { - CLOG_WRITE_FORMAT( "Sec data: %S", iWlanSecurity[i] ); - } - else - { - CLOG_WRITE( "Sec data NULL" ); - } - } - - // Sets the WLAN security paramters including EAP settings - SetWlanSecurityL( iWlanSecurity ); - - // Sets linger settings - SetLingerSettingsL( iLingerSettings ); - - // Logs IAPs in UDEB mode - #ifdef _DEBUG - LogIapIdsL(); - #endif -} - -//------------------------------------------------ -// CCdcCommsDatCreator::DumpCommsDatL -//------------------------------------------------ -// -EXPORT_C void CCdcCommsDatCreator::DumpCommsDatL( const TFileName& aOutFileName ) - { - CLOG_WRITE( "==========================\n" ) - CLOG_WRITE( "Dump processing started...\n" ) - CLOG_WRITE( "==========================\n" ) - - - CDumpTables* dump = CDumpTables::NewLC(); - dump->DoDumpTablesL( aOutFileName ); - CleanupStack::PopAndDestroy( dump ); //dump - - CLOG_WRITE( "======== end dump =========\n" ) - - } - -//------------------------------------------------ -// CCdcCommsDatCreator::CCdcCommsDatCreator -//------------------------------------------------ -// -CCdcCommsDatCreator::CCdcCommsDatCreator() - { - } - -//------------------------------------------------ -// CCdcCommsDatCreator::~CCdcCommsDatCreator -//------------------------------------------------ -// -CCdcCommsDatCreator::~CCdcCommsDatCreator() - { - delete iReader; - - iEapSettings.ResetAndDestroy(); - - for ( TInt i = 0; i < iPluginArray.Count(); i++ ) - { - iPluginArray[i]->Close(); - } - iPluginArray.ResetAndDestroy(); - iPluginNames.ResetAndDestroy(); - - for ( TInt i = 0; i < iDestArray.Count(); i++ ) - { - iDestArray[i]->Close(); - } - iDestArray.ResetAndDestroy(); - - iDestNames.ResetAndDestroy(); - - iUnderLying.ResetAndDestroy(); - - iWlanSecurity.ResetAndDestroy(); - - iLingerSettings.ResetAndDestroy(); - - iCmInDest.Close(); - - iCmManager.Close(); - } - - -//------------------------------------------------ -// CCdcCommsDatCreator::ConstructL -//------------------------------------------------ -// -void CCdcCommsDatCreator::ConstructL() - { - CLOG_WRITE( "Initialising FeatureManager\n" ) - //checks if Wlan feature is supported - FeatureManager::InitializeLibL(); - iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); - FeatureManager::UnInitializeLib(); - CLOG_WRITE( "FeatureManager closed\n" ) - - iCmManager.OpenL(); - } - -//------------------------------------------------ -// CCdcCommsDatCreator::InputFileType -//------------------------------------------------ -// -TUint CCdcCommsDatCreator::InputFileType( const TFileName& aFileName ) - { - TBuf extension; - - //get extension - extension.Copy( aFileName.Right( KLengthOfExtention ) ); - - TDbCreatorInputFile type ( EFileUnknown ); - - if ( extension.CompareF( KExtensionXML ) == 0 ) - { - type = EFileXML; - } - else - { - //type keeps default value - } - - return type; - - } - - -//------------------------------------------------ -// CCdcCommsDatCreator::UpdateUncatCmsL -//------------------------------------------------ -// -void CCdcCommsDatCreator::UpdateUncatCmsL( RArray< TBool >& aCmInDest ) - { - CLOG_WRITE( "-------------------------------\n" ) - CLOG_WRITE( "Uncategorised Cms:\n" ) - - // No destination defined - if( aCmInDest.Count() == 0 ) - { - for( TInt i(0); i < iPluginArray.Count(); i++ ) - { - iPluginArray[i]->UpdateL(); - CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] ); - } - } - else - { - - for( TInt i(0); i < iPluginArray.Count(); i++ ) - { - if( aCmInDest[ i ] == EFalse ) - { - iPluginArray[i]->UpdateL(); - CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] ); - } - } - } - - CLOG_WRITE( "-------------------------------\n" ) - } - - -//------------------------------------------------ -// CCdcCommsDatCreator::LogIapIdsL -//------------------------------------------------ -// -void CCdcCommsDatCreator::LogIapIdsL() - { - for( TInt i(0); i < iPluginArray.Count(); i++ ) - { - TUint32 uid1 = iPluginArray[i]->GetIntAttributeL( CMManager::ECmId ); - CLOG_WRITE_FORMAT( "IAP Name: %S", iPluginNames[i] ); - CLOG_WRITE_FORMAT( "ID: %d\n", uid1 ); - } - - for( TInt i(0); i < iDestArray.Count(); i++ ) - { - TUint32 uid1 = iDestArray[i]->Id(); - CLOG_WRITE_FORMAT( "SNAP Name: %S", iDestNames[i] ); - CLOG_WRITE_FORMAT( "ID: %d\n", uid1); - } - } - -// --------------------------------------------------------- -// CCdcCommsDatCreator::ProcessDNL -// --------------------------------------------------------- -// -void CCdcCommsDatCreator::ProcessDNL( RArray< TBool >& aCmInDest, - TBool aFirstRound ) - { - CLOG_WRITE( "Feature found : Destination Network(s)\n" ) - CLOG_WRITE( "--------------------------------------\n" ) - - - if( !aFirstRound ) - { - for( TInt i(0); i < iPluginArray.Count(); i++ ) - { - aCmInDest.Append( EFalse ); - } - } - - iFileProcessor = CProcessorDN::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iDestArray, - iDestNames, - aCmInDest, - aFirstRound ); - iFileProcessor->ParseFileL(); - - delete iFileProcessor; - iFileProcessor = NULL; - CLOG_WRITE( "--------------------------------------\n" ) - } - -// --------------------------------------------------------- -// CCdcCommsDatCreator::SetUnderlyingIapL -// --------------------------------------------------------- -// -void CCdcCommsDatCreator::SetUnderlyingIapL( RPointerArray< HBufC >& aUnderLying ) - { - // Sets the underlying IAP/SNAPS for vpn IAPs - if( aUnderLying.Count() > 0 ) - { - CLOG_WRITE_FORMAT( "SetUnderlyingIapL: %d\n", aUnderLying.Count() ) - CLOG_WRITE( "--------------------------------------\n" ) - - CProcessorVpn* vpn = CProcessorVpn::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - aUnderLying ); - - CleanupStack::PushL( vpn ); - vpn->ProcessUnderLyingL( iDestArray, iDestNames ); - - - CleanupStack::PopAndDestroy( vpn ); - - CLOG_WRITE( "--------------------------------------\n" ) - } - } - - -// --------------------------------------------------------- -// CCdcCommsDatCreator::SetUnderlyingIapL -// --------------------------------------------------------- -// -void CCdcCommsDatCreator::SetWlanSecurityL( RPointerArray< HBufC >& aWlanSecurity ) - { - if( aWlanSecurity.Count() > 0 - || iEapSettings.Count() > 0 ) - { - CLOG_WRITE_FORMAT( "SetWlanSecurityL: %d\n", aWlanSecurity.Count() ); - CLOG_WRITE_FORMAT( "SetWlanSecurityL: EAPs: %d\n", iEapSettings.Count() ); - CLOG_WRITE( "--------------------------------------\n" ) - - CProcessorWlan* wlan = CProcessorWlan::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - aWlanSecurity, - iEapSettings); - - CleanupStack::PushL( wlan ); - wlan->SaveSecurityInfoL(); - - CleanupStack::PopAndDestroy( wlan ); - - // EAP settings were saved. Delete them. - iEapSettings.ResetAndDestroy(); - - CLOG_WRITE( "--------------------------------------\n" ) - } - } - -// --------------------------------------------------------- -// CCdcCommsDatCreator:::SetLingerSettingsL -// --------------------------------------------------------- -// -void CCdcCommsDatCreator::SetLingerSettingsL( - RPointerArray< CLingerElement >& aLingerSettings ) - { - CLOG_WRITE_FORMAT( "SetLingerSettingsL: %d\n", aLingerSettings.Count() ); - if ( aLingerSettings.Count() > 0 ) - { - CProcessorPacketData* pdp = CProcessorPacketData::NewL( iReader, - iCmManager, - iPluginArray, - iPluginNames, - iLingerSettings ); - - CleanupStack::PushL( pdp ); - pdp->SaveLingerSettingsL(); - - CleanupStack::PopAndDestroy( pdp ); - } - CLOG_WRITE( "--------------------------------------\n" ) - } - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcdatamobilitytables.cpp --- a/dbcreator/commsdatcreator/Src/cdcdatamobilitytables.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,613 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CDataMobilityTables -* -*/ - - - - -// INCLUDE FILES -#include "cdcdatamobilitytables.h" -#include "cdclogger.h" - -#include -#include -#include -#include -#include - -// CONSTANTS - -// Maximum bearer type name length -const TUint KMaxNameLength = 50; - -// Default bearer priorities -const TUint KDefaultPriorityLan = 0; -const TUint KDefaultPriorityWlan = 1; -const TUint KDefaultPriorityPan = 2; -const TUint KDefaultPriorityGprsOut = 3; -const TUint KDefaultPriorityGprsIn = 4; -const TUint KDefaultPriorityDialOut = 6; -const TUint KDefaultPriorityDialIn = 7; -const TUint KDefaultUIPriorityVpn = 253; -const TUint KDefaultUIPriorityMip = 254; - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CDataMobilityTables::NewL -// --------------------------------------------------------- -// -CDataMobilityTables* CDataMobilityTables::NewL() - { - - CDataMobilityTables* self = new ( ELeave ) CDataMobilityTables; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CDataMobilityTables -// --------------------------------------------------------- -// -CDataMobilityTables::CDataMobilityTables() - { - //no implementation needed - } - - -// --------------------------------------------------------- -// CDataMobilityTables::ConstructL -// --------------------------------------------------------- -// -void CDataMobilityTables::ConstructL() - { - //no implementation needed - iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); - } - - -// --------------------------------------------------------- -// CDataMobilityTables::~CDataMobilityTables -// --------------------------------------------------------- -// -CDataMobilityTables::~CDataMobilityTables() - { - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CheckAndCreateAlrTablesL -// --------------------------------------------------------- -// -void CDataMobilityTables::CheckAndCreateAlrTablesL() - { - CreateVirtualIAPNextLayerTableL(); - CreateGlobalBearerTypeTableL(); - PopulateGlobalBearerTypeTableL(); - CreateDataMobilitySelectionPolicyTableL(); - CreateSNAPMetadataTableL(); - CreateIAPMetadataTableL(); - CreateDestNetworkTableL(); - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CheckAndCreateMipTablesL -// --------------------------------------------------------- -// -void CDataMobilityTables::CheckAndCreateMipTablesL() - { - CreateMIPServiceTableL(); - CreateMIP4TableL(); - CreateMIP6TableL(); - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateGlobalBearerTypeTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateGlobalBearerTypeTableL() - { - //Check whether Global Bearer Type Priorization table exists - TInt error( KErrNone ); - - TRAP( error, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDGlobalBearerTypePriorizationRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) ); - if( id >= KErrNone ) - { - CLOG_WRITE( "Added Global Bearer Type Priorization table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add Global Bearer Type Priorization\ - table: %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE ( "Global Bearer Type Priorization table already exists" ) - } - else - { - //do nothing - } - } - - -// ------------------------------------------------------------ -// CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL -// ------------------------------------------------------------ -// -void CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL() - { - //Check whether Data Mobility Selection Policy table exists - TInt error( KErrNone ); - TRAP( error, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDDataMobilitySelectionPolicyRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) ); - if( id >= KErrNone ) - { - CLOG_WRITE( "Added Data Mobility Selection Policy table\n" ) - } - else - { - CLOG_WRITE_FORMAT( - "Failed to add Data Mobility Selection Policy table. %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "Data Mobility Selection Policy table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateMIPServiceTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateMIPServiceTableL() - { - //Check whether MIP Service table exists - TInt error( KErrNone ); - TRAP( error, CCDMIPServiceExtRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDMIPServiceExtRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDMIPServiceExtRecord::TableIdL( *iSession ) ); - if( KErrNone <= id ) - { - CLOG_WRITE( "Added MIP Service table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add MIP Service table: %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "MIP Service table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateMIP4TableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateMIP4TableL() - { - //Check whether MIP4 table exists - TInt error( KErrNone ); - TRAP( error, CCDMIP4Record::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDMIP4Record::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDMIP4Record::TableIdL( *iSession ) ); - if( KErrNone <= id ) - { - CLOG_WRITE( "Added MIP4 table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add MIP4 table: %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "MIP4 table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateMIP6TableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateMIP6TableL() - { - //Check whether MIP6 table exists - TInt error( KErrNone ); - TRAP( error, CCDMIP6Record::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDMIP6Record::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDMIP6Record::TableIdL( *iSession ) ); - if( KErrNone <= id ) - { - CLOG_WRITE( "Added MIP6 table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add MIP6 table %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "MIP6 table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateSNAPMetadataTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateSNAPMetadataTableL() - { - //Check whether SNAP Metadata table exists - TInt error( KErrNone ); - TRAP( error, CCDSNAPMetadataRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDSNAPMetadataRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDSNAPMetadataRecord::TableIdL( *iSession ) ); - if( KErrNone <= id ) - { - CLOG_WRITE( "Added SNAP Metadata table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add SNAP Metadata table? %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "SNAP Metadata table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateIAPMetadataTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateIAPMetadataTableL() - { - //Check whether IAP Metadata table exists - TInt error( KErrNone ); - TRAP( error, CCDIAPMetadataRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDIAPMetadataRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDIAPMetadataRecord::TableIdL( *iSession ) ); - if( KErrNone <= id ) - { - CLOG_WRITE( "Added IAP Metadata table\n" ) - } - else - { - CLOG_WRITE_FORMAT( "Failed to add IAP Metadata table: %d\n", id ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "IAP Metadata table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CDataMobilityTables::CreateVirtualIAPNextLayerTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateVirtualIAPNextLayerTableL() - { - //Check whether IAP Metadata table exists - TInt error( KErrNone ); - TRAP( error, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) ); - - //Table not found -> create it - if( error == KErrNotFound ) - { - //Add table to CommsDat - CCDVirtualIAPNextLayerRecord::CreateTableL( *iSession ); - - //check result - TInt id( KErrNone ); - TRAP( id, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) ); - if( KErrNone > id ) - { - CLOG_WRITE_FORMAT( "Failed to add Virtual IAP Next Layer table %d\n", id ) - } - else - { - CLOG_WRITE( "Added Virtual IAP Next Layer table\n" ) - } - } - //Table already exists - else if ( error == KErrNone) - { - CLOG_WRITE( "Virtual IAP Next Layer table already exists" ) - } - else - { - //do nothing - } - } - -// --------------------------------------------------------- -// CreateDestNetworkTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::CreateDestNetworkTableL() - { - //checks whether table exists - TInt error( KErrNone ); - - TRAP( error, CCDDestNWTable::TableIdL( *iSession ) ); - if( error == KErrNotFound ) - { - //table not found -- add new table - CCDDestNWTable::CreateTableL( *iSession ); - - //check result - TRAP( error, CCDDestNWTable::TableIdL( *iSession ) ); - - if ( error == KErrNone ) - { - CLOG_WRITE( "Added Destination Network table" ) - } - } - else if ( error == KErrNone) - { - CLOG_WRITE( "Destination Network table already exists" ) - } - else - { - //do nothing - } - } - -// --------------------------------------------------------- -// CDataMobilityTables::PopulateGlobalBearerTypeTableL -// --------------------------------------------------------- -// -void CDataMobilityTables::PopulateGlobalBearerTypeTableL() - { - RCmManagerExt cmManager; - cmManager.CreateTablesAndOpenL(); - - CleanupClosePushL( cmManager ); - - RArray< TBearerPriority >* bearerArray = new( ELeave ) - RArray< TBearerPriority >(); - - CleanupStack::PushL( bearerArray ); - - // Check if the bearer table has already been filled - // (and skip populating in this case) - - cmManager.BearerPriorityArrayL( *bearerArray ); - - if( !bearerArray->Count() ) - { - // Prepare bearer priority array - // Strings are needed to be available until the update of the bearer array - // (TBearerPriority has a HBufC* member) - HBufC* lanServiceName = HBufC::NewLC( KMaxNameLength ); - *lanServiceName = TPtrC( KCDTypeNameLANService ); - HBufC* wLanServiceName = HBufC::NewLC( KMaxNameLength ); - *wLanServiceName = TPtrC( KCDTypeNameWLANServiceExt ); - HBufC* panServiceName = HBufC::NewLC( KMaxNameLength ); - *panServiceName = TPtrC( KCDTypeNamePANServiceExt ); - HBufC* gprsOutServiceName = HBufC::NewLC( KMaxNameLength ); - *gprsOutServiceName = TPtrC( KCDTypeNameOutgoingWCDMA ); - HBufC* gprsInServiceName = HBufC::NewLC( KMaxNameLength ); - *gprsInServiceName = TPtrC( KCDTypeNameIncomingWCDMA ); - HBufC* dialOutServiceName = HBufC::NewLC( KMaxNameLength ); - *dialOutServiceName = TPtrC( KCDTypeNameDialOutISP ); - HBufC* dialInServiceName = HBufC::NewLC( KMaxNameLength ); - *dialInServiceName = TPtrC( KCDTypeNameDialInISP ); - HBufC* vpnServiceName = HBufC::NewLC( KMaxNameLength ); - *vpnServiceName = TPtrC( KCDTypeNameVPNService ); - HBufC* mipServiceName = HBufC::NewLC( KMaxNameLength ); - *mipServiceName = TPtrC( KCDTypeNameMIPServiceExt ); - - bearerArray->Reset(); - - TBearerPriority lanRecord; - lanRecord.iServiceType = lanServiceName; - lanRecord.iPriority = KDefaultPriorityLan; - lanRecord.iUIPriority = KDefaultPriorityLan; - bearerArray->Append( lanRecord ); - - TBearerPriority wLanRecord; - wLanRecord.iServiceType = wLanServiceName; - wLanRecord.iPriority = KDefaultPriorityWlan; - wLanRecord.iUIPriority = KDefaultPriorityWlan; - bearerArray->Append( wLanRecord ); - - TBearerPriority panRecord; - panRecord.iServiceType = panServiceName; - panRecord.iPriority = KDefaultPriorityPan; - panRecord.iUIPriority = KDefaultPriorityPan; - bearerArray->Append( panRecord ); - - TBearerPriority gprsOutRecord; - gprsOutRecord.iServiceType = gprsOutServiceName; - gprsOutRecord.iPriority = KDefaultPriorityGprsOut; - gprsOutRecord.iUIPriority = KDefaultPriorityGprsOut; - bearerArray->Append( gprsOutRecord ); - - TBearerPriority gprsInRecord; - gprsInRecord.iServiceType = gprsInServiceName; - gprsInRecord.iPriority = KDefaultPriorityGprsIn; - gprsInRecord.iUIPriority = KDefaultPriorityGprsIn; - bearerArray->Append( gprsInRecord ); - - TBearerPriority dialOutRecord; - dialOutRecord.iServiceType = dialOutServiceName; - dialOutRecord.iPriority = KDefaultPriorityDialOut; - dialOutRecord.iUIPriority = KDefaultPriorityDialOut; - bearerArray->Append( dialOutRecord ); - - TBearerPriority dialInRecord; - dialInRecord.iServiceType = dialInServiceName; - dialInRecord.iPriority = KDefaultPriorityDialIn; - dialInRecord.iUIPriority = KDefaultPriorityDialIn; - bearerArray->Append( dialInRecord ); - - TBearerPriority vpnRecord; - vpnRecord.iServiceType = vpnServiceName; - vpnRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; - vpnRecord.iUIPriority = KDefaultUIPriorityVpn; - bearerArray->Append( vpnRecord ); - - TBearerPriority mipRecord; - mipRecord.iServiceType = mipServiceName; - mipRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; - mipRecord.iUIPriority = KDefaultUIPriorityMip; - bearerArray->Append( mipRecord ); - - cmManager.UpdateBearerPriorityArrayL( *bearerArray ); - - CLOG_WRITE( "Global Bearer Priorization table updated with default values\n" ) - - // Only pop, because ownership is passed to the array - CleanupStack::Pop( mipServiceName ); - CleanupStack::Pop( vpnServiceName ); - CleanupStack::Pop( dialInServiceName ); - CleanupStack::Pop( dialOutServiceName ); - CleanupStack::Pop( gprsInServiceName ); - CleanupStack::Pop( gprsOutServiceName ); - CleanupStack::Pop( panServiceName ); - CleanupStack::Pop( wLanServiceName ); - CleanupStack::Pop( lanServiceName ); - } - - else - { - CLOG_WRITE( "Not updating Global Bearer Priorization table\n" ) - } - - cmManager.CleanupGlobalPriorityArray( *bearerArray ); - - CleanupStack::PopAndDestroy( bearerArray ); - CleanupStack::PopAndDestroy( &cmManager ); - } - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcdumptables.cpp --- a/dbcreator/commsdatcreator/Src/cdcdumptables.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,453 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorCSD -* -*/ - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include - -#include "cdcdumptables.h" -#include "cdclogger.h" - -// DEFINES - -#define QUERY_HBUFC_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) -#define QUERY_HBUFC8_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) -#define QUERY_UINT32_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) -#define QUERY_INT_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) - - -// CONSTANTS - -// commons for CSV file creatin -_LIT16( KComma, "," ); -_LIT16( KNewLine, "\n" ); -_LIT16( KCRT, "\r" ); -_LIT16( KDQuote, "\"" ); - -// Table names for CSV file creation -_LIT16( KCDWlanServiceRecord, "CCDWlanService" ); -_LIT16( KCDWlanDeviceSettingsRecord, "CCDWlanDeviceSettings" ); -_LIT16( KCDWLANSecSSIDTable, "CCDWLANSecSSIDTable" ); -_LIT16( KCDDestNWTable, "CCDDestNWTable" ); -_LIT16( KCDVirtualIAPNextLayerRecord,"CCDVirtualIAPNextLayer" ); -_LIT16( KCDDataMobilitySelectionPolicyRecord, "CCDDataMobilitySelectionPolicy" ); -_LIT16( KCDSNAPMetadataRecord, "CCDSNAPMetadata" ); -_LIT16( KCDGlobalBearerTypePriorizationRecord, "CCDGlobalBearerTypePriorization" ); -_LIT16( KCDMIPServiceExtRecord, "CCDMIPServiceExt" ); -_LIT16( KCDIAPMetadataRecord, "CCDIAPMetadata" ); -_LIT16( KCDMIP4Record, "CCDMIP4" ); -_LIT16( KCDMIP6Record, "CCDMIP6" ); - - -// Little-endian Unicode file header. -const TUint16 KLittleEndianUnicodeHeader = 0xFEFF; -// Buffer length for number conversion -const TInt KFormatBufLen = 40; - - -// --------------------------------------------------------- -// CDumpTables::NewL -// --------------------------------------------------------- -// -CDumpTables* CDumpTables::NewL() - { - CDumpTables* self = NewLC(); - CleanupStack::Pop( self ); // self - return self; - } - -// --------------------------------------------------------- -// CDumpTables::NewLC -// --------------------------------------------------------- -// -CDumpTables* CDumpTables::NewLC() - { - CDumpTables* self = new ( ELeave ) CDumpTables(); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - return self; - } - - -// --------------------------------------------------------- -// CDumpTables::~CDumpTables -// --------------------------------------------------------- -// -CDumpTables::~CDumpTables() - { - iRfs.Close(); - if (iSession) - { - iSession->Close(); - delete iSession; - } - } - -// --------------------------------------------------------- -// CDumpTables::ConstructL -// --------------------------------------------------------- -// -void CDumpTables::ConstructL() - { - iSession = CommsDat::CMDBSession::NewL( - CommsDat::CMDBSession::LatestVersion() ); - } - - -// --------------------------------------------------------- -// CDumpTables::CDumpTables -// --------------------------------------------------------- -// -CDumpTables::CDumpTables() - { - - } - -// --------------------------------------------------------- -// CDumpTables::DoDumpTablesL -// --------------------------------------------------------- -// -void CDumpTables::DoDumpTablesL( const TFileName& aOutFileName ) - { - - User::LeaveIfError( OpenFileL( aOutFileName ) ); - - - //checks if Wlan feature is supported - FeatureManager::InitializeLibL(); - TBool isWlanS( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ); - FeatureManager::UnInitializeLib(); - - if( isWlanS ) - { - // Dumps CCDWlanService Table - DumpTableL( &KCDWlanServiceRecord ); - - // Dumps CCDWlanDeviceSettings Table - DumpTableL( &KCDWlanDeviceSettingsRecord ); - - // Dumps CCDWLANSecSSID Table - DumpTableL( &KCDWLANSecSSIDTable ); - - // Dumps CCDDestNWTable Table - DumpTableL( &KCDDestNWTable ); - } - - // Dumps CCDVirtualIAPNextLayerRecord Table - DumpTableL( - &KCDVirtualIAPNextLayerRecord ); - - // Dumps CCDDataMobilitySelectionPolicyRecord Table - DumpTableL( - &KCDDataMobilitySelectionPolicyRecord ); - - // Dumps CCDSNAPMetadataRecord Table - DumpTableL( &KCDSNAPMetadataRecord ); - - // Dumps CCDGlobalBearerTypePriorizationRecord Table - DumpTableL( - &KCDGlobalBearerTypePriorizationRecord ); - - // Dumps CCDMIPServiceExtRecord Table - DumpTableL( &KCDMIPServiceExtRecord ); - - // Dumps CCDIAPMetadataRecord Table - DumpTableL( &KCDIAPMetadataRecord ); - - // Dumps CCDMIP4Record Table - DumpTableL( &KCDMIP4Record ); - - // Dumps CCDMIP6Record Table - DumpTableL( &KCDMIP6Record ); - - iFile.Close(); - } - - -// --------------------------------------------------------- -// CDumpTables::DumpTableL -// --------------------------------------------------------- -// -template void CDumpTables::DumpTableL( const TDesC* aTableName ) - { - - CLOG_WRITE_FORMAT( "Dump table: %S \n", aTableName ); - - iFile.WriteL( *aTableName ); - iFile.WriteL( KNewLine ); - - // Retreives the table the recordset and the recordinfo - TMDBElementId tableId = T::TableIdL( *iSession ); - - T* table = new (ELeave) T( tableId ); - - const SRecordTypeInfo* aRecordInfo = table->GetRecordInfo(); - - CommsDat::CMDBRecordSet* aRecordSet = - new (ELeave) CommsDat::CMDBRecordSet( tableId ); - - // Loads the table - TRAP_IGNORE( aRecordSet->LoadL( *iSession ) ); - - //The table has been loaded - TInt count = aRecordSet->iRecords.Count(); - CLOG_WRITE_FORMAT("Record count: %d", count ); - - - TBuf16 buf; - - // Goes throught the records - for ( TInt i = 0; i < count; i++ ) - { - // The closing (after last) field in the record has 0 iTypeId - // to indicate the end of the record. - for ( TInt j = 0; 0 < aRecordInfo[j].iTypeId; j++ ) - { - // Switch for different data types - switch( aRecordInfo[j].iValType ) - { - case EInt: - case EBool: - { - // Dumping TInt - TInt res( QUERY_INT_FIELD( - (*aRecordSet)[i], aRecordInfo[j].iTypeId ) ); - buf.Format( _L( "%d" ), res ); - iFile.WriteL ( buf ); - } - break; - - case EUint32: - case ELink: - { - // Dumping TUint32 - TUint32 res32( QUERY_UINT32_FIELD( - (*aRecordSet)[i], aRecordInfo[j].iTypeId ) ); - buf.Format( _L( "%d" ), res32 ); - iFile.WriteL ( buf ); - } - break; - - case EText: - case EMedText: - case ELongText: - { - // Dumping text16 - HBufC16* text16 = QUERY_HBUFC_FIELD( - (*aRecordSet)[i], aRecordInfo[j].iTypeId ); - WriteL ( text16 ); - } - break; - - case EDesC8: - { - // Dumping text8 - HBufC8* text8 = QUERY_HBUFC8_FIELD( - (*aRecordSet)[i], aRecordInfo[j].iTypeId ); - - WriteL ( text8 ); - } - break; - - default: - CLOG_WRITE_FORMAT("! warning: type not supported: %d", - aRecordInfo[j].iValType ); - break; - } - iFile.WriteL( KComma ); - - } - iFile.WriteL( KNewLine ); - } - } - -// --------------------------------------------------------- -// CDumpTables::OpenFileL -// --------------------------------------------------------- -// -TInt CDumpTables::OpenFileL( const TFileName& aFileName ) - { - ////CLOG_WRITE_FORMAT( "Output file name %S", aFileName ); - - TInt err = iRfs.Connect(); - - if( err == KErrNone ) - { - err = iFile.Replace( iRfs, aFileName, EFileStreamText | EFileWrite ); - } - - if( err == KErrNotFound ) - // file does not exist - create it - { - err=iFile.Create( iRfs, aFileName, EFileStreamText | EFileWrite ); - } - - if( err == KErrNone ) - { - // Write little-endian Unicode file header. - iFile.WriteUint16L( KLittleEndianUnicodeHeader ); - } - - if( err != KErrNone ) - { - iFile.Close(); - ////CLOG_WRITE_FORMAT( "!Error Output file cannot be opened: %S", aFileName ); - } - - return err; - } - - -// --------------------------------------------------------- -// CDumpTables::WriteL -// --------------------------------------------------------- -// -void CDumpTables::WriteL( HBufC8* aDes ) - { - - if( aDes ) - { - - CleanupStack::PushL( aDes ); - - HBufC16* text16 = HBufC16::NewL( aDes->Length() ); - text16->Des().Copy( aDes->Des() ); - - WriteL ( text16 ); - - CleanupStack::PopAndDestroy( aDes ); - } - - } - - -// --------------------------------------------------------- -// CDumpTables::WriteL -// --------------------------------------------------------- -// -void CDumpTables::WriteL( HBufC16* aDes ) - { - - if( aDes ) - { - CleanupStack::PushL( aDes ); - - TBool res = CheckCSVTransformNeedL( aDes ); - - // Need conversion - if( res ) - { - HBufC16* cvsFormat = TransformToCSVFormatLC( aDes ); - iFile.WriteL ( *cvsFormat ); - CleanupStack::PopAndDestroy( cvsFormat ); - } - else - { - iFile.WriteL ( *aDes ); - } - CleanupStack::PopAndDestroy( aDes ); - } - } - - -// --------------------------------------------------------- -// CDumpTables::TransformToCSVFormatLC -// --------------------------------------------------------- -// -HBufC16* CDumpTables::TransformToCSVFormatLC( const HBufC16* aField ) - { - CLOG_WRITE_FORMAT( "Transform needed: %S", aField ); - - // Length of the csv format string is calculated. - // "2" are the leading and trailing d.qquotes - TInt csvLen = aField->Length() + iNumOfDQuotes + 2; - HBufC16* csv = HBufC16::NewLC( csvLen ); - - TPtr16 ptr = csv->Des(); - - // Heading quote - ptr.Append( KDQuote ); - ptr.Append( *aField ); - - // Quotes might be duplicated - if( 0 < iNumOfDQuotes ) - { - // Heading quote step over - TInt pos = 1; - while( pos < ptr.Length() && pos != KErrNotFound ) - { - ptr = ptr.Mid( pos ); - pos = ptr.Find( KDQuote ); - if( pos != KErrNotFound ) - { - ptr.Insert( pos, KDQuote ); - pos+=2; - } - } - } - - // Tailing quote - ptr.Append( KDQuote ); - - CLOG_WRITE_FORMAT( "Transformed: %S", csv ); - - return csv; - } - - -// --------------------------------------------------------- -// CDumpTables::CheckCSVTransformNeedL -// --------------------------------------------------------- -// -TBool CDumpTables::CheckCSVTransformNeedL( HBufC16* aField ) - { - // Looks for comma, new line or carrige return characters. - // Only existance is necessary. If any of them exist the - // quoting is necessary - TInt cnrPos = aField->Find( KComma ); - if( cnrPos == KErrNotFound ) - { - cnrPos = aField->Find( KNewLine ); - if( cnrPos == KErrNotFound ) - { - cnrPos = aField->Find( KCRT ); - } - } - - // Serches for all dquote. Number is usefull for csv text creation - iNumOfDQuotes = 0; - TPtr16 ptr = aField->Des(); - - TInt quotePos = ptr.Find( KDQuote ); - while( quotePos != KErrNotFound ) - { - iNumOfDQuotes++; - ptr = ptr.Mid( quotePos+1 ); - quotePos = ptr.Find( KDQuote ); - } - - // csv file conversion necessary if comma... or quote is in the text. - return ( 0 < iNumOfDQuotes || cnrPos != KErrNotFound ); - } diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorbase.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorbase.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,547 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorBase -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessorbase.h" -#include "cdcreaderbase.h" -#include "cdclogger.h" - -#include -#include -#include -#include -#include - - -using namespace CMManager; - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProcessorBase::CProcessorBase -// Constructor. -// --------------------------------------------------------- -// -CProcessorBase::CProcessorBase( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames ) : - iFileReader( aFileReader ), - iProxyEnabled( EFalse ), - iIsProtected( EFalse ) - { - iCmManager = &aCmManager; - - iPluginArray = &aPluginArray; - iPluginName = &aPluginNames; - } - - -CProcessorBase::CProcessorBase( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ) : - iFileReader( aFileReader ), - iProxyEnabled( EFalse ), - iIsProtected( EFalse ) - { - iCmManager = &aCmManager; - - iPluginArray = &aPluginArray; - iPluginName = &aPluginNames; - - iDestArray = &aDestArray; - iDestName = &aDestNames; - } - - -// --------------------------------------------------------- -// CProcessorBase::~CProcessorBase -// Destructor. -// --------------------------------------------------------- -// -CProcessorBase::~CProcessorBase() - { - iPlugin.Close(); - if( iName ) - { - delete iName; - } - } - - -// --------------------------------------------------------- -// CProcessorBase::ParseFileL -// --------------------------------------------------------- -// -//PseudoCode: -// 0010 locates the next access point within the text file -// 0020 parses the location and reads the input data to TagContainer -// 0030 from TagContainer creates Access Point Item Object -// 0040 using the Access Point Item Object creates a new AP record in CommsDat -// 0050 clears TagContainer -// -void CProcessorBase::ParseFileL() - { - //LocateAP : locates the access points within the text file - while ( iFileReader->LocateAPL() ) - { - //ParseAPL : parses the location, reads the input data to TagContainer - iFileReader->ParseAPL(); - - //from TagContainer creates Access Point Item Object - ProcessTagL( iFileReader->FieldIDPresent() ); - - //adds the Access Point Item Object to CommsDB - ProcessAPL(); - - //clear TagContainer - TagContainer().Clear(); - - }//while - - CLOG_WRITE( "---------------------\n" ) - } - -// --------------------------------------------------------- -// CProcessorPacketData::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorBase::ProcessTagL( TBool /*aFieldIDPresent*/ ) - { - iProxyEnabled= EFalse; - iIsProtected = EFalse; - - Reset(); - TInt aCMId = -1; - for ( TInt idx(0); idx < TagContainer().Count(); idx++) - { - if ( TagContainer().FieldId( idx ) == ECmId) - { - HBufC16* ptrTag = TagContainer().Tag(idx); - TLex16 lex(ptrTag->Des()); - TInt err = lex.Val(aCMId); - if (err != KErrNone) - { - User::Leave(err); - } - break; - } - } - if (aCMId == -1) - { - iPlugin = iCmManager->CreateConnectionMethodL( iBearerType ); - CLOG_WRITE( "ConnectionMethod created without ECmId."); - } - else - { - iPlugin = iCmManager->CreateConnectionMethodL( iBearerType, aCMId); - CLOG_WRITE_FORMAT( "ConnectionMethod created. ECmId:%d", aCMId); - } - - for ( TInt idx(0); idx < TagContainer().Count(); idx++) - { - HBufC16* ptrTag = TagContainer().Tag(idx); - TInt field = TagContainer().FieldId( idx ); - - TBool processed = SetGeneralFieldL( field, ptrTag ); - if( !processed ) - { - ProcessSpecialFieldsL( field, ptrTag, idx ); - } - } - - AddToPluginArrayL(); - - } - -// -------------------------------------------------------- -// CProcessorBase::TagContainer() -// -------------------------------------------------------- -CTagContainer& CProcessorBase::TagContainer() - { - return iFileReader->TagContainer(); - } - - -// -------------------------------------------------------- -// CProcessorBase::AddToPluginArrayL() -// -------------------------------------------------------- -void CProcessorBase::AddToPluginArrayL() - { - if( !iName ) - { - CLOG_WRITE( "Error: No plugin name !!!" ) - } - else - { - const RCmConnectionMethodExt* newItem = new (ELeave) - RCmConnectionMethodExt( iPlugin ); - - iPluginArray->Append( newItem ); - iPluginName->Append( iName->AllocL() ); - - delete iName; - iName = NULL; - - iPlugin.Close(); - } - } - -// -------------------------------------------------------- -// CProcessorBase::GetLastPluginL() -// -------------------------------------------------------- -RCmConnectionMethodExt& CProcessorBase::GetLastPluginL() - { - return GetPluginL( PluginCount() - 1 ); - - } - -// -------------------------------------------------------- -// CProcessorBase::GetPluginL() -// -------------------------------------------------------- -RCmConnectionMethodExt& CProcessorBase::GetPluginL( TInt aPos ) - { - - return *(iPluginArray->operator[]( aPos )); - - } - -// -------------------------------------------------------- -// CProcessorBase::PluginCount() -// -------------------------------------------------------- -TInt CProcessorBase::PluginCount() - { - - return iPluginArray->Count(); - - } - -// --------------------------------------------------------- -// CProcessorBase::FindDestinationL -// --------------------------------------------------------- -// -RCmDestinationExt* CProcessorBase::FindDestinationL( HBufC* aName ) - { - for( TInt i(0); i < iDestName->Count(); i++ ) - { - HBufC *name = (*iDestName)[i]; - if( aName->Compare( *name ) == 0 ) - { - return (*iDestArray)[ i ]; - } - } - CLOG_WRITE_FORMAT("Warning: Destination not found: %S", aName ); - return NULL; - } - -// --------------------------------------------------------- -// CProcessorBase::GetDestinationIdL -// --------------------------------------------------------- -// -TInt CProcessorBase::GetDestinationIdL( HBufC16* aName ) - { - RCmDestinationExt* dest = FindDestinationL( aName ); - - TInt ret( KErrNotFound ); - if( dest != NULL ) - { - ret = dest->Id(); - } - - return ret; - } - -// --------------------------------------------------------- -// CProcessorBase::FindPluginL -// --------------------------------------------------------- -// -RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName ) - { - TInt pos; - return FindPluginL( aName, pos ); - } - -// --------------------------------------------------------- -// CProcessorBase::FindPluginL -// --------------------------------------------------------- -// -RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName, TInt& aPos ) - { - RCmConnectionMethodExt* ret( NULL ); - - aPos = CheckPluginName( aName ); - if ( aPos != KErrNotFound ) - { - ret = (*iPluginArray)[ aPos ]; - } - else - { - CLOG_WRITE_FORMAT("Warning: Connection method not found: %S", aName ); - } - - return ret; - } - -// --------------------------------------------------------- -// CProcessorBase::CheckPluginName -// --------------------------------------------------------- -// -TInt CProcessorBase::CheckPluginName( HBufC* aName ) - { - TInt ret( KErrNotFound ); - - for( TInt i = 0; i < iPluginName->Count() && ret == KErrNotFound; i++ ) - { - HBufC *name = (*iPluginName)[i]; - if( aName->Compare( *name ) == 0 ) - { - ret = i; - } - } - return ret; - } - - - -// --------------------------------------------------------- -// CProcessorBase::GetPluginIdL -// --------------------------------------------------------- -// -TInt CProcessorBase::GetPluginIdL( HBufC16* aName ) - { - RCmConnectionMethodExt* cm = FindPluginL( aName ); - - TInt ret( KErrNotFound ); - if( cm != NULL ) - { - ret = cm->GetIntAttributeL( CMManager::ECmIapId ); - } - - return ret; - } - - -// --------------------------------------------------------- -// CProcessorBase::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorBase::ProcessAPL() - { - RCmConnectionMethodExt& plugin = GetLastPluginL(); - if( iIsProtected ) - { - plugin.SetBoolAttributeL( ECmProtected, ETrue ); - } - - // Writes into the log file. - DoLogL(); - } - -// --------------------------------------------------------- -// CProcessorBase::ProcessAPL -// --------------------------------------------------------- -// -TBool CProcessorBase::SetGeneralFieldL( TInt aField, HBufC* aPtrTag ) - { - TBool processed( ETrue ); - switch( aField ) - { - case ECmName: - { - // If input is not empty - if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) - { - TInt pos = CheckPluginName( aPtrTag ); - if( pos != KErrNotFound ) - { - CLOG_WRITE_FORMAT("Warning: plugin exist. It might be renamed ! : %S", aPtrTag ); - } - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - if( !iName ) - { - iName = aPtrTag->AllocL(); - } - } - break; - } - case ECmStartPage: - { - // If input is not empty - if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - } - break; - } - case ECmHidden: //fall through - case ECmMetaHiddenAgent: //fall through - case ECmMetaHighlight: //fall through - { - if( aPtrTag->CompareF( KStrNo ) == 0 ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else if( aPtrTag->CompareF( KStrYes ) == 0 ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - switch ( aField ) - { - case ECmHidden: - CLOG_WRITE( "! Error : Invalid Hidden. Default:No"); - break; - case ECmMetaHiddenAgent: - CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No"); - break; - case ECmMetaHighlight: - CLOG_WRITE( "! Error : Invalid Highlight. Default:No"); - break; - } - } - break; - } - case ECmSeamlessnessLevel: - { - if ( aPtrTag->CompareF( KStrNotRoamedTo ) == 0 ) - { - iPlugin.SetIntAttributeL( aField, - CMManager::ESeamlessnessNotRoamedTo ); - } - else if ( aPtrTag->CompareF( KStrConfirmFirst ) == 0 ) - { - iPlugin.SetIntAttributeL( aField, - CMManager::ESeamlessnessConfirmFirst ); - } - else if ( aPtrTag->CompareF( KStrShowProgress ) == 0 ) - { - iPlugin.SetIntAttributeL( aField, - CMManager::ESeamlessnessShowprogress ); - } - else if ( aPtrTag->CompareF( KStrFullySeamless ) == 0 ) - { - iPlugin.SetIntAttributeL( aField, - CMManager::ESeamlessnessFullySeamless ); - } - break; - } - - case ECmProtected: - { - // Protection - if ( aPtrTag->CompareF( KStrYes ) == 0 ) - { - iIsProtected = ETrue; - } - else if ( aPtrTag->CompareF( KStrNo ) != 0 ) - { - CLOG_WRITE( "! Error : Invalid Protected value. Default:No" ) - } - break; - } - - default: - { - processed = EFalse; - } - } - - return processed; - } - -// --------------------------------------------------------- -// CProcessorBase::DoLogL -// --------------------------------------------------------- -// - -void CProcessorBase::DoLogL() - { - - TInt lastPos = iPluginArray->Count() - 1; - - CLOG_WRITE( "Internet Access Point created:" ) - CLOG_WRITE_FORMAT( "\t Connection name: %S ", (*iPluginName)[ lastPos ] ); - - if ( iIsProtected ) - { - CLOG_WRITE( "\t Protected" ) - } - else - { - CLOG_WRITE( "\t Not protected" ) - } - } -// --------------------------------------------------------- -// CProcessorBase::SetAddressFromServerL -// --------------------------------------------------------- -// - -void CProcessorBase::SetAddressFromServerL( TInt aIPField1, - TInt aIPField2, - TInt aAddrFromSField, - TInt aIPField1IP6, - TInt aIPField2IP6, - TInt aAddrFromSFieldIP6 ) - { - //calculate and set Ip6AddrFromServer - HBufC *pIp1 = NULL; - HBufC *pIp2 = NULL; - pIp1 = iPlugin.GetStringAttributeL( aIPField1IP6 ); - CleanupStack::PushL( pIp1 ); - pIp2 = iPlugin.GetStringAttributeL( aIPField2IP6 ); - CleanupStack::PushL( pIp2 ); - _LIT( KDynIpv6Address, "0:0:0:0:0:0:0:0" ); - if ( ( pIp1->Compare( KDynIpv6Address ) == 0 ) && - ( pIp2->Compare( KDynIpv6Address ) == 0 ) ) - { - iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, ETrue ); - } - else - { - iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, EFalse ); - } - CleanupStack::PopAndDestroy( 2,pIp1 ); - - //calculate and set AddrFromServer - pIp1 = iPlugin.GetStringAttributeL( aIPField1 ); - CleanupStack::PushL( pIp1 ); - pIp2 = iPlugin.GetStringAttributeL( aIPField2 ); - CleanupStack::PushL( pIp2 ); - _LIT( KDynIpAddress, "0.0.0.0" ); - if ( ( pIp1->Compare( KDynIpAddress ) == 0 ) && - ( pIp2->Compare( KDynIpAddress ) == 0 ) ) - { - iPlugin.SetBoolAttributeL( aAddrFromSField, ETrue ); - } - else - { - iPlugin.SetBoolAttributeL( aAddrFromSField, EFalse ); - } - CleanupStack::PopAndDestroy( 2,pIp1 ); - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessordn.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessordn.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,460 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorDN -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessordn.h" -#include "cdclogger.h" -#include "cdctagcontainer.h" - -using namespace CMManager; - -// CONSTANTS - -_LIT16( KDefaultDestinationName, "Default destination" ); -//_LIT16( KMetadataUserDefined, "UserDefined" ); -//_LIT16( KMetadataInternet, "Internet" ); - -// constants for TSnapPurpose -_LIT16( KPurposeUnknown, "UserDefined" ); -_LIT16( KPurposeInternet, "Internet" ); -_LIT16( KPurposeOperator, "Operator" ); -_LIT16( KPurposeMMS, "MMS" ); -_LIT16( KPurposeIntranet, "Intranet" ); - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProcessorDN::NewL -// --------------------------------------------------------- -// -CProcessorDN* CProcessorDN::NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames, - RArray& aCmInDest, - TBool aIsFirstRound ) - { - CProcessorDN* self = new ( ELeave ) CProcessorDN( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aDestArray, - aDestNames, - aCmInDest, - aIsFirstRound ); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); // self - return self; - } - - -// --------------------------------------------------------- -// CProcessorDN::~CProcessorDN -// --------------------------------------------------------- -// -CProcessorDN::~CProcessorDN() - { - iDestination.Close(); - } - - -// --------------------------------------------------------- -// CProcessorDN::ConstructL -// --------------------------------------------------------- -// -void CProcessorDN::ConstructL() - { - } - - -// --------------------------------------------------------- -// CProcessorDN::CProcessorDN -// --------------------------------------------------------- -// -CProcessorDN::CProcessorDN( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames, - RArray< TBool >& aCmInDest, - TBool aIsFirstRound ) : - CProcessorBase( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aDestArray, - aDestNames ), - iProtectionLevel( EProtLevel0 ), - iIsFirstRound( aIsFirstRound ) - { - iCmInDest = &aCmInDest; - } - - -// --------------------------------------------------------- -// CProcessorDN::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorDN::ProcessTagL( TBool /*aFieldIDPresent*/ ) - { - - iDestinationDropped = EFalse; - - iProtectionLevel = EProtLevel0; - - if( iIsFirstRound ) - { - TInt dnId = -1; - for ( TInt idx(0); idx < TagContainer().Count(); idx++) - { - if ( TagContainer().FieldId( idx ) == EDN_Id ) - { - HBufC16* ptrTag = TagContainer().Tag(idx); - TLex16 lex(ptrTag->Des()); - TInt err = lex.Val(dnId); - if (err != KErrNone) - { - CLOG_WRITE( "The destinaton Id field is bad."); - User::Leave(err); - } - break; - } - } - if (dnId == -1) - { - iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName ); - CLOG_WRITE( "Destinaton created without dnId."); - } - else - { - iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName, dnId); - CLOG_WRITE_FORMAT( "Destinaton created. dnId:%d", dnId); - } - } - - HBufC *destName( NULL ); - TInt priority = 0; - RPointerArray names; - - for (TInt idx(0); idx < TagContainer().Count(); idx++) - { - HBufC16* ptrTag = TagContainer().Tag(idx); - TInt field = TagContainer().FieldId( idx ); - - if( iIsFirstRound && !iDestinationDropped ) - { - switch ( field ) - { - case EDN_Name: - { - // If more destinations exist with same name then one is kept - TRAPD( err, iDestination.SetNameL( *ptrTag ) ); - if( KErrAlreadyExists == err ) - { - CLOG_WRITE_FORMAT( - "Error: Destination exist: %S. It is dropped!", ptrTag ) - CLOG_WRITE( "\t \r\n" ) - iDestinationDropped = ETrue; - } - else - { - destName = ptrTag->AllocLC(); - } - } - break; - case EDN_Metadata: - { - if( !ptrTag->Compare( KPurposeUnknown ) ) - { - iDestination.SetMetadataL( ESnapMetadataPurpose, - ESnapPurposeUnknown ); - } - else if( !ptrTag->Compare( KPurposeInternet ) ) - { - iDestination.SetMetadataL( - ESnapMetadataPurpose, - ESnapPurposeInternet ); - } - else if( !ptrTag->Compare( KPurposeOperator ) ) - { - iDestination.SetMetadataL( - ESnapMetadataPurpose, - ESnapPurposeOperator ); - } - else if( !ptrTag->Compare( KPurposeMMS ) ) - { - iDestination.SetMetadataL( - ESnapMetadataPurpose, - ESnapPurposeMMS ); - } - else if( !ptrTag->Compare( KPurposeIntranet ) ) - { - iDestination.SetMetadataL( - ESnapMetadataPurpose, - ESnapPurposeIntranet ); - } - else - { - //no valid data is given - use default value - iDestination.SetMetadataL( ESnapMetadataPurpose, - ESnapPurposeUnknown ); - CLOG_WRITE( "! Error : Invalid Metadata. Default:User Defined"); - } - } - break; - case EDN_Protection: - { - TPtrC16 protPtr = ptrTag->Right( ptrTag->Length() ); - TLex16 lex( protPtr ); - TUint32 prot( 0 ); - if ( lex.Val( prot, EDecimal ) == KErrNone ) - { - if( prot <= EProtLevel3 ) // prot is unsigned so no need - // to check lower boundary - { - iProtectionLevel = TProtectionLevel( prot ); - } - else - { - //no valid data is given - use default value - iProtectionLevel = EProtLevel0; - CLOG_WRITE( "! Error : Invalid Protection level. Default:Level0"); - } - } - } - break; - case EDN_Hidden: - { - if( !ptrTag->Compare( KStrYes ) ) - { - iDestination.SetHiddenL( ETrue ); - } - else if( !ptrTag->Compare( KStrNo ) ) - { - iDestination.SetHiddenL( EFalse ); - } - else - { - //no valid data is given - use default value - iDestination.SetHiddenL( EFalse ); - CLOG_WRITE( "! Error : Invalid Hidden. Default:No"); - } - } - break; - case EDN_HiddenAgent: - { - if( !ptrTag->Compare( KStrYes ) ) - { - iDestination.SetMetadataL( ESnapMetadataHiddenAgent, ETrue ); - } - else if( !ptrTag->Compare( KStrNo ) ) - { - iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse ); - } - else - { - iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse ); - //no valid data is given - use default value - CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No"); - } - } - break; - case EDN_Highlighted: - { - if( !ptrTag->Compare( KStrYes ) ) - { - iDestination.SetMetadataL( ESnapMetadataHighlight, ETrue ); - } - else if( !ptrTag->Compare( KStrNo ) ) - { - iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse ); - } - else - { - iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse ); - //no valid data is given - use default value - CLOG_WRITE( "! Error : Invalid Highlighted. Default:No"); - } - } - break; - } // switch - } // if - else if( !iIsFirstRound && !iDestinationDropped ) - { - switch ( field ) - { - case EDN_Name: - { - iDest = FindDestinationL( ptrTag ); - if( iDest == NULL ) - { - CLOG_WRITE_FORMAT( "Error: Destination not found: %S ", ptrTag ) - iDestinationDropped = ETrue; - } - else - { - CLOG_WRITE_FORMAT( "\t Destination name: %S ", ptrTag ) - } - } - break; - case EDN_IAPName: - { - TInt pos; - RCmConnectionMethodExt* plugin = FindPluginL( ptrTag, pos ); - if( plugin ) - { - TRAPD( err, iDest->AddConnectionMethodL( *plugin ) ); - // Set the priority according to the order in which the IAPs are in the XML - TRAPD( err2 ,iDest->ModifyPriorityL( *plugin, priority )); - if ( err2 != KErrNone ) - { - err2 = KErrNone; // to remove the compiler warnings - } - - iDest->UpdateL(); - priority++; - - if( err == KErrNone ) - { - CLOG_WRITE_FORMAT( "\t Added connection method: %S ", ptrTag ) - (*iCmInDest)[ pos ] = ETrue; - } - else - { - CLOG_WRITE_FORMAT( - "Warning connection method could not added: %S ", ptrTag ) - } - } - else - { - CLOG_WRITE_FORMAT( - "Warning: plugin could not added: %S ", ptrTag ) - } - } - break; - case EDN_EmbeddedDNName: - { - const RCmDestinationExt* embDestination = FindDestinationL( ptrTag ); - if( embDestination ) - { - - TRAPD( err, iDest->AddEmbeddedDestinationL( *embDestination ) ); - - if( err == KErrNone ) - { - CLOG_WRITE_FORMAT( "\t Added embedded destination: %S ", ptrTag ) - } - else - { - CLOG_WRITE_FORMAT( - "Warning embedded destination could not added: %S ", ptrTag ) - } - } - else - { - CLOG_WRITE_FORMAT( - "Warning embedded destination could not added: %S ", ptrTag ) - } - - } - break; - default: - { - break; - } - } // switch - - } // if - - }//for - - if( iIsFirstRound && !iDestinationDropped ) - { - RCmDestinationExt* newItem = new (ELeave) - RCmDestinationExt( iDestination ); - - iDest = newItem; - - iDestArray->Append( newItem ); - iDestName->Append( destName ); - CleanupStack::Pop( destName ); - } - } - - -// --------------------------------------------------------- -// CProcessorDN::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorDN::ProcessAPL() - { - if( !iDestinationDropped ) - { - if( iDest ) - { - if( iIsFirstRound ) - { - iDest->SetProtectionL( iProtectionLevel ); - } - iDest->UpdateL(); - - if( iIsFirstRound ) - { - DoLogL(); - } - else - { - CLOG_WRITE( "\t \r\n" ) - } - } - } - } - - -// --------------------------------------------------------- -// CProcessorDN::DoLogL -// --------------------------------------------------------- -// -void CProcessorDN::DoLogL() - { - HBufC16* tmp; - - tmp = iDestination.NameLC(); - - // Writes some data of the destination network into the log file. - CLOG_WRITE( "Destination Network created:" ) - CLOG_WRITE_FORMAT( "\t Destination name: %S ", tmp ) - TUint32 uid = iDest->Id(); - CLOG_WRITE_FORMAT( "\t Destination ID: %d", uid ); - - CLOG_WRITE( "\t \r\n" ) - - CleanupStack::PopAndDestroy( tmp ); // Removes tmp. - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,735 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorGlobal -* -*/ - - - - -// INCLUDE FILES - -#include "cdclogger.h" -#include "cdcerrors.h" -#include "cdctagcontainer.h" -#include "cdccommon.h" -#include "cmgenconnsettings.h" -#include "cdcprocessorglobal.h" - -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -// CONSTANTS - -// Global settings record name -_LIT16( KGlobalSettingsRecordName, "DefaultRecordName-1" ); - -// Default GPRS record name -_LIT( KDefaultGPRSRecordName, "Dummy Default GPRS Settings" ); - -// Modem bearer names for GPRS/WCDMA Access Points -_LIT( KModemBearerPacketData, "GPRS Modem" ); - -// LAN bearer names for Wlan Access Points -_LIT( KLANBearerWlan, "WLANBearer" ); - - -// Structure that converts field ids to the corresponding table names -// and parameter types -typedef struct - { - TDbCreatorGlobalSettings iField; - const TText* iBearerTableName; - TBool iIsUIPriority; - } TPriorityConversion; - -const TPriorityConversion KPriorityConversionTable[] = - { - { EPriorityLan, KCDTypeNameLANService, EFalse }, - { EPriorityWlan, KCDTypeNameWLANServiceExt, EFalse }, - { EPriorityPan, KCDTypeNamePANServiceExt, EFalse }, - { EPriorityGprsIn, KCDTypeNameOutgoingWCDMA, EFalse }, - { EPriorityGprsOut, KCDTypeNameIncomingWCDMA, EFalse }, - { EPriorityDialOut, KCDTypeNameDialOutISP, EFalse }, - { EPriorityDialIn, KCDTypeNameDialInISP, EFalse }, - { EPriorityVpn, KCDTypeNameVPNService, EFalse }, - { EPriorityMip, KCDTypeNameMIPServiceExt, EFalse }, - { EUIPriorityLan, KCDTypeNameLANService, ETrue }, - { EUIPriorityWlan, KCDTypeNameWLANServiceExt, ETrue }, - { EUIPriorityPan, KCDTypeNamePANServiceExt, ETrue }, - { EUIPriorityGprsIn, KCDTypeNameOutgoingWCDMA, ETrue }, - { EUIPriorityGprsOut, KCDTypeNameIncomingWCDMA, ETrue }, - { EUIPriorityDialOut, KCDTypeNameDialOutISP, ETrue }, - { EUIPriorityDialIn, KCDTypeNameDialInISP, ETrue }, - { EUIPriorityVpn, KCDTypeNameVPNService, ETrue }, - { EUIPriorityMip, KCDTypeNameMIPServiceExt, ETrue }, - { EUnused, NULL, EFalse } - }; - - -// Maximum size to be allocated for table names -const TUint KMaxTableNameSize = 50; - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProcessorGlobal::NewL -// --------------------------------------------------------- -// -CProcessorGlobal* CProcessorGlobal::NewL( - CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ) - { - CProcessorGlobal* self = new ( ELeave ) CProcessorGlobal( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aDestArray, - aDestNames ); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// --------------------------------------------------------- -// CProcessorGlobal::CProcessorGlobal -// --------------------------------------------------------- -// -CProcessorGlobal::CProcessorGlobal( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ) : - CProcessorBase( aFileReader, aCmManager, aPluginArray, aPluginNames, aDestArray, aDestNames ), - iAttachWhenNeeded ( EFalse ) - { - } - - -// --------------------------------------------------------- -// CProcessorGlobal::ConstructL -// --------------------------------------------------------- -// -void CProcessorGlobal::ConstructL() - { - iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); - - iSession->SetAttributeMask( ECDNoWriteButDelete | ECDHidden | ECDProtectedWrite | ECDPrivate ); // Check this - - // Create General connection settings struct and set the default values - iGenConnSettings = new (ELeave) TCmGenConnSettings; - iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanKnown; - iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageAutomatic; - iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageConfirm; - - CLOG_WRITE( "Initialising FeatureManager\n" ) - //checks if Wlan feature is supported - FeatureManager::InitializeLibL(); - iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); - FeatureManager::UnInitializeLib(); - CLOG_WRITE( "FeatureManager closed\n" ) - } - - -// --------------------------------------------------------- -// CProcessorGlobal::~CProcessorGlobal -// --------------------------------------------------------- -// -CProcessorGlobal::~CProcessorGlobal() - { - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - delete iGenConnSettings; - } - -// --------------------------------------------------------- -// CProcessorGlobal::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorGlobal::ProcessTagL( TBool /*aFieldIDPresent*/ ) - { - for (TInt idx(0); idx < TagContainer().Count(); idx++) - { - TDbCreatorGlobalSettings fieldId; - - fieldId = static_cast< TDbCreatorGlobalSettings > - ( TagContainer().FieldId( idx ) ); - - HBufC16* ptrTag = TagContainer().Tag(idx); - - switch( fieldId ) - { - case EGPRSAttachMode: - { - _LIT( KAttachWhenNeeded, "whenneeded" ); - _LIT( KAttachWhenAvailable, "whenavailable" ); - - if ( !ptrTag->CompareF( KAttachWhenNeeded ) ) - { - iAttachWhenNeeded = ETrue; - } - else if ( !ptrTag->CompareF( KAttachWhenAvailable ) ) - { - iAttachWhenNeeded = EFalse; - } - else - { - iAttachWhenNeeded = EFalse; - CLOG_WRITE( "! Error : invalid attach mode. Default:whenavailable" ); - } - - break; - } - - case EDefaultAP: - { - CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() ); - CleanupStack::PushL( db ); - - CCDDefaultWCDMARecord* defaultGPRS = static_cast< CCDDefaultWCDMARecord* > - ( CCDRecordBase::RecordFactoryL( KCDTIdDefaultWCDMARecord ) ); - - CleanupStack::PushL( defaultGPRS ); - - defaultGPRS->iRecordName.SetL( KDefaultGPRSRecordName ); - - defaultGPRS->FindL( *db ); - - defaultGPRS->iAPN.SetL( *ptrTag ); - - defaultGPRS->ModifyL( *db ); - - CleanupStack::PopAndDestroy( defaultGPRS ); - - db->Close(); - CleanupStack::PopAndDestroy( db ); - break; - } - - case EDefaultDnIcon: - { - // Convert default icon to int - TPtrC16 iconPtr = ptrTag->Right( ptrTag->Length() ); - TLex16 lex( iconPtr ); - TUint32 icon( 0 ); - if ( lex.Val( icon, EDecimal ) == KErrNone ) - { - // If there was no error, write default entry to SNAP - // Metadata table. - // First load SNAP table to get table id - CMDBGenericRecord* snapTable = static_cast< CMDBGenericRecord* > - ( CCDRecordBase::RecordFactoryL( 0 ) ); - CleanupStack::PushL( snapTable ); - snapTable->InitializeL( TPtrC( KCDTypeNameSNAPMetadata ), - NULL ); - snapTable->LoadL( *iSession ); - // Then add default record to table - CCDSNAPMetadataRecord* defaultRecord = new( ELeave ) - CCDSNAPMetadataRecord( snapTable->TableId() ); - CleanupStack::PushL( defaultRecord ); - defaultRecord->SetRecordId( KCDNewRecordRequest ); - defaultRecord->iMetadata.SetL( 0 ); - defaultRecord->iIcon.SetL( icon ); - defaultRecord->StoreL( *iSession ); - - CleanupStack::PopAndDestroy( defaultRecord ); // defaultRecord - CleanupStack::PopAndDestroy( snapTable ); // snapTable - } - break; - } - - case EPriorityLan: - case EPriorityWlan: - case EPriorityPan: - case EPriorityGprsIn: - case EPriorityGprsOut: - case EPriorityDialOut: - case EPriorityDialIn: - case EPriorityVpn: - case EPriorityMip: - case EUIPriorityLan: - case EUIPriorityWlan: - case EUIPriorityPan: - case EUIPriorityGprsIn: - case EUIPriorityGprsOut: - case EUIPriorityDialOut: - case EUIPriorityDialIn: - case EUIPriorityVpn: - case EUIPriorityMip: - { - // Convert priority to int - TPtrC16 prioPtr = ptrTag->Right( ptrTag->Length() ); - TLex16 lex( prioPtr ); - TUint32 prio( 0 ); - if ( lex.Val( prio, EDecimal ) == KErrNone ) - { - UpdateGlobalBearerArrayL( fieldId, prio ); - } - break; - } - - case EGprsLastSocketActivityTimeout: - case EGprsLastSessionClosedTimeout: - case EGprsLastSocketClosedTimeout: - { - // Load modem bearer record - CCDModemBearerRecord* bearerRecord = static_cast< CCDModemBearerRecord * > - ( CCDRecordBase::RecordFactoryL( KCDTIdModemBearerRecord ) ); - CleanupStack::PushL( bearerRecord ); - - if( fieldId == EGprsLastSocketActivityTimeout - || fieldId == EGprsLastSessionClosedTimeout - || fieldId == EGprsLastSocketClosedTimeout ) - { - // Open the record "Gprs Modem" - bearerRecord->iRecordName.SetL( KModemBearerPacketData ); - } - - bearerRecord->FindL( *iSession ); // CHECK: Leaves if record not found - - // Convert input parameter - TLex lex( *ptrTag ); - - TInt timeout( 0 ); - - // If there are parameters that cannot be handled just leave. In that case the CommsDat creation - // fails and default is used instead. So it is easier for the variant engineer to detect - // that something went wrong. - if ( lex.Val( timeout ) != KErrNone) - { - CLOG_WRITE( "! Error : invalid NIF parameter for GPRS (socket/session timeout)" ); - User::Leave( KErrArgument ); - } - - // Set the parameter - if( fieldId == EGprsLastSocketActivityTimeout ) - { - bearerRecord->iLastSocketActivityTimeout.SetL( timeout ); - } - else if( fieldId == EGprsLastSessionClosedTimeout ) - { - bearerRecord->iLastSessionClosedTimeout.SetL( timeout ); - } - else - { - bearerRecord->iLastSocketClosedTimeout.SetL( timeout ); - } - - bearerRecord->ModifyL( *iSession ); - - CleanupStack::PopAndDestroy( bearerRecord ); - - break; - } - - case EWlanLastSocketActivityTimeout: - case EWlanLastSessionClosedTimeout: - case EWlanLastSocketClosedTimeout: - { - if( iIsWlanS ) - { - // Load LAN bearer record - CCDLANBearerRecord* bearerRecord = static_cast< CCDLANBearerRecord * > - ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) ); - CleanupStack::PushL( bearerRecord ); - - // Open the record "WlanBearer" - bearerRecord->iRecordName.SetL( KLANBearerWlan ); - - User::LeaveIfError( bearerRecord->FindL( *iSession ) ); - - // Convert the input paramater to UINT - TLex lex( *ptrTag ); - - TInt timeout( 0 ); - - // If there are parameters that cannot be handled just leave. In that case the CommsDat creation - // fails and default is used instead. So it is easier for the variant engineer to detect - // that something went wrong. - if ( lex.Val( timeout ) != KErrNone) - { - CLOG_WRITE( "! Error : invalid NIF parameter for WLAN (socket/session timeout)" ); - User::Leave( KErrArgument ); - } - - - // Set the paramter - if( fieldId == EWlanLastSocketActivityTimeout ) - { - bearerRecord->iLastSocketActivityTimeout.SetL( timeout ); - } - else if( fieldId == EWlanLastSessionClosedTimeout) - { - bearerRecord->iLastSessionClosedTimeout.SetL( timeout ); - } - else - { - bearerRecord->iLastSocketClosedTimeout.SetL( timeout ); - } - - bearerRecord->ModifyL( *iSession ); - CleanupStack::PopAndDestroy( bearerRecord ); - } - break; - } - - case EWlanBGScanInterval: - case EWlanUseDefSettings: - case EWlanLongRetry: - case EWlanShortRetry: - case EWlanRTS: - case EWlanTxPowerLevel: - case EWlanRadioMeasurements: - case EWlanPowerMode: - { - if( iIsWlanS ) - { - // Save the same value both to default and user settings records - TInt err; - TRAP( err, SaveGlobalWlanParameterL( KWlanDefaultSettings, fieldId, ptrTag ) ); - if( err != KErrNone ) - { - CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" ); - User::Leave( err ); - } - TRAP( err, SaveGlobalWlanParameterL( KWlanUserSettings, fieldId, ptrTag ) ); - if( err != KErrNone ) - { - CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" ); - User::Leave( err ); - } - } - break; - } - - case EUsageOfWlan: - { - SetGenConnSettingWlanUsage( ptrTag ); - break; - } - - case ECellularDataUsageHome: - { - SetGenConnSettingCellularDataUsageHome( ptrTag ); - break; - } - - case ECellularDataUsageVisitor: - { - SetGenConnSettingCellularDataUsageVisitor( ptrTag ); - break; - } - - default: - break; - } - } - - if( iBearerArrayChanged ) - { - - CLOG_WRITE( "UpdateBearerPriorityArrayL\n" ) - - iCmManager->UpdateBearerPriorityArrayL( iBearerArray ); - iCmManager->CleanupGlobalPriorityArray( iBearerArray ); - - iBearerArray.Close(); - - CLOG_WRITE( "UpdateBearerPriorityArrayL end\n" ) - } - - // General Connection settings are always set - SetGenConnSettingsL(); - } - -// --------------------------------------------------------- -// CProcessorGlobal::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorGlobal::ProcessAPL() - { - CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() ); - CleanupStack::PushL( db ); - - CLOG_WRITE( "Global settings\n" ) - CLOG_WRITE( "---------------\n" ) - - CCDGlobalSettingsRecord* globalSettings = static_cast< CCDGlobalSettingsRecord* > - ( CCDRecordBase::RecordFactoryL( KCDTIdGlobalSettingsRecord ) ); - - CleanupStack::PushL( globalSettings ); - - globalSettings->iRecordName.SetL( KGlobalSettingsRecordName ); - - if( globalSettings->FindL( *db ) ) - { - //Gprs attach mode - if ( iAttachWhenNeeded ) - { - CLOG_WRITE( "GPRS attach mode : attach when needed\n" ) - globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenNeeded; - } - else - { - CLOG_WRITE( "GPRS attach mode : attach when available\n" ) - globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenPossible; - } - } - - globalSettings->ModifyL( *db ); - - CleanupStack::PopAndDestroy( globalSettings ); - db->Close(); - CleanupStack::PopAndDestroy( db ); // db - } - - -// --------------------------------------------------------- -// CProcessorGlobal::UpdateGlobalBearerArrayL -// --------------------------------------------------------- -// -void CProcessorGlobal::UpdateGlobalBearerArrayL - ( TDbCreatorGlobalSettings aField, TUint32 aPrio ) - { - TUint itemIndex( 0 ); - - // Look up field from conversion table - while( EUnused != KPriorityConversionTable[ itemIndex ].iField ) - { - if( KPriorityConversionTable[ itemIndex ].iField == aField) - { - break; - } - ++itemIndex; - } - - // If found - if( EUnused != KPriorityConversionTable[ itemIndex ].iField ) - { - if( !iBearerArrayChanged ) - { - iCmManager->BearerPriorityArrayL( iBearerArray ); - iBearerArrayChanged = ETrue; - } - - - HBufC* tableName = HBufC::NewLC( KMaxTableNameSize ); - *tableName = TPtrC( KPriorityConversionTable[ itemIndex ] - .iBearerTableName ); - TBool foundBearer( EFalse ); - - // Find the appropriate bearer type - for( TInt i( 0 ); i < iBearerArray.Count(); ++i ) - { - if( !( ( iBearerArray )[ i ].iServiceType->Compare( *tableName ) ) ) - { - if( KPriorityConversionTable[ itemIndex ].iIsUIPriority ) - { - ( iBearerArray )[ i ].iUIPriority = aPrio; - } - else - { - ( iBearerArray )[ i ].iPriority = aPrio; - } - foundBearer = ETrue; - break; - } - } - - // If bearer was not found, add it to the table - if( !foundBearer ) - { - TBearerPriority newBearer; - newBearer.iServiceType = tableName; - if( KPriorityConversionTable[ itemIndex ].iIsUIPriority ) - { - newBearer.iUIPriority = aPrio; - } - else - { - newBearer.iPriority = aPrio; - } - iBearerArray.Append( newBearer ); - } - - CleanupStack::PopAndDestroy( tableName ); // tableName - } - } - -// --------------------------------------------------------- -// CProcessorGlobal::SetGenConnSettingWlanUsage -// --------------------------------------------------------- -// -void CProcessorGlobal::SetGenConnSettingWlanUsage( HBufC16* aPtrTag ) - { - // This parameter should't be set at all if WLAN isn't supported. - // However, CMM should take care of this in WriteGenConnSettingsL(). - if ( aPtrTag->CompareF( KStrManual ) == 0 ) - { - iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanManual; - } - // else: Default value for the string is: "Known", set in ConstructL() - } - -// --------------------------------------------------------- -// CProcessorGlobal::SetGenConnSettingCellularDataUsageHome -// --------------------------------------------------------- -// -void CProcessorGlobal::SetGenConnSettingCellularDataUsageHome( HBufC16* aPtrTag ) - { - if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) - { - iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageAutomatic; - } - else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) - { - // This value can't be set if WLAN isn't supported - iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageDisabled; - } - // else: Default value for the string is: "Confirm", set in ConstructL() - } - -// --------------------------------------------------------- -// CProcessorGlobal::SetGenConnSettingCellularDataUsageVisitor -// --------------------------------------------------------- -// -void CProcessorGlobal::SetGenConnSettingCellularDataUsageVisitor( HBufC16* aPtrTag ) - { - if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) - { - iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageAutomatic; - } - else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) - { - // This value can't be set if WLAN isn't supported - iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageDisabled; - } - // else: Default value for the string is: "Confirm", set in ConstructL() - } - -// --------------------------------------------------------- -// CProcessorGlobal::SetGenConnSettingsL -// --------------------------------------------------------- -// -void CProcessorGlobal::SetGenConnSettingsL() - { - RCmManager cmManager; - cmManager.CreateTablesAndOpenL(); - CleanupClosePushL( cmManager ); - cmManager.WriteGenConnSettingsL( *iGenConnSettings ); - CleanupStack::PopAndDestroy( &cmManager ); - } - -//----------------------------------------------------------------------------- -// CProcessorGlobal::SaveGlobalWlanParameterL() -//----------------------------------------------------------------------------- -// -void CProcessorGlobal::SaveGlobalWlanParameterL( const TUint32 aTableType, const TDbCreatorGlobalSettings aField, const HBufC16* const aValue ) - { - // Initialize the record - CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* > - ( CCDRecordBase::RecordFactoryL( 0 ) ); - - CleanupStack::PushL( deviceSettingsTable ); - - deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); - - deviceSettingsTable->LoadL( *iSession ); - - // Open the record that matches aTableType (either default or user settings table) - - CMDBField* settingsTypeField = (CMDBField*)deviceSettingsTable->GetFieldByIdL(KCDTIdWlanDeviceSettingsType); - - settingsTypeField->SetL( aTableType ); - - deviceSettingsTable->FindL( *iSession ); - - // Convert the input parameter to integer - TLex lex( *aValue ); - - TInt value( 0 ); - User::LeaveIfError( lex.Val( value ) ); - - // Set the paramter value - - if ( aField == EWlanBGScanInterval ) - { - CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdBgScanInterval ); - field->SetL( value ); - } - else if ( aField == EWlanUseDefSettings ) - { - CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdUseDefaultSettings ); - field->SetL( value ); - } - else if ( aField == EWlanLongRetry ) - { - CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanLongRetry ); - field->SetL( value ); - } - else if ( aField == EWlanShortRetry ) - { - CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanShortRetry ); - field->SetL( value ); - } - else if ( aField == EWlanRTS ) - { - CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanRTSThreshold ); - field->SetL( value ); - } - else if ( aField == EWlanTxPowerLevel ) - { - CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdTxPowerLevel ); - field->SetL( value ); - } - else if ( aField == EWlanRadioMeasurements ) - { - CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdAllowRadioMeasurements ); - field->SetL( value ); - } - else if ( aField == EWlanPowerMode ) - { - CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanPowerMode ); - field->SetL( value ); - } - - deviceSettingsTable->ModifyL( *iSession ); - - CleanupStack::PopAndDestroy( deviceSettingsTable ); - } -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorlan.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorlan.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorLan -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessorlan.h" -#include "cdclogger.h" -#include "cdctagcontainer.h" - -#include -#include -#include -#include -#include -#include - -using namespace CMManager; - -// CONSTANTS - -const TUint32 KDefaultPortNum = 80; - -// These constants are used to identify tags of iInFile. - -//Connection type -_LIT16( KStrContinuous, "Continuous" ); -_LIT16( KStrTemporary, "Temporary" ); - -_LIT16( KStrTrue, "True" ); -_LIT16( KStrFalse, "False" ); - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProcessorLan::NewL -// --------------------------------------------------------- -// -CProcessorLan* CProcessorLan::NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames ) - { - CProcessorLan* self = new ( ELeave ) CProcessorLan( aFileReader, - aCmManager, - aPluginArray, - aPluginNames ); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); // self - return self; - } - - -// --------------------------------------------------------- -// CProcessorLan::~CProcessorLan -// --------------------------------------------------------- -// -CProcessorLan::~CProcessorLan() - { - } - - -// --------------------------------------------------------- -// CProcessorLan::ConstructL -// --------------------------------------------------------- -// -void CProcessorLan::ConstructL() - { - } - - -// --------------------------------------------------------- -// CProcessorLan::CProcessorLan -// --------------------------------------------------------- -// -CProcessorLan::CProcessorLan( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames) : - CProcessorBase( aFileReader, - aCmManager, - aPluginArray, - aPluginNames ) - { - iBearerType = KUidLanBearerType; - } - - -// --------------------------------------------------------- -// CProcessorLan::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorLan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) - { - switch ( aField ) - { - case ECmWapIPGatewayAddress: - { - // Unicode 16-bit text - if ( aPtrTag->Length() ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - } - - break; - } - case ECmWapIPSecurity: - { - // TBool - if ( !aPtrTag->CompareF( KStrOn ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrOff ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - //no valid data is given - default data is used - iPlugin.SetBoolAttributeL( aField, ETrue ); - CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On"); - } - - break; - } - case ELanIpAddrFromServer: - case ELanIpDNSAddrFromServer: - { - // TBool - if ( !aPtrTag->CompareF( KStrTrue ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrFalse ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - //no valid data is given - default data is used - iPlugin.SetBoolAttributeL( aField, ETrue ); - CLOG_WRITE( "! Error : Invalid LAN server setting. Default:On"); - } - break; - } - case ECmWapIPWSPOption: - { - // UInt - if ( !aPtrTag->CompareF( KStrContinuous ) ) - { - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionOriented ); - } - else if ( !aPtrTag->CompareF( KStrTemporary ) ) - { - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionless ); - } - else - { - //no valid data is given - default data is used - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionOriented ); - CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous"); - } - - break; - } - case ECmProxyProtocolName: - { - // Do not enable proxy in this case yet - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - - case ECmProxyServerName: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // Long text - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - case ECmProxyPortNumber: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // TUint32 and should be read as text. - TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); - TLex16 lex( portptr ); - TUint32 portnum( 0 ); - if ( lex.Val( portnum, EDecimal ) == KErrNone ) - { - iPlugin.SetIntAttributeL( aField, portnum ); - } - else - { - //no valid data is given - default value is used - iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); - CLOG_WRITE( "! Error : Invalid port number. Default:80"); - } - break; - } - case ELanIfNetworks: - case ELanIpNetMask: - case ELanIpGateway: - case ELanIpAddr: - case ELanConfigDaemonManagerName: - case ELanConfigDaemonName: - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - case ELanIpNameServer1: - case ELanIpNameServer2: - case ELanIp6NameServer1: - case ELanIp6NameServer2: - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - SetAddressFromServerL( ELanIpNameServer1, - ELanIpNameServer2, - ELanIpDNSAddrFromServer, - ELanIp6NameServer1, - ELanIp6NameServer2, - ELanIp6DNSAddrFromServer ); - break; - } - default: - { - break; - } - }//switch - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorpacketdata.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorpacketdata.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,473 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorPacketData -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessorpacketdata.h" -#include "cdclogger.h" -#include "cdctagcontainer.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace CMManager; - -// CONSTANTS - -const TUint32 KDefaultPortNum = 80; -const TInt32 KDefaultLinger = 0; -const TUint KIapColumn = 0x00000100; -const TUint KLingerColumn = 0x00000200; -const TUint KColumnMask = 0xFFFFFF00; -const TUint KRowMask = 0x000000FF; - -// These constants are used to identify tags of iInFile. - -//ISP types -_LIT16( KStrISPInternet, "0" ); -_LIT16( KStrISPWAP, "1" ); - -//Connection type -_LIT16( KStrContinuous, "Continuous" ); -_LIT16( KStrTemporary, "Temporary" ); - -//Password authentication -_LIT16( KStrPwdAuthNormal, "Normal" ); -_LIT16( KStrPwdAuthSecure, "Secure" ); - -//Network types -_LIT16( KStrNetworkIPv4, "IPv4" ); -_LIT16( KStrNetworkIPv6, "IPv6" ); - - -// ================= MEMBER FUNCTIONS ======================= -CLingerElement::~CLingerElement() - { - delete iName; - delete iLinger; - } -// --------------------------------------------------------- -// CProcessorPacketData::NewL -// --------------------------------------------------------- -// -CProcessorPacketData* CProcessorPacketData::NewL( - CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< CLingerElement >& aLingerSettings) - { - CProcessorPacketData* self = new ( ELeave ) CProcessorPacketData - ( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aLingerSettings); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); // self - return self; - } - - -// --------------------------------------------------------- -// CProcessorPacketData::~CProcessorPacketData -// --------------------------------------------------------- -// -CProcessorPacketData::~CProcessorPacketData() - { - } - - -// --------------------------------------------------------- -// CProcessorPacketData::ConstructL -// --------------------------------------------------------- -// -void CProcessorPacketData::ConstructL() - { - } - - -// --------------------------------------------------------- -// CProcessorPacketData::CProcessorPacketData -// --------------------------------------------------------- -// -CProcessorPacketData::CProcessorPacketData( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< CLingerElement >& aLingerSettings ) : - CProcessorBase( aFileReader, - aCmManager, - aPluginArray, - aPluginNames ) - - { - iLingerSettings = &aLingerSettings; - iBearerType = KUidPacketDataBearerType; - } - -// --------------------------------------------------------- -// CProcessorPacketData::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorPacketData::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) - { - - switch ( aField ) - { - case EPacketDataAPName: //fall through - case EPacketDataIFAuthName: //fall through - case EPacketDataIFAuthPass: //fall through - case EPacketDataIPAddr: //fall through - { - // Unicode 16-bit text - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - - break; - } - case EPacketDataIPNameServer1: //fall through - case EPacketDataIPNameServer2: //fall through - case EPacketDataIPIP6NameServer1: //fall through - case EPacketDataIPIP6NameServer2: //fall through - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - SetAddressFromServerL( EPacketDataIPNameServer1, - EPacketDataIPNameServer2, - EPacketDataIPDNSAddrFromServer, - EPacketDataIPIP6NameServer1, - EPacketDataIPIP6NameServer2, - EPacketDataIPIP6DNSAddrFromServer ); - break; - } - case ECmWapIPGatewayAddress: - { - // Unicode 16-bit text - if ( aPtrTag->Length() ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - } - - break; - } - case EPacketDataIFPromptForAuth: - { - // Boolean - if ( !aPtrTag->CompareF( KStrYes ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrNo ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - //no valid data is given - use default value - iPlugin.SetBoolAttributeL( aField, EFalse ); - CLOG_WRITE( "! Error : Invalid Prompt password. Default:No"); - } - - break; - } - case EPacketDataUseEdge: - { - // Boolean - if ( !aPtrTag->CompareF( KStrYes ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrNo ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - //no valid data is given - use default value - iPlugin.SetBoolAttributeL( aField, ETrue ); - CLOG_WRITE( "! Error : Invalid Use EDGE. Default:Yes"); - } - - break; - } - case EPacketDataLinger: - { - // Pair linger with name for later saving - CLingerElement* linger = new (ELeave) CLingerElement; - - CleanupStack::PushL( linger ); - - linger->iName = iName->AllocL(); - linger->iLinger = aPtrTag->AllocL(); - - iLingerSettings->AppendL(linger); - - CleanupStack::Pop( linger ); - break; - } - case ECmWapIPSecurity: - { - // TBool - if ( !aPtrTag->CompareF( KStrOn ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrOff ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - //no valid data is given - default data is used - iPlugin.SetBoolAttributeL( aField, ETrue ); - CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On"); - } - - break; - } - case ECmWapIPWSPOption: - { - // UInt - if ( !aPtrTag->CompareF( KStrContinuous ) ) - { - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionOriented ); - } - else if ( !aPtrTag->CompareF( KStrTemporary ) ) - { - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionless ); - } - else - { - //no valid data is given - default data is used - iPlugin.SetIntAttributeL( aField, - EWapWspOptionConnectionOriented ); - CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous"); - } - - break; - } - - case ECmProxyProtocolName: - { - // Do not enable proxy in this case yet - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - - case ECmProxyServerName: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // Long text - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - case ECmProxyPortNumber: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // TUint32 and should be read as text. - TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); - TLex16 lex( portptr ); - TUint32 portnum( 0 ); - if ( lex.Val( portnum, EDecimal ) == KErrNone ) - { - iPlugin.SetIntAttributeL( aField, portnum ); - } - else - { - //no valid data is given - default value is used - iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); - CLOG_WRITE( "! Error : Invalid port number. Default:80"); - } - break; - } - case EPacketDataDisablePlainTextAuth: - { - // TBool - if ( !aPtrTag->CompareF( KStrPwdAuthNormal ) ) - { - // Normal, => auth. not secure, plain text NOT disabled - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else if ( !aPtrTag->CompareF( KStrPwdAuthSecure ) ) - { - // Secure, => auth. secure, plain text disabled - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else - { - //no valid data is given - default value is used - CLOG_WRITE( "! Error : Invalid password authentication. Default:Secure "); - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - break; - } - case EPacketDataPDPType: - { - if ( !aPtrTag->CompareF( KStrNetworkIPv4 ) ) - { - iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 ); - } - else if ( !aPtrTag->CompareF( KStrNetworkIPv6 ) ) - { - iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv6 ); - } - else - { - iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 ); - CLOG_WRITE( "! Error : Invalid Network type. Default:IPv4" ) - } - break; - } - case EPacketDataApType: - { - if ( !aPtrTag->CompareF( KStrISPInternet ) ) - { - iPlugin.SetIntAttributeL( aField, 0 ); - } - else if ( !aPtrTag->CompareF( KStrISPWAP ) ) - { - iPlugin.SetIntAttributeL( aField, 1 ); - } - else - { - iPlugin.SetIntAttributeL( aField, 2 ); - } - break; - } - default: - { - break; - } - }//switch - } - -// --------------------------------------------------------- -// CProcessorPacketData::AddLingerL -// --------------------------------------------------------- -// -void CProcessorPacketData::AddLingerL( const TInt aIapId, const TInt aLingerInterval) - { - TInt err( KErrNone ); - - // Open repository - CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); - - // Find if an entry for "iapId" already exists in CentRep - RArray< TUint32 > foundKeys; - foundKeys.Reset(); - - err = repository->FindEqL( KIapColumn, // partial key - KColumnMask, // key mask - aIapId, // value - foundKeys ); // found keys - - if ( err == KErrNone || err == KErrNotFound ) - { - if ( foundKeys.Count() == 0 ) - { - // Add a new entry - TInt arrayCount( 0 ); - - // Get number of iapId&linger entries in Centrep - err = repository->Get( KPdpContextManagerLingerArrayCount, - arrayCount ); - - if ( err == KErrNone ) - { - arrayCount++; - - err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); - - if ( err == KErrNone ) - { - err = repository->Create( ( KLingerColumn | arrayCount ), - aLingerInterval ); - } - - if ( err == KErrNone ) - { - // Update number of iapId&linger entries in Centrep - err = repository->Set( KPdpContextManagerLingerArrayCount, - arrayCount ); - } - } - } - else - { - // Update existing entry on current row - TInt32 row = foundKeys[ 0 ] & KRowMask; - - err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); - } - } - - foundKeys.Close(); - CleanupStack::PopAndDestroy( repository ); - - User::LeaveIfError( err ); - } - -// --------------------------------------------------------- -// CProcessorPacketData::SaveLingerSettingsL -// --------------------------------------------------------- -// -void CProcessorPacketData::SaveLingerSettingsL() - { - for ( TInt i(0); i < iLingerSettings->Count(); i++ ) - { - TInt id = GetPluginIdL(((*iLingerSettings)[i])->iName); - - TLex16 lex(*((*iLingerSettings)[i])->iLinger); - TInt linger( 0 ); - if ( lex.Val( linger ) == KErrNone ) - { - AddLingerL( id, linger); - } - else - { - // no valid data is given - default value is used - AddLingerL( id, KDefaultLinger); - } - } - iLingerSettings->ResetAndDestroy(); - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorvpn.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorvpn.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,242 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorVpn -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessorvpn.h" -#include "cdclogger.h" -#include "cdctagcontainer.h" - -#include -#include -#include -#include -#include -#include - -using namespace CMManager; - -// CONSTANTS - -const TUint32 KDefaultPortNum = 80; - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProcessorVpn::NewL -// --------------------------------------------------------- -// -CProcessorVpn* CProcessorVpn::NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aUnderLying ) - { - CProcessorVpn* self = new ( ELeave ) CProcessorVpn( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aUnderLying ); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); // self - return self; - } - - -// --------------------------------------------------------- -// CProcessorVpn::~CProcessorVpn -// --------------------------------------------------------- -// -CProcessorVpn::~CProcessorVpn() - { - } - - -// --------------------------------------------------------- -// CProcessorVpn::ConstructL -// --------------------------------------------------------- -// -void CProcessorVpn::ConstructL() - { - } - - -// --------------------------------------------------------- -// CProcessorVpn::CProcessorVpn -// --------------------------------------------------------- -// -CProcessorVpn::CProcessorVpn( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aUnderLying ) : - - CProcessorBase( aFileReader, - aCmManager, - aPluginArray, - aPluginNames ) - { - iUnderLying = &aUnderLying; - iBearerType = KPluginVPNBearerTypeUid; - } - -// --------------------------------------------------------- -// CProcessorVpn::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorVpn::ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray, - RPointerArray< HBufC >& aDestNames ) - { - iDestArray = &aDestArray; - iDestName = &aDestNames; - - for( TInt i(0); i < iUnderLying->Count(); i++ ) - { - // Finds the vpn IAP by its name - RCmConnectionMethodExt* iPlugin = FindPluginL( (*iUnderLying)[i] ); - if( iPlugin != NULL ) - { - CLOG_WRITE_FORMAT( "Underlying set for:%S", (*iUnderLying)[i] ); - - // Finds the underlying IAP by its name - i++; - RCmConnectionMethodExt* up = FindPluginL( (*iUnderLying)[i] ); - if( up != NULL ) - { - iPlugin->SetIntAttributeL( ECmNextLayerIapId, - up->GetIntAttributeL( ECmIapId ) ); - iPlugin->UpdateL(); - - CLOG_WRITE_FORMAT( "Underlying IAP Set:%S", (*iUnderLying)[i] ); - } - else - { - // Underlyinf can be destination. If not IAP finds destination. - RCmDestinationExt* ud = FindDestinationL( (*iUnderLying)[i] ); - if( ud != NULL ) - { - iPlugin->SetIntAttributeL( ECmNextLayerSNAPId, ud->Id() ); - iPlugin->UpdateL(); - - CLOG_WRITE_FORMAT( "Underlying SNAP Set: %S", (*iUnderLying)[i] ); - } - } - } - } - } - - -// --------------------------------------------------------- -// CProcessorVpn::ProcessTagL -// --------------------------------------------------------- -// -void CProcessorVpn::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) - { - CLOG_WRITE_FORMAT( "field: %d", aField ); - switch ( aField ) - { - case ECmProxyProtocolName: - { - // Do not enable proxy in this case yet - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - - case ECmProxyServerName: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // Long text - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - case ECmProxyPortNumber: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - // TUint32 and should be read as text. - TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); - TLex16 lex( portptr ); - TUint32 portnum( 0 ); - if ( lex.Val( portnum, EDecimal ) == KErrNone ) - { - iPlugin.SetIntAttributeL( aField, portnum ); - } - else - { - //no valid data is given - default value is used - iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); - CLOG_WRITE( "! Error : Invalid port number. Default:80"); - } - break; - } - case EVPN_IapName: // Underlying IAP/destination - { - if( !iName ) - { - TInt len = aPtrTag->Length(); - - iName = HBufC::NewL( 8 + len ); - TPtr name = iName->Des(); - name.Append( _L( "VPN to " ) ); - name.Append( *aPtrTag ); - - SetGeneralFieldL( ECmName, iName ); - - } - - // Adds vpnIAP name - underlying IAP/Dest name pair to a list - if( iName ) - { - iUnderLying->AppendL( iName->AllocL() ); - iUnderLying->AppendL( aPtrTag->AllocL() ); - } - break; - } - case EVpnServicePolicy: - ////case ECmName: //fall through - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - if( !iName ) - { - iName = aPtrTag->AllocLC(); - } - - break; - } - default: - { - break; - } - }//switch - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp --- a/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2317 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CProcessorWlan -* -*/ - - - - -// INCLUDE FILES - -#include "cdcprocessorwlan.h" -#include "cdclogger.h" -#include "cdcerrors.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace CMManager; - -// CONSTANTS - -// network modes. -_LIT16( KStrAd_hoc, "Ad-hoc" ); -_LIT16( KStrInfrastructure, "Infrastructure" ); // Default value. - -// security modes. -_LIT16( KStrWEP, "WEP" ); -_LIT16( KStr802_1x, "802.1x" ); -_LIT16( KStrWPA, "WPA" ); // WPA/WPA2 mixed mode -_LIT16( KStrWPA2, "WPA2" ); // WPA2-only mode -_LIT16( KStrOpen, "Open" ); // Default value. - -// default WLAN channel Id value -const TInt KDefaultChannelId = 0; -const TInt KMaximumChannelId = 11; - -// default port number -const TUint32 KDefaultPortNum = 0; - -// ratio between sizes of ascii and unicode characters -const TUint KAsciiUnicodeRatio = 2; - -// ================= MEMBER FUNCTIONS ======================= - -CEapTypeElement::~CEapTypeElement() - { - delete iEapSettings; - delete iName; - } - - -// --------------------------------------------------------- -// CProcessorWlan::NewL -// --------------------------------------------------------- -// -CProcessorWlan* CProcessorWlan::NewL( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aSecurityInfo, - RPointerArray< CEapTypeElement >& aEapSettings ) - { - CProcessorWlan* self = new ( ELeave ) CProcessorWlan( aFileReader, - aCmManager, - aPluginArray, - aPluginNames, - aSecurityInfo, - aEapSettings ); - CleanupStack::PushL( self ); - - // From base class - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -// --------------------------------------------------------- -// CProcessorWlan::ConstructL -// --------------------------------------------------------- -// -void CProcessorWlan::ConstructL() - { - iEmptyTag = KStrEmpty.operator const TDesC16&().Alloc(); - - Reset(); // iWepData, iWpaData - } - - -// --------------------------------------------------------- -// CProcessorWlan::CProcessorWlan -// --------------------------------------------------------- -// -CProcessorWlan::CProcessorWlan( CReaderBase* aFileReader, - RCmManagerExt& aCmManager, - RPointerArray< RCmConnectionMethodExt >& aPluginArray, - RPointerArray< HBufC >& aPluginNames, - RPointerArray< HBufC >& aSecurityInfo, - RPointerArray< CEapTypeElement >& aEapSettings ) : - CProcessorBase( aFileReader, - aCmManager, - aPluginArray, - aPluginNames ), - iSecurityMode( ESecurityModeOpen ), - iEapSettings( aEapSettings ), - iIsEasyWlan( ETrue ) - { - iBearerType = KUidWlanBearerType; - iSecurityInfo = &aSecurityInfo; - iDataStart = 0; - } - - -// --------------------------------------------------------- -// CProcessorWlan::~CProcessorWlan -// --------------------------------------------------------- -// -CProcessorWlan::~CProcessorWlan() - { - delete iEmptyTag; - REComSession::FinalClose(); - } - -// --------------------------------------------------------- -// CProcessorWlan::ProcessSpecialFieldsL -// --------------------------------------------------------- -// -void CProcessorWlan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) - { - switch( aField ) - { - // TDesC16 - case EWlanSSID: - { - if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - iIsEasyWlan = EFalse; - } - else - { - // Access point is Easy WLAN - iIsEasyWlan = ETrue; - } - break; - } - case EWlanIpAddr: - { - if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - } - break; - } - // TDesC16 - case EWlanIpGateway: //fall through - case EWlanIpNetMask: //fall through - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - case EWlanIpNameServer1: //fall through - case EWlanIpNameServer2: //fall through - case EWlanIp6NameServer1: //fall through - case EWlanIp6NameServer2: //fall through - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - SetAddressFromServerL( EWlanIpNameServer1, - EWlanIpNameServer2, - EWlanIpDNSAddrFromServer, - EWlanIp6NameServer1, - EWlanIp6NameServer2, - EWlanIp6DNSAddrFromServer ); - break; - } - // TUint32 - case EWlanSecurityMode: - { - - if ( aPtrTag->CompareF( KStrWEP ) == 0 ) - { - // WEP - iPlugin.SetIntAttributeL( aField, EWlanSecModeWep ); - iSecurityMode = ESecurityModeWEP; - } - else if ( aPtrTag->CompareF( KStr802_1x ) == 0 ) - { - // 802.1x - iPlugin.SetIntAttributeL( aField, EWlanSecMode802_1x ); - iSecurityMode = ESecurityMode802; - } - else if ( aPtrTag->CompareF( KStrWPA ) == 0 ) - { - // WPA/WPA2 mixed mode - iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa ); - iSecurityMode = ESecurityModeWPA; - } - else if ( aPtrTag->CompareF( KStrWPA2 ) == 0 ) - { - // WPA2 - iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa2 ); - iSecurityMode = ESecurityModeWPA2; - } - else if ( aPtrTag->CompareF( KStrOpen ) == 0 ) - { - // Open network (default) - iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen ); - iSecurityMode = ESecurityModeOpen; - } - else - { - iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen ); - iSecurityMode = ESecurityModeOpen; - CLOG_WRITE( "! Error : Invalid Security Mode. Default:Open" ) - } - break; - } - - // TUint32 - case EWlanConnectionMode: - { - - if ( !aPtrTag->CompareF( KStrAd_hoc ) ) - { - // Ad-hoc - iPlugin.SetIntAttributeL( aField, EAdhoc ); - } - else if ( !aPtrTag->CompareF( KStrInfrastructure ) ) - { - // Infrastructure - iPlugin.SetIntAttributeL( aField, EInfra ); - } - else - { - iPlugin.SetIntAttributeL( aField, EInfra ); - CLOG_WRITE( "! Error : Invalid Network Mode. Default:Infrastructure" ) - } - break; - } - - // TUint32 - case ECmProxyPortNumber: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - TLex16 lex( *aPtrTag ); - TUint32 tmp( 0 ); - if ( lex.Val( tmp, EDecimal ) == KErrNone ) - { - iPlugin.SetIntAttributeL( aField, tmp ); - } - else - { - //no valid data is given - iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); - CLOG_WRITE( "! Error : Invalid port number. Default:0" ); - } - break; - } - // Long text. - case ECmStartPage: - { - - if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) - { - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - } - break; - } - - case ECmProxyProtocolName: - { - // Do not enable proxy in this case yet - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - - // Long text. - case ECmProxyServerName: - { - // First set proxy usage to enabled - if( !iProxyEnabled ) - { - iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); - iProxyEnabled = ETrue; - } - iPlugin.SetStringAttributeL( aField, *aPtrTag ); - break; - } - // Bool - case EWlanScanSSID: - { - if ( !aPtrTag->CompareF( KStrYes ) ) - { - iPlugin.SetBoolAttributeL( aField, ETrue ); - } - else if ( !aPtrTag->CompareF( KStrNo ) ) - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - } - else - { - iPlugin.SetBoolAttributeL( aField, EFalse ); - CLOG_WRITE( "! Error : Invalid Scan SSID. Default:No" ) - } - break; - } - - // TUint32 - case EWlanChannelID: - { - TLex16 lex( *aPtrTag ); - TUint32 tmp( 0 ); - lex.Val( tmp, EDecimal ); - - if( tmp <= KMaximumChannelId ) - { - iPlugin.SetIntAttributeL( aField, tmp ); - } - else - { - // Default value - iPlugin.SetIntAttributeL( aField, KDefaultChannelId ); - CLOG_WRITE( "! Error : Invalid Chanel Id. Default:0" ) - } - break; - } - //WEP - case EWEPKeyInUse: - case EWEPAuthType: - case EWEPKey1Length: - case EWEPKey1Format: - case EWEPKey1Data: - case EWEPKey2Length: - case EWEPKey2Format: - case EWEPKey2Data: - case EWEPKey3Length: - case EWEPKey3Format: - case EWEPKey3Data: - case EWEPKey4Length: - case EWEPKey4Format: - case EWEPKey4Data: - { - if( iSecurityMode == ESecurityModeWEP ) - { - AddSecurityDataL( aField, aPtrTag, ETrue ); - } - } - break; - //WPA - case EWPAPresharedKey: - case EWPAKeyLength: - case EWPAEapMethod: - case EWPAUseOfPresharedKey: - { - if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen ) - { - AddSecurityDataL( aField, aPtrTag, EFalse ); - } - } - break; - - default: - // Check if this is EAP setting - if ( EAPSetting( aField ) ) - { - AddEAPSettingL( aField, aPtrTag ); - } - else - { - CLOG_WRITE_FORMAT( "! Warning: Unhandled setting for WLAN: %d", aField ); - } - break; - }//switch - } - - -// --------------------------------------------------------- -// CProcessorWlan::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorWlan::ProcessAPL() - { - - RCmConnectionMethodExt& iPlugin = GetLastPluginL(); - - if( iIsProtected ) - { - iPlugin.SetBoolAttributeL( ECmProtected, ETrue ); - } - - // Ensure that Easy WLAN is always an open network - if( iIsEasyWlan ) - { - iSecurityMode = ESecurityModeOpen; - } - - FillSecurityInfoL(); - - // Writes into the log file. - DoLogL(); - - Reset(); // iWepData, iWpaData - } - -// --------------------------------------------------------- -// CProcessorWlan::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorWlan::FillSecurityInfoL() - { - //Set Security mode settings - switch ( iSecurityMode ) - { - case ESecurityModeWEP: - if ( WEPFieldValidate() ) - { - FillSecurityInfoL( ETrue ); //WEP - } - else - { - CLOG_WRITE( "! Error : WEP settings are not valid." ) - } - break; - case ESecurityMode802: - case ESecurityModeWPA: - case ESecurityModeWPA2: - { - FillSecurityInfoL( EFalse ); //WPA - break; - } - default: - { - } - break; - } - } - -// --------------------------------------------------------- -// CProcessorWlan::ProcessAPL -// --------------------------------------------------------- -// -void CProcessorWlan::FillSecurityInfoL( TBool aIsWep ) - { - // iName has been deleted by Base. Name is retrieved from name array. - TInt lastPos = iPluginArray->Count() - 1; - HBufC* name = (*iPluginName)[ lastPos ]; - - // Name appended to the array - iSecurityInfo->Append( name->AllocL() ); - CLOG_WRITE_FORMAT( "FillSecurityInfoL %S", name ); - CLOG_WRITE_FORMAT( "FillSecurityInfoL start %d", iSecurityInfo->Count() ); - - if( aIsWep ) - { - // Security type appended to the array - iSecurityInfo->Append( KStrWEP.operator const TDesC16&().Alloc() ); - for( TInt i( 0 ); i < KWEPKeyNumOfFields; i++ ) - { - - if( iWepData[i] != NULL ) - { - CLOG_WRITE_FORMAT( "wep info %S", iWepData[i] ); - } - else - { - CLOG_WRITE( "wep info NULL" ); - } - iSecurityInfo->Append( iWepData[i] ); - } - } - else - { - // Security type appended to the array - switch ( iSecurityMode ) - { - case ESecurityMode802: - iSecurityInfo->Append( KStr802_1x.operator const TDesC16&().Alloc() ); - break; - case ESecurityModeWPA2: - iSecurityInfo->Append( KStrWPA2.operator const TDesC16&().Alloc() ); - break; - default: - iSecurityInfo->Append( KStrWPA.operator const TDesC16&().Alloc() ); - break; - } - - for( TInt i( 0 ); i < KWPAKeyNumOfFields; i++ ) - { - - if( iWpaData[i] != NULL ) - { - CLOG_WRITE_FORMAT( "wpa info %S", iWpaData[i] ); - } - else - { - CLOG_WRITE( "wep info NULL" ); - } - iSecurityInfo->Append( iWpaData[ i ] ); - } - } - - CLOG_WRITE_FORMAT( "FillSecurityInfoL end %d", iSecurityInfo->Count() ); - } - -// --------------------------------------------------------- -// CProcessorWlan::SaveSecurityInfoL -// --------------------------------------------------------- -// -void CProcessorWlan::SaveSecurityInfoL() - { - TInt i(0); - - while( i < iSecurityInfo->Count() ) - { - if( (*iSecurityInfo)[i] != NULL ) - { - CLOG_WRITE_FORMAT( "Sec Info: %S", (*iSecurityInfo)[i] ); - } - else - { - CLOG_WRITE( "Sec Info: NULL" ); - } - - i++; - } - - - i = 0; - - while( i < iSecurityInfo->Count() ) - { - CLOG_WRITE_FORMAT( "SaveSecurityInfoL %S", (*iSecurityInfo)[i] ); - - TInt id = GetPluginIdL( (*iSecurityInfo)[i] ); - if( id != KErrNotFound ) - { - i++; - SaveSecurityInfoL( i, id ); - } - else - { - CLOG_WRITE_FORMAT( "WLan IAp cannot find %S", (*iSecurityInfo)[i] ); - CLOG_WRITE( "Security save likely collapsed" ); - // Tries to look for an existing IAP. - i++; - } - } - - // EAP settings - CLOG_WRITE( "Starting EAP settings saving" ); - CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); - CleanupStack::PushL( session ); - - // Load IAP record in order to get the service id - for ( i = 0; i < iEapSettings.Count() ; i++ ) - { - CEapTypeElement* eap = iEapSettings[i]; - // - TInt id = GetPluginIdL( eap->iName ); - - CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * > - ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); - - CleanupStack::PushL( iapRecord ); - - iapRecord->SetRecordId( id ); - - iapRecord->LoadL( *session ); - - TInt serviceId = iapRecord->iService; - - CleanupStack::PopAndDestroy( iapRecord ); - - CEapType* eapType ( NULL ); - TRAPD( leave, - eapType = CEapType::NewL( ELan, - serviceId, - eap->iEapSettings->iEAPExpandedType ) ); - if ( leave == KErrNone ) - { - CleanupStack::PushL( eapType ); - - // Inner EAP - if ( eap->iEncapsulatingEapId != *EapExpandedTypeNone.GetType() ) - { - eapType->SetTunnelingType( eap->iEncapsulatingEapId ); - } - - // write EAP setting - eapType->SetConfigurationL(*eap->iEapSettings); - CleanupStack::PopAndDestroy( eapType ); - } - } - - session->Close(); - CleanupStack::PopAndDestroy( session ); - CLOG_WRITE( "Finished EAP settings saving" ); - - CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); -} - -// --------------------------------------------------------- -// CProcessorWlan::SaveSecurityInfoL -// --------------------------------------------------------- -// -void CProcessorWlan::SaveSecurityInfoL( TInt& aCounter, TInt aId ) - { - if( (*iSecurityInfo)[ aCounter ]->Compare( KStrWEP ) == 0 ) - { - aCounter++; - TInt end( aCounter + KWEPKeyNumOfFields ); - - for( TInt index(0); aCounter < end; aCounter++, index++ ) - { - if( (*iSecurityInfo)[ aCounter ] != NULL ) - { - CLOG_WRITE_FORMAT( "wep info %S", (*iSecurityInfo)[ aCounter ] ); - } - else - { - CLOG_WRITE( "wep info NULL" ); - } - iWepData[ index] = (*iSecurityInfo)[ aCounter ] ; - } - SaveWEPL( aId ); - } - else - { - - // Set security mode. - if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStr802_1x ) == 0 ) - { - // 802.1x - iSecurityMode = ESecurityMode802; - } - else if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStrWPA2 ) == 0 ) - { - // WPA2 mode - iSecurityMode = ESecurityModeWPA2; - } - else - { - // WPA - iSecurityMode = ESecurityModeWPA; - } - - aCounter++; - TInt end( aCounter + KWPAKeyNumOfFields ); - - for( TInt index(0); aCounter < end; aCounter++, index++ ) - { - if( (*iSecurityInfo)[ aCounter ] != NULL ) - { - CLOG_WRITE_FORMAT( "wpa info %S", (*iSecurityInfo)[ aCounter ] ); - } - else - { - CLOG_WRITE( "wpa info NULL" ); - } - iWpaData[ index ] = (*iSecurityInfo)[ aCounter ] ; - } - SaveWPAL( aId ); - } - } - - - -// --------------------------------------------------------- -// WEP Security settings -// --------------------------------------------------------- - -// --------------------------------------------------------- -// CProcessorWlan::SaveWEPL -// --------------------------------------------------------- -// -void CProcessorWlan::SaveWEPL( TUint32 aIapId ) - { - CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); - CleanupStack::PushL( session ); - // Load IAP record - CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * > - ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); - CleanupStack::PushL( iapRecord ); - iapRecord->SetRecordId( aIapId ); - iapRecord->LoadL( *session ); - - // Load WLAN service table - // first get WLAN table id - CMDBGenericRecord* generic = static_cast - ( CCDRecordBase::RecordFactoryL( 0 ) ); - CleanupStack::PushL( generic ); - generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); - generic->LoadL( *session ); - TMDBElementId wlanTableId = generic->TableId(); - - CMDBField* sidField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); - - TInt service = iapRecord->iService; - // prime with service id - *sidField = (TUint32)service; - - User::LeaveIfError( generic->FindL( *session ) ); - - // Save index of key in use - TUint32 keyInUse( WEPKeyInUse() ); - CMDBField* keyInUseField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWepIndex ) ); - keyInUseField->SetL( keyInUse ); - - // Save authentication mode - TUint32 auth( WEPAuthentication() ); - CMDBField* authenticationField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanAuthMode ) ); - authenticationField->SetL( auth ); - - // Save WEP keys and key formats - if ( WEPFieldData( EWEPKey1Data )->Length() ) - { - CMDBField* wepKey1Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWepKey1 ) ); - WriteKeyL( wepKey1Field, - WEPFieldData( EWEPKey1Data ), - WEPKeyFormat( EWEPKey1Format ) ); - CMDBField* formatKey1Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanFormatKey1 ) ); - formatKey1Field->SetL( WEPKeyFormat( EWEPKey1Format ) ); - } - if ( WEPFieldData( EWEPKey2Data )->Length() ) - { - CMDBField* wepKey2Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWepKey2 ) ); - WriteKeyL( wepKey2Field, - WEPFieldData( EWEPKey2Data ), - WEPKeyFormat( EWEPKey2Format ) ); - CMDBField* formatKey2Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanFormatKey2 ) ); - formatKey2Field->SetL( WEPKeyFormat( EWEPKey2Format ) ); - } - if ( WEPFieldData( EWEPKey3Data )->Length() ) - { - CMDBField* wepKey3Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWepKey3 ) ); - WriteKeyL( wepKey3Field, - WEPFieldData( EWEPKey3Data ), - WEPKeyFormat( EWEPKey3Format ) ); - CMDBField* formatKey3Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanFormatKey3 ) ); - formatKey3Field->SetL( WEPKeyFormat( EWEPKey3Format ) ); - } - if ( WEPFieldData( EWEPKey4Data )->Length() ) - { - CMDBField* wepKey4Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWepKey4 ) ); - WriteKeyL( wepKey4Field, - WEPFieldData( EWEPKey4Data ), - WEPKeyFormat( EWEPKey4Format ) ); - CMDBField* formatKey4Field = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) ); - formatKey4Field->SetL( WEPKeyFormat( EWEPKey4Format ) ); - } - - generic->ModifyL( *session ); - - CleanupStack::PopAndDestroy( generic ); // generic - CleanupStack::PopAndDestroy( iapRecord ); // iapRecord - CleanupStack::PopAndDestroy( session ); // session - } - - -// --------------------------------------------------------- -// CProcessorWlan::WriteKeyL -// --------------------------------------------------------- -// -void CProcessorWlan::WriteKeyL( CMDBField* aKeyField, - HBufC16* aKey, - const TInt aKeyFormat ) - { - TBuf8 key; - - //convert to 8 bit - key.Copy( aKey->Des() ); - - if ( aKeyFormat == EAscii ) - { - // Must be converted to hexa and stored as a hexa - // Ascii key is half the length of Hex - HBufC8* buf8Conv = HBufC8::NewLC( key.Length() * KAsciiUnicodeRatio ); - ConvertAsciiToHex( key, buf8Conv ); - aKeyField->SetL( buf8Conv->Des() ); - CleanupStack::PopAndDestroy( buf8Conv ); - } - else if ( VerifyHex( key ) ) - { - //already in hexa format - aKeyField->SetL( key ); - } - else - { - CLOG_WRITE( "! Error : Invalid hexadecimal format" ) - } - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPFieldData -// --------------------------------------------------------- -// -HBufC16* CProcessorWlan::WEPFieldData( TDbCreatorWEPFields aFieldId ) - { - TInt index = WEPIndex( aFieldId ); - if( iWepData[ index ] == NULL ) - { - return iEmptyTag; - } - else - { - return iWepData[ index ]; - } - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPAuthentication -// --------------------------------------------------------- -// -TInt CProcessorWlan::WEPAuthentication() - { - HBufC16* authTypeStr = WEPFieldData( EWEPAuthType ); - TInt authType ( EAuthOpen ) ; - - _LIT16( KStrOpen, "Open" ); - _LIT16( KStrShared, "Shared" ); - - if ( authTypeStr->CompareF( KStrOpen ) == 0 ) - { - //CLOG_WRITE( "Authentication type : Open" ) - } - else if ( authTypeStr->CompareF( KStrShared ) == 0 ) - { - //CLOG_WRITE( "Authentication type : Shared" ) - authType = EAuthShared; - } - else - { - //aField is either empty or invalid - authType = KErrNotFound; - } - - return authType; - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPKeyInUse -// --------------------------------------------------------- -// -TInt CProcessorWlan::WEPKeyInUse() - { - HBufC16* keyStr = WEPFieldData( EWEPKeyInUse ); - TInt key ( EKeyNumber1 ) ; - - _LIT16( KStrKey1, "key1" ); - _LIT16( KStrKey2, "key2" ); - _LIT16( KStrKey3, "key3" ); - _LIT16( KStrKey4, "key4" ); - - if ( keyStr->CompareF( KStrKey1 ) == 0 ) - { - //CLOG_WRITE( "WEP key in use : key 1" ) - } - else if ( keyStr->CompareF( KStrKey2 ) == 0 ) - { - //CLOG_WRITE( "WEP key in use : key 2" ) - key = EKeyNumber2; - } - else if ( keyStr->CompareF( KStrKey3 ) == 0 ) - { - //CLOG_WRITE( "WEP key in use : key 3" ) - key = EKeyNumber3; - } - else if ( keyStr->CompareF( KStrKey4 ) == 0 ) - { - //CLOG_WRITE( "WEP key in use : key 4" ) - key = EKeyNumber4; - } - else - { - //aField is either empty or invalid - key = KErrNotFound; - } - - return key; - } - - - -// --------------------------------------------------------- -// CProcessorWlan::WEPKeyFormat -// --------------------------------------------------------- -// -TInt CProcessorWlan::WEPKeyFormat( TDbCreatorWEPFields aFieldId ) - { - __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Format || - aFieldId == EWEPKey2Format || - aFieldId == EWEPKey3Format || - aFieldId == EWEPKey4Format ), - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - HBufC16* keyFormatStr = WEPFieldData( aFieldId ); - TWEPKeyFormat keyFormat ( EAscii ) ; - - _LIT16( KStrAscii, "Ascii" ); - _LIT16( KStrHexadecimal, "Hexadecimal" ); - - if ( keyFormatStr->CompareF( KStrAscii ) == 0 ) - { - //CLOG_WRITE( "Key format : Ascii" ) - } - else if ( keyFormatStr->CompareF( KStrHexadecimal ) == 0 ) - { - //CLOG_WRITE( "Key format : Hexadecimal" ) - keyFormat = EHexadecimal; - } - else - { - CLOG_WRITE( "! Error : Invalid key format. Default:Ascii" ) - } - - return keyFormat; - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPKeyLength -// --------------------------------------------------------- -// -TWEPKeyLength CProcessorWlan::WEPKeyLength( TDbCreatorWEPFields aFieldId ) - { - __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Length || - aFieldId == EWEPKey2Length || - aFieldId == EWEPKey3Length || - aFieldId == EWEPKey4Length ), - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - HBufC16* keyLengthStr = WEPFieldData( aFieldId ); - TWEPKeyLength keyLen ( E40Bits ) ; - - _LIT16( KStr64, "64" ); - _LIT16( KStr128, "128" ); - _LIT16( KStr256, "256" ); - - if ( keyLengthStr->CompareF( KStr64 ) == 0 ) - { - //CLOG_WRITE( "Key length : 64" ) - } - else if ( keyLengthStr->CompareF( KStr128 ) == 0 ) - { - //CLOG_WRITE( "Key length : 128" ) - keyLen = E104Bits; - } - else if ( keyLengthStr->CompareF( KStr256 ) == 0 ) - { - //CLOG_WRITE( "Key length : 256" ) - keyLen = E232Bits; - } - else - { - CLOG_WRITE( "! Error : Invalid key length. Default:64" ) - } - - return keyLen; - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPKeyValidLen -// --------------------------------------------------------- -// -TInt CProcessorWlan::WEPKeyValidLen(TInt aFormat , TWEPKeyLength aLen ) - { - __ASSERT_ALWAYS( aFormat == EAscii || aFormat == EHexadecimal, - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - __ASSERT_ALWAYS( aLen == E40Bits || aLen == E104Bits || aLen == E232Bits, - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - TInt len( 0 ); - - switch ( aFormat ) - { - case EAscii: - switch ( aLen ) - { - case E40Bits : len = KKeyDataLength40Bits / - KAsciiUnicodeRatio; - break; - case E104Bits : len = KKeyDataLength104Bits / - KAsciiUnicodeRatio; - break; - case E232Bits : len = KKeyDataLength232Bits / - KAsciiUnicodeRatio; - } - break; - case EHexadecimal: - switch ( aLen ) - { - case E40Bits : len = KKeyDataLength40Bits; - break; - case E104Bits : len = KKeyDataLength104Bits; - break; - case E232Bits : len = KKeyDataLength232Bits; - } - } - - return len; - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPIndex -// --------------------------------------------------------- -// -TInt CProcessorWlan::WEPIndex( TDbCreatorWEPFields aFieldId ) - { - __ASSERT_ALWAYS( aFieldId >= EWEPKeyInUse && aFieldId <= EWEPKey4Data, - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - return aFieldId - 0x1000 + iDataStart; - - ////return iWEPIndex[ aFieldId - 0x1000 ]; - } - -// --------------------------------------------------------- -// CProcessorWlan::WEPFieldValidate -// --------------------------------------------------------- -// -TBool CProcessorWlan::WEPFieldValidate() - { - TBool valid (ETrue); - - if ( ( WEPAuthentication() == KErrNotFound ) || - ( WEPKeyInUse() == KErrNotFound ) ) - { - valid = EFalse; - } - else - { - //gets the actual keylength - TInt keyLen[ KMaxNumberofKeys ] = { 0,0,0,0 }; - - keyLen[EKeyNumber1] = WEPFieldData( EWEPKey1Data )->Length(); - keyLen[EKeyNumber2] = WEPFieldData( EWEPKey2Data )->Length(); - keyLen[EKeyNumber3] = WEPFieldData( EWEPKey3Data )->Length(); - keyLen[EKeyNumber4] = WEPFieldData( EWEPKey4Data )->Length(); - - - //check validity of key1 length - TInt validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey1Format ), - WEPKeyLength( EWEPKey1Length ) ); - if ( keyLen[EKeyNumber1] && keyLen[EKeyNumber1] != validLen) - { - valid = EFalse; - CLOG_WRITE_FORMAT( "! Error : Key1 length is invalid %d", - keyLen[EKeyNumber1] ); - CLOG_WRITE_FORMAT( "ValidLen1: %d \n", validLen ); - } - else if ( keyLen[EKeyNumber2] ) - { - //check validity of key2 length - validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey2Format ), - WEPKeyLength( EWEPKey2Length ) ); - if ( keyLen[EKeyNumber2] != validLen ) - { - valid = EFalse; - CLOG_WRITE_FORMAT( "! Error : Key2 length is invalid %d", - keyLen[EKeyNumber2] ) - CLOG_WRITE_FORMAT( "ValidLen2: %d \n", validLen ); - } - else if ( keyLen[EKeyNumber3] ) - { - //check validity of key3 length - validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey3Format ), - WEPKeyLength( EWEPKey3Length ) ); - if ( keyLen[EKeyNumber3] != validLen ) - { - valid = EFalse; - CLOG_WRITE_FORMAT( "! Error : Key3 length is invalid %d", - keyLen[EKeyNumber3] ); - CLOG_WRITE_FORMAT( "ValidLen3: %d \n", validLen ); - } - else if ( keyLen[EKeyNumber4] ) - { - //check validity of key4 length - validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey4Format ), - WEPKeyLength( EWEPKey4Length ) ); - if ( keyLen[EKeyNumber4] != validLen ) - { - valid = EFalse; - CLOG_WRITE_FORMAT( "! Error : Key4 length is invalid %d", - keyLen[EKeyNumber4] ); - CLOG_WRITE_FORMAT( "ValidLen4: %d \n", validLen ); - }//if - }//else - }//else - }//else - }//else - - return valid; - } - -//---------------------------------------------------------- -// CProcessorWlan::ConvertAsciiToHex -//---------------------------------------------------------- -// -void CProcessorWlan::ConvertAsciiToHex( const TDesC8& aSource, - HBufC8*& aDest ) - { - _LIT( hex, "0123456789ABCDEF" ); - TInt size = aSource.Size(); - TPtr8 ptr = aDest->Des(); - for ( TInt ii = 0; ii < size; ii++ ) - { - TText8 ch = aSource[ii]; - ptr.Append( hex()[(ch/16)&0x0f] ); - ptr.Append( hex()[ch&0x0f] ); - } - } - -//---------------------------------------------------------- -// CWEPSecuritySettingsDlg::VerifyHex -//---------------------------------------------------------- -// -TBool CProcessorWlan::VerifyHex( const TDesC8& aHex ) - { - TBool err( ETrue ); - - for ( TInt i = 0; i < aHex.Length(); i++ ) - { - TChar c( aHex[i] ); - - if ( !c.IsHexDigit() ) - { - err = EFalse; - break; - } - } - - return err; - } - - -// --------------------------------------------------------- -// WPA Security settings -// --------------------------------------------------------- - - -// --------------------------------------------------------- -// CProcessorWlan::SaveWPAL -// --------------------------------------------------------- -// -void CProcessorWlan::SaveWPAL( TUint32 aIapId ) - { - CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); - - CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); - CleanupStack::PushL( session ); - - // Load IAP record - CCDIAPRecord* iapRecord = static_cast - ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); - CleanupStack::PushL( iapRecord ); - iapRecord->SetRecordId( aIapId ); - iapRecord->LoadL( *session ); - - // Load WLAN service table - // first get WLAN table id - CMDBGenericRecord* generic = static_cast - ( CCDRecordBase::RecordFactoryL( 0 ) ); - CleanupStack::PushL( generic ); - - generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); - generic->LoadL( *session ); - TMDBElementId wlanTableId = generic->TableId(); - CMDBField* sidField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); - - TInt service = iapRecord->iService; - // prime with service id - *sidField = (TUint32)service; - - User::LeaveIfError( generic->FindL( *session ) ); - - // Set WPA mode - CMDBField* enableWpaPskField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); - - enableWpaPskField->SetL( WPAPresharedKeyInUse() ); - - CLOG_WRITE( "Wrote enableWpaPskField" ); - - // Set security mode - CMDBField* secModeField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); - secModeField->SetL( iSecurityMode ); - - CLOG_WRITE( "Wrote securityMode" ); - - // Save EAP list - SetExpandedEapListL( service ); - CLOG_WRITE( "Wrote Expanded EAPList" ); - - // Save PreShared Key - TBuf8 keyWPA; - //convert to 8 bit - keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); - CMDBField* wpaPskField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); - wpaPskField->SetL( keyWPA ); - - CLOG_WRITE( "Wrote pre-shared key" ); - if ( keyWPA.Length() < 8 ) - { - CLOG_WRITE( "Error: WPA pre-shared key is less then 8 chars." ); - } - - // Check and save PreShared Key Length - TInt len( WPAKeyLength() ); - if ( len != keyWPA.Length() ) - { - CLOG_WRITE( "! Error : WPA key lengths do not match" ); - } - - CMDBField* keyLengthField = static_cast*> - ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) ); - keyLengthField->SetL( len ); - - generic->ModifyL( *session ); - - CleanupStack::PopAndDestroy( generic ); - CleanupStack::PopAndDestroy( iapRecord ); - CleanupStack::PopAndDestroy( session ); - CLOG_WRITE( "CProcessorWlan::SaveWPAL exit" ); - } - -// --------------------------------------------------------- -// CProcessorWlan::SetExpandedEapListL -// --------------------------------------------------------- -// -void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId ) - { - CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" ) - // Gets the text format eap list - HBufC16* eapList = WPAFieldData( EWPAEapMethod ); - - if ( eapList != NULL && 0 < eapList->Length() ) - { - // load general EAP settings If - CEapGeneralSettings* eapGs; - eapGs = CEapGeneralSettings::NewL( ELan, aServiceId ); - CleanupStack::PushL( eapGs ); - - // get lists of enabled/disabled EAPs for the IAP - RArray< TEapExpandedType > enabledEapMethods; - RArray< TEapExpandedType > disabledEapMethods; - - enabledEapMethods.Append( GetExpandedEapTypeIdL( *eapList ) ); - - // disabledEapMethods can be empty, SetEapMethods takes care of it, - // only enabledEapMethods is a must with correct contents - User::LeaveIfError( eapGs->SetEapMethods( enabledEapMethods, - disabledEapMethods ) ); - - CleanupStack::PopAndDestroy( eapGs ); - } - } - -// --------------------------------------------------------- -// CProcessorWlan::GetExpandedEapTypeId -// --------------------------------------------------------- -// -TEapExpandedType CProcessorWlan::GetExpandedEapTypeIdL( TDesC& aField ) - { - TUint8 resultByte; - TLex16 lex( aField.Ptr() ); - User::LeaveIfError( lex.Val( resultByte, EDecimal ) ); - - CLOG_WRITE_FORMAT( "CProcessorWlan::GetExpandedEapTypeIdL: EAP %d", - (int)resultByte ) - - switch ( resultByte ) - { - case 0x06: - { - return *EapExpandedTypeGtc.GetType(); - } - case 0x0d: - { - return *EapExpandedTypeTls.GetType(); - } - case 0x11: - { - return *EapExpandedTypeLeap.GetType(); - } - case 0x12: - { - return *EapExpandedTypeSim.GetType(); - } - case 0x15: - { - return *EapExpandedTypeTtls.GetType(); - } - case 0x17: - { - return *EapExpandedTypeAka.GetType(); - } - case 0x19: - { - return *EapExpandedTypePeap.GetType(); - } - case 0x1a: - { - return *EapExpandedTypeMsChapv2.GetType(); - } - case 0x2b: - { - return *EapExpandedTypeFast.GetType(); - } - case 0x01: - { - return *EapExpandedTypeProtectedSetup.GetType(); - } - case 0x62: - { - return *EapExpandedTypeTtlsPap.GetType(); - } - case 0x63: - { - return *EapExpandedPlainMsChapv2.GetType(); - } - default: - { - return *EapExpandedTypeNone.GetType(); - } - } - } - -// --------------------------------------------------------- -// CProcessorWlan::WPAIndex -// --------------------------------------------------------- -// -TInt CProcessorWlan::WPAIndex( TDbCreatorWPAFields aFieldId ) - { - __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - return aFieldId - 0x2000 + iDataStart; - } - -// --------------------------------------------------------- -// CProcessorWlan::WPAFieldData -// --------------------------------------------------------- -// -HBufC16* CProcessorWlan::WPAFieldData( TDbCreatorWPAFields aFieldId ) - { - TInt index = WPAIndex( aFieldId ); - if( iWpaData[ index ] == NULL ) - { - return iEmptyTag; - } - else - { - return iWpaData[ index ]; - } - } - -// --------------------------------------------------------- -// CProcessorWlan::WPAPresharedKeyInUse -// --------------------------------------------------------- -// -TBool CProcessorWlan::WPAPresharedKeyInUse() - { - HBufC16* useStr = WPAFieldData( EWPAUseOfPresharedKey ); - - TBool usePSK ( EFalse ) ; - - if ( useStr->CompareF( KStrYes ) == 0 ) - { - CLOG_WRITE( "Preshared key in use" ) - usePSK = ETrue; - } - else if ( useStr->CompareF( KStrNo ) == 0 ) - { - CLOG_WRITE( "Preshared key not in use" ); - } - else - { - //aField is either empty or invalid - CLOG_WRITE( "! Error : Invalid Use WPA preshared key. Default:No" ); - } - - return usePSK; - } - -// --------------------------------------------------------- -// CProcessorWlan::WPAKeyLength -// --------------------------------------------------------- -// -TInt CProcessorWlan::WPAKeyLength() - { - HBufC16* tag = WPAFieldData( EWPAKeyLength ); - - TInt num( 0 ); - TLex parser( tag->Des() ); - - if ( parser.Val( num ) != KErrNone ) - { - CLOG_WRITE( "! Error : Invalid input : WPA key length" ); - } - - return num; - } - -// --------------------------------------------------------- -// CProcessorWlan::AddSecurityDataL -// --------------------------------------------------------- -// -void CProcessorWlan::AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep ) - { - if( aIsWep ) - { - iWepData[ WEPIndex( (TDbCreatorWEPFields)aField ) ] = aPtrTag->AllocL(); - ////iWepData.Insert( aPtrTag->AllocL(), WEPIndex( (TDbCreatorWEPFields)aField ) ); - } - else - { - iWpaData[ WPAIndex( (TDbCreatorWPAFields)aField ) ] = aPtrTag->AllocL(); - ////iWpaData.Insert( aPtrTag->AllocL(), WPAIndex( (TDbCreatorWPAFields)aField ) ); - } - } - -// --------------------------------------------------------- -// CProcessorWlan::DoLogL -// --------------------------------------------------------- -// -void CProcessorWlan::DoLogL() - { - // Writes some data of the actual WLAN access point into the log file. - HBufC16* tmp; - RCmConnectionMethodExt& plugin = GetLastPluginL(); - - // Writes some data of the Internet acces point into the log file. - if ( iIsEasyWlan ) - { - CLOG_WRITE( "Easy WLAN Access Point created:" ) - } - else - { - CLOG_WRITE( "WLAN Access Point created:" ) - } - - CLOG_WRITE_FORMAT( "\t Connection name in array: %S ", - (*iPluginName)[ PluginCount() - 1] ); - - tmp = plugin.GetStringAttributeL( ECmName ); - if( tmp ) - { - CleanupStack::PushL( tmp ); - CLOG_WRITE_FORMAT( "\t Connection name: %S ", tmp ) - CleanupStack::PopAndDestroy( tmp ); - } - - // For the WLAN network name - tmp = plugin.GetStringAttributeL( EWlanSSID ); - if( tmp ) - { - CleanupStack::PushL( tmp ); - CLOG_WRITE_FORMAT( "\t Network name: %S", tmp ) - CleanupStack::PopAndDestroy( tmp ); - } - CLOG_WRITE( "\t \r\n" ) - } - - -// --------------------------------------------------------- -// CProcessorWlan::Reset -// --------------------------------------------------------- -// -void CProcessorWlan::Reset() - { - for( TInt i = 0; i < KWEPKeyNumOfFields; i++ ) - { - iWepData[i] = NULL; - } - for( TInt i = 0; i < KWPAKeyNumOfFields; i++ ) - { - iWpaData[i] = NULL; - } - } - -// --------------------------------------------------------- -// CProcessorWlan::EAPSetting -// --------------------------------------------------------- -// -TBool CProcessorWlan::EAPSetting( const TInt aField ) - { - // Checks if the supplied field is EAP settings and returns ETrue if it is - if ( aField > EEapParameterFirst - && aField < EEapParameterLast ) - { - return ETrue; - } - else - { - return EFalse; - } - } - -// --------------------------------------------------------- -// CProcessorWlan::GetEapTypeIdFromSettingId -// --------------------------------------------------------- -// -TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) - { - switch ( aField ) - { - case EEapGtcUsername: - case EEapGtcSessionValidityTime: - case EEapGtcEncapsulation: - { - return *EapExpandedTypeGtc.GetType(); - } - case EEapTlsUsername: - case EEapTlsRealm: - case EEapTlsVerifyServerRealm: - case EEapTlsRequireClientAuth: - case EEapTlsSessionValidityTime: - case EEapTlsCipherSuites: - case EEapTlsUserCertSubjectKeyId: - case EEapTlsUserCertIssuerName: - case EEapTlsUserCertSerialNumber: - case EEapTlsCaCertSubjectKeyId: - case EEapTlsCaCertIssuerName: - case EEapTlsCaCertSerialNumber: - case EEapTlsEncapsulation: - { - return *EapExpandedTypeTls.GetType(); - } - case EEapLeapUsername: - case EEapLeapPassword: - case EEapLeapSessionValidityTime: - { - return *EapExpandedTypeLeap.GetType(); - } - case EEapSimUsername: - case EEapSimRealm: - case EEapSimUsePseudonyms: - case EEapSimSessionValidityTime: - case EEapSimEncapsulation: - { - return *EapExpandedTypeSim.GetType(); - } - case EEapTtlsUsername: - case EEapTtlsRealm: - case EEapTtlsVerifyServerRealm: - case EEapTtlsRequireClientAuth: - case EEapTtlsSessionValidityTime: - case EEapTtlsCipherSuites: - case EEapTtlsEncapsulatedTypes: - case EEapTtlsUserCertSubjectKeyId: - case EEapTtlsUserCertIssuerName: - case EEapTtlsUserCertSerialNumber: - case EEapTtlsCaCertSubjectKeyId: - case EEapTtlsCaCertIssuerName: - case EEapTtlsCaCertSerialNumber: - { - return *EapExpandedTypeTtls.GetType(); - } - case EEapAkaUsername: - case EEapAkaRealm: - case EEapAkaUsePseudonyms: - case EEapAkaSessionValidityTime: - case EEapAkaEncapsulation: - { - return *EapExpandedTypeAka.GetType(); - } - case EEapPeapUsername: - case EEapPeapRealm: - case EEapPeapVerifyServerRealm: - case EEapPeapRequireClientAuth: - case EEapPeapSessionValidityTime: - case EEapPeapCipherSuites: - case EEapPeapV0Allowed: - case EEapPeapV1Allowed: - case EEapPeapV2Allowed: - case EEapPeapEncapsulatedTypes: - case EEapPeapUserCertSubjectKeyId: - case EEapPeapUserCertIssuerName: - case EEapPeapUserCertSerialNumber: - case EEapPeapCaCertSubjectKeyId: - case EEapPeapCaCertIssuerName: - case EEapPeapCaCertSerialNumber: - { - return *EapExpandedTypePeap.GetType(); - } - case EEapMschapv2Username: - case EEapMschapv2Password: - case EEapMschapv2SessionValidityTime: - case EEapMschapv2Encapsulation: - { - return *EapExpandedTypeMsChapv2.GetType(); - } - case EEapFastUsername: - case EEapFastRealm: - case EEapFastVerifyServerRealm: - case EEapFastRequireClientAuth: - case EEapFastSessionValidityTime: - case EEapFastCipherSuites: - case EEapFastEncapsulatedTypes: - case EEapFastAuthProvModeAllowed: - case EEapFastUnauthProvModeAllowed: - case EEapFastWarnADHPNoPAC: - case EEapFastWarnADHPNoMatchingPAC: - case EEapFastWarnNotDefaultServer: - case EEapFastUserCertSubjectKeyId: - case EEapFastUserCertIssuerName: - case EEapFastUserCertSerialNumber: - case EEapFastCaCertSubjectKeyId: - case EEapFastCaCertIssuerName: - case EEapFastCaCertSerialNumber: - { - return *EapExpandedTypeFast.GetType(); - } - - case EMschapv2Username: - case EMschapv2Password: - case EMschapv2SessionValidityTime: - case EMschapv2Encapsulation: - { - return *EapExpandedPlainMsChapv2.GetType(); - } - default: - { - return *EapExpandedTypeNone.GetType(); - } - - } - } - -// --------------------------------------------------------- -// CProcessorWlan::AddEAPSetting -// --------------------------------------------------------- -// -void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue ) - { - TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField ); - if ( eapId == *EapExpandedTypeNone.GetType() ) - { - CLOG_WRITE( "! Error : Unknown EAP method" ); - User::Leave( KErrArgument ); - } - - TInt eapIndex(0); - // Search if the EAP instance already exists in the array for this - for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) - { - if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId ) - && ( iEapSettings[eapIndex]->iName != NULL ) - && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) - { - // Found it - break; - } - } - - if ( eapIndex == iEapSettings.Count() ) - { - // Not found. Create new - CEapTypeElement* newEap = new (ELeave) CEapTypeElement; - CleanupStack::PushL( newEap ); - - newEap->iEapSettings = new (ELeave) EAPSettings; - - newEap->iEapSettings->iEAPExpandedType = eapId; - - newEap->iName = iName->AllocL(); - - iEapSettings.AppendL(newEap); - - CleanupStack::Pop( newEap ); - - // Set the index to the newly created EAP settings instance - eapIndex = iEapSettings.Count() - 1; - - } - switch ( aField ) - { - case EEapGtcUsername: - case EEapTlsUsername: - case EEapLeapUsername: - case EEapSimUsername: - case EEapTtlsUsername: - case EEapAkaUsername: - case EEapPeapUsername: - case EEapMschapv2Username: - case EEapFastUsername: - case EMschapv2Username: - { - iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; - break; - } - - case EEapLeapPassword: - case EEapMschapv2Password: - case EMschapv2Password: - { - iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); - iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; - break; - } - - case EEapTlsRealm: - case EEapSimRealm: - case EEapTtlsRealm: - case EEapAkaRealm: - case EEapPeapRealm: - case EEapFastRealm: - { - iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse; - break; - } - - case EEapGtcSessionValidityTime: - case EEapTtlsSessionValidityTime: - case EEapTlsSessionValidityTime: - case EEapSimSessionValidityTime: - case EEapLeapSessionValidityTime: - case EMschapv2SessionValidityTime: - case EEapAkaSessionValidityTime: - case EEapPeapSessionValidityTime: - case EEapMschapv2SessionValidityTime: - case EEapFastSessionValidityTime: - { - // Convert the input parameter to integer - TLex lex( *aValue ); - TUint value( 0 ); - if( lex.Val( value, EDecimal) != KErrNone ) - { - CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; - break; - } - - case EEapGtcEncapsulation: - case EEapTlsEncapsulation: - case EEapSimEncapsulation: - case EEapAkaEncapsulation: - case EEapMschapv2Encapsulation: - case EMschapv2Encapsulation: - { - TLex lex( *aValue ); - TUint eapTypeId( 0 ); - if( lex.Val( eapTypeId, EDecimal) != KErrNone ) - { - CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId ); - break; - } - - case EEapTlsVerifyServerRealm: - case EEapTtlsVerifyServerRealm: - case EEapPeapVerifyServerRealm: - case EEapFastVerifyServerRealm: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapTlsRequireClientAuth: - case EEapTtlsRequireClientAuth: - case EEapPeapRequireClientAuth: - case EEapFastRequireClientAuth: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapTlsCipherSuites: - case EEapTtlsCipherSuites: - case EEapPeapCipherSuites: - case EEapFastCipherSuites: - { - TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); - if( err != KErrNone ) - { - CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - break; - } - - case EEapTlsUserCertSubjectKeyId: - case EEapTtlsUserCertSubjectKeyId: - case EEapPeapUserCertSubjectKeyId: - case EEapFastUserCertSubjectKeyId: - { - TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); - - TKeyIdentifier key; - - TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); - if( err != KErrNone ) - { - CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); - break; - } - - case EEapTlsUserCertIssuerName: - case EEapTtlsUserCertIssuerName: - case EEapPeapUserCertIssuerName: - case EEapFastUserCertIssuerName: - { - TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); - - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); - break; - } - - case EEapTlsUserCertSerialNumber: - case EEapTtlsUserCertSerialNumber: - case EEapPeapUserCertSerialNumber: - case EEapFastUserCertSerialNumber: - { - TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); - - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); - break; - } - - case EEapTlsCaCertSubjectKeyId: - case EEapTtlsCaCertSubjectKeyId: - case EEapPeapCaCertSubjectKeyId: - case EEapFastCaCertSubjectKeyId: - { - TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); - - TKeyIdentifier key; - - TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); - if( err != KErrNone ) - { - CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; - break; - } - - case EEapTlsCaCertIssuerName: - case EEapTtlsCaCertIssuerName: - case EEapPeapCaCertIssuerName: - case EEapFastCaCertIssuerName: - { - TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerNamePresent(); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; - - break; - } - - case EEapTlsCaCertSerialNumber: - case EEapTtlsCaCertSerialNumber: - case EEapPeapCaCertSerialNumber: - case EEapFastCaCertSerialNumber: - { - TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); - iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); - iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; - break; - } - - case EEapSimUsePseudonyms: - case EEapAkaUsePseudonyms: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - break; - } - - case EEapTtlsEncapsulatedTypes: - case EEapPeapEncapsulatedTypes: - case EEapFastEncapsulatedTypes: - { - iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) ); - iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; - break; - } - - case EEapPeapV0Allowed: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapPeapV1Allowed: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapPeapV2Allowed: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapFastAuthProvModeAllowed: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapFastUnauthProvModeAllowed: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; - } - else - { - - CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapFastWarnADHPNoPAC: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapFastWarnADHPNoMatchingPAC: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - case EEapFastWarnNotDefaultServer: - { - if ( !aValue->CompareF( KStrYes ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = ETrue; - } - else if ( !aValue->CompareF( KStrNo ) ) - { - iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; - iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; - } - else - { - CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() ); - User::Leave( KErrArgument ); - } - - break; - } - - default: - { - - } - } - } -// --------------------------------------------------------- -// CProcessorWlan::FillCipherSuitesL -// --------------------------------------------------------- -// -void CProcessorWlan::FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex ) - { - if ( iEapSettings[aEapIndex] == NULL ) - { - User::Leave( KErrArgument ); - } - - iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Reset(); - iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = EFalse; // init to EFalse - - TChar plus( '+' ); - - TBuf8<256> tmpBuf; - tmpBuf.Copy( *aPtrTag); - - TInt length = tmpBuf.Length(); - - for ( TInt i = 0 ; i + 3 < length ; i += 5) - { - if ( tmpBuf[i] == plus ) - { - TLex8 lex( tmpBuf.Mid( i + 1, 3) ); - TUint suite; - User::LeaveIfError( lex.Val( suite ) ); - iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Append(suite); - iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = ETrue; - } - } - } - -// --------------------------------------------------------- -// CProcessorWlan::FindCertificateEntry -// --------------------------------------------------------- -// -TUint CProcessorWlan::FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ) - { - TUint certIndex( 0 ); - for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) - { - if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType ) - { - // Found - break; - } - } - if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) - { - // Not found. Create - EapCertificateEntry* entry; - entry = new (ELeave) EapCertificateEntry; - entry->SetCertType( aCertType ); - - iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); - - certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; - } - return certIndex; - } - -// --------------------------------------------------------- -// CProcessorWlan::ConvertSubjectKeyIdToBinary -// --------------------------------------------------------- -// -void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey) - { - TInt err( KErrNone ); - - // Define literals to search the subject key for possible 0X/0x beginning - _LIT(KHexIdLC, "0x"); - _LIT(KHexIdUC, "0X"); - TBuf<2> hexIdBuf; - - // The lenght of the key given as input - TInt keyLen = aSubjectKeyIdString->Length(); - - // setting the given key to the key buffer - TBuf8<256> origKey; - - origKey.Copy( *aSubjectKeyIdString ); - origKey.SetLength(keyLen); - - TLex8 tmpByte; - TUint16 byte; - - // Remove possible spaces from the beginning - origKey.TrimLeft(); - - // the key should be atleast two chars long - if (origKey.Length() >= 2) - { - // Copy the two left most characters in to the buffer - hexIdBuf.Copy(origKey.Left(2)); - - // If the first characters are 0x or 0X, then thet should be ignored - if (hexIdBuf.Compare(KHexIdLC) == 0 - || hexIdBuf.Compare(KHexIdUC) == 0) - { - // delete two characters - origKey.Delete(0, 2); - } - } - - - // looping the subject key through, removing whitespaces - for (TInt i = 0; i < KKeyIdentifierLength; i++) - { - // removing white spaces from the left side of the key - origKey.TrimLeft(); - // check that there are characters left - if (origKey.Length() >= 2) - { - // pick the two left most bytes from the key - tmpByte = origKey.Left(2); - // convert byte into binary format - err = tmpByte.Val(byte, EHex); - - // check whether conversion to decimal went ok - if (err != KErrNone) - { - // if there are problems, then leave the loop - break; - } - - // store the appended byte into the key variable - aBinaryKey.Append(byte); - // delete two characters from the left side of the character array in the buffer - origKey.Delete(0, 2); - } - else { - // leave the loop, no characters are left - break; - } - } - User::LeaveIfError( err ); - } - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcreaderbase.cpp --- a/dbcreator/commsdatcreator/Src/cdcreaderbase.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CReaderBase -* -*/ - - - - -// INCLUDE FILES - -#include "cdcreaderbase.h" -#include "cdclogger.h" - -#include "cdcerrors.h" -#include "cdccommon.h" - -// CONSTANTS - -// ================= MEMBER FUNCTIONS ======================= - -//--------------------------------------------------------- -// Constructor & Destructor -//--------------------------------------------------------- -// -CReaderBase::~CReaderBase() - { - CLOSE_LOG; - //no implementation required - delete iTagContainer; - - iInputFile.Close(); - iFs.Close(); - } - - -CReaderBase::CReaderBase( TDbCreatorInputFile aFileType, - TDbCreatorFeatures aFeature ): - iCurrentFeature( aFeature ), - iTagContainer( NULL ), - iFileType( aFileType ) - { - //no implementation required - } - -// --------------------------------------------------------- -// CProcessorBase::ConstructL -// --------------------------------------------------------- -// -void CReaderBase::ConstructL( const TDesC& aInFileName ) - { - User::LeaveIfError( iFs.Connect() ); - - TInt error( iInputFile.Open( iFs, aInFileName, - EFileShareReadersOnly | EFileStream | EFileRead ) ); - - if ( error == KErrNotFound ) - { - User::Leave( KErrNotFound ); - } - else if ( error ) - { - User::Leave( KErrFileCannotBeOpened ); - } - else - { - //nothing to do - } - - ////iFs.MkDirAll( KFullLogDir ); - - CREATE_LOG; - - ////User::LeaveIfError( iLogFile.Connect() ); - ////iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend ); - - iTagContainer = CTagContainer::NewL(); - } - - -// --------------------------------------------------------- -// CProcessorBase::TagContainer -// --------------------------------------------------------- -// -CTagContainer& CReaderBase::TagContainer() - { - return *iTagContainer; - } - - -// --------------------------------------------------------- -// CProcessorBase::InputFile -// --------------------------------------------------------- -// -RFile& CReaderBase::InputFile() - { - return iInputFile; - } - - -// --------------------------------------------------------- -// CProcessorBase::FileLogger -// --------------------------------------------------------- -// -RFileLogger& CReaderBase::FileLogger() - { - return iLogFile; - } - - -// --------------------------------------------------------- -// CProcessorBase::FieldIDPresent -// --------------------------------------------------------- -// -TBool CReaderBase::FieldIDPresent() - { - return ( iFileType == EFileXML ); - } - - -// --------------------------------------------------------- -// CProcessorBase::CurrentFeature -// --------------------------------------------------------- -// -TDbCreatorFeatures CReaderBase::CurrentFeature() - { - return iCurrentFeature; - } - -//End of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcreaderxml.cpp --- a/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1825 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CReaderXML -* -*/ - - - - -// INCLUDE FILES - -#include "cdcreaderxml.h" -#include "cdclogger.h" - -#include -#include -#include -#include -#include -#include -#include - -using namespace CMManager; - -//TYPE DECLARATION - -//CONSTANTS -// -// Literals in XML header -_LIT16( KXmlVersion, "xml version" ); -_LIT16( KEncoding, "encoding" ); -_LIT16( KEncodingUtf8, "UTF-8" ); - -// File tail marker -_LIT16( KFileTail, ""); -_LIT16( KFileTail2, ""); - -// Feature head markers -_LIT16( KFeatureHeadPacketData, "" ); -_LIT16( KFeatureHeadWLAN, "" ); -_LIT16( KFeatureHeadLAN, "" ); -_LIT16( KFeatureHeadVPN, "" ); -_LIT16( KFeatureHeadGlobal, "" ); -_LIT16( KFeatureHeadDN, "" ); - -// Feature tail markers -_LIT16( KFeatureTailPacketData, "" ); -_LIT16( KFeatureTailWLAN, "" ); -_LIT16( KFeatureTailLAN, "" ); -_LIT16( KFeatureTailVPN, "" ); -_LIT16( KFeatureTailGlobal, "" ); -_LIT16( KFeatureTailDN, "" ); - -// Feature data head markers -_LIT16( KDataHeadPacketData, "" ); -_LIT16( KDataHeadWLAN, "" ); -_LIT16( KDataHeadLAN, "" ); -_LIT16( KDataHeadVPN, "" ); -_LIT16( KDataHeadDN, "" ); - -// Feature data tail markers -_LIT16( KDataTailPacketData, "" ); -_LIT16( KDataTailWLAN, "" ); -_LIT16( KDataTailLAN, "" ); -_LIT16( KDataTailVPN, "" ); -_LIT16( KDataTailDN, "" ); - -// Parameter Markers -// ParamValue -_LIT16( KParamValueHead, ">" ); -_LIT16( KParamValueTail, "" ); - - -//maximum line size -const TInt16 KMaxLineSize = 1024; -//maximum item (tag) size -const TInt16 KMaxItemLength = 100; - -// ratio between ascii and unicode character sizes -const TUint KAsciiUnicodeRatio = 2; - -// Following table contains the input parameter names: -// -// Name Type Description -//---------------------------------------------------------------------------- -//General & Gprs specific: -//======================== -//KConnectionName string The name of the access point. -//KProtected string Protection -//KHidden string CM/DN is hidden -//KHiddenAgent string CM/DN is not shown in CConnDlg -//KHighlighted string CM/DN is highlighted in CConnDlg -//KSeamlessness string Seamlessness value -//KGprs_AP_Name string Access point name. -//KUserName string Login user name -//KPromptPassword string Prompts the user for username and -// password -//KPassword string Login password. -//KPasswordAuthType string Disables plain text authentication. -//KWAPGatewayIP string WAP gateway address (IP address). -//KStartingPage string WAP start page URL. -//KWTLS_Security string Attempts a secure WTLS connection -// to the gateway. -//KWAP_ConnectionType string Indicates whether a connection- -// oriented or connectionless API -// should be used. -//KPhoneIP string IP address of the interface. -//KPrimaryNameServer string IP address of the primary name -// server. -//KSecondaryNameServer string IP address of the secondary name -// server. -//KProxyServerAddress string Proxy server address. -//KProxyPortNumber string Proxy port number. -//KProxyProtocolName string Proxy protocol name. -//KPrimaryIP6NameServer string IP address of the primary IPv6 -// name server. -//KSecondaryIP6NameServer string IP address of the secondary IPv6 -// name server. -//KNetworkType string Network type: IPv4 or IPv6 -//KGprsUseEdge string Sets the GprsUseEdge parameter -//============= -//LAN specific: -//============= -//KLanIfNetworks string Network protcols -//KLanIpNetMask string IP net mask of interface -//KLanIpGateway string IP address of gateway -//============== -//WLAN specific: -//============== -//KNetworkName string The name of the WLAN network -//KNetworkMode string The WLAN network mode -//KSecurityMode string The security mode of the WLAN network -//KWlanIpGatewayAddress string IP address of gateway -//KWlanIpNetMask string IP net mask of interface -//KWlanChannelId integer 802.11 Channel ID (1-14) - -//--------------- -//WEP security -//--------------- -//WEPKeyInUse integer Index of the default WEP key -//WEPAuthType string WEP authentication mode. -//WEPKey1Length string Key length of WEP key1. 64, 128, 256 bit. -//WEPKey1Format string Format of WEP key 1. ASCII or Hexadecimal -//WEPKey1Data string Data of WEP key1 -//WEPKey2Length string Key length of WEP key2. 64, 128, 256 bit. -//WEPKey2Format string Format of WEP key 2. ASCII or Hexadecimal -//WEPKey2Data string Data of WEP key2 -//WEPKey3Length string Key length of WEP key3. 64, 128, 256 bit. -//WEPKey3Format string Format of WEP key 3. ASCII or Hexadecimal -//WEPKey3Data string Data of WEP key3 -//WEPKey4Length string Key length of WEP key4. 64, 128, 256 bit. -//WEPKey4Format string Format of WEP key 4. ASCII or Hexadecimal -//WEPKey4Data string Data of WEP key4 -//--------------- -//WPA security -//--------------- -//WPAPresharedKey string WPA/WPA2 pre-shared key in plain text. -//WPAKeyLength integer The length of the WPA/WPA2 pre-shared key. -//WPAEapMethod string A EAP method in use -//WPAUseOfPresharedKey string WPA/WPA2 pre-shared key usage. -//============= -//VPN specific: -//============= -//KVpnIapName string IAP name used for the connection -//KVpnServicePolicy string Service policy ID -//==================== -//Destination Networks -//==================== -//KDN_Name string The name of the Destination Network -//KDN_Icon integer Index of icon assigned to the DN -//KDN_Metadata string Destination type -//KDN_Protection integer Protection level of the DN -//KDN_Hidden integer Shows whether DN is hidden or not -//KDN_IAPName string Name of a Connection Method that is -// bound to the DN -//KDN_IAPName2..10 string Same as above -//KDN_EmbeddedDN string Name of an Embedded DN that is bound -// to the DN -//=============== -//Global settings -//=============== -//KAttachMode string Gprs attach mode -//KDefaultAP string Default Gprs access point -//KTableProtection string Table level protection -//KDefaultDnIcon integer Default icon for DNs -//KPriorityLan integer Default priority for Lan bearer type -//KPriorityWlan integer Default priority for WLan bearer type -//KPriorityPan integer Default priority for Pan bearer type -//KPriorityGprsOut integer Default priority for outgoing Gprs -// bearer type -//KPriorityGprsIn integer Default priority for incoming Gprs -// bearer type -//KPriorityCdma2k integer Default priority for CDMA2000 bearer type -//KPriorityDialOut integer Default priority for incoming dial -// bearer type -//KPriorityDialIn integer Default priority for outgoing dial -// bearer type -//KPriorityVpn integer Default priority for Vpn bearer type -//KPriorityMip integer Default priority for Mip bearer type -//KUIPriorityLan integer Default UI priority for Lan bearer type -//KUIPriorityWlan integer Default UI priority for WLan bearer type -//KUIPriorityPan integer Default UI priority for Pan bearer type -//KUIPriorityGprsOut integer Default UI priority for outgoing Gprs -// bearer type -//KUIPriorityGprsIn integer Default UI priority for incoming Gprs -// bearer type -//KUIPriorityCdma2k integer Default UI priority for CDMA2000 -// bearer type -//KUIPriorityDialOut integer Default UI priority for incoming dial -// bearer type -//KUIPriorityDialIn integer Default UI priority for outgoing dial -// bearer type -//KUIPriorityVpn integer Default UI priority for Vpn bearer type -//KUIPriorityMip integer Default UI priority for Mip bearer type - -//KDefaultConnectionType integer Default connection method type -//KDefaultConnectionName string Default connection method name - -//KUsageOfWlan integer Usage of known WLAN networks, automatical or manual -//KSeamlessnessHome integer Cellular data usage in home network -//KSeamlessnessVisitor integer Cellular data usage in foreign networks - - -//KGprsLastSocketActivityTimeout integer -//KGprsLastSessionClosedTimeout integer The time how long Gprs PDP context stays active -// after the last application using the connection was closed. -//KGprsLastSocketClosedTimeout integer -//KCsdLastSocketActivityTimeout integer -//KCsdLastSessionClosedTimeout integer -//KCsdLastSocketClosedTimeout integer -//KWlanLastSocketActivityTimeout integer -//KWlanLastSessionClosedTimeout integer -//KWlanLastSocketClosedTimeout integer -//KWlanBGScanInterval integer -//KWlanUseDefSettings integer -//KWlanLongRetry integer -//KWlanShortRetry integer -//KWlanRTS integer -//KWlanTxPowerLevel integer -//KWlanRadioMeasurements integer -//KWlanPowerMode integer Whether WLAN power save is on or off - - -//String literals defined for input parameters - -//General & Gprs specific -_LIT16( KConnectionName, "ConnectionName" ); -_LIT16( KConnectionId, "ConnectionId" ); -_LIT16( KProtected, "Protected" ); -_LIT16( KHidden, "Hidden" ); -_LIT16( KHiddenAgent, "HiddenAgent" ); -_LIT16( KHighlighted, "Highlighted" ); -_LIT16( KSeamlessness, "Seamlessness" ); -_LIT16( KGprs_AP_Name, "Gprs_AP_Name" ); -_LIT16( KUserName, "UserName" ); -_LIT16( KPromptPassword, "PromptPassword" ); -_LIT16( KPassword, "Password" ); -_LIT16( KPasswordAuthType, "PasswordAuthenticationType" ); -_LIT16( KWAPGatewayIP, "WAPGatewayIP" ); -_LIT16( KStartingPage, "StartingPage" ); -_LIT16( KWTLS_Security, "WTLS_Security" ); -_LIT16( KWAP_ConnectionType, "WAP_ConnectionType" ); -_LIT16( KPhoneIP, "PhoneIP" ); -_LIT16( KPrimaryNameServer, "PrimaryNameServer" ); -_LIT16( KSecondaryNameServer, "SecondaryNameServer" ); -_LIT16( KProxyServerAddress, "ProxyServerAddress" ); -_LIT16( KProxyPortNumber, "ProxyPortNumber" ); -_LIT16( KProxyProtocolName, "ProxyProtocolName"); -_LIT16( KPrimaryIP6NameServer, "PrimaryIP6NameServer" ); -_LIT16( KSecondaryIP6NameServer, "SecondaryIP6NameServer" ); -_LIT16( KNetworkType, "NetworkType"); -_LIT16( KIspType, "IspType" ); -_LIT16( KGprsUseEdge, "GprsUseEdge"); -_LIT16( KLinger, "Linger"); - -//Lan specific -_LIT16( KLanIfNetworks, "LanIfNetworks" ); -_LIT16( KLanIpNetMask, "LanIpNetMask" ); -_LIT16( KLanIpGateway, "LanIpGateway" ); -_LIT16( KLanIpAddrFromServer, "IpAddrFromServer" ); -_LIT16( KLanIpDNSAddrFromServer, "IpDNSAddrFromServer" ); -_LIT16( KLanConfigDaemonManagerName,"ConfigDaemonManagerName" ); -_LIT16( KLanConfigDaemonName, "ConfigDaemonName" ); - -//Wlan specific -_LIT16( KNetworkName, "NetworkName" ); -_LIT16( KNetworkMode, "NetworkMode" ); -_LIT16( KSecurityMode, "SecurityMode" ); -_LIT16( KWlanIpGatewayAddress, "WlanIpGatewayAddress" ); -_LIT16( KWlanIpNetMask, "WlanIpNetMask" ); -_LIT16( KWlanScanSSId, "WlanScanSSId" ); -_LIT16( KWlanChannelId, "WlanChannelId" ); - -//WEP security -_LIT16( KWEPKeyInUse, "WEPKeyInUse" ); -_LIT16( KWEPAuthType, "WEPAuthType" ); -_LIT16( KWEPKey1Length, "WEPKey1Length" ); -_LIT16( KWEPKey1Format, "WEPKey1Format" ); -_LIT16( KWEPKey1Data, "WEPKey1Data" ); -_LIT16( KWEPKey2Length, "WEPKey2Length" ); -_LIT16( KWEPKey2Format, "WEPKey2Format" ); -_LIT16( KWEPKey2Data, "WEPKey2Data" ); -_LIT16( KWEPKey3Length, "WEPKey3Length" ); -_LIT16( KWEPKey3Format, "WEPKey3Format" ); -_LIT16( KWEPKey3Data, "WEPKey3Data" ); -_LIT16( KWEPKey4Length, "WEPKey4Length" ); -_LIT16( KWEPKey4Format, "WEPKey4Format" ); -_LIT16( KWEPKey4Data, "WEPKey4Data" ); - -//WPA security -_LIT16( KWPAPresharedKey, "WPAPresharedKey" ); -_LIT16( KWPAKeyLength, "WPAKeyLength" ); -_LIT16( KWPAEapMethod, "WPAEapMethod"); -_LIT16( KWPAUseOfPresharedKey, "WPAUseOfPresharedKey" ); - -//EAP security -_LIT16( KEapGtcUsername, "EapGtcUsername" ); -_LIT16( KEapGtcSessionValidityTime, "EapGtcSessionValidityTime" ); -_LIT16( KEapGtcEncapsulation, "EapGtcEncapsulation" ); - - -_LIT16( KEapTlsUsername, "EapTlsUsername" ); -_LIT16( KEapTlsRealm, "EapTlsRealm" ); -_LIT16( KEapTlsVerifyServerRealm, "EapTlsVerifyServerRealm" ); -_LIT16( KEapTlsRequireClientAuth, "EapTlsRequireClientAuth" ); -_LIT16( KEapTlsSessionValidityTime, "EapTlsSessionValidityTime" ); -_LIT16( KEapTlsCipherSuites, "EapTlsCipherSuites" ); -_LIT16( KEapTlsUserCertSubjectKeyId,"EapTlsUserCertSubjectKeyId" ); -_LIT16( KEapTlsUserCertIssuerName, "EapTlsUserCertIssuerName" ); -_LIT16( KEapTlsUserCertSerialNumber,"EapTlsUserCertSerialNumber" ); -_LIT16( KEapTlsCaCertSubjectKeyId, "EapTlsCaCertSubjectKeyId" ); -_LIT16( KEapTlsCaCertIssuerName, "EapTlsCaCertIssuerName" ); -_LIT16( KEapTlsCaCertSerialNumber, "EapTlsCaCertSerialNumber" ); -_LIT16( KEapTlsEncapsulation, "EapTlsEncapsulation" ); - - -_LIT16( KEapLeapUsername, "EapLeapUsername" ); -_LIT16( KEapLeapPassword, "EapLeapPassword" ); -_LIT16( KEapLeapSessionValidityTime,"EapLeapSessionValidityTime" ); - - -_LIT16( KEapSimUsername, "EapSimUsername" ); -_LIT16( KEapSimRealm, "EapSimRealm" ); -_LIT16( KEapSimUsePseudonyms, "EapSimUsePseudonyms" ); -_LIT16( KEapSimSessionValidityTime, "EapSimSessionValidityTime" ); -_LIT16( KEapSimEncapsulation, "EapSimEncapsulation" ); - -_LIT16( KEapTtlsUsername, "EapTtlsUsername" ); -_LIT16( KEapTtlsRealm, "EapTtlsRealm" ); -_LIT16( KEapTtlsVerifyServerRealm, "EapTtlsVerifyServerRealm" ); -_LIT16( KEapTtlsRequireClientAuth, "EapTtlsRequireClientAuth" ); -_LIT16( KEapTtlsSessionValidityTime,"EapTtlsSessionValidityTime" ); -_LIT16( KEapTtlsCipherSuites, "EapTtlsCipherSuites" ); -_LIT16( KEapTtlsEncapsulatedTypes, "EapTtlsEncapsulatedTypes" ); -_LIT16( KEapTtlsUserCertSubjectKeyId,"EapTtlsUserCertSubjectKeyId" ); -_LIT16( KEapTtlsUserCertIssuerName, "EapTtlsUserCertIssuerName" ); -_LIT16( KEapTtlsUserCertSerialNumber,"EapTtlsUserCertSerialNumber" ); -_LIT16( KEapTtlsCaCertSubjectKeyId, "EapTtlsCaCertSubjectKeyId" ); -_LIT16( KEapTtlsCaCertIssuerName, "EapTtlsCaCertIssuerName" ); -_LIT16( KEapTtlsCaCertSerialNumber, "EapTtlsCaCertSerialNumber" ); - -_LIT16( KEapAkaUsername, "EapAkaUsername" ); -_LIT16( KEapAkaRealm, "EapAkaRealm" ); -_LIT16( KEapAkaUsePseudonyms, "EapAkaUsePseudonyms" ); -_LIT16( KEapAkaSessionValidityTime, "EapAkaSessionValidityTime" ); -_LIT16( KEapAkaEncapsulation, "EapAkaEncapsulation" ); - -_LIT16( KEapPeapUsername, "EapPeapUsername" ); -_LIT16( KEapPeapRealm, "EapPeapRealm" ); -_LIT16( KEapPeapVerifyServerRealm, "EapPeapVerifyServerRealm" ); -_LIT16( KEapPeapRequireClientAuth, "EapPeapRequireClientAuth" ); -_LIT16( KEapPeapSessionValidityTime,"EapPeapSessionValidityTime" ); -_LIT16( KEapPeapCipherSuites, "EapPeapCipherSuites" ); -_LIT16( KEapPeapV0Allowed, "EapPeapV0Allowed" ); -_LIT16( KEapPeapV1Allowed, "EapPeapV1Allowed" ); -_LIT16( KEapPeapV2Allowed, "EapPeapV2Allowed" ); -_LIT16( KEapPeapEncapsulatedTypes, "EapPeapEncapsulatedTypes" ); -_LIT16( KEapPeapUserCertSubjectKeyId,"EapPeapUserCertSubjectKeyId" ); -_LIT16( KEapPeapUserCertIssuerName, "EapPeapUserCertIssuerName" ); -_LIT16( KEapPeapUserCertSerialNumber,"EapPeapUserCertSerialNumber" ); -_LIT16( KEapPeapCaCertSubjectKeyId, "EapPeapCaCertSubjectKeyId" ); -_LIT16( KEapPeapCaCertIssuerName, "EapPeapCaCertIssuerName" ); -_LIT16( KEapPeapCaCertSerialNumber, "EapPeapCaCertSerialNumber" ); - -_LIT16( KEapMschapv2Username, "EapMschapv2Username" ); -_LIT16( KEapMschapv2Password, "EapMschapv2Password" ); -_LIT16( KEapMschapv2SessionValidityTime,"EapMschapv2SessionValidityTime" ); -_LIT16( KEapMschapv2Encapsulation, "EapMschapv2Encapsulation" ); - -_LIT16( KEapFastUsername, "EapFastUsername" ); -_LIT16( KEapFastRealm, "EapFastRealm" ); -_LIT16( KEapFastVerifyServerRealm, "EapFastVerifyServerRealm" ); -_LIT16( KEapFastRequireClientAuth, "EapFastRequireClientAuth" ); -_LIT16( KEapFastSessionValidityTime,"EapFastSessionValidityTime" ); -_LIT16( KEapFastCipherSuites, "EapFastCipherSuites" ); -_LIT16( KEapFastEncapsulatedTypes, "EapFastEncapsulatedTypes" ); -_LIT16( KEapFastAuthProvModeAllowed,"EapFastAuthProvModeAllowed" ); -_LIT16( KEapFastUnauthProvModeAllowed,"EapFastUnauthProvModeAllowed" ); -_LIT16( KEapFastWarnADHPNoPAC, "EapFastWarnADHPNoPAC" ); -_LIT16( KEapFastWarnADHPNoMatchingPAC,"EapFastWarnADHPNoMatchingPAC" ); -_LIT16( KEapFastWarnNotDefaultServer,"EapFastWarnNotDefaultServer" ); -_LIT16( KEapFastUserCertSubjectKeyId,"EapFastUserCertSubjectKeyId" ); -_LIT16( KEapFastUserCertIssuerName, "EapFastUserCertIssuerName" ); -_LIT16( KEapFastUserCertSerialNumber,"EapFastUserCertSerialNumber" ); -_LIT16( KEapFastCaCertSubjectKeyId, "EapFastCaCertSubjectKeyId" ); -_LIT16( KEapFastCaCertIssuerName, "EapFastCaCertIssuerName" ); -_LIT16( KEapFastCaCertSerialNumber, "EapFastCaCertSerialNumber" ); - -_LIT16( KMschapv2Username, "Mschapv2Username" ); -_LIT16( KMschapv2Password, "Mschapv2Password" ); -_LIT16( KMschapv2SessionValidityTime,"Mschapv2SessionValidityTime" ); -_LIT16( KMschapv2Encapsulation, "Mschapv2Encapsulation" ); - - -//VPN specific -_LIT16( KVpnIapName, "IAP_Name" ); -_LIT16( KVpnServicePolicy, "Policy_ID" ); - -//DN specific -_LIT16( KDN_Name, "Name" ); -_LIT16( KDN_Id, "DNId" ); -_LIT16( KDN_Icon, "Icon" ); -_LIT16( KDN_Metadata, "Metadata" ); -_LIT16( KDN_Protection, "Protection" ); -_LIT16( KDN_EmbeddedDNName, "EmbeddedDN" ); -_LIT16( KDN_IAPName, "IAP" ); - -// Needed because of Customization Tool limitations -_LIT16( KDN_IAPName2, "IAP2" ); -_LIT16( KDN_IAPName3, "IAP3" ); -_LIT16( KDN_IAPName4, "IAP4" ); -_LIT16( KDN_IAPName5, "IAP5" ); -_LIT16( KDN_IAPName6, "IAP6" ); -_LIT16( KDN_IAPName7, "IAP7" ); -_LIT16( KDN_IAPName8, "IAP8" ); -_LIT16( KDN_IAPName9, "IAP9" ); -_LIT16( KDN_IAPName10, "IAP10" ); - -//Global settings -_LIT16( KAttachMode, "Attachmode" ); -_LIT16( KDefaultAP, "DefaultAP" ); -_LIT16( KDefaultDnIcon, "DefaultDnIcon" ); -_LIT16( KPriorityLan, "PriorityLan" ); -_LIT16( KPriorityWlan, "PriorityWlan" ); -_LIT16( KPriorityPan, "PriorityPan" ); -_LIT16( KPriorityGprsOut, "PriorityGprsOut" ); -_LIT16( KPriorityGprsIn, "PriorityGprsIn" ); -_LIT16( KPriorityCdma2k, "PriorityCdma2k" ); -_LIT16( KPriorityDialOut, "PriorityDialOut" ); -_LIT16( KPriorityDialIn, "PriorityDialIn" ); -_LIT16( KPriorityVpn, "PriorityVpn" ); -_LIT16( KPriorityMip, "PriorityMip" ); -_LIT16( KUIPriorityLan, "UIPriorityLan" ); -_LIT16( KUIPriorityWlan, "UIPriorityWlan" ); -_LIT16( KUIPriorityPan, "UIPriorityPan" ); -_LIT16( KUIPriorityGprsOut, "UIPriorityGprsOut" ); -_LIT16( KUIPriorityGprsIn, "UIPriorityGprsIn" ); -_LIT16( KUIPriorityCdma2k, "UIPriorityCdma2k" ); -_LIT16( KUIPriorityDialOut, "UIPriorityDialOut" ); -_LIT16( KUIPriorityDialIn, "UIPriorityDialIn" ); -_LIT16( KUIPriorityVpn, "UIPriorityVpn" ); -_LIT16( KUIPriorityMip, "UIPriorityMip" ); -_LIT16( KUsageOfWlan, "UsageOfWlan" ); -_LIT16( KCellularDataUsageHome, "CellularDataUsageHome" ); -_LIT16( KCellularDataUsageVisitor, "CellularDataUsageVisitor" ); -_LIT16( KGprsLastSocketActivityTimeout, "GprsLastSocketActivityTimeout" ); -_LIT16( KGprsLastSessionClosedTimeout, "GprsLastSessionClosedTimeout" ); -_LIT16( KGprsLastSocketClosedTimeout, "GprsLastSocketClosedTimeout" ); -_LIT16( KWlanLastSocketActivityTimeout, "WlanLastSocketActivityTimeout" ); -_LIT16( KWlanLastSessionClosedTimeout, "WlanLastSessionClosedTimeout" ); -_LIT16( KWlanLastSocketClosedTimeout, "WlanLastSocketClosedTimeout" ); -_LIT16( KWlanBGScanInterval, "WlanBGScanInterval" ); -_LIT16( KWlanUseDefSettings, "WlanUseDefSettings" ); -_LIT16( KWlanLongRetry, "WlanLongRetry" ); -_LIT16( KWlanShortRetry, "WlanShortRetry" ); -_LIT16( KWlanRTS, "WlanRTS" ); -_LIT16( KWlanTxPowerLevel, "WlanTxPowerLevel" ); -_LIT16( KWlanRadioMeasurements, "WlanRadioMeasurements" ); -_LIT16( KWlanPowerMode, "WlanPowerMode" ); - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CReaderXML::NewL -// --------------------------------------------------------- -// -CReaderXML* CReaderXML::NewLC( const TDesC& aInFileName, - const TDbCreatorInputCharSet aCharSet ) - { - CReaderXML* self = new ( ELeave ) CReaderXML( aCharSet ); - - CleanupStack::PushL( self ); - - self->CReaderBase::ConstructL( aInFileName ); - self->ConstructL(); - - return self; - } - - -// --------------------------------------------------------- -// CReaderXML::ConstructL -// --------------------------------------------------------- -// -void CReaderXML::ConstructL() - { - //if charset is not given as a parameter - detect it - if ( iCharSet == ECharSetUnknown ) - { - DetectEncodingL(); - } - - FillPacketDataParams(); - FillLanParams(); - FillWLanParams(); - FillVpnParams(); - FillGlobalParams(); - FillDNParams(); - } - - -// --------------------------------------------------------- -// CReaderXML::CReaderXML -// --------------------------------------------------------- -// -CReaderXML::CReaderXML( const TDbCreatorInputCharSet aCharSet ) : - CReaderBase( EFileXML, EFeatureNone ), - iCharSet( aCharSet ), - iLine ( NULL ), - iFoundGlobal( EFalse ) - { - //no implementation required - } - - -// --------------------------------------------------------- -// CReaderXML::~CReaderXML -// --------------------------------------------------------- -// -CReaderXML::~CReaderXML() - { - delete iLine; - - iPDParams.Close(); - iLanParams.Close(); - iWLanParams.Close(); - iVpnParams.Close(); - iGlobalParams.Close(); - iDNParams.Close(); - } - - -// --------------------------------------------------------- -// CReaderXML::LocateFeature -// --------------------------------------------------------- -// -void CReaderXML::LocateFeatureL() - { - iCurrentFeature = EFeatureNone; - TInt result( KErrNone ); - TBool eof( EFalse ); - - //looks for the next feature - while ( !eof && CurrentFeature() == EFeatureNone ) - { - //reads the next line - result = ReadLineL(); - - if ( result == KErrEof ) - { - //end of file - eof = ETrue; - } - else if ( result ) - { - //other error - User::Leave( result ); - } - else - { - //no error - if ( iLine->FindF( KFileTail ) == KErrNone || - iLine->FindF( KFileTail2 ) == KErrNone ) - { - //end of file is reached ("/variantvariant" found) - eof = ETrue; - } - else - { - //try to recognize a feature - iCurrentFeature = DetectFeatureHead(); - }//else - }//else - }//while - } - - -// --------------------------------------------------------- -// CReaderXML::LocateAP -// --------------------------------------------------------- -// -TBool CReaderXML::LocateAPL() - { - TBool found( EFalse ); //found feature data - TBool eofea( EFalse ); //end of feature - - if ( CurrentFeature() == EFeatureGlobal ) - { - //for Global settings there is no feature data header - found = iFoundGlobal; - iFoundGlobal = EFalse; - } - else - { - //looks for the next feature header - while ( !eofea && !found ) - { - User::LeaveIfError( ReadLineL() ); - - if ( DetectFeatureTail() ) - { - //feature tail is detected - no more data to process - eofea = ETrue; - } - else - { - //looks for feature data header - switch ( CurrentFeature() ) - { - case EFeaturePacketData: - found = ( iLine->FindF( KDataHeadPacketData ) != KErrNotFound ); - break; - case EFeatureWLAN: - found = ( iLine->FindF( KDataHeadWLAN ) != KErrNotFound ); - break; - case EFeatureLAN: - found = ( iLine->FindF( KDataHeadLAN ) != KErrNotFound ); - break; - case EFeatureVPN: - found = ( iLine->FindF( KDataHeadVPN ) != KErrNotFound ); - break; - case EFeatureDN: - found = ( iLine->FindF( KDataHeadDN ) != KErrNotFound ); - break; - }//switch - }//else - }//while - }//else - - return found; - - } - - -// --------------------------------------------------------- -// CReaderXML::ParseAPL -// --------------------------------------------------------- -// -void CReaderXML::ParseAPL() - { - do - { - User::LeaveIfError( ReadLineL() ); - TInt fieldId = DetectParam(); - - if ( fieldId != KErrNotFound ) - { - HBufC16* param = ReadParam( EParamValue ); - if ( param ) - { - ConvertSpecialXMLChars( param ); - CleanupStack::PushL( param ); - TagContainer().AddL( param , fieldId ); - CleanupStack::Pop( param ); - } - else - { - //simply skip line - } - } - - } - while ( !DetectTailAP() ); - } - -// --------------------------------------------------------- -// CReaderXML::Reset -// --------------------------------------------------------- -// -TInt CReaderXML::Reset() - { - iFilePos = 0; - return InputFile().Seek( ESeekStart, iFilePos ); - } - - -// --------------------------------------------------------- -// CReaderXML::ToDoLog -// --------------------------------------------------------- -// -void CReaderXML::ToDoLog() - { - CLOG_WRITE( "Line :" ) - FileLogger().Write( *iLine ); - CLOG_WRITE( "--------------------------------------------\n\n" ) - } - -// --------------------------------------------------------- -// Private methods -// --------------------------------------------------------- - -// --------------------------------------------------------- -// CReaderXML::ReadLine -// --------------------------------------------------------- -// -TInt CReaderXML::ReadLineL() - { - //go to the actual position - TInt result = InputFile().Seek(ESeekStart, iFilePos); - - //temporary buffer for line - TBuf8 buf; - - if (result == KErrNone) - { - result = InputFile().Read(buf, buf.MaxSize()); - } - - //if seeking and reading both succesful extract one line form the buffer - if (result == KErrNone) - { - TPtrC8 ptrBuf8; - ptrBuf8.Set( buf ); - - if (result == KErrNone || result == KErrEof) - { - switch ( iCharSet ) - { - case ECharSetUnicode: - { - //simply copy to a Unicode descriptor - TPtrC16 ptrBuf16( ( TText16* )ptrBuf8.Ptr(), \ - ptrBuf8.Length() / KAsciiUnicodeRatio ); - - TPtrC16 ptrLine; - result = ExtractLine(ptrBuf16, ptrLine); - - if ( result == KErrNone ) - { - delete iLine; - iLine = NULL; - iLine = ptrLine.AllocL(); - - //Increment the file position - iFilePos += iLine->Length() * KAsciiUnicodeRatio; - } - - break; - } - case ECharSetAscii: - case ECharSetUtf8: - default: - { - //conversion to Unicode is needed - HBufC16* hBuf16 = HBufC16::NewLC( KMaxLineSize ); - TPtr16 ptrBuf16( hBuf16->Des() ); - - if( iCharSet == ECharSetUtf8 ) - { - CnvUtfConverter::ConvertToUnicodeFromUtf8 - ( ptrBuf16, ptrBuf8 ); - } - else - { - ptrBuf16.Copy( ptrBuf8 ); - } - - TPtrC16 ptrLine; - result = ExtractLine(ptrBuf16, ptrLine); - - if ( result == KErrNone ) - { - delete iLine; - iLine = NULL; - iLine = ptrLine.AllocL(); - - // Increment the file position - // Line in unicode format converted back to UTF-8 - // for getting the right lenght and osition in file - CnvUtfConverter::ConvertFromUnicodeToUtf8( - buf, iLine->Des() ); - iFilePos += buf.Length(); - } - - CleanupStack::PopAndDestroy( hBuf16 ); - - break; - }//case - }//switch - }//if - }//if - - return result; - } - - -// --------------------------------------------------------- -// CReaderXML::ExtractLine -// --------------------------------------------------------- -// -TInt CReaderXML::ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine) - { - // Whitespace characters - const TChar KSpace = ' '; - const TChar KNewLine = '\n'; - const TChar KCarriageReturn = '\r'; - const TChar KTab = '\t'; - const TChar KTagStart = '<'; - - - // A line is considered to contain one parameter. It starts from the - // current position and lasts until the end of the current parameter. - // The end is detected by looking for the characters ">" and "<" with - // any number of white spaces between them. The next line will start at - // the "<" character. - TBool lineEndFound( EFalse ); - TBool tagEndFound( EFalse ); - TInt pos( 0 ); - while( !lineEndFound && pos < aBuffer.Length() ) - { - if( !tagEndFound && KParamNameTail.iBuf[ 0 ] == aBuffer[ pos ] ) - { - tagEndFound = ETrue; - } - else if( tagEndFound && KParamNameHead.iBuf[ 0 ] == aBuffer[ pos ] ) - { - lineEndFound = ETrue; - break; - } - - else if( ( KSpace != aBuffer[ pos ] ) && - ( KNewLine != aBuffer[ pos ] ) && - ( KCarriageReturn != aBuffer[ pos ] ) && - ( KTab != aBuffer[ pos ] ) && - tagEndFound ) - { - tagEndFound = EFalse; - } - ++pos; - } - - if( !lineEndFound ) - { - //End of line not found--malformed xml file or no more data - //get highest file position; and check EoF - TInt hiPos = 0; - - if (InputFile().Size(hiPos) != KErrNone) - { - return KErrGeneral; - } - - //check for end of file - if ( aBuffer.Length() < KMaxLineSize ) - { - aLine.Set( aBuffer ); - return KErrEof; - } - else - { - return KErrNotFound; - } - } - - aLine.Set( aBuffer.Left( pos ) ); - - return KErrNone ; - } - -// --------------------------------------------------------- -// CReaderXML::DetectFeatureHead -// --------------------------------------------------------- -// -TDbCreatorFeatures CReaderXML::DetectFeatureHead() - { - TDbCreatorFeatures feature( EFeatureNone ); - - if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeaturePacketData" ); - feature = EFeaturePacketData; - } - else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureWLAN" ); - feature = EFeatureWLAN; - } - else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureLAN" ); - feature = EFeatureLAN; - } - else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureVPN" ); - feature = EFeatureVPN; - } - else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureDN" ); - feature = EFeatureDN; - } - else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound ) - { - CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureGlobal" ); - feature = EFeatureGlobal; - iFoundGlobal = ETrue; - } - else - { - //feature not found - } - - return feature; - - } - - -// --------------------------------------------------------- -// CReaderXML::DetectFeatureTail -// --------------------------------------------------------- -// -TBool CReaderXML::DetectFeatureTail() - { - TBool found( EFalse ); - - switch ( CurrentFeature() ) - { - case EFeaturePacketData: - found = ( iLine->FindF( KFeatureTailPacketData ) != KErrNotFound ); - break; - case EFeatureWLAN: - found = ( iLine->FindF( KFeatureTailWLAN ) != KErrNotFound ); - break; - case EFeatureLAN: - found = ( iLine->FindF( KFeatureTailLAN ) != KErrNotFound ); - break; - case EFeatureVPN: - found = ( iLine->FindF( KFeatureTailVPN ) != KErrNotFound ); - break; - case EFeatureDN: - found = ( iLine->FindF( KFeatureTailDN ) != KErrNotFound ); - break; - case EFeatureGlobal: - found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound ); - break; - } - - return found; - } - - -// --------------------------------------------------------- -// CReaderXML::DetectTailAP -// --------------------------------------------------------- -// -TBool CReaderXML::DetectTailAP() - { - TBool found( EFalse ); - - switch ( CurrentFeature() ) - { - case EFeaturePacketData: - found = ( iLine->FindF( KDataTailPacketData ) != KErrNotFound ); - break; - case EFeatureWLAN: - found = ( iLine->FindF( KDataTailWLAN ) != KErrNotFound ); - break; - case EFeatureLAN: - found = ( iLine->FindF( KDataTailLAN ) != KErrNotFound ); - break; - case EFeatureVPN: - found = ( iLine->FindF( KDataTailVPN ) != KErrNotFound ); - break; - case EFeatureDN: - found = ( iLine->FindF( KDataTailDN ) != KErrNotFound ); - break; - case EFeatureGlobal: - //there is no data tail for Global settings -- looks for feature tail - found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound ); - break; - } - - return found; - } - - -// --------------------------------------------------------- -// CReaderXML::DetectParamL -// --------------------------------------------------------- -// -TInt CReaderXML::DetectParam() - { - TInt fieldId( KErrNotFound ); //field id of detected parameter - RArray *params( NULL ); //pointer to the table used - //for or detection - - switch ( CurrentFeature() ) - { - case EFeaturePacketData: - params = &iPDParams; - break; - case EFeatureWLAN: - params = &iWLanParams; - break; - case EFeatureLAN: - params = &iLanParams; - break; - case EFeatureVPN: - params = &iVpnParams; - break; - case EFeatureDN: - params = &iDNParams; - break; - case EFeatureGlobal: - params = &iGlobalParams; - break; - default: - User::Panic( KPanicInvalidCase, KErrInvalidCase ); - } - - //looks for parameter match - HBufC16* paramName = ReadParam( EParamName ); - if ( paramName == NULL ) - { - return fieldId; - } - - TBool found ( EFalse ); - for ( TInt idx = 0; idx < params->Count() && !found; idx++ ) - { - if ( paramName->CompareF( (*params)[idx].iParam ) == 0 ) - { - fieldId = (*params)[idx].iId; - found = ETrue; - } - } - - delete paramName; - return fieldId; - } - - -// --------------------------------------------------------- -// CReaderXML::ReadParam -// --------------------------------------------------------- -// -HBufC16* CReaderXML::ReadParam( TParamSegment aSegment ) - { - TBuf tag; //local buffer - TInt posh( 0 ); //header position - TInt post( 0 ); //tail position - HBufC16* ret = NULL; // returned pointer - - // calculation of the position - // - // EParamValue: posh| post| - // | | - // EParamName: posh| post|| | - // ¡ ¡¡ ¡ - // ParamValue - - switch ( aSegment ) - { - case EParamValue: - posh = iLine->Find( KParamValueHead ) + 1; - post = iLine->Find( KParamValueTail ); - break; - case EParamName: - posh = iLine->Find( KParamNameHead ) + 1; - post = iLine->Find( KParamNameTail ); - break; - default: - break; - } - - if ( posh == KErrNotFound || post == KErrNotFound || post == 0 ) - { - //line must contain header and tail and longer than 0 - ret = NULL; - } - else - { - // Copis the value to the local buffer and allocates buffer - tag.Copy( iLine->Mid( posh, post - posh ) ); - ret = tag.Alloc(); - // Checks the result. - if( ret == NULL ) - { - CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:", - &tag ); - } -// Debugging help; commented out for clearer log. -// else -// { -// if (aSegment == EParamValue) -// { -// CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: value %S", &tag ); -// } -// else if (aSegment == EParamName) -// { -// CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: name %S", &tag ); -// } -// } - } - return ret; - } - - -// --------------------------------------------------------- -// CReaderXML::DetectEncoding -// --------------------------------------------------------- -// -void CReaderXML::DetectEncodingL() - { - TInt originalPos( iFilePos ); //stores original file position - TBool found( EFalse ); - - for ( TInt i = ECharSetUnicode; i >= ECharSetAscii && !found; i--) - { - //assumes that the first line contains version and encoding info - iFilePos = 0; - iCharSet = static_cast( i ); - - if ( ReadLineL() == KErrNone ) - { - if( iCharSet == ECharSetAscii ) - { - if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) || - ( iLine->FindF( KEncoding ) != KErrNotFound ) ) - { - if( iLine->FindF( KEncodingUtf8 ) != KErrNotFound ) - { - iCharSet = ECharSetUtf8; - } - found = ETrue; - } - } - else if( iCharSet == ECharSetUnicode ) - { - if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) || - ( iLine->FindF( KEncoding ) != KErrNotFound ) ) - { - found = ETrue; - } - } - } - } - iFilePos = originalPos; - } - -// --------------------------------------------------------- -// CReaderXML::ConvertSpecialXMLChars -// --------------------------------------------------------- -// -void CReaderXML::ConvertSpecialXMLChars( HBufC* aPtrTag ) - { - if ( aPtrTag == NULL ) - { - return; - } - _LIT16( escapeStart, "&" ); - - //check if there are parameters to be replaced, if not: return - if ( aPtrTag->Des().Find( escapeStart ) == KErrNotFound ) - { - return; - } - - _LIT16( spXML1, "<" ); - _LIT16( sp1, "<" ); - ReplaceInString( aPtrTag, spXML1, sp1 ); - _LIT16( spXML2, "&" ); - _LIT16( sp2, "&" ); - ReplaceInString( aPtrTag, spXML2, sp2 ); - _LIT16( spXML3, ">" ); - _LIT16( sp3, ">" ); - ReplaceInString( aPtrTag, spXML3, sp3 ); - _LIT16( spXML4, """ ); - _LIT16( sp4, "\"" ); - ReplaceInString( aPtrTag, spXML4, sp4 ); - _LIT16( spXML5, "'" ); - _LIT16( sp5, "\'" ); - ReplaceInString( aPtrTag, spXML5, sp5 ); - _LIT16( spXML6, "¡" ); - _LIT16( sp6, "¡" ); - ReplaceInString( aPtrTag, spXML6, sp6 ); - _LIT16( spXML7, "¢" ); - _LIT16( sp7, "¢" ); - ReplaceInString( aPtrTag, spXML7, sp7 ); - _LIT16( spXML8, "£" ); - _LIT16( sp8, "£" ); - ReplaceInString( aPtrTag, spXML8, sp8 ); - _LIT16( spXML9, "¤" ); - _LIT16( sp9, "¤" ); - ReplaceInString( aPtrTag, spXML9, sp9 ); - _LIT16( spXML10, "¥" ); - _LIT16( sp10, "¥" ); - ReplaceInString( aPtrTag, spXML10, sp10 ); - _LIT16( spXML11, "¦" ); - _LIT16( sp11, "¦" ); - ReplaceInString( aPtrTag, spXML11, sp11 ); - _LIT16( spXML12, "§" ); - _LIT16( sp12, "§" ); - ReplaceInString( aPtrTag, spXML12, sp12 ); - _LIT16( spXML13, "¨" ); - _LIT16( sp13, "¨" ); - ReplaceInString( aPtrTag, spXML13, sp13 ); - _LIT16( spXML14, "©" ); - _LIT16( sp14, "©" ); - ReplaceInString( aPtrTag, spXML14, sp14 ); - _LIT16( spXML15, "ª" ); - _LIT16( sp15, "ª" ); - ReplaceInString( aPtrTag, spXML15, sp15 ); - _LIT16( spXML16, "«" ); - _LIT16( sp16, "«" ); - ReplaceInString( aPtrTag, spXML16, sp16 ); - _LIT16( spXML17, "¬" ); - _LIT16( sp17, "¬" ); - ReplaceInString( aPtrTag, spXML17, sp17 ); - _LIT16( spXML18, "®" ); - _LIT16( sp18, "®" ); - ReplaceInString( aPtrTag, spXML18, sp18 ); - _LIT16( spXML19, "¯" ); - _LIT16( sp19, "¯" ); - ReplaceInString( aPtrTag, spXML19, sp19 ); - _LIT16( spXML20, "°" ); - _LIT16( sp20, "°" ); - ReplaceInString( aPtrTag, spXML20, sp20 ); - _LIT16( spXML21, "±" ); - _LIT16( sp21, "±" ); - ReplaceInString( aPtrTag, spXML21, sp21 ); - _LIT16( spXML22, "²" ); - _LIT16( sp22, "²" ); - ReplaceInString( aPtrTag, spXML22, sp22 ); - _LIT16( spXML23, "³" ); - _LIT16( sp23, "³" ); - ReplaceInString( aPtrTag, spXML23, sp23 ); - _LIT16( spXML24, "´" ); - _LIT16( sp24, "´" ); - ReplaceInString( aPtrTag, spXML24, sp24 ); - _LIT16( spXML25, "µ" ); - _LIT16( sp25, "µ" ); - ReplaceInString( aPtrTag, spXML25, sp25 ); - _LIT16( spXML26, "¶" ); - _LIT16( sp26, "¶" ); - ReplaceInString( aPtrTag, spXML26, sp26 ); - _LIT16( spXML27, "·" ); - _LIT16( sp27, "·" ); - ReplaceInString( aPtrTag, spXML27, sp27 ); - _LIT16( spXML28, "¸" ); - _LIT16( sp28, "¸" ); - ReplaceInString( aPtrTag, spXML28, sp28 ); - _LIT16( spXML29, "¹" ); - _LIT16( sp29, "¹" ); - ReplaceInString( aPtrTag, spXML29, sp29 ); - _LIT16( spXML30, "º" ); - _LIT16( sp30, "º" ); - ReplaceInString( aPtrTag, spXML30, sp30 ); - _LIT16( spXML31, "»" ); - _LIT16( sp31, "»" ); - ReplaceInString( aPtrTag, spXML31, sp31 ); - _LIT16( spXML32, "¼" ); - _LIT16( sp32, "¼" ); - ReplaceInString( aPtrTag, spXML32, sp32 ); - _LIT16( spXML33, "½" ); - _LIT16( sp33, "½" ); - ReplaceInString( aPtrTag, spXML33, sp33 ); - _LIT16( spXML34, "¾" ); - _LIT16( sp34, "¾" ); - ReplaceInString( aPtrTag, spXML34, sp34 ); - _LIT16( spXML35, "¿" ); - _LIT16( sp35, "¿" ); - ReplaceInString( aPtrTag, spXML35, sp35 ); - _LIT16( spXML36, "À" ); - _LIT16( sp36, "À" ); - ReplaceInString( aPtrTag, spXML36, sp36 ); - _LIT16( spXML37, "Á" ); - _LIT16( sp37, "Á" ); - ReplaceInString( aPtrTag, spXML37, sp37 ); - _LIT16( spXML38, "Â" ); - _LIT16( sp38, "Â" ); - ReplaceInString( aPtrTag, spXML38, sp38 ); - _LIT16( spXML39, "Ã" ); - _LIT16( sp39, "Ã" ); - ReplaceInString( aPtrTag, spXML39, sp39 ); - _LIT16( spXML40, "Ä" ); - _LIT16( sp40, "Ä" ); - ReplaceInString( aPtrTag, spXML40, sp40 ); - _LIT16( spXML41, "Å" ); - _LIT16( sp41, "Å" ); - ReplaceInString( aPtrTag, spXML41, sp41 ); - _LIT16( spXML42, "Æ" ); - _LIT16( sp42, "Æ" ); - ReplaceInString( aPtrTag, spXML42, sp42 ); - _LIT16( spXML43, "Ç" ); - _LIT16( sp43, "Ç" ); - ReplaceInString( aPtrTag, spXML43, sp43 ); - _LIT16( spXML44, "È" ); - _LIT16( sp44, "È" ); - ReplaceInString( aPtrTag, spXML44, sp44 ); - _LIT16( spXML45, "É" ); - _LIT16( sp45, "É" ); - ReplaceInString( aPtrTag, spXML45, sp45 ); - _LIT16( spXML46, "Ê" ); - _LIT16( sp46, "Ê" ); - ReplaceInString( aPtrTag, spXML46, sp46 ); - _LIT16( spXML47, "Ë" ); - _LIT16( sp47, "Ë" ); - ReplaceInString( aPtrTag, spXML47, sp47 ); - _LIT16( spXML48, "Ì" ); - _LIT16( sp48, "Ì" ); - ReplaceInString( aPtrTag, spXML48, sp48 ); - _LIT16( spXML49, "Í" ); - _LIT16( sp49, "Í" ); - ReplaceInString( aPtrTag, spXML49, sp49 ); - _LIT16( spXML50, "Î" ); - _LIT16( sp50, "Î" ); - ReplaceInString( aPtrTag, spXML50, sp50 ); - _LIT16( spXML51, "Ï" ); - _LIT16( sp51, "Ï" ); - ReplaceInString( aPtrTag, spXML51, sp51 ); - _LIT16( spXML52, "Ð" ); - _LIT16( sp52, "Ð" ); - ReplaceInString( aPtrTag, spXML52, sp52 ); - _LIT16( spXML53, "Ñ" ); - _LIT16( sp53, "Ñ" ); - ReplaceInString( aPtrTag, spXML53, sp53 ); - _LIT16( spXML54, "Ò" ); - _LIT16( sp54, "Ò" ); - ReplaceInString( aPtrTag, spXML54, sp54 ); - _LIT16( spXML55, "Ó" ); - _LIT16( sp55, "Ó" ); - ReplaceInString( aPtrTag, spXML55, sp55 ); - _LIT16( spXML56, "Ô" ); - _LIT16( sp56, "Ô" ); - ReplaceInString( aPtrTag, spXML56, sp56 ); - _LIT16( spXML57, "Õ" ); - _LIT16( sp57, "Õ" ); - ReplaceInString( aPtrTag, spXML57, sp57 ); - _LIT16( spXML58, "Ö" ); - _LIT16( sp58, "Ö" ); - ReplaceInString( aPtrTag, spXML58, sp58 ); - _LIT16( spXML59, "×" ); - _LIT16( sp59, "×" ); - ReplaceInString( aPtrTag, spXML59, sp59 ); - _LIT16( spXML60, "Ø" ); - _LIT16( sp60, "Ø" ); - ReplaceInString( aPtrTag, spXML60, sp60 ); - _LIT16( spXML61, "Ù" ); - _LIT16( sp61, "Ù" ); - ReplaceInString( aPtrTag, spXML61, sp61 ); - _LIT16( spXML62, "Ú" ); - _LIT16( sp62, "Ú" ); - ReplaceInString( aPtrTag, spXML62, sp62 ); - _LIT16( spXML63, "Û" ); - _LIT16( sp63, "Û" ); - ReplaceInString( aPtrTag, spXML63, sp63 ); - _LIT16( spXML64, "Ü" ); - _LIT16( sp64, "Ü" ); - ReplaceInString( aPtrTag, spXML64, sp64 ); - _LIT16( spXML65, "Ý" ); - _LIT16( sp65, "Ý" ); - ReplaceInString( aPtrTag, spXML65, sp65 ); - _LIT16( spXML66, "Þ" ); - _LIT16( sp66, "Þ" ); - ReplaceInString( aPtrTag, spXML66, sp66 ); - _LIT16( spXML67, "ß" ); - _LIT16( sp67, "ß" ); - ReplaceInString( aPtrTag, spXML67, sp67 ); - _LIT16( spXML68, "à" ); - _LIT16( sp68, "à" ); - ReplaceInString( aPtrTag, spXML68, sp68 ); - _LIT16( spXML69, "á" ); - _LIT16( sp69, "á" ); - ReplaceInString( aPtrTag, spXML69, sp69 ); - _LIT16( spXML70, "â" ); - _LIT16( sp70, "â" ); - ReplaceInString( aPtrTag, spXML70, sp70 ); - _LIT16( spXML71, "ã" ); - _LIT16( sp71, "ã" ); - ReplaceInString( aPtrTag, spXML71, sp71 ); - _LIT16( spXML72, "ä"); - _LIT16( sp72, "ä" ); - ReplaceInString( aPtrTag, spXML72, sp72 ); - _LIT16( spXML73, "å" ); - _LIT16( sp73, "å" ); - ReplaceInString( aPtrTag, spXML73, sp73 ); - _LIT16( spXML74, "æ" ); - _LIT16( sp74, "æ" ); - ReplaceInString( aPtrTag, spXML74, sp74 ); - _LIT16( spXML75, "&acedil;" ); - _LIT16( sp75, "ç" ); - ReplaceInString( aPtrTag, spXML75, sp75 ); - _LIT16( spXML76, "è" ); - _LIT16( sp76, "è" ); - ReplaceInString( aPtrTag, spXML76, sp76 ); - _LIT16( spXML77, "é" ); - _LIT16( sp77, "é" ); - ReplaceInString( aPtrTag, spXML77, sp77 ); - _LIT16( spXML78, "ê" ); - _LIT16( sp78, "ê" ); - ReplaceInString( aPtrTag, spXML78, sp78 ); - _LIT16( spXML79, "ë" ); - _LIT16( sp79, "ë" ); - ReplaceInString( aPtrTag, spXML79, sp79 ); - _LIT16( spXML80, "ì" ); - _LIT16( sp80, "ì" ); - ReplaceInString( aPtrTag, spXML80, sp80 ); - _LIT16( spXML81, "í" ); - _LIT16( sp81, "í" ); - ReplaceInString( aPtrTag, spXML81, sp81 ); - _LIT16( spXML82, "î" ); - _LIT16( sp82, "î" ); - ReplaceInString( aPtrTag, spXML82, sp82 ); - _LIT16( spXML83, "ï" ); - _LIT16( sp83, "ï" ); - ReplaceInString( aPtrTag, spXML83, sp83 ); - _LIT16( spXML84, "ð" ); - _LIT16( sp84, "ð" ); - ReplaceInString( aPtrTag, spXML84, sp84 ); - _LIT16( spXML85, "ñ" ); - _LIT16( sp85, "ñ" ); - ReplaceInString( aPtrTag, spXML85, sp85 ); - _LIT16( spXML86, "ò" ); - _LIT16( sp86, "ò" ); - ReplaceInString( aPtrTag, spXML86, sp86 ); - _LIT16( spXML87, "ó" ); - _LIT16( sp87, "ó" ); - ReplaceInString( aPtrTag, spXML87, sp87 ); - _LIT16( spXML88, "ô" ); - _LIT16( sp88, "ô" ); - ReplaceInString( aPtrTag, spXML88, sp88 ); - _LIT16( spXML89, "õ" ); - _LIT16( sp89, "õ" ); - ReplaceInString( aPtrTag, spXML89, sp89 ); - _LIT16( spXML90, "ö" ); - _LIT16( sp90, "ö" ); - ReplaceInString( aPtrTag, spXML90, sp90 ); - _LIT16( spXML91, "÷" ); - _LIT16( sp91, "÷" ); - ReplaceInString( aPtrTag, spXML91, sp91 ); - _LIT16( spXML92, "ø" ); - _LIT16( sp92, "ø" ); - ReplaceInString( aPtrTag, spXML92, sp92 ); - _LIT16( spXML93, "ù" ); - _LIT16( sp93, "ù" ); - ReplaceInString( aPtrTag, spXML93, sp93 ); - _LIT16( spXML94, "ú" ); - _LIT16( sp94, "ú" ); - ReplaceInString( aPtrTag, spXML94, sp94 ); - _LIT16( spXML95, "û" ); - _LIT16( sp95, "û" ); - ReplaceInString( aPtrTag, spXML95, sp95 ); - _LIT16( spXML96, "ü" ); - _LIT16( sp96, "ü" ); - ReplaceInString( aPtrTag, spXML96, sp96 ); - _LIT16( spXML97, "ý" ); - _LIT16( sp97, "ý" ); - ReplaceInString( aPtrTag, spXML97, sp97 ); - _LIT16( spXML98, "þ" ); - _LIT16( sp98, "þ" ); - ReplaceInString( aPtrTag, spXML98, sp98 ); - _LIT16( spXML99, "ÿ" ); - _LIT16( sp99, "ÿ" ); - ReplaceInString( aPtrTag, spXML99, sp99 ); - _LIT16( spXML100, "Œ" ); - _LIT16( sp100, "Œ" ); - ReplaceInString( aPtrTag, spXML100, sp100 ); - _LIT16( spXML101, "œ" ); - _LIT16( sp101, "œ" ); - ReplaceInString( aPtrTag, spXML101, sp101 ); - _LIT16( spXML102, "Š" ); - _LIT16( sp102, "Š" ); - ReplaceInString( aPtrTag, spXML102, sp102 ); - _LIT16( spXML103, "š" ); - _LIT16( sp103, "š" ); - ReplaceInString( aPtrTag, spXML103, sp103 ); - _LIT16( spXML104, "Ÿ" ); - _LIT16( sp104, "Ÿ" ); - ReplaceInString( aPtrTag, spXML104, sp104 ); - _LIT16( spXML105, "ƒ" ); - _LIT16( sp105, "ƒ" ); - ReplaceInString( aPtrTag, spXML105, sp105 ); - _LIT16( spXML106, "ˆ" ); - _LIT16( sp106, "ˆ" ); - ReplaceInString( aPtrTag, spXML106, sp106 ); - _LIT16( spXML107, "˜" ); - _LIT16( sp107, "˜" ); - ReplaceInString( aPtrTag, spXML107, sp107 ); - } - -// --------------------------------------------------------- -// CReaderXML::Replace -// --------------------------------------------------------- -// -void CReaderXML::ReplaceInString( HBufC* aPtrTag, - const TDesC& aSpXML, - const TDesC& aSp ) - { - if( aPtrTag == NULL ) - { - return; - } - TInt strPos = aPtrTag->Des().Find(aSpXML); - while ( strPos != KErrNotFound ) - { - aPtrTag->Des().Replace(strPos, aSpXML.Length() , aSp); - strPos = aPtrTag->Des().Find(aSpXML); - } - } - -//maximum number of VPN AP parameters - - -void CReaderXML::FillPacketDataParams() - { - iPDParams.Append( EInputParams( ECmName, KConnectionName ) ); - iPDParams.Append( EInputParams( ECmId, KConnectionId ) ); - iPDParams.Append( EInputParams( ECmProtected, KProtected ) ); - iPDParams.Append( EInputParams( ECmHidden, KHidden ) ); - iPDParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); - iPDParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); - iPDParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); - iPDParams.Append( EInputParams( EPacketDataAPName, KGprs_AP_Name ) ); - iPDParams.Append( EInputParams( EPacketDataIFAuthName, KUserName ) ); - iPDParams.Append( EInputParams( EPacketDataIFPromptForAuth, KPromptPassword ) ); - iPDParams.Append( EInputParams( EPacketDataIFAuthPass, KPassword ) ); - iPDParams.Append( EInputParams( EPacketDataDisablePlainTextAuth, KPasswordAuthType ) ); - iPDParams.Append( EInputParams( ECmWapIPGatewayAddress, KWAPGatewayIP ) ); - iPDParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); - iPDParams.Append( EInputParams( ECmWapIPSecurity, KWTLS_Security ) ); - iPDParams.Append( EInputParams( ECmWapIPWSPOption, KWAP_ConnectionType ) ); - iPDParams.Append( EInputParams( EPacketDataIPAddr, KPhoneIP ) ); - iPDParams.Append( EInputParams( EPacketDataIPNameServer1, KPrimaryNameServer ) ); - iPDParams.Append( EInputParams( EPacketDataIPNameServer2, KSecondaryNameServer ) ); - iPDParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); - iPDParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); - iPDParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); - iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer1, KPrimaryIP6NameServer ) ); - iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer2, KSecondaryIP6NameServer ) ); - iPDParams.Append( EInputParams( EPacketDataApType, KIspType ) ); - iPDParams.Append( EInputParams( EPacketDataPDPType, KNetworkType ) ); - iPDParams.Append( EInputParams( EPacketDataUseEdge, KGprsUseEdge ) ); - iPDParams.Append( EInputParams( EPacketDataLinger, KLinger ) ); - }; - -void CReaderXML::FillLanParams() - { - iLanParams.Append( EInputParams( ECmName, KConnectionName ) ); - iLanParams.Append( EInputParams( ECmId, KConnectionId ) ); - iLanParams.Append( EInputParams( ECmProtected, KProtected ) ); - iLanParams.Append( EInputParams( ECmHidden, KHidden ) ); - iLanParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); - iLanParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); - iLanParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); - iLanParams.Append( EInputParams( ECmWapIPGatewayAddress, KWAPGatewayIP ) ); - iLanParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); - iLanParams.Append( EInputParams( ECmWapIPSecurity, KWTLS_Security ) ); - iLanParams.Append( EInputParams( ECmWapIPWSPOption, KWAP_ConnectionType ) ); - iLanParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); - iLanParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); - iLanParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); - iLanParams.Append( EInputParams( ELanIfNetworks, KLanIfNetworks ) ); - iLanParams.Append( EInputParams( ELanIpNetMask, KLanIpNetMask ) ); - iLanParams.Append( EInputParams( ELanIpGateway, KLanIpGateway ) ); - iLanParams.Append( EInputParams( ELanIpAddr, KPhoneIP ) ); - iLanParams.Append( EInputParams( ELanIpNameServer1, KPrimaryNameServer ) ); - iLanParams.Append( EInputParams( ELanIpNameServer2, KSecondaryNameServer ) ); - iLanParams.Append( EInputParams( ELanIp6NameServer1, KPrimaryIP6NameServer ) ); - iLanParams.Append( EInputParams( ELanIp6NameServer2, KSecondaryIP6NameServer ) ); - iLanParams.Append( EInputParams( ELanIpAddrFromServer, KLanIpAddrFromServer ) ); - iLanParams.Append( EInputParams( ELanIpDNSAddrFromServer, KLanIpDNSAddrFromServer ) ); - iLanParams.Append( EInputParams( ELanConfigDaemonManagerName, KLanConfigDaemonManagerName ) ); - iLanParams.Append( EInputParams( ELanConfigDaemonName, KLanConfigDaemonName ) ); - }; - -//Binds WLAN access point parameters to field IDs -void CReaderXML::FillWLanParams() - { - iWLanParams.Append( EInputParams( ECmName, KConnectionName ) ); - iWLanParams.Append( EInputParams( ECmId, KConnectionId ) ); - iWLanParams.Append( EInputParams( ECmProtected, KProtected ) ); - iWLanParams.Append( EInputParams( ECmHidden, KHidden ) ); - iWLanParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); - iWLanParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); - iWLanParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); - iWLanParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); - iWLanParams.Append( EInputParams( EWlanSSID, KNetworkName ) ); - iWLanParams.Append( EInputParams( EWlanConnectionMode, KNetworkMode ) ); - iWLanParams.Append( EInputParams( EWlanSecurityMode, KSecurityMode ) ); - iWLanParams.Append( EInputParams( EWlanIpNameServer1, KPrimaryNameServer ) ); - iWLanParams.Append( EInputParams( EWlanIpNameServer2, KSecondaryNameServer ) ); - iWLanParams.Append( EInputParams( EWlanIp6NameServer1, KPrimaryIP6NameServer ) ); - iWLanParams.Append( EInputParams( EWlanIp6NameServer2, KSecondaryIP6NameServer ) ); - iWLanParams.Append( EInputParams( EWlanIpGateway, KWlanIpGatewayAddress ) ); - iWLanParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); - iWLanParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); - iWLanParams.Append( EInputParams( EWlanIpNetMask, KWlanIpNetMask ) ); - iWLanParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); - iWLanParams.Append( EInputParams( EWlanIpAddr, KPhoneIP ) ); - iWLanParams.Append( EInputParams( EWlanScanSSID, KWlanScanSSId ) ); - iWLanParams.Append( EInputParams( EWlanChannelID, KWlanChannelId ) ); - iWLanParams.Append( EInputParams( EWEPKeyInUse, KWEPKeyInUse ) ); - iWLanParams.Append( EInputParams( EWEPAuthType, KWEPAuthType ) ); - iWLanParams.Append( EInputParams( EWEPKey1Length, KWEPKey1Length ) ); - iWLanParams.Append( EInputParams( EWEPKey1Format, KWEPKey1Format ) ); - iWLanParams.Append( EInputParams( EWEPKey1Data, KWEPKey1Data ) ); - iWLanParams.Append( EInputParams( EWEPKey2Length, KWEPKey2Length ) ); - iWLanParams.Append( EInputParams( EWEPKey2Format, KWEPKey2Format ) ); - iWLanParams.Append( EInputParams( EWEPKey2Data, KWEPKey2Data ) ); - iWLanParams.Append( EInputParams( EWEPKey3Length, KWEPKey3Length ) ); - iWLanParams.Append( EInputParams( EWEPKey3Format, KWEPKey3Format ) ); - iWLanParams.Append( EInputParams( EWEPKey3Data, KWEPKey3Data ) ); - iWLanParams.Append( EInputParams( EWEPKey4Length, KWEPKey4Length ) ); - iWLanParams.Append( EInputParams( EWEPKey4Format, KWEPKey4Format ) ); - iWLanParams.Append( EInputParams( EWEPKey4Data, KWEPKey4Data ) ); - iWLanParams.Append( EInputParams( EWPAPresharedKey, KWPAPresharedKey ) ); - iWLanParams.Append( EInputParams( EWPAKeyLength, KWPAKeyLength ) ); - iWLanParams.Append( EInputParams( EWPAEapMethod, KWPAEapMethod ) ); - iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey, KWPAUseOfPresharedKey ) ); - iWLanParams.Append( EInputParams( EEapGtcUsername, KEapGtcUsername ) ); - iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime, KEapGtcSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapGtcEncapsulation, KEapGtcEncapsulation ) ); - iWLanParams.Append( EInputParams( EEapTlsUsername, KEapTlsUsername ) ); - iWLanParams.Append( EInputParams( EEapTlsRealm, KEapTlsRealm ) ); - iWLanParams.Append( EInputParams( EEapTlsVerifyServerRealm, KEapTlsVerifyServerRealm ) ); - iWLanParams.Append( EInputParams( EEapTlsRequireClientAuth, KEapTlsRequireClientAuth ) ); - iWLanParams.Append( EInputParams( EEapTlsSessionValidityTime, KEapTlsSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapTlsCipherSuites, KEapTlsCipherSuites ) ); - iWLanParams.Append( EInputParams( EEapTlsUserCertSubjectKeyId, KEapTlsUserCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapTlsUserCertIssuerName, KEapTlsUserCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapTlsUserCertSerialNumber, KEapTlsUserCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapTlsCaCertSubjectKeyId, KEapTlsCaCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapTlsCaCertIssuerName, KEapTlsCaCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapTlsCaCertSerialNumber, KEapTlsCaCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapTlsEncapsulation, KEapTlsEncapsulation ) ); - iWLanParams.Append( EInputParams( EEapLeapUsername, KEapLeapUsername ) ); - iWLanParams.Append( EInputParams( EEapLeapPassword, KEapLeapPassword ) ); - iWLanParams.Append( EInputParams( EEapLeapSessionValidityTime, KEapLeapSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapSimUsername, KEapSimUsername ) ); - iWLanParams.Append( EInputParams( EEapSimRealm, KEapSimRealm ) ); - iWLanParams.Append( EInputParams( EEapSimUsePseudonyms, KEapSimUsePseudonyms ) ); - iWLanParams.Append( EInputParams( EEapSimSessionValidityTime, KEapSimSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapSimEncapsulation, KEapSimEncapsulation ) ); - iWLanParams.Append( EInputParams( EEapTtlsUsername, KEapTtlsUsername ) ); - iWLanParams.Append( EInputParams( EEapTtlsRealm, KEapTtlsRealm ) ); - iWLanParams.Append( EInputParams( EEapTtlsVerifyServerRealm, KEapTtlsVerifyServerRealm ) ); - iWLanParams.Append( EInputParams( EEapTtlsRequireClientAuth, KEapTtlsRequireClientAuth ) ); - iWLanParams.Append( EInputParams( EEapTtlsSessionValidityTime, KEapTtlsSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapTtlsCipherSuites, KEapTtlsCipherSuites ) ); - iWLanParams.Append( EInputParams( EEapTtlsEncapsulatedTypes, KEapTtlsEncapsulatedTypes ) ); - iWLanParams.Append( EInputParams( EEapTtlsUserCertSubjectKeyId, KEapTtlsUserCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapTtlsUserCertIssuerName, KEapTtlsUserCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapTtlsUserCertSerialNumber, KEapTtlsUserCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapTtlsCaCertSubjectKeyId, KEapTtlsCaCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapTtlsCaCertIssuerName, KEapTtlsCaCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapTtlsCaCertSerialNumber, KEapTtlsCaCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapAkaUsername, KEapAkaUsername ) ); - iWLanParams.Append( EInputParams( EEapAkaRealm, KEapAkaRealm ) ); - iWLanParams.Append( EInputParams( EEapAkaUsePseudonyms, KEapAkaUsePseudonyms ) ); - iWLanParams.Append( EInputParams( EEapAkaSessionValidityTime, KEapAkaSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapAkaEncapsulation, KEapAkaEncapsulation ) ); - iWLanParams.Append( EInputParams( EEapPeapUsername, KEapPeapUsername ) ); - iWLanParams.Append( EInputParams( EEapPeapRealm, KEapPeapRealm ) ); - iWLanParams.Append( EInputParams( EEapPeapVerifyServerRealm, KEapPeapVerifyServerRealm ) ); - iWLanParams.Append( EInputParams( EEapPeapRequireClientAuth, KEapPeapRequireClientAuth ) ); - iWLanParams.Append( EInputParams( EEapPeapSessionValidityTime, KEapPeapSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapPeapCipherSuites, KEapPeapCipherSuites ) ); - iWLanParams.Append( EInputParams( EEapPeapV0Allowed, KEapPeapV0Allowed ) ); - iWLanParams.Append( EInputParams( EEapPeapV1Allowed, KEapPeapV1Allowed ) ); - iWLanParams.Append( EInputParams( EEapPeapV2Allowed, KEapPeapV2Allowed ) ); - iWLanParams.Append( EInputParams( EEapPeapEncapsulatedTypes, KEapPeapEncapsulatedTypes ) ); - iWLanParams.Append( EInputParams( EEapPeapUserCertSubjectKeyId, KEapPeapUserCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapPeapUserCertIssuerName, KEapPeapUserCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapPeapUserCertSerialNumber, KEapPeapUserCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapPeapCaCertSubjectKeyId, KEapPeapCaCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapPeapCaCertIssuerName, KEapPeapCaCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapPeapCaCertSerialNumber, KEapPeapCaCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapMschapv2Username, KEapMschapv2Username ) ); - iWLanParams.Append( EInputParams( EEapMschapv2Password, KEapMschapv2Password ) ); - iWLanParams.Append( EInputParams( EEapMschapv2SessionValidityTime, KEapMschapv2SessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapMschapv2Encapsulation, KEapMschapv2Encapsulation ) ); - iWLanParams.Append( EInputParams( EEapFastUsername, KEapFastUsername ) ); - iWLanParams.Append( EInputParams( EEapFastRealm, KEapFastRealm ) ); - iWLanParams.Append( EInputParams( EEapFastVerifyServerRealm, KEapFastVerifyServerRealm ) ); - iWLanParams.Append( EInputParams( EEapFastRequireClientAuth, KEapFastRequireClientAuth ) ); - iWLanParams.Append( EInputParams( EEapFastSessionValidityTime, KEapFastSessionValidityTime ) ); - iWLanParams.Append( EInputParams( EEapFastCipherSuites, KEapFastCipherSuites ) ); - iWLanParams.Append( EInputParams( EEapFastEncapsulatedTypes, KEapFastEncapsulatedTypes ) ); - iWLanParams.Append( EInputParams( EEapFastAuthProvModeAllowed, KEapFastAuthProvModeAllowed ) ); - iWLanParams.Append( EInputParams( EEapFastUnauthProvModeAllowed, KEapFastUnauthProvModeAllowed ) ); - iWLanParams.Append( EInputParams( EEapFastWarnADHPNoPAC, KEapFastWarnADHPNoPAC ) ); - iWLanParams.Append( EInputParams( EEapFastWarnADHPNoMatchingPAC, KEapFastWarnADHPNoMatchingPAC ) ); - iWLanParams.Append( EInputParams( EEapFastWarnNotDefaultServer, KEapFastWarnNotDefaultServer ) ); - iWLanParams.Append( EInputParams( EEapFastUserCertSubjectKeyId, KEapFastUserCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapFastUserCertIssuerName, KEapFastUserCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapFastUserCertSerialNumber, KEapFastUserCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EEapFastCaCertSubjectKeyId, KEapFastCaCertSubjectKeyId ) ); - iWLanParams.Append( EInputParams( EEapFastCaCertIssuerName, KEapFastCaCertIssuerName ) ); - iWLanParams.Append( EInputParams( EEapFastCaCertSerialNumber, KEapFastCaCertSerialNumber ) ); - iWLanParams.Append( EInputParams( EMschapv2Username, KMschapv2Username ) ); - iWLanParams.Append( EInputParams( EMschapv2Password, KMschapv2Password ) ); - iWLanParams.Append( EInputParams( EMschapv2SessionValidityTime, KMschapv2SessionValidityTime ) ); - iWLanParams.Append( EInputParams( EMschapv2Encapsulation, KMschapv2Encapsulation ) ); - }; - - - -void CReaderXML::FillVpnParams() - { - iVpnParams.Reset(); - - iVpnParams.Append( EInputParams( ECmName, KConnectionName ) ); - iVpnParams.Append( EInputParams( ECmId, KConnectionId ) ); - iVpnParams.Append( EInputParams( ECmProtected, KProtected ) ); - iVpnParams.Append( EInputParams( ECmHidden, KHidden ) ); - iVpnParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); - iVpnParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); - iVpnParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); - iVpnParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); - iVpnParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); - iVpnParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); - iVpnParams.Append( EInputParams( EVPN_IapName, KVpnIapName ) ); - iVpnParams.Append( EInputParams( EVpnServicePolicy, KVpnServicePolicy ) ); - - }; - -//Binds Gobal settings parameters to field IDs -void CReaderXML::FillGlobalParams() - { - iGlobalParams.Append( EInputParams( EGPRSAttachMode, KAttachMode ) ); - iGlobalParams.Append( EInputParams( EDefaultAP, KDefaultAP) ); - iGlobalParams.Append( EInputParams( EDefaultDnIcon, KDefaultDnIcon ) ); - iGlobalParams.Append( EInputParams( EPriorityLan, KPriorityLan ) ); - iGlobalParams.Append( EInputParams( EPriorityWlan, KPriorityWlan ) ); - iGlobalParams.Append( EInputParams( EPriorityPan, KPriorityPan ) ); - iGlobalParams.Append( EInputParams( EPriorityGprsOut, KPriorityGprsOut ) ); - iGlobalParams.Append( EInputParams( EPriorityGprsIn, KPriorityGprsIn ) ); - iGlobalParams.Append( EInputParams( EPriorityCdma2k, KPriorityCdma2k ) ); - iGlobalParams.Append( EInputParams( EPriorityDialOut, KPriorityDialOut ) ); - iGlobalParams.Append( EInputParams( EPriorityDialIn, KPriorityDialIn ) ); - iGlobalParams.Append( EInputParams( EPriorityVpn, KPriorityVpn ) ); - iGlobalParams.Append( EInputParams( EPriorityMip, KPriorityMip ) ); - iGlobalParams.Append( EInputParams( EUIPriorityLan, KUIPriorityLan ) ); - iGlobalParams.Append( EInputParams( EUIPriorityWlan, KUIPriorityWlan ) ); - iGlobalParams.Append( EInputParams( EUIPriorityPan, KUIPriorityPan ) ); - iGlobalParams.Append( EInputParams( EUIPriorityGprsOut, KUIPriorityGprsOut ) ); - iGlobalParams.Append( EInputParams( EUIPriorityGprsIn, KUIPriorityGprsIn ) ); - iGlobalParams.Append( EInputParams( EUIPriorityCdma2k, KUIPriorityCdma2k ) ); - iGlobalParams.Append( EInputParams( EUIPriorityDialOut, KUIPriorityDialOut ) ); - iGlobalParams.Append( EInputParams( EUIPriorityDialIn, KUIPriorityDialIn ) ); - iGlobalParams.Append( EInputParams( EUIPriorityVpn, KUIPriorityVpn ) ); - iGlobalParams.Append( EInputParams( EUIPriorityMip, KUIPriorityMip ) ); - iGlobalParams.Append( EInputParams( EUsageOfWlan, KUsageOfWlan ) ); - iGlobalParams.Append( EInputParams( ECellularDataUsageHome, KCellularDataUsageHome ) ); - iGlobalParams.Append( EInputParams( ECellularDataUsageVisitor, KCellularDataUsageVisitor ) ); - iGlobalParams.Append( EInputParams( EGprsLastSocketActivityTimeout, KGprsLastSocketActivityTimeout ) ); - iGlobalParams.Append( EInputParams( EGprsLastSessionClosedTimeout, KGprsLastSessionClosedTimeout ) ); - iGlobalParams.Append( EInputParams( EGprsLastSocketClosedTimeout, KGprsLastSocketClosedTimeout ) ); - iGlobalParams.Append( EInputParams( EWlanLastSocketActivityTimeout, KWlanLastSocketActivityTimeout ) ); - iGlobalParams.Append( EInputParams( EWlanLastSessionClosedTimeout, KWlanLastSessionClosedTimeout ) ); - iGlobalParams.Append( EInputParams( EWlanLastSocketClosedTimeout, KWlanLastSocketClosedTimeout ) ); - iGlobalParams.Append( EInputParams( EWlanBGScanInterval, KWlanBGScanInterval ) ); - iGlobalParams.Append( EInputParams( EWlanUseDefSettings, KWlanUseDefSettings ) ); - iGlobalParams.Append( EInputParams( EWlanLongRetry, KWlanLongRetry ) ); - iGlobalParams.Append( EInputParams( EWlanShortRetry, KWlanShortRetry ) ); - iGlobalParams.Append( EInputParams( EWlanRTS, KWlanRTS ) ); - iGlobalParams.Append( EInputParams( EWlanTxPowerLevel, KWlanTxPowerLevel ) ); - iGlobalParams.Append( EInputParams( EWlanRadioMeasurements, KWlanRadioMeasurements ) ); - iGlobalParams.Append( EInputParams( EWlanPowerMode, KWlanPowerMode ) ); - - }; - -//Describes a Destination Network -void CReaderXML::FillDNParams() - { - iDNParams.Append( EInputParams( EDN_Name, KDN_Name ) ); - iDNParams.Append( EInputParams( EDN_Id, KDN_Id ) ); - iDNParams.Append( EInputParams( EDN_Icon, KDN_Icon ) ); - iDNParams.Append( EInputParams( EDN_Metadata, KDN_Metadata ) ); - iDNParams.Append( EInputParams( EDN_Protection, KDN_Protection ) ); - iDNParams.Append( EInputParams( EDN_Hidden, KHidden ) ); - iDNParams.Append( EInputParams( EDN_HiddenAgent, KHiddenAgent ) ); - iDNParams.Append( EInputParams( EDN_Highlighted, KHighlighted ) ); - iDNParams.Append( EInputParams( EDN_EmbeddedDNName, KDN_EmbeddedDNName ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName ) ); - // Needed because of Customization Tool limitations - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName2 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName3 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName4 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName5 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName6 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName7 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName8 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName9 ) ); - iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName10 ) ); - }; - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdctagcontainer.cpp --- a/dbcreator/commsdatcreator/Src/cdctagcontainer.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Method definitions of the class CTagContainer. -* -*/ - - - -#include "cdctagcontainer.h" -#include "cdcerrors.h" - -//CONSTANTS -const TInt KGranularity = 20; - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// Constructor of ETag -// --------------------------------------------------------- -CTagContainer::ETag::ETag( HBufC16* aTag, TInt aFieldId ): - iFieldId( aFieldId ), - iTag( aTag ) - { - //no implementation needed - } - -// --------------------------------------------------------- -// Destructor of ETag -// --------------------------------------------------------- -CTagContainer::ETag::~ETag() - { - delete iTag; - } - -// --------------------------------------------------------- -// TTagContainer NewL -// --------------------------------------------------------- -// -CTagContainer* CTagContainer::NewL() - { - CTagContainer* self = new ( ELeave ) CTagContainer(); - CleanupStack::PushL( self ); - - // From Base class - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// --------------------------------------------------------- -// TTagContainer ConstructL -// --------------------------------------------------------- -// -void CTagContainer::ConstructL() - { - iTags = new (ELeave) CArrayPtrSeg( KGranularity ); - } - -// --------------------------------------------------------- -// TTagContainer Constructor -// --------------------------------------------------------- -// -CTagContainer::CTagContainer() - { - } - -// --------------------------------------------------------- -// TTagContainer Destructor -// --------------------------------------------------------- -// -CTagContainer::~CTagContainer() - { - Clear(); - delete iTags; - } - -// --------------------------------------------------------- -// CTagContainer::Clear -// --------------------------------------------------------- -// -void CTagContainer::Clear() - { - iTags->ResetAndDestroy(); - } - -// --------------------------------------------------------- -// CTagContainer::Add -// --------------------------------------------------------- -// -void CTagContainer::AddL( HBufC16* aTag, TInt aFieldId ) - { - ETag* tag = new (ELeave) ETag( aTag, aFieldId ); - //lint -sem( iTags->AppendL, custodial(1) ) - - CleanupStack::PushL( tag ); - iTags->AppendL( tag ); - CleanupStack::Pop( tag ); - } - -// --------------------------------------------------------- -// CTagContainer::Tag -// --------------------------------------------------------- -// -HBufC16* CTagContainer::Tag( TUint aIdx ) - { - __ASSERT_ALWAYS( aIdx < Count(), - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - return iTags->At(aIdx)->iTag; - } - -// --------------------------------------------------------- -// CTagContainer::FieldId -// --------------------------------------------------------- -// -TInt CTagContainer::FieldId( TUint aIdx ) - { - __ASSERT_ALWAYS( aIdx < Count(), - User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); - - return iTags->At( aIdx )->iFieldId; - } - -// --------------------------------------------------------- -// CTagContainer::Count -// --------------------------------------------------------- -// -TInt CTagContainer::Count() - { - return iTags->Count(); - } - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcwlandevicesettings.cpp --- a/dbcreator/commsdatcreator/Src/cdcwlandevicesettings.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,279 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CWlanDeviceSettings -* -*/ - - - -// INCLUDE FILES -#include "cdcwlandevicesettings.h" -#include "cdclogger.h" - -#include -#include - -#include -#include -#include -#include - - -// CONSTANTS -// WLAN Device Settings table - default settings -const TUint32 KDefaultBGScanInterval = 0xFFFFFFFF; // Automatic scan -const TBool KDefaultUseDefSettings = ETrue; -const TUint32 KDefaultLongRetry = 4; -const TUint32 KDefaultShortRetry = 7; -const TUint32 KDefaultRTS = 2347; -const TUint32 KDefaultTxPowerLevel = 100; //mW -const TBool KDefaultRadioMeasurements = ETrue; -const TBool KDefaultWlanPowerMode = ETrue; - -// Increase version every time the content of the table changes -const TUint32 KWlanDeviceSettingsTableVersion = 9; - - -// ================= MEMBER FUNCTIONS ====================== - -// --------------------------------------------------------- -// Constructor -// --------------------------------------------------------- -// -CWlanDeviceSettings::CWlanDeviceSettings() - { - } - - -// --------------------------------------------------------- -// Symbian 2nd phase constructor can leave. -// --------------------------------------------------------- -// -void CWlanDeviceSettings::ConstructL() - { - DEBUG( "CWlanDeviceSettings::ConstructL()" ) - - iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); - - // Open the WLAN device settings table. - if( !iSession->IsInTransaction() ) - { - iSession->OpenTransactionL(); - } - OpenTableL(); - iSession->CommitTransactionL(); - DEBUG( "CWlanDeviceSettings::ConstructL() Tables opened ok." ) - } - - -// --------------------------------------------------------- -// Static constructor. -// --------------------------------------------------------- -// -CWlanDeviceSettings* CWlanDeviceSettings::NewL() - { - DEBUG( "CWlanDeviceSettings::NewL()" ) - - CWlanDeviceSettings* self = new (ELeave) CWlanDeviceSettings; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - - -// --------------------------------------------------------- -// Destructor -// --------------------------------------------------------- -// -CWlanDeviceSettings::~CWlanDeviceSettings() - { - DEBUG( "CWlanDeviceSettings::~CWlanDeviceSettings()" ) - - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - } - - -// --------------------------------------------------------- -// CWlanDeviceSettings::GetDefaultSettings -// --------------------------------------------------------- -// -void CWlanDeviceSettings::GetDefaultSettings( SWlanDeviceSettings& aSettings ) - { - DEBUG( "CWlanDeviceSettings::GetDefaultSettings()" ) - - aSettings.backgroundScanInterval = KDefaultBGScanInterval; - aSettings.savedBgScanInterval = KDefaultBGScanInterval; - aSettings.useDefaultSettings = KDefaultUseDefSettings; - aSettings.longRetry = KDefaultLongRetry; - aSettings.shortRetry = KDefaultShortRetry; - aSettings.rts = KDefaultRTS; - aSettings.txPowerLevel = KDefaultTxPowerLevel; - aSettings.radioMeasurements = KDefaultRadioMeasurements; - aSettings.powerMode = KDefaultWlanPowerMode; - } - - -// --------------------------------------------------------- -// CWlanDeviceSettings::OpenTableL -// --------------------------------------------------------- -// -void CWlanDeviceSettings::OpenTableL() - { - DEBUG( "CWlanDeviceSettings::OpenTableL()" ) - - // See if there is a record whose device settings type is - // 'WLAN default settings' - CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* > - ( CCDRecordBase::RecordFactoryL( 0 ) ); - CleanupStack::PushL( deviceSettingsTable ); - deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); - deviceSettingsTable->LoadL( *iSession ); - - CMDBElement* tableType = deviceSettingsTable->GetFieldByIdL - ( KCDTIdWlanDeviceSettingsType ); - CMDBField< TUint32 >* tableTypeField = - static_cast< CMDBField< TUint32 >* >( tableType ); - tableTypeField->SetL( KWlanDefaultSettings ); - - if( !deviceSettingsTable->FindL( *iSession ) ) - { - // If not, store empty record - deviceSettingsTable->SetRecordId( KCDNewRecordRequest ); - deviceSettingsTable->StoreL( *iSession ); - // And fill it with data - FillRecordL( KWlanDefaultSettings, deviceSettingsTable ); - deviceSettingsTable->ModifyL( *iSession ); - } - CleanupStack::PopAndDestroy( deviceSettingsTable ); - - // See if there is a record whose device settings type is - // 'WLAN user settings' - deviceSettingsTable = static_cast< CMDBGenericRecord* > - ( CCDRecordBase::RecordFactoryL( 0 ) ); - CleanupStack::PushL( deviceSettingsTable ); - deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); - deviceSettingsTable->LoadL( *iSession ); - - tableType = deviceSettingsTable->GetFieldByIdL( KCDTIdWlanDeviceSettingsType ); - tableTypeField = static_cast< CMDBField< TUint32 >* >( tableType ); - tableTypeField->SetL( KWlanUserSettings ); - - if( !deviceSettingsTable->FindL( *iSession ) ) - { - // If not, store empty record - deviceSettingsTable->SetRecordId( KCDNewRecordRequest ); - deviceSettingsTable->StoreL( *iSession ); - // And fill it with data - FillRecordL( KWlanUserSettings, deviceSettingsTable ); - deviceSettingsTable->ModifyL( *iSession ); - } - CleanupStack::PopAndDestroy( deviceSettingsTable ); - } - - -// --------------------------------------------------------- -// CWlanDeviceSettings::FillRecordL -// --------------------------------------------------------- -// - -void CWlanDeviceSettings::FillRecordL( TUint32 aTableType, - CMDBGenericRecord* aRecord ) - { - DEBUG1( "CWlanDeviceSettings::NewRecordL() Type=%d", aTableType ) - - SWlanDeviceSettings settings; - GetDefaultSettings( settings ); - - // Device Settings Type - CMDBElement* tableType = aRecord->GetFieldByIdL - ( KCDTIdWlanDeviceSettingsType ); - CMDBField< TUint32 >* tableTypeField = - static_cast< CMDBField< TUint32 >* >( tableType ); - tableTypeField->SetL( aTableType ); - - // Table Version - CMDBElement* tableVersion = aRecord->GetFieldByIdL - ( KCDTIdTableVersion ); - CMDBField< TUint32 >* tableVersionField = - static_cast< CMDBField< TUint32 >* >( tableVersion ); - - tableVersionField->SetL( KWlanDeviceSettingsTableVersion ); - - // BG Scan Interval - CMDBElement* bgScanInterval = aRecord->GetFieldByIdL - ( KCDTIdBgScanInterval ); - CMDBField< TUint32 >* bgScanIntervalField = - static_cast< CMDBField< TUint32 >* >( bgScanInterval ); - bgScanIntervalField->SetL( settings.backgroundScanInterval ); - - // Saved BG Scan Interval - CMDBElement* savedBgScanInterval = aRecord->GetFieldByIdL - ( KCDTIdSavedBgScanInterval ); - CMDBField< TUint32 >* savedBgScanIntervalField = - static_cast< CMDBField< TUint32 >* >( savedBgScanInterval ); - savedBgScanIntervalField->SetL( settings.savedBgScanInterval ); - - // Use Default Settings - CMDBElement* useDefaultSettings = aRecord->GetFieldByIdL - ( KCDTIdUseDefaultSettings ); - CMDBField< TBool >* useDefaultSettingsField = - static_cast< CMDBField< TBool >* >( useDefaultSettings ); - useDefaultSettingsField->SetL( settings.useDefaultSettings ); - - // Long Retry - CMDBElement* longRetry = aRecord->GetFieldByIdL( KCDTIdWlanLongRetry ); - CMDBField< TUint32 >* longRetryField = - static_cast< CMDBField< TUint32 >* >( longRetry ); - longRetryField->SetL( settings.longRetry ); - - // Short Retry - CMDBElement* shortRetry = aRecord->GetFieldByIdL( KCDTIdWlanShortRetry ); - CMDBField< TUint32 >* shortRetryField = - static_cast< CMDBField< TUint32 >* >( shortRetry ); - shortRetryField->SetL( settings.shortRetry ); - - // RTS Threshold - CMDBElement* rts = aRecord->GetFieldByIdL( KCDTIdWlanRTSThreshold ); - CMDBField< TUint32 >* rtsField = - static_cast< CMDBField< TUint32 >* >( rts ); - rtsField->SetL( settings.rts ); - - // TX Power Level - CMDBElement* txPowerLevel = aRecord->GetFieldByIdL( KCDTIdTxPowerLevel ); - CMDBField< TUint32 >* txPowerLevelField = - static_cast< CMDBField< TUint32 >* >( txPowerLevel ); - txPowerLevelField->SetL( settings.txPowerLevel ); - - // Radio Measurements - CMDBElement* radioMeasurements = aRecord->GetFieldByIdL - ( KCDTIdAllowRadioMeasurements ); - CMDBField< TBool >* radioMeasurementsField = - static_cast< CMDBField< TBool >* >( radioMeasurements ); - radioMeasurementsField->SetL( settings.radioMeasurements ); - - // Power Mode - CMDBElement* powerMode = aRecord->GetFieldByIdL( KCDTIdWlanPowerMode ); - CMDBField< TBool >* powerModeField = - static_cast< CMDBField< TBool >* >( powerMode ); - powerModeField->SetL( settings.powerMode ); - } - -// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/Src/cdcwlantables.cpp --- a/dbcreator/commsdatcreator/Src/cdcwlantables.cpp Fri Aug 06 19:11:03 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the class CWlanTables -* -*/ - - - - -// INCLUDE FILES -#include "cdclogger.h" -#include "cdcwlantables.h" - -#include - -// CONSTANTS -/// Modem bearer names for WLAN connection methods -_LIT( KWlanBearerName, "WLANBearer" ); -_LIT( KWlanBearerAgent, "wlanagt.agt" ); -_LIT( KWlanBearerNif, "wlannif" ); - -_LIT( KWlanLDDName, "not used" ); -_LIT( KWlanPDDName, "not used" ); -const TInt KWlanLastSocketActivityTimeout = -1; -const TInt KWlanLastSessionClosedTimeout = 1; -const TInt KWlanLastSocketClosedTimeout = -1; - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CWlanTables::NewL -// --------------------------------------------------------- -// -CWlanTables* CWlanTables::NewL() - { - - CWlanTables* self = new ( ELeave ) CWlanTables; - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - - -// --------------------------------------------------------- -// CWlanTables::CWlanTables -// --------------------------------------------------------- -// -CWlanTables::CWlanTables() - { - //no implementation needed - } - - -// --------------------------------------------------------- -// CWlanTables::ConstructL -// --------------------------------------------------------- -// -void CWlanTables::ConstructL() - { - iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); - } - - -// --------------------------------------------------------- -// CWlanTables::~CWlanTables -// --------------------------------------------------------- -// -CWlanTables::~CWlanTables() - { - if ( iSession ) - { - iSession->Close(); - delete iSession; - } - } - - -// --------------------------------------------------------- -// CreateWlanServiceTableL -// --------------------------------------------------------- -// -void CWlanTables::CheckAndCreateTablesL() - { - // Check WLAN Device Settings Table (creates if does not exist). - CreateWlanDeviceSettingsTableL(); - - // Check WLAN Service Table (creates if does not exist). - CreateWlanServiceTableL(); - - // Check WLAN Secondary SSID Table (creates if does not exist). - CreateWlanSecSSIDTableL(); - - // Check WLAN bearer record (creates if does not exist). - CreateWlanBearerRecordL(); - } - -// --------------------------------------------------------- -// CreateWlanServiceTableL -// --------------------------------------------------------- -// -void CWlanTables::CreateWlanServiceTableL() - { - //checks whether table exists - TInt error( KErrNone ); - - TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) ); - if( error == KErrNotFound ) - { - //table not found -- add new table - CCDWlanServiceRecord::CreateTableL( *iSession ); - - //check result - TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) ); - - if ( error == KErrNone ) - { - CLOG_WRITE( "Added WLAN service table" ) - } - } - else if ( error == KErrNone) - { - CLOG_WRITE( "WLAN service table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CreateWlanDeviceTableL -// --------------------------------------------------------- -// -void CWlanTables::CreateWlanDeviceSettingsTableL() - { - //checks whether table exists - TInt error( KErrNone ); - - TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) ); - if( error == KErrNotFound ) - { - //table not found -- add new table - CCDWlanDeviceSettingsRecord::CreateTableL( *iSession ); - - //check result - TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) ); - if ( error == KErrNone ) - { - CLOG_WRITE( "Added Device Settings table" ) - } - } - else if ( error == KErrNone) - { - CLOG_WRITE( "Device Settings table already exists" ) - } - else - { - //do nothing - } - } - - -// --------------------------------------------------------- -// CreateWlanSecSSIDTableL -// --------------------------------------------------------- -// -void CWlanTables::CreateWlanSecSSIDTableL() - { - //checks whether table exists - TInt error( KErrNone ); - - TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) ); - if( error == KErrNotFound ) - { - //table not found -- add new table - CCDWLANSecSSIDTable::CreateTableL( *iSession ); - - //check result - TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) ); - - if ( error == KErrNone ) - { - CLOG_WRITE( "Added Secondary SSID table" ) - } - } - else if ( error == KErrNone) - { - CLOG_WRITE( "Secondary SSID table already exists" ) - } - else - { - //do nothing - } - } - -// --------------------------------------------------------- -// CreateWlanBearerRecordL -// --------------------------------------------------------- -// -void CWlanTables::CreateWlanBearerRecordL() - { - CCDLANBearerRecord* record = static_cast - ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) ); - CleanupStack::PushL( record ); - - record->iRecordName.SetL( TPtrC( KWlanBearerName ) ); - - if ( !record->FindL( *iSession ) ) - { // bearer not found -> create dummy values. Copied from CmManager initialization. - record->SetRecordId( KCDNewRecordRequest ); - - record->iBearerAgent.SetL( KWlanBearerAgent ); - record->iRecordName.SetL( KWlanBearerName ); - record->iLanBearerNifName.SetL( KWlanBearerNif ); - record->iLanBearerLddName.SetL( KWlanLDDName ); - record->iLanBearerPddName.SetL( KWlanPDDName ); - record->iLastSocketActivityTimeout.SetL( - ( TUint32 )KWlanLastSocketActivityTimeout ); - record->iLastSessionClosedTimeout.SetL( - (TUint32 )KWlanLastSessionClosedTimeout ); - record->iLastSocketClosedTimeout.SetL( - ( TUint32 )KWlanLastSocketClosedTimeout ); - record->StoreL( *iSession ); - CLOG_WRITE( "Added WLAN bearer record" ); - } - else - { - CLOG_WRITE( "WLAN bearer record already exists" ); - } - - CleanupStack::PopAndDestroy( record ); - } - - - -// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp --- a/dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp Fri Aug 06 19:11:03 2010 +0300 +++ b/dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp Mon Aug 23 13:40:12 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,12 +11,10 @@ * * Contributors: * -* Description: Project description file for commsdatcreator -* +* Description: +* Project description file for commsdatcreator */ - - #include TARGET commsdatcreator.dll @@ -30,7 +28,7 @@ LANG SC -SOURCEPATH ../Src +SOURCEPATH ../src SOURCE cdcreaderbase.cpp SOURCE cdcreaderxml.cpp @@ -50,7 +48,7 @@ // Component specific internal headers -USERINCLUDE ../Inc +USERINCLUDE ../inc USERINCLUDE ../../inc diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcdatamobilitytables.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcdatamobilitytables.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CDataMobilityTables. +* +*/ + + + + +#ifndef DATAMOBILITYTABLESHANDLER_H +#define DATAMOBILITYTABLESHANDLER_H + + +// INCLUDES +#include +#include + +using namespace CommsDat; + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* CDataMobilityTables +* Capable of checking the existence of certain Data Mobility specific +* tables and - if necessary create them. +*/ +class CDataMobilityTables : public CBase + { + public: + + /** + * Static constructor + */ + static CDataMobilityTables* NewL(); + + /** + * Destructor + */ + virtual ~CDataMobilityTables(); + + /** + * Checks if Data Mobility ALR tables exist. Creates them if not. + */ + void CheckAndCreateAlrTablesL(); + + /** + * Checks if Data Mobility MIP tables exist. Creates them if not. + */ + void CheckAndCreateMipTablesL(); + + + private: + + /** + * C++ default constructor. + */ + CDataMobilityTables(); + + /** + * By default Symbian second phase constructor is private. + */ + void ConstructL(); + + /** + * Check if Global Bearer Type Priorization Table exists in CommsDat; + * create if not. + */ + void CreateGlobalBearerTypeTableL(); + + /** + * Check if Data Mobility Selection Policy Table exists in CommsDat; + * create if not. + */ + void CreateDataMobilitySelectionPolicyTableL(); + + /** + * Check if Virtual IAP Next Layer Table exists in CommsDat; + * create if not. + */ + void CreateVirtualIAPNextLayerTableL(); + + /** + * Check if MIP Service Table exists in CommsDat; create if not. + */ + void CreateMIPServiceTableL(); + + /** + * Check if MIP Service Table exists in CommsDat; create if not. + */ + void CreateMIP4TableL(); + + /** + * Check if MIP Service Table exists in CommsDat; create if not. + */ + void CreateMIP6TableL(); + + /** + * Check if SNAP Metadata Table exists in CommsDat; create if not. + */ + void CreateSNAPMetadataTableL(); + + /** + * Check if IAP Metadata Table exists in CommsDat; create if not. + */ + void CreateIAPMetadataTableL(); + + /** + * Check if WLAN Destination network Table exists in CommsDat; + * create if not. + */ + void CreateDestNetworkTableL(); + + /** + * Populates the Global Bearer Priorization table. + */ + void PopulateGlobalBearerTypeTableL(); + + private: // Data + + //@var session - Owned + CMDBSession* iSession; + + }; + +#endif // DATAMOBILITYTABLESHANDLER_H + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcdumptables.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcdumptables.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CDbCreator +* +*/ + + + + +#ifndef DUMP_TABLES_H +#define DUMP_TABLES_H + +// INCLUDE FILES + +#include +#include + +// CLASS DECLARATION + +class CMDBSession; + +/** +* CDumpTables writes data from CommsDat to CSV format file. +* CDumpTables dumps the CommsDat tables which are not dumped +* by any other application. +*/ +class CDumpTables : public CBase + { + + public: + + /** + * Two-phase constructor. + * @return CDumpTables instance. + */ + static CDumpTables* NewL(); + + /** + * Two-phase constructor. + * @return CDumpTables instance. Let the instance on the CleanupStack. + */ + static CDumpTables* NewLC(); + + /** + * Destructor. + */ + virtual ~CDumpTables(); + + /** + * Dumps the unsupported tables to CSV format file. + * @param outFileName name of the output file with full path. + */ + void DoDumpTablesL( const TFileName& aOutFileName ); + + protected: + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + private: + + /** + * Constructor + */ + CDumpTables(); + + /** + * Template method for dumping one CommsDat table + * @param class T representing the table which is dumped. + */ + template void DumpTableL( const TDesC* aTableName ); + + /** + * Opens a output file for dumping. It tries to open the file + * and if it does not exist then a new one created. + * @param aFileName name of the file. It cannot be NULL. + */ + TInt OpenFileL( const TFileName& aFileName ); + + /** + * Writes 8 bit descriptor to 16 bit unicode file in CSV format. + * @param aDes the written text. It gets the ownership. + */ + void WriteL( HBufC8* aDes ); + + /** + * Writes 16 bit descriptor to 16 bit unicode file in CSV format. + * @param aDes the written text. It gets the ownership. + */ + void WriteL( HBufC16* aDes ); + + /** + * Transform the parameter field to CSV accepted format. + * @param aField the field that should be checked and transform + * to CSV format if it is necessary + * @return the CSV acceptable format. + */ + HBufC16* TransformToCSVFormatLC( const HBufC16* aField ); + + /** + * Checks the parameter field if transformation to CSV format is + * necessary. + * @param aField the field which should be checked. + * @return ETrue if transformation is necessary else EFalse. + */ + TBool CheckCSVTransformNeedL( HBufC16* aFiled ); + + + private: + + // Session for CommsDat + CommsDat::CMDBSession* iSession; + + // Fs for file handling + RFs iRfs; + + // Output file + RFileWriteStream iFile; + + // Counter for how many double qoutes are in the given text. + TInt iNumOfDQuotes; + + }; + +#endif DUMP_TABLES_H + + diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdclogfilename.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdclogfilename.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: contains logger macros +* +*/ + + + + +#ifndef CDC_LOGFILE_NAME_H +#define CDC_LOGFILE_NAME_H + + +/// Directory where the log file can be found. +_LIT16( KLogDir, "cdc" ); + +/// Log file name. +_LIT16( KLogFile, "cdc.txt" ); + + +#endif // CDC_LOGFILE_NAME_H \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorbase.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorBase. +* +*/ + + + + +#ifndef APFILE_PARSER_BASE_H +#define APFILE_PARSER_BASE_H + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include + +#include "cdcerrors.h" +#include "cdccommon.h" + +// FORWARD DECLARATION +class CTagContainer; +class CReaderBase; + +// CONSTANTS + +/** +* Max length of a line in the log file. +*/ +LOCAL_D const TInt KMaxLogLineLength = 256; + + +// CLASS DECLARATION +/** +* CProcessorBase +* Abstract base class for processor classes +*/ +class CProcessorBase : public CBase + { + + public: + /** + * Destructor. + */ + virtual ~CProcessorBase(); + + /** + * Processes the input files line by line. + */ + void ParseFileL(); + + + protected: + /** + * Constructor + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray array that holds the plugins - and so the CMs + * @param aPluginNames array that holds the CM names + */ + CProcessorBase( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames ); + + + /** + * Constructor + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray array that holds the plugins - and so the CMs + * @param aPluginNames array that holds the CM names + * @param aDestArray array that holds the Destination + * @param aDestNames array that holds the Destination names + */ + CProcessorBase( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ); + /** + * Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + */ + virtual void ProcessTagL( TBool aFieldIDPresent ); + + /** + * Processes the special fields of the tag. Every descendand can implement + * processes of their special fields + * @param aField ID of the field + * @param aTagPtr data conatining by the field + * @param aDx serial number of the field + */ + virtual void ProcessSpecialFieldsL( TInt /*aField*/, + HBufC* /*aTagPtr*/, + TInt /*aDx*/ ) {}; + + /** + * Does the necessary settings before processing tag. Every descendand + * can implement their special needs. + */ + virtual void Reset() {}; + + /** + * Calculates and sets the AddressFromServer field + */ + virtual void SetAddressFromServerL( TInt aIPField1, + TInt aIPField2, + TInt aAddrFromSField, + TInt aIPField1IP6, + TInt aIPField2IP6, + TInt aAddrFromSFieldIP6 ); + /** + * Virtual function. Processes the actual access point. + */ + virtual void ProcessAPL(); + + /** + * Writes the actual created access point to the log file. + */ + virtual void DoLogL(); + + /** + * Returns the TagContainer + * @return iTagContainer + */ + CTagContainer& TagContainer(); + + /** + * Adds one item to the plugin array. + */ + void AddToPluginArrayL(); + + /** + * Retrieves the last plugin from the plugin array. + * @return the last plugin in the plugin array + */ + RCmConnectionMethodExt& GetLastPluginL(); + + /** + * Retrieves the plugin in position from the plugin array. + * @param aPos position of the desired plugin. + * @return the plugin in position from the plugin array + */ + RCmConnectionMethodExt& GetPluginL( TInt aPos ); + + /** + * Retrieves count of plugins in the plugin array. + * @return count of plugins in the plugin array + */ + TInt PluginCount(); + + RCmDestinationExt* FindDestinationL( HBufC* aName ); + + TInt GetDestinationIdL( HBufC16* aName ); + + RCmConnectionMethodExt* FindPluginL( HBufC* aName ); + + RCmConnectionMethodExt* FindPluginL( HBufC* aName, TInt& aPos ); + + TInt GetPluginIdL( HBufC16* aName ); + + TBool ProcessTag( HBufC* aTag, RCmConnectionMethodExt* aPlugin ); + TBool SetGeneralFieldL( TInt aField, HBufC* aPtrTag ); + + private: + + + TInt CheckPluginName( HBufC* aName ); + + + protected: + + // @var Gives back AP data from the file. + CReaderBase* iFileReader; + + // @var Pointer to Connection Method Manager that is required to access + // Access Point data + RCmManagerExt* iCmManager; + + // @var Shows whether proxies have already been enabled or not. + TBool iProxyEnabled; + + // @var Indicates whether the connection method is protected or not + TBool iIsProtected; + + // @var Name of the actual IAP or Destination + HBufC* iName; + + // @var Actual IAP + RCmConnectionMethodExt iPlugin; + + // @var Actual Bearer Type + TUint iBearerType; + + protected: + + // @var Plugin array that is used to store pointers to access point data + RPointerArray< RCmConnectionMethodExt >* iPluginArray; + // @var Plugin array that is used to store names of access point data + RPointerArray< HBufC >* iPluginName; + + // @var Destination array that is used to store pointers to Destination data + RPointerArray< RCmDestinationExt >* iDestArray; + // @var Destination array that is used to store names of Destination + RPointerArray< HBufC >* iDestName; + + }; + + +#endif // APFILE_PARSER_BASE_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessordn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessordn.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorDN. +* +*/ + + + + +#ifndef PROCESSOR_DN_H +#define PROCESSOR_DN_H + + +// INCLUDE FILES + +#include +#include +#include +#include +#include + +#include "cdcprocessorbase.h" + + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* CProcessorDN +* Inherits from the class CProcessorBase. +* Creates Destination Network Item from CTagContainer and +* adds it to the database +*/ +class CProcessorDN : public CProcessorBase + { + public: + /** + * Two-phase constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aCmArray Array of the processed connection methods + * @param aIsFirstRound ETrue if this is the first round of DN + * processing. In this case DNs are created. + * EFalse otherwise. This time connection methods + * are added. + * @return CProcessorDN instance. + */ + static CProcessorDN* NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& + aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames, + RArray< TBool >& aCmInDest, + TBool aIsFirstRound ); + /** + * Destructor. + */ + virtual ~CProcessorDN(); + + protected: + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aCmArray Array of the processed connection methods + * @param aIsFirstRound ETrue if this is the first round of DN + * processing. In this case DNs are created. + * EFalse otherwise. This time connection methods + * are added. + */ + CProcessorDN( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames, + RArray< TBool >& aCmInDest, + TBool aIsFirstRound ); + + /** + * From CProcessorBase. Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + * @return the result of the process, KErrNone if the actual tag is + * valid. + */ + virtual void ProcessTagL( TBool aFieldIDPresent ); + + /** + * From CProcessorBase. Processes the actual access point. + * @return the result of the process. + */ + virtual void ProcessAPL(); + + /** + * Writes the actual created access point to the log file. + */ + void DoLogL(); + + private: + + // @var The destiantion that is created + RCmDestinationExt iDestination; + + // @var Pointer to the destiantion that has been created and stored + // in iDestArray + RCmDestinationExt* iDest; + + // @var Stores the protection level of the destination + CMManager::TProtectionLevel iProtectionLevel; + + // @var Stores whether this is the first round of DN processing or not + TBool iIsFirstRound; + + // @var ETrue if the destination cannot processed so it is dropped away + TBool iDestinationDropped; + + RArray< TBool >* iCmInDest; + }; + + +#endif PROCESSOR_DN_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorglobal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorglobal.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorGlobal. +* +*/ + + + + +#ifndef CDCPROCESSORGLOBAL_H +#define CDCPROCESSORGLOBAL_H + + +// INCLUDE FILES + +#include + +#include + +#include "cdcprocessorbase.h" + +using namespace CommsDat; + +// FORWARD DECLARATIONS +class RCmConnectionMethodExt; +class RCmDestinationExt; +class CReaderBase; +class CommsDat::CMDBSession; +struct TCmGenConnSettings; +class RCmManagerExt; + +// CLASS DECLARATION + +/** +* CProcessorGlobal +* Inhertits from the class CProcessorBase. +* Reads Access Points related settings from CTagContainer. +*/ +class CProcessorGlobal : public CProcessorBase + { + public: + /** + * Two-phase constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager + * @return CProcessorGlobal instance. + */ + static CProcessorGlobal* NewL( + CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ); + + /** + * Destructor. + */ + virtual ~CProcessorGlobal(); + + protected: + + /** + * Constructor. + * @param aFileReader pointer to the file reader + */ + CProcessorGlobal( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ); + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * From CProcessorBase. Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + * @return TInt The result of the process, KErrNone if the actual tag is + * valid. + */ + virtual void ProcessTagL( TBool aFieldIDPresent ); + + /** + * From CProcessorBase. Processes the actual access point. + * @return The result of the processing + */ + virtual void ProcessAPL(); + + + private: + + /** + * Updates bearer priority array with the specified bearers priority or + * UI priority. + * @param aField Identifier of the the bearer whose priority/UI-priority + * is to be updated. + * @param aPrio The new priority. + */ + void UpdateGlobalBearerArrayL + ( TDbCreatorGlobalSettings aField, TUint32 aPrio ); + + + /** + * Sets the WLAN Usage parameter in general connection settings. + * @param aPtrTag string containing the parameter's value. + */ + void SetGenConnSettingWlanUsage( HBufC16* aPtrTag ); + + /** + * Sets the "cellular data usage in home networks" + * parameter in general connection settings. + * @param aPtrTag string containing the parameter's value. + */ + void SetGenConnSettingCellularDataUsageHome( HBufC16* aPtrTag ); + + /** + * Sets the "cellular data usage in visitor networks" + * parameter in general connection settings. + * @param aPtrTag string containing the parameter's value. + */ + void SetGenConnSettingCellularDataUsageVisitor( HBufC16* aPtrTag ); + + // Stores the general connection settings, using CMM + void SetGenConnSettingsL(); + + // Stores the WLAN parameters + void SaveGlobalWlanParameterL( const TUint32 aTableType, + const TDbCreatorGlobalSettings aField, + const HBufC16* const aValue ); + + private: + + + // @var GPRS attach mode : whenneeded/whenavailable + TBool iAttachWhenNeeded; + + RArray< TBearerPriority > iBearerArray; + TBool iBearerArrayChanged; + + // @var Stores the general connection settings + TCmGenConnSettings* iGenConnSettings; + + //@var session - Owned + CMDBSession* iSession; + + //@var WLAN supported flag + TBool iIsWlanS; + }; + +#endif CDCPROCESSORGLOBAL_H + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorlan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorlan.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,93 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorLan. +* +*/ + + + + +#ifndef PROCESSOR_LAN_H +#define PROCESSOR_LAN_H + + +// INCLUDE FILES + +#include +#include +#include + +#include "cdcprocessorbase.h" + + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* CProcessorLan +* Inhertits from the class CProcessorBase. +* Creates internet Access Point Item from CTagContainer and +* adds AP item to database. +*/ +class CProcessorLan : public CProcessorBase + { + public: + /** + * Two-phase constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + * @return CProcessorLan instance. + */ + static CProcessorLan* NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames ); + /** + * Destructor. + */ + virtual ~CProcessorLan(); + + protected: + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + */ + CProcessorLan( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames ); + + /** + * From CProcessorBase. Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + * @return the result of the process, KErrNone if the actual tag is + * valid. + */ + virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); + }; + + +#endif PROCESSOR_LAN_H + + +// End of File. \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorpacketdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorpacketdata.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorPacketData. +* +*/ + + + + +#ifndef PROCESSOR_PACKET_DATA_H +#define PROCESSOR_PACKET_DATA_H + + +// INCLUDE FILES + +#include +#include +#include + +#include "cdcprocessorbase.h" + + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** + * CLingerElement is array element for linger value end corresponding CM name. + */ +NONSHARABLE_CLASS( CLingerElement ) : public CBase + { + public: + ~CLingerElement(); + HBufC* iName; + HBufC* iLinger; + }; + +/** +* CProcessorPacketData +* Inhertits from the class CProcessorBase. +* Creates internet Access Point Item from CTagContainer and +* adds AP item to database. +*/ +class CProcessorPacketData : public CProcessorBase + { + public: + /** + * Two-phase constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + * @param aLingerSettings stores processed GPRS linger values + * @return CProcessorPacketData instance. + */ + static CProcessorPacketData* NewL( + CReaderBase* aFileReader, + RCmManagerExt& aCmMnaager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< CLingerElement >& aLingerSettings); + /** + * Destructor. + */ + virtual ~CProcessorPacketData(); + + /** + * Maps previously stored linger values with connection ID's + * and writes them to repository. + */ + void SaveLingerSettingsL(); + + protected: + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + * @param aLingerSettings stores processed GPRS linger values + */ + CProcessorPacketData( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< CLingerElement >& aLingerSettings); + + /** + * From CProcessorBase. Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + * @return the result of the process, KErrNone if the actual tag is + * valid. + */ + virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); + + /** + * Writes connections linger value to repository. + * @param aIapId is the id of connection to which linger value is set. + * @param aLingerInterval linger value to set to connection. + */ + void AddLingerL( const TInt aIapId, const TInt aLingerInterval); + + private: + + // @var Stores linger values + RPointerArray< CLingerElement >* iLingerSettings; + }; + + +#endif PROCESSOR_PACKET_DATA_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorvpn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorvpn.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorVpn. +* +*/ + + + + +#ifndef PROCESSOR_VPN_H +#define PROCESSOR_VPN_H + + +// INCLUDE FILES + +#include +#include +#include + +#include "cdcprocessorbase.h" + +// FORWARD DECLARATION + +// CLASS DECLARATION + +/** +* CProcessorVpn +* Inhertits from the class CProcessorBase. +* Creates internet Access Point Item from CTagContainer and +* adds AP item to database. +*/ +class CProcessorVpn : public CProcessorBase + { + public: + /** + * Two-phase constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + * @return CProcessorVpn instance. + */ + static CProcessorVpn* NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmMnaager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aUnderLying); + + void ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ); + + + /** + * Destructor. + */ + virtual ~CProcessorVpn(); + + protected: + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + * @param aFileReader pointer to the file reader + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + */ + CProcessorVpn( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aUnderLying ); + + /** + * From CProcessorBase. + */ + virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); + + private: + + // @var Stores whether this is the first round of VPN processing or not + TBool iIsFirstRound; + + // @var Stores the IAP name underLying IAP/SNAP name pairs + RPointerArray< HBufC >* iUnderLying; + }; + + +#endif PROCESSOR_VPN_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcprocessorwlan.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcprocessorwlan.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,322 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CProcessorWlan. +* +*/ + + + + +#ifndef PROCESSOR_WLAN_H +#define PROCESSOR_WLAN_H + + +// INCLUDE FILES + +#include +#include +#include +#include +#include +#include + +#include "cdcprocessorbase.h" + +using namespace CommsDat; + +// FORWARD DECLARATIONS + + +// CLASS DECLARATION + + +/** + * CEapTypeElement is array element for several EapTypes + */ +class CEapTypeElement: public CBase + { + public: + ~CEapTypeElement(); + HBufC* iName; + EAPSettings* iEapSettings; + TEapExpandedType iEncapsulatingEapId; + }; + + +/** +* CProcessorWlan +* Inhertits from the class CProcessorBase. +* Creates WLAN Access Point Item from CTagContainer and +* adds AP item to database. +*/ +class CProcessorWlan : public CProcessorBase + { + public: + + /** + * Two-phase constructor. + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + * @return CProcessorWlan instance. + */ + static CProcessorWlan* NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aSecurityInfo, + RPointerArray< CEapTypeElement >& eapSettings ); + + void SaveSecurityInfoL(); + + /** + * Destructor. + */ + virtual ~CProcessorWlan(); + + protected: + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor. + * @param aCmManager Connection Method Manager + * @param aPluginArray Array that stores the processed plugins + */ + CProcessorWlan( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aSecurityInfo, + RPointerArray< CEapTypeElement >& aEapSettings ); + + /** + * From CProcessorBase. Processes the actual tag. + * @param aFieldIDPresent shows if field id is read from input file + * @return TInt The result of the process, KErrNone if the actual tag is + * valid. + */ + virtual void ProcessSpecialFieldsL( TInt aField, HBufC* aTagPtr, TInt aDx ); + + + /** + * From CProcessorBase. Processes the actual access point. + * @return TInt The result of the process. + */ + virtual void ProcessAPL(); + + void FillSecurityInfoL(); + + void FillSecurityInfoL( TBool aIsWep ); + + void SaveSecurityInfoL( TInt& aCounter, TInt aId ); + + /** + * Saves WEP security settings + * @param aIapId Access point id WEP security settings belongs to. + */ + void SaveWEPL( TUint32 aIapId ); + + /** + * Writes key data to CommsDat. + * @param aKeyField The field to be written to + * @param aKey The key data to be written + * @param aKeyformat The format of the key (ascii/hex) + */ + void WriteKeyL( CMDBField* aKeyField, + HBufC16* aKey, + const TInt aKeyFormat ); + + /** + * Gets WEP field value in text format from TagContainer + * @param aFieldId is the id of the field + * @return pointer to the data of the field + */ + HBufC16* WEPFieldData( TDbCreatorWEPFields aFieldId ); + + /** + * Gets Authentication type + * @return TWEPAuthentication - authentication type + * KErrNotFound - if authentication type is not present + */ + TInt WEPAuthentication(); + + /** + * Gets the WEP key in use + * @return TWEPKeyInUse - the WEP key in use + * KErrNotFound - if WEP key in use is not present + */ + TInt WEPKeyInUse(); + + /** + * Gets WEP key format + * @param aFieldId is the id of the field + * should be EWEPKeyXFormat + * @return TWEPKeyFormat - key format + * KErrNotFound - if WEP key format is not present + */ + TInt WEPKeyFormat( TDbCreatorWEPFields aFieldId ); + + /** + * Gets WEP key length + * @param aFieldId is the id of the length field + * should be EWEPKeyXLength + * @return TWEPKeyLength - WEP key length + */ + TWEPKeyLength WEPKeyLength( TDbCreatorWEPFields aFieldId ); + + /** + * Gets valid WEP key length in characters + * @param aFormat is the id of the field - should be EWEPKeyXFormat + * @param aLen is the WEP key length - should be TWEPKeyLength + * @return TInt - valid key length in characters + */ + TInt WEPKeyValidLen( TInt aFormat, TWEPKeyLength aLen ); + + /** + * Gets the TagContainer index that belongst to the given WEP field + * @param aFieldId is the id of the field + * @return index in TagContainer + */ + TInt WEPIndex( TDbCreatorWEPFields aFieldId ); + + /** + * Check the existence and validity of WEP fields + * @return - TRUE if all WEP fields are present and valid + * - FALSE if any of the fields is missing or invalid. + */ + TBool WEPFieldValidate(); + + /** + * Converts keyData enetered in Ascii format to hex format + * @param aSource Source string + * @param aDest destination string + */ + void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ); + + /** + * Veryfies hexadecimal format + * @param aHex hexadecimal key + * @return Etrue if hexadecimal key is valid, Efalse otherwise + */ + TBool VerifyHex( const TDesC8& aHex ); + + /** + * Saves WPA security settings + * @param aIapId Access point id WEP security settings belongs to. + */ + void SaveWPAL( TUint32 aIapId ); + + /** + * Gets the expanded EAP type + * @param aFieldId is the id of the field + * @return expanded EAP type + */ + TEapExpandedType GetExpandedEapTypeIdL( TDesC& aField ); + + /** + * Gets the TagContainer index that belongst to the given WPA field + * @param aFieldId is the id of the field + * @return index in TagContainer + */ + TInt WPAIndex( TDbCreatorWPAFields aFieldId ); + + /** + * Gets WPA field value in text format from TagContainer + * @param aFieldId is the id of the field + * @return pointer to the data of the field + */ + HBufC16* WPAFieldData( TDbCreatorWPAFields aFieldId ); + + /** + * Gets the use of preshared key + * @return ETrue - PSK is in use + * EFalse - PSK is not in use + */ + TBool WPAPresharedKeyInUse(); + + /** + * Gets WPA key length + * @return length of the key + */ + TInt WPAKeyLength(); + + /** + * Writes the actual created access point to the log file. + */ + void DoLogL(); + + private: + + /** + * Sets the necessary initial values + */ + virtual void Reset(); + + /* + * Sets the values of the expanded Eap lists to the database + * @param aServiceId for accessing the EAP data + */ + void SetExpandedEapListL( const TUint aServiceId ); + + private: + + void AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep ); + + void AddEAPSettingL( const TInt aField, HBufC16* aValue ); + + TBool EAPSetting( const TInt aField ); + + void FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex ); + + TEapExpandedType GetEapTypeIdFromSettingId( const TInt aField ); + + TUint FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ); + + void ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey); + + // @var Indicates the WLAN security mode + TDbCreatorSecurityMode iSecurityMode; + // @var Indicates the WLAN security mode name + HBufC* iSecurityModeString; + + // @var Stores WLAN security mode info + RPointerArray< HBufC >* iSecurityInfo; + + // @var Stores WLAN EAP settings + RPointerArray< CEapTypeElement >& iEapSettings; + + // @var access point is Easy WLAN if true + TBool iIsEasyWlan; + + // @var HBufC for empty WEP and WPA tags + HBufC* iEmptyTag; + + HBufC* iWepData[KWEPKeyNumOfFields]; + + HBufC* iWpaData[KWPAKeyNumOfFields]; + + TInt iDataStart; + + RArray< RPointerArray< HBufC > >* iTest; + + }; + + +#endif PROCESSOR_WLAN_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcreaderbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcreaderbase.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CReaderBase. +* +*/ + + + + +#ifndef READER_BASE_H +#define READER_BASE_H + + +// INCLUDE FILES +#include +#include +#include + +#include "cdccommon.h" +#include "cdcerrors.h" +#include "cdctagcontainer.h" + +// CLASS DECLARATION + +/** +* CReaderBase. +* Base class for XML and CSV reader. +*/ +class CReaderBase : public CBase + { + + public: + /** + * Destructor. + */ + virtual ~CReaderBase(); + + protected: + + /** + * Default constructor. + * @param TDbCreatorInputFile input file type (csv or xml) + * @param TDbCreatorFeatures feature type - relevant in case + * of csv input as feature is not detected by the reader. + */ + CReaderBase( TDbCreatorInputFile aFileType, + TDbCreatorFeatures aFeature ); + + /** + * Second phase constructor. Leaves on failure. + * @param aInFileName Name of the input file. + */ + void ConstructL( const TDesC& aInFileName ); + + public: + + /** + * Locates the next feature in input file. + */ + virtual void LocateFeatureL() = 0; + + /** + * Gives back the next line from the given buffer. + * @return EFalse if the end of buffer is accessed, ETrue otherwise. + */ + virtual TBool LocateAPL() = 0; + + /** + * Parses a line of the input file. + */ + virtual void ParseAPL() = 0; + + /** + * Resets the actual file position to the beginning of the file. + * @return One of the system-wide error codes if reset failed. + */ + virtual TInt Reset() = 0; + + /** + * Writes log to the log file. + */ + virtual void ToDoLog() = 0; + + /** + * Returns reference to the TagContainer + * @return CTagContainer + */ + CTagContainer& TagContainer(); + + /** + * Returns reference to the input file + * @return RFile + */ + RFile& InputFile(); + + /** + * Returns reference to the logger + * @return RFileLogger + */ + RFileLogger& FileLogger(); + + /** + * Checks if filed ID is read from the input file (otherwise it is + * calculated by reader according to the index of the tag) + * @return TRUE if reader reads the field id + */ + TBool FieldIDPresent(); + + /** + * Returns the feature currently being parsed + * @return TDbCreatorFeatures + * - EFeatureNone - No feature found + * - EFeatureAP - Internet access point + * - EFeatureWLAN - WLAN access point + * - EFeatureVPN - VPN access point + */ + TDbCreatorFeatures CurrentFeature(); + + protected: + // @var marks the found feature that is being processed + TDbCreatorFeatures iCurrentFeature; + + private: + + // @var contains the values read from input file + CTagContainer* iTagContainer; + // @var for file handling. + RFs iFs; + // @var Input file. + RFile iInputFile; + // @var Log file. + RFileLogger iLogFile; + // @var Input file type + TDbCreatorInputFile iFileType; + + }; + + + +#endif // READER_BASE_H + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcreaderxml.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcreaderxml.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,231 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CReaderXML. +* +*/ + + + + +#ifndef XML_READER_H +#define XML_READER_H + + +// INCLUDE FILES +#include + +#include "cdcreaderbase.h" + +// COSTANTS +enum TParamSegment + { + EParamName, + EParamValue + }; + +class EInputParams +{ + public: + + inline EInputParams( const TInt aId, const TDesC16& aParam ) : + iId( aId ), + iParam( aParam ) + { + //no implementation required + }; + + const TInt iId; + const TDesC16& iParam; +}; + + +// CLASS DECLARATION + +/** +* CReaderXML. +* Reads and parses XML input. Capable of locating and reading Internet, WLAN +* and VPN access points. +*/ +class CReaderXML : public CReaderBase + { + + public: + /** + * Two-phase constructor. + * @param aInFileName the input file name + * @param aCharSet the input characterset + * @return CReaderXML instance + */ + static CReaderXML* NewLC( const TDesC& aInFileName, + const TDbCreatorInputCharSet aCharSet ); + + /** + * Destructor. + */ + virtual ~CReaderXML(); + + protected: + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Default constructor. + */ + CReaderXML( const TDbCreatorInputCharSet aCharSet ); + + public: + + /** + * Locates the next feature in XML file. + */ + virtual void LocateFeatureL(); + + /** + * Gives back the next line from the given buffer. + * @return - EFalse if the end of buffer is accessed, + * - ETrue otherwise. + */ + virtual TBool LocateAPL(); + + /** + * Parses a line of the input file. + */ + virtual void ParseAPL(); + + /** + * Resets the actual file position to the beginning of the file. + * @return One of the system-wide error codes if reset failed. + */ + virtual TInt Reset(); + + /** + * Writes log to the log file. + */ + virtual void ToDoLog(); + + private: + /** + * Reads one line of the input file. + * @return - KErrNone if the whole line is read successfully. + * - KErrEof if end of file is reached + * - KErrNotFound if line delimiter is not found + * - KErrGenereal in case of any other error + */ + TInt ReadLineL(); + + /** + * Extracts one line from the buffer read by ReadLineL + * @param const TPtrC16& aBuffer reference to the buffer descriptor + * @param TPtrC16& aLine reference to the line descriptor + * @return - KErrNone if the whole line is read successfully. + * - KErrEof if end of file is reached + * - KErrNotFound if line delimiter is not found + * - KErrGenereal in case of any other error + */ + TInt ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine); + + /** + * Detects the head of feature segment + * @return the detected feature : + * - EFeatureNone : No feature found + * - EFeatureAP : Internet access point + * - EFeatureWLAN : WLAN access point + * - EFeatureVPN : VPN access point + */ + TDbCreatorFeatures DetectFeatureHead(); + + /** + * Detects the tail of feature segment + * @return TRUE if the current line contains the tail of feature + */ + TBool DetectFeatureTail(); + + /** + * Detects the tail of access point data segment + * @return TRUE if the current line contains the tail + */ + TBool DetectTailAP(); + + /** + * Detects the parameter of access point data segment + * @return TInt the ID the matching field id of the parameter + */ + TInt DetectParam(); + + /** + * Reads the parameter value + * @param aSegment - the required segment of the param + * EParamName - name + * EParamValue - value + * ParamValue + * @return pointer to the tag read from the input file. Memory is + * allocated by the function. NULL can be returned. + */ + HBufC16* ReadParam( TParamSegment aSegment ); + + /** + * Detects the encoding of the xml input. If detection fails leaves + * ECharSetAscii as default character set. + */ + void DetectEncodingL(); + + + /** + * Fills the parameter arrays with the id-name pairs + */ + void FillPacketDataParams(); + void FillLanParams(); + void FillWLanParams(); + void FillVpnParams(); + void FillGlobalParams(); + void FillDNParams(); + + /** + * Replace special XML chars in connecton method names + */ + void ConvertSpecialXMLChars( HBufC* aPtrTag ); + void ReplaceInString( HBufC* aPtrTag, const TDesC& aSpXML, + const TDesC& aSp ); + + private: + + // @var Holds the actual file position + TInt iFilePos; + + // @var Input character set + TDbCreatorInputCharSet iCharSet; + + // @var holds the line + HBufC16* iLine; + + // @var true if global settings are found + TBool iFoundGlobal; + + RArray iPDParams; + RArray iLanParams; + RArray iWLanParams; + RArray iVpnParams; + RArray iGlobalParams; + RArray iDNParams; + + + }; + + +#endif // XML_READER_H + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdctagcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdctagcontainer.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,120 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CTagContainer. +* +*/ + + + +#ifndef TAG_CONTAINER_H +#define TAG_CONTAINER_H + +// INCLUDE FILES + +#include + +// CLASS DECLARATION +/** +* CTagContainer +* contains and manages the fields read form XML or CSV input file +*/ +class CTagContainer : public CBase + { + //TYPE DECLARATION + private: + + /** + * ETag + * contains one tag and the belonging field id + */ + class ETag + { + public: + //constructor & destructor + ETag( HBufC16* aTag, TInt aFieldId ); + ~ETag(); + + //attributes + TInt iFieldId; ///< field id tag belongs to + HBufC16* iTag; ///< tag is the data segment read from file + ///< created elsewhere but owned by ETag + ///< and deallocated by ETag's destructor + }; + + public: + + /** + * Two-phase constructor. + */ + static CTagContainer* NewL(); + + /** + * Destructor. + */ + ~CTagContainer(); + + private: + + /** + * Second phase constructor. Leaves on failure. + */ + void ConstructL(); + + /** + * Constructor + */ + CTagContainer(); + + public: + + /** + * Clears the array and deallocates all reserved memory + */ + void Clear(); + + /** + * Adds a new tag to the array + * @param aTag is a pointer to the tag + */ + void AddL(HBufC16* aTag, TInt aFieldId); + + /** + * Retrieves a tag identified by its index + * @param aIdx is the index of the tag + * @return HBufC16* pointer to the tag + */ + HBufC16* Tag(TUint aIdx); + + /** + * Retrieves the field ID + * @param aIdx is the index of the tag + * @return HBufC16* pointer to the tag + */ + TInt FieldId(TUint aIdx); + + /** + * Counts the number of tags + * @return TInt is the number of tags + */ + TInt Count(); + + private: + + // @var Dynamic array for holding tags + CArrayPtrSeg* iTags; + + }; + + +#endif //TAG_CONTAINER_H \ No newline at end of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcwlandevicesettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcwlandevicesettings.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CWlanDeviceSettings. +* +*/ + + + +#ifndef WLANDEVICESETTINGS_H +#define WLANDEVICESETTINGS_H + +// INCLUDES +#include +#include + +#define DEBUG( a ) +#define DEBUG1( a, b ) + +using namespace CommsDat; + +// FORWARD DECLARATIONS + +// CLASS DECLARATION + +/** +* Interface to read and write WLAN device specific settings. +* The data is stored in CommsDB. +*/ +NONSHARABLE_CLASS( CWlanDeviceSettings ): public CBase + { +public: + + NONSHARABLE_STRUCT( SWlanDeviceSettings ) + { + //Is WLAN indication icon been showed in UI. + TUint32 backgroundScanInterval; + //Stores the previously set background scan interval. + TUint32 savedBgScanInterval; + //If - ETrue default values are being used, + // - EFalse use the user defined values. + TBool useDefaultSettings; + //How many times packets bigger than 'rts' are been resent. + TUint32 longRetry; + //How many times packets smaller than 'rts' are been resent. + TUint32 shortRetry; + //Min. size of a packet that CTS/RTS handshake is been used. + TUint32 rts; + //Transmission power level in use. In mWs. + TUint32 txPowerLevel; + //Are the radio measurements allowed. + TBool radioMeasurements; + //Is WLAN in power mode enabled + TBool powerMode; + }; + + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CWlanDeviceSettings* NewL(); + + /** + * Destructor. + */ + virtual ~CWlanDeviceSettings(); + + // New methods + + /** + * Returns the default WLAN device settings. + * @param aSettings Default WLAN device settings + */ + static void GetDefaultSettings( SWlanDeviceSettings& aSettings ); + + private: //Methods + + /** + * C++ default constructor. + */ + CWlanDeviceSettings(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Fills a WLAN device settings record with default data. + * @param aTableType 0 for default settings, 1 for user settings. + * @param aRecord pointer to commsdat table view + */ + void FillRecordL( TUint32 aTableType, CMDBGenericRecord* aRecord ); + + /** + * Open database table. + */ + void OpenTableL(); + + private: // Data + + //@var session - Owned + CMDBSession* iSession; + }; + +#endif // WLANDEVICESETTINGS_H + +// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/inc/cdcwlantables.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/inc/cdcwlantables.h Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Declaration of the class CWlanTables. +* +*/ + + + + +#ifndef WLANTABLESHANDLER_H +#define WLANTABLESHANDLER_H + + +// INCLUDES +#include +#include +#include +#include + +using namespace CommsDat; + +// FORWARD DECLARATIONS + +// CONSTANTS + +// CLASS DECLARATION + +/** +* CWlanTables +* Capable of checking the existence of certain WLAN specific +* tables and - if necessry create them. +*/ +class CWlanTables : public CBase + { + public: + + /** + * Static constructor + */ + static CWlanTables* NewL(); + + /** + * Destructor + */ + virtual ~CWlanTables(); + + /** + * Checks if WLAN tables exist. Creates them if not. + */ + void CheckAndCreateTablesL(); + + + private: + + /** + * C++ default constructor. + */ + CWlanTables(); + + /** + * By default Symbian second phase constructor is private. + */ + void ConstructL(); + + /** + * Check if WLAN Service Table exists in CommsDat; create if not. + */ + void CreateWlanServiceTableL(); + + /** + * Check if WLAN Device Table exists in CommsDat; create if not. + */ + void CreateWlanDeviceSettingsTableL(); + + /** + * Check if WLAN Secondary SSID Table exists in CommsDat; create if not. + */ + void CreateWlanSecSSIDTableL(); + + /** + * Check if WLAN bearer record exists in LANBearer table in CommsDat; create if not. + */ + void CreateWlanBearerRecordL(); + + + + private: // Data + + //@var session - Owned + CMDBSession* iSession; + }; + +#endif // WLANTABLESHANDLER_H + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdccommsdatcreator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdccommsdatcreator.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,638 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Module for creating CommsDat from an input file +* +*/ + + + + +// INCLUDE FILES + +#include "cdccommsdatcreator.h" +#include "cdclogger.h" +#include "cdcreaderxml.h" +#include "cdcprocessorpacketdata.h" +#include "cdcprocessorwlan.h" +#include "cdcprocessorlan.h" +#include "cdcprocessorvpn.h" +#include "cdcprocessordn.h" +#include "cdcprocessorglobal.h" +#include "cdcwlantables.h" +#include "cdcwlandevicesettings.h" +#include "cdcdatamobilitytables.h" +#include "cdcdumptables.h" +#include "centralrepository.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + + +// CONSTANTS +//maximum length of access point name +const TInt KLengthOfExtention = 4; + +//extension +_LIT16( KExtensionXML, ".xml" ); //XML file + + +//----------------------------------------------------------------------------- +// CCdcCommsDatCreator::NewL() +//----------------------------------------------------------------------------- +// +EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewL() + { + CCdcCommsDatCreator* self = NewLC(); + CleanupStack::Pop( self ); // self + + return self; + } + + +//----------------------------------------------------------------------------- +// CCdcCommsDatCreator::NewLC() +//----------------------------------------------------------------------------- +// +EXPORT_C CCdcCommsDatCreator* CCdcCommsDatCreator::NewLC() + { + CCdcCommsDatCreator* self = new (ELeave) CCdcCommsDatCreator(); + CleanupStack::PushL( self ); + self->ConstructL(); + + return self; + } + + +//------------------------------------------------ +// CDbCreator::CreateTablesL +//------------------------------------------------ +// +EXPORT_C void CCdcCommsDatCreator::CreateTablesL() + { + CLOG_WRITE( "=====================\n" ) + CLOG_WRITE( "Creating tables ...\n" ) + CLOG_WRITE( "=====================\n" ) + + + //extends architecture of CommsDat + //creates WLAN tables + //------------------------------- + if ( iIsWlanS ) + { + CLOG_WRITE( "Creates WLAN service tables\n" ) + CLOG_WRITE( "---------------------------\n" ) + + CWlanTables* wlanTables = CWlanTables::NewL(); + CleanupStack::PushL( wlanTables ); + wlanTables->CheckAndCreateTablesL(); + + CleanupStack::PopAndDestroy( wlanTables ); + + // WLAN Device Settings Table. + CLOG_WRITE( "Writes Default settings to WLAN Device Settings Table.\n" ) + + // Creating a settings object does it all. + CWlanDeviceSettings* wlanDeviceSettings = CWlanDeviceSettings::NewL(); + delete wlanDeviceSettings; + } + + CLOG_WRITE( "CDataMobilityTables\n" ) + + //extends architecture of CommsDat + //creates Data Mobility tables + //---------------------------- + CDataMobilityTables* dmTables = CDataMobilityTables::NewL(); + CleanupStack::PushL( dmTables ); + + CLOG_WRITE( "Creates Data Mobility ALR tables\n" ) + CLOG_WRITE( "--------------------------------\n" ) + dmTables->CheckAndCreateAlrTablesL(); + + CLOG_WRITE( "Creates Data Mobility MIP tables\n" ) + CLOG_WRITE( "--------------------------------\n" ) + dmTables->CheckAndCreateMipTablesL(); + + CleanupStack::PopAndDestroy( dmTables ); + + //if there is only an "e" parameter then DbCreator extends CommsDat, but + //does not create access points. This functionality earlier was done + //by WlanToCDb modul. + } + + +//------------------------------------------------ +// CDbCreator::CreateCommsDatL +//------------------------------------------------ +// +EXPORT_C void CCdcCommsDatCreator::CreateCommsDatL( const TFileName& aInFileName ) + { + CLOG_WRITE( "=====================\n" ) + CLOG_WRITE( "Processing started...\n" ) + CLOG_WRITE( "=====================\n" ) + + TDbCreatorInputCharSet charSet( ECharSetUnknown );//input character set + + //Creates access points + //---------------------- + + if ( InputFileType( aInFileName ) == EFileXML ) + { + CLOG_WRITE( "Tries to open file"); + // Logs file name + HBufC *fileName = aInFileName.AllocLC(); + CLOG_WRITE_FORMAT( "Input file : %S\n", fileName ) + CleanupStack::PopAndDestroy( fileName ); + + delete iReader; + iReader = NULL; + iReader = CReaderXML::NewLC( aInFileName, charSet ); + CleanupStack::Pop(iReader); + + //locates feature in xml file + iReader->LocateFeatureL(); + } + else + { + User::Leave( KErrInvalidExtension ); + } + + + TBool found( EFalse ); + + // First, add all destinations to the database. Connection methods and + // embedded destinations are not added at this time. + while ( iReader->CurrentFeature() != EFeatureNone && !found ) + { + if( iReader->CurrentFeature() == EFeatureDN ) + { + ProcessDNL( iCmInDest, ETrue ); + } + iReader->LocateFeatureL(); + } + + // Reset input file + iReader->Reset(); + iReader->LocateFeatureL(); + + // Then add connection methods, and assign them to destinations if + // needed + while ( iReader->CurrentFeature() != EFeatureNone ) + { + switch ( iReader->CurrentFeature() ) + { + case EFeaturePacketData: + { + //creates GPRS access point + CLOG_WRITE( "Feature found : Packet Data Access point(s)\n" ) + + iFileProcessor = CProcessorPacketData::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iLingerSettings ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + + break; + } + + case EFeatureWLAN: + { + if( iIsWlanS ) + { + //creates WLAN access point + CLOG_WRITE( "Feature found : WLAN Access point(s)\n" ) + + // Reset the EAP settings just to be safe although it should be empty always here. + iEapSettings.ResetAndDestroy(); + + iFileProcessor = CProcessorWlan::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iWlanSecurity, + iEapSettings ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + + } + break; + } + + case EFeatureLAN: + { + //creates LAN access point + CLOG_WRITE( "Feature found : LAN Access point(s)\n" ) + + iFileProcessor = CProcessorLan::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + break; + } + + case EFeatureVPN: + { + //creates VPN access point + CLOG_WRITE( "Feature found : VPN Access point(s)\n" ) + CLOG_WRITE( "-----------------------------------\n" ) + + iFileProcessor = CProcessorVpn::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iUnderLying ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + + break; + } + + case EFeatureDN: + { + + ProcessDNL( iCmInDest, EFalse ); + + break; + } + + case EFeatureGlobal: + { + // Valid tag but does nothing now. + // Global can be processed at the last end. + + + //sets global settings + CLOG_WRITE( "Feature found : Global settings\n" ) + CLOG_WRITE( "-------------------------------\n" ) + + iFileProcessor = CProcessorGlobal::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iDestArray, + iDestNames ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + + break; + } + + default: + User::Panic( KPanicInvalidCase, KErrInvalidCase ); + + }//switch + + //gets next feature + iReader->LocateFeatureL(); + + }//while + + + // Updates the IAPs that are not in destinations. + UpdateUncatCmsL( iCmInDest ); + + // Sets the underlying IAP/SNAPS for vpn IAPs + SetUnderlyingIapL( iUnderLying ); + + for( TInt i(0); i < iWlanSecurity.Count(); i++ ) + { + CLOG_WRITE_FORMAT( "Sec Pos: %d", i ); + if( iWlanSecurity[i] != NULL ) + { + CLOG_WRITE_FORMAT( "Sec data: %S", iWlanSecurity[i] ); + } + else + { + CLOG_WRITE( "Sec data NULL" ); + } + } + + // Sets the WLAN security paramters including EAP settings + SetWlanSecurityL( iWlanSecurity ); + + // Sets linger settings + SetLingerSettingsL( iLingerSettings ); + + // Logs IAPs in UDEB mode + #ifdef _DEBUG + LogIapIdsL(); + #endif +} + +//------------------------------------------------ +// CCdcCommsDatCreator::DumpCommsDatL +//------------------------------------------------ +// +EXPORT_C void CCdcCommsDatCreator::DumpCommsDatL( const TFileName& aOutFileName ) + { + CLOG_WRITE( "==========================\n" ) + CLOG_WRITE( "Dump processing started...\n" ) + CLOG_WRITE( "==========================\n" ) + + + CDumpTables* dump = CDumpTables::NewLC(); + dump->DoDumpTablesL( aOutFileName ); + CleanupStack::PopAndDestroy( dump ); //dump + + CLOG_WRITE( "======== end dump =========\n" ) + + } + +//------------------------------------------------ +// CCdcCommsDatCreator::CCdcCommsDatCreator +//------------------------------------------------ +// +CCdcCommsDatCreator::CCdcCommsDatCreator() + { + } + +//------------------------------------------------ +// CCdcCommsDatCreator::~CCdcCommsDatCreator +//------------------------------------------------ +// +CCdcCommsDatCreator::~CCdcCommsDatCreator() + { + delete iReader; + + iEapSettings.ResetAndDestroy(); + + for ( TInt i = 0; i < iPluginArray.Count(); i++ ) + { + iPluginArray[i]->Close(); + } + iPluginArray.ResetAndDestroy(); + iPluginNames.ResetAndDestroy(); + + for ( TInt i = 0; i < iDestArray.Count(); i++ ) + { + iDestArray[i]->Close(); + } + iDestArray.ResetAndDestroy(); + + iDestNames.ResetAndDestroy(); + + iUnderLying.ResetAndDestroy(); + + iWlanSecurity.ResetAndDestroy(); + + iLingerSettings.ResetAndDestroy(); + + iCmInDest.Close(); + + iCmManager.Close(); + } + + +//------------------------------------------------ +// CCdcCommsDatCreator::ConstructL +//------------------------------------------------ +// +void CCdcCommsDatCreator::ConstructL() + { + CLOG_WRITE( "Initialising FeatureManager\n" ) + //checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + FeatureManager::UnInitializeLib(); + CLOG_WRITE( "FeatureManager closed\n" ) + + iCmManager.OpenL(); + } + +//------------------------------------------------ +// CCdcCommsDatCreator::InputFileType +//------------------------------------------------ +// +TUint CCdcCommsDatCreator::InputFileType( const TFileName& aFileName ) + { + TBuf extension; + + //get extension + extension.Copy( aFileName.Right( KLengthOfExtention ) ); + + TDbCreatorInputFile type ( EFileUnknown ); + + if ( extension.CompareF( KExtensionXML ) == 0 ) + { + type = EFileXML; + } + else + { + //type keeps default value + } + + return type; + + } + + +//------------------------------------------------ +// CCdcCommsDatCreator::UpdateUncatCmsL +//------------------------------------------------ +// +void CCdcCommsDatCreator::UpdateUncatCmsL( RArray< TBool >& aCmInDest ) + { + CLOG_WRITE( "-------------------------------\n" ) + CLOG_WRITE( "Uncategorised Cms:\n" ) + + // No destination defined + if( aCmInDest.Count() == 0 ) + { + for( TInt i(0); i < iPluginArray.Count(); i++ ) + { + iPluginArray[i]->UpdateL(); + CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] ); + } + } + else + { + + for( TInt i(0); i < iPluginArray.Count(); i++ ) + { + if( aCmInDest[ i ] == EFalse ) + { + iPluginArray[i]->UpdateL(); + CLOG_WRITE_FORMAT( "Uncat CM Name: %S", iPluginNames[i] ); + } + } + } + + CLOG_WRITE( "-------------------------------\n" ) + } + + +//------------------------------------------------ +// CCdcCommsDatCreator::LogIapIdsL +//------------------------------------------------ +// +void CCdcCommsDatCreator::LogIapIdsL() + { + for( TInt i(0); i < iPluginArray.Count(); i++ ) + { + TUint32 uid1 = iPluginArray[i]->GetIntAttributeL( CMManager::ECmId ); + CLOG_WRITE_FORMAT( "IAP Name: %S", iPluginNames[i] ); + CLOG_WRITE_FORMAT( "ID: %d\n", uid1 ); + } + + for( TInt i(0); i < iDestArray.Count(); i++ ) + { + TUint32 uid1 = iDestArray[i]->Id(); + CLOG_WRITE_FORMAT( "SNAP Name: %S", iDestNames[i] ); + CLOG_WRITE_FORMAT( "ID: %d\n", uid1); + } + } + +// --------------------------------------------------------- +// CCdcCommsDatCreator::ProcessDNL +// --------------------------------------------------------- +// +void CCdcCommsDatCreator::ProcessDNL( RArray< TBool >& aCmInDest, + TBool aFirstRound ) + { + CLOG_WRITE( "Feature found : Destination Network(s)\n" ) + CLOG_WRITE( "--------------------------------------\n" ) + + + if( !aFirstRound ) + { + for( TInt i(0); i < iPluginArray.Count(); i++ ) + { + aCmInDest.Append( EFalse ); + } + } + + iFileProcessor = CProcessorDN::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iDestArray, + iDestNames, + aCmInDest, + aFirstRound ); + iFileProcessor->ParseFileL(); + + delete iFileProcessor; + iFileProcessor = NULL; + CLOG_WRITE( "--------------------------------------\n" ) + } + +// --------------------------------------------------------- +// CCdcCommsDatCreator::SetUnderlyingIapL +// --------------------------------------------------------- +// +void CCdcCommsDatCreator::SetUnderlyingIapL( RPointerArray< HBufC >& aUnderLying ) + { + // Sets the underlying IAP/SNAPS for vpn IAPs + if( aUnderLying.Count() > 0 ) + { + CLOG_WRITE_FORMAT( "SetUnderlyingIapL: %d\n", aUnderLying.Count() ) + CLOG_WRITE( "--------------------------------------\n" ) + + CProcessorVpn* vpn = CProcessorVpn::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + aUnderLying ); + + CleanupStack::PushL( vpn ); + vpn->ProcessUnderLyingL( iDestArray, iDestNames ); + + + CleanupStack::PopAndDestroy( vpn ); + + CLOG_WRITE( "--------------------------------------\n" ) + } + } + + +// --------------------------------------------------------- +// CCdcCommsDatCreator::SetUnderlyingIapL +// --------------------------------------------------------- +// +void CCdcCommsDatCreator::SetWlanSecurityL( RPointerArray< HBufC >& aWlanSecurity ) + { + if( aWlanSecurity.Count() > 0 + || iEapSettings.Count() > 0 ) + { + CLOG_WRITE_FORMAT( "SetWlanSecurityL: %d\n", aWlanSecurity.Count() ); + CLOG_WRITE_FORMAT( "SetWlanSecurityL: EAPs: %d\n", iEapSettings.Count() ); + CLOG_WRITE( "--------------------------------------\n" ) + + CProcessorWlan* wlan = CProcessorWlan::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + aWlanSecurity, + iEapSettings); + + CleanupStack::PushL( wlan ); + wlan->SaveSecurityInfoL(); + + CleanupStack::PopAndDestroy( wlan ); + + // EAP settings were saved. Delete them. + iEapSettings.ResetAndDestroy(); + + CLOG_WRITE( "--------------------------------------\n" ) + } + } + +// --------------------------------------------------------- +// CCdcCommsDatCreator:::SetLingerSettingsL +// --------------------------------------------------------- +// +void CCdcCommsDatCreator::SetLingerSettingsL( + RPointerArray< CLingerElement >& aLingerSettings ) + { + CLOG_WRITE_FORMAT( "SetLingerSettingsL: %d\n", aLingerSettings.Count() ); + if ( aLingerSettings.Count() > 0 ) + { + CProcessorPacketData* pdp = CProcessorPacketData::NewL( iReader, + iCmManager, + iPluginArray, + iPluginNames, + iLingerSettings ); + + CleanupStack::PushL( pdp ); + pdp->SaveLingerSettingsL(); + + CleanupStack::PopAndDestroy( pdp ); + } + CLOG_WRITE( "--------------------------------------\n" ) + } + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcdatamobilitytables.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcdatamobilitytables.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,613 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CDataMobilityTables +* +*/ + + + + +// INCLUDE FILES +#include "cdcdatamobilitytables.h" +#include "cdclogger.h" + +#include +#include +#include +#include +#include + +// CONSTANTS + +// Maximum bearer type name length +const TUint KMaxNameLength = 50; + +// Default bearer priorities +const TUint KDefaultPriorityLan = 0; +const TUint KDefaultPriorityWlan = 1; +const TUint KDefaultPriorityPan = 2; +const TUint KDefaultPriorityGprsOut = 3; +const TUint KDefaultPriorityGprsIn = 4; +const TUint KDefaultPriorityDialOut = 6; +const TUint KDefaultPriorityDialIn = 7; +const TUint KDefaultUIPriorityVpn = 253; +const TUint KDefaultUIPriorityMip = 254; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CDataMobilityTables::NewL +// --------------------------------------------------------- +// +CDataMobilityTables* CDataMobilityTables::NewL() + { + + CDataMobilityTables* self = new ( ELeave ) CDataMobilityTables; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CDataMobilityTables +// --------------------------------------------------------- +// +CDataMobilityTables::CDataMobilityTables() + { + //no implementation needed + } + + +// --------------------------------------------------------- +// CDataMobilityTables::ConstructL +// --------------------------------------------------------- +// +void CDataMobilityTables::ConstructL() + { + //no implementation needed + iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); + } + + +// --------------------------------------------------------- +// CDataMobilityTables::~CDataMobilityTables +// --------------------------------------------------------- +// +CDataMobilityTables::~CDataMobilityTables() + { + if ( iSession ) + { + iSession->Close(); + delete iSession; + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CheckAndCreateAlrTablesL +// --------------------------------------------------------- +// +void CDataMobilityTables::CheckAndCreateAlrTablesL() + { + CreateVirtualIAPNextLayerTableL(); + CreateGlobalBearerTypeTableL(); + PopulateGlobalBearerTypeTableL(); + CreateDataMobilitySelectionPolicyTableL(); + CreateSNAPMetadataTableL(); + CreateIAPMetadataTableL(); + CreateDestNetworkTableL(); + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CheckAndCreateMipTablesL +// --------------------------------------------------------- +// +void CDataMobilityTables::CheckAndCreateMipTablesL() + { + CreateMIPServiceTableL(); + CreateMIP4TableL(); + CreateMIP6TableL(); + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateGlobalBearerTypeTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateGlobalBearerTypeTableL() + { + //Check whether Global Bearer Type Priorization table exists + TInt error( KErrNone ); + + TRAP( error, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDGlobalBearerTypePriorizationRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDGlobalBearerTypePriorizationRecord::TableIdL( *iSession ) ); + if( id >= KErrNone ) + { + CLOG_WRITE( "Added Global Bearer Type Priorization table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add Global Bearer Type Priorization\ + table: %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE ( "Global Bearer Type Priorization table already exists" ) + } + else + { + //do nothing + } + } + + +// ------------------------------------------------------------ +// CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL +// ------------------------------------------------------------ +// +void CDataMobilityTables::CreateDataMobilitySelectionPolicyTableL() + { + //Check whether Data Mobility Selection Policy table exists + TInt error( KErrNone ); + TRAP( error, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDDataMobilitySelectionPolicyRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDDataMobilitySelectionPolicyRecord::TableIdL( *iSession ) ); + if( id >= KErrNone ) + { + CLOG_WRITE( "Added Data Mobility Selection Policy table\n" ) + } + else + { + CLOG_WRITE_FORMAT( + "Failed to add Data Mobility Selection Policy table. %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "Data Mobility Selection Policy table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateMIPServiceTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateMIPServiceTableL() + { + //Check whether MIP Service table exists + TInt error( KErrNone ); + TRAP( error, CCDMIPServiceExtRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDMIPServiceExtRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDMIPServiceExtRecord::TableIdL( *iSession ) ); + if( KErrNone <= id ) + { + CLOG_WRITE( "Added MIP Service table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add MIP Service table: %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "MIP Service table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateMIP4TableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateMIP4TableL() + { + //Check whether MIP4 table exists + TInt error( KErrNone ); + TRAP( error, CCDMIP4Record::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDMIP4Record::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDMIP4Record::TableIdL( *iSession ) ); + if( KErrNone <= id ) + { + CLOG_WRITE( "Added MIP4 table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add MIP4 table: %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "MIP4 table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateMIP6TableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateMIP6TableL() + { + //Check whether MIP6 table exists + TInt error( KErrNone ); + TRAP( error, CCDMIP6Record::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDMIP6Record::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDMIP6Record::TableIdL( *iSession ) ); + if( KErrNone <= id ) + { + CLOG_WRITE( "Added MIP6 table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add MIP6 table %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "MIP6 table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateSNAPMetadataTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateSNAPMetadataTableL() + { + //Check whether SNAP Metadata table exists + TInt error( KErrNone ); + TRAP( error, CCDSNAPMetadataRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDSNAPMetadataRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDSNAPMetadataRecord::TableIdL( *iSession ) ); + if( KErrNone <= id ) + { + CLOG_WRITE( "Added SNAP Metadata table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add SNAP Metadata table? %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "SNAP Metadata table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateIAPMetadataTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateIAPMetadataTableL() + { + //Check whether IAP Metadata table exists + TInt error( KErrNone ); + TRAP( error, CCDIAPMetadataRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDIAPMetadataRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDIAPMetadataRecord::TableIdL( *iSession ) ); + if( KErrNone <= id ) + { + CLOG_WRITE( "Added IAP Metadata table\n" ) + } + else + { + CLOG_WRITE_FORMAT( "Failed to add IAP Metadata table: %d\n", id ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "IAP Metadata table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CDataMobilityTables::CreateVirtualIAPNextLayerTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateVirtualIAPNextLayerTableL() + { + //Check whether IAP Metadata table exists + TInt error( KErrNone ); + TRAP( error, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) ); + + //Table not found -> create it + if( error == KErrNotFound ) + { + //Add table to CommsDat + CCDVirtualIAPNextLayerRecord::CreateTableL( *iSession ); + + //check result + TInt id( KErrNone ); + TRAP( id, CCDVirtualIAPNextLayerRecord::TableIdL( *iSession ) ); + if( KErrNone > id ) + { + CLOG_WRITE_FORMAT( "Failed to add Virtual IAP Next Layer table %d\n", id ) + } + else + { + CLOG_WRITE( "Added Virtual IAP Next Layer table\n" ) + } + } + //Table already exists + else if ( error == KErrNone) + { + CLOG_WRITE( "Virtual IAP Next Layer table already exists" ) + } + else + { + //do nothing + } + } + +// --------------------------------------------------------- +// CreateDestNetworkTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::CreateDestNetworkTableL() + { + //checks whether table exists + TInt error( KErrNone ); + + TRAP( error, CCDDestNWTable::TableIdL( *iSession ) ); + if( error == KErrNotFound ) + { + //table not found -- add new table + CCDDestNWTable::CreateTableL( *iSession ); + + //check result + TRAP( error, CCDDestNWTable::TableIdL( *iSession ) ); + + if ( error == KErrNone ) + { + CLOG_WRITE( "Added Destination Network table" ) + } + } + else if ( error == KErrNone) + { + CLOG_WRITE( "Destination Network table already exists" ) + } + else + { + //do nothing + } + } + +// --------------------------------------------------------- +// CDataMobilityTables::PopulateGlobalBearerTypeTableL +// --------------------------------------------------------- +// +void CDataMobilityTables::PopulateGlobalBearerTypeTableL() + { + RCmManagerExt cmManager; + cmManager.CreateTablesAndOpenL(); + + CleanupClosePushL( cmManager ); + + RArray< TBearerPriority >* bearerArray = new( ELeave ) + RArray< TBearerPriority >(); + + CleanupStack::PushL( bearerArray ); + + // Check if the bearer table has already been filled + // (and skip populating in this case) + + cmManager.BearerPriorityArrayL( *bearerArray ); + + if( !bearerArray->Count() ) + { + // Prepare bearer priority array + // Strings are needed to be available until the update of the bearer array + // (TBearerPriority has a HBufC* member) + HBufC* lanServiceName = HBufC::NewLC( KMaxNameLength ); + *lanServiceName = TPtrC( KCDTypeNameLANService ); + HBufC* wLanServiceName = HBufC::NewLC( KMaxNameLength ); + *wLanServiceName = TPtrC( KCDTypeNameWLANServiceExt ); + HBufC* panServiceName = HBufC::NewLC( KMaxNameLength ); + *panServiceName = TPtrC( KCDTypeNamePANServiceExt ); + HBufC* gprsOutServiceName = HBufC::NewLC( KMaxNameLength ); + *gprsOutServiceName = TPtrC( KCDTypeNameOutgoingWCDMA ); + HBufC* gprsInServiceName = HBufC::NewLC( KMaxNameLength ); + *gprsInServiceName = TPtrC( KCDTypeNameIncomingWCDMA ); + HBufC* dialOutServiceName = HBufC::NewLC( KMaxNameLength ); + *dialOutServiceName = TPtrC( KCDTypeNameDialOutISP ); + HBufC* dialInServiceName = HBufC::NewLC( KMaxNameLength ); + *dialInServiceName = TPtrC( KCDTypeNameDialInISP ); + HBufC* vpnServiceName = HBufC::NewLC( KMaxNameLength ); + *vpnServiceName = TPtrC( KCDTypeNameVPNService ); + HBufC* mipServiceName = HBufC::NewLC( KMaxNameLength ); + *mipServiceName = TPtrC( KCDTypeNameMIPServiceExt ); + + bearerArray->Reset(); + + TBearerPriority lanRecord; + lanRecord.iServiceType = lanServiceName; + lanRecord.iPriority = KDefaultPriorityLan; + lanRecord.iUIPriority = KDefaultPriorityLan; + bearerArray->Append( lanRecord ); + + TBearerPriority wLanRecord; + wLanRecord.iServiceType = wLanServiceName; + wLanRecord.iPriority = KDefaultPriorityWlan; + wLanRecord.iUIPriority = KDefaultPriorityWlan; + bearerArray->Append( wLanRecord ); + + TBearerPriority panRecord; + panRecord.iServiceType = panServiceName; + panRecord.iPriority = KDefaultPriorityPan; + panRecord.iUIPriority = KDefaultPriorityPan; + bearerArray->Append( panRecord ); + + TBearerPriority gprsOutRecord; + gprsOutRecord.iServiceType = gprsOutServiceName; + gprsOutRecord.iPriority = KDefaultPriorityGprsOut; + gprsOutRecord.iUIPriority = KDefaultPriorityGprsOut; + bearerArray->Append( gprsOutRecord ); + + TBearerPriority gprsInRecord; + gprsInRecord.iServiceType = gprsInServiceName; + gprsInRecord.iPriority = KDefaultPriorityGprsIn; + gprsInRecord.iUIPriority = KDefaultPriorityGprsIn; + bearerArray->Append( gprsInRecord ); + + TBearerPriority dialOutRecord; + dialOutRecord.iServiceType = dialOutServiceName; + dialOutRecord.iPriority = KDefaultPriorityDialOut; + dialOutRecord.iUIPriority = KDefaultPriorityDialOut; + bearerArray->Append( dialOutRecord ); + + TBearerPriority dialInRecord; + dialInRecord.iServiceType = dialInServiceName; + dialInRecord.iPriority = KDefaultPriorityDialIn; + dialInRecord.iUIPriority = KDefaultPriorityDialIn; + bearerArray->Append( dialInRecord ); + + TBearerPriority vpnRecord; + vpnRecord.iServiceType = vpnServiceName; + vpnRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; + vpnRecord.iUIPriority = KDefaultUIPriorityVpn; + bearerArray->Append( vpnRecord ); + + TBearerPriority mipRecord; + mipRecord.iServiceType = mipServiceName; + mipRecord.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard; + mipRecord.iUIPriority = KDefaultUIPriorityMip; + bearerArray->Append( mipRecord ); + + cmManager.UpdateBearerPriorityArrayL( *bearerArray ); + + CLOG_WRITE( "Global Bearer Priorization table updated with default values\n" ) + + // Only pop, because ownership is passed to the array + CleanupStack::Pop( mipServiceName ); + CleanupStack::Pop( vpnServiceName ); + CleanupStack::Pop( dialInServiceName ); + CleanupStack::Pop( dialOutServiceName ); + CleanupStack::Pop( gprsInServiceName ); + CleanupStack::Pop( gprsOutServiceName ); + CleanupStack::Pop( panServiceName ); + CleanupStack::Pop( wLanServiceName ); + CleanupStack::Pop( lanServiceName ); + } + + else + { + CLOG_WRITE( "Not updating Global Bearer Priorization table\n" ) + } + + cmManager.CleanupGlobalPriorityArray( *bearerArray ); + + CleanupStack::PopAndDestroy( bearerArray ); + CleanupStack::PopAndDestroy( &cmManager ); + } + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcdumptables.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcdumptables.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,453 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorCSD +* +*/ + + + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "cdcdumptables.h" +#include "cdclogger.h" + +// DEFINES + +#define QUERY_HBUFC_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) +#define QUERY_HBUFC8_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) +#define QUERY_UINT32_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) +#define QUERY_INT_FIELD( record, fieldId ) *STATIC_CAST(CommsDat::CMDBField*, record->GetFieldByIdL( fieldId )) + + +// CONSTANTS + +// commons for CSV file creatin +_LIT16( KComma, "," ); +_LIT16( KNewLine, "\n" ); +_LIT16( KCRT, "\r" ); +_LIT16( KDQuote, "\"" ); + +// Table names for CSV file creation +_LIT16( KCDWlanServiceRecord, "CCDWlanService" ); +_LIT16( KCDWlanDeviceSettingsRecord, "CCDWlanDeviceSettings" ); +_LIT16( KCDWLANSecSSIDTable, "CCDWLANSecSSIDTable" ); +_LIT16( KCDDestNWTable, "CCDDestNWTable" ); +_LIT16( KCDVirtualIAPNextLayerRecord,"CCDVirtualIAPNextLayer" ); +_LIT16( KCDDataMobilitySelectionPolicyRecord, "CCDDataMobilitySelectionPolicy" ); +_LIT16( KCDSNAPMetadataRecord, "CCDSNAPMetadata" ); +_LIT16( KCDGlobalBearerTypePriorizationRecord, "CCDGlobalBearerTypePriorization" ); +_LIT16( KCDMIPServiceExtRecord, "CCDMIPServiceExt" ); +_LIT16( KCDIAPMetadataRecord, "CCDIAPMetadata" ); +_LIT16( KCDMIP4Record, "CCDMIP4" ); +_LIT16( KCDMIP6Record, "CCDMIP6" ); + + +// Little-endian Unicode file header. +const TUint16 KLittleEndianUnicodeHeader = 0xFEFF; +// Buffer length for number conversion +const TInt KFormatBufLen = 40; + + +// --------------------------------------------------------- +// CDumpTables::NewL +// --------------------------------------------------------- +// +CDumpTables* CDumpTables::NewL() + { + CDumpTables* self = NewLC(); + CleanupStack::Pop( self ); // self + return self; + } + +// --------------------------------------------------------- +// CDumpTables::NewLC +// --------------------------------------------------------- +// +CDumpTables* CDumpTables::NewLC() + { + CDumpTables* self = new ( ELeave ) CDumpTables(); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + return self; + } + + +// --------------------------------------------------------- +// CDumpTables::~CDumpTables +// --------------------------------------------------------- +// +CDumpTables::~CDumpTables() + { + iRfs.Close(); + if (iSession) + { + iSession->Close(); + delete iSession; + } + } + +// --------------------------------------------------------- +// CDumpTables::ConstructL +// --------------------------------------------------------- +// +void CDumpTables::ConstructL() + { + iSession = CommsDat::CMDBSession::NewL( + CommsDat::CMDBSession::LatestVersion() ); + } + + +// --------------------------------------------------------- +// CDumpTables::CDumpTables +// --------------------------------------------------------- +// +CDumpTables::CDumpTables() + { + + } + +// --------------------------------------------------------- +// CDumpTables::DoDumpTablesL +// --------------------------------------------------------- +// +void CDumpTables::DoDumpTablesL( const TFileName& aOutFileName ) + { + + User::LeaveIfError( OpenFileL( aOutFileName ) ); + + + //checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + TBool isWlanS( FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ) ); + FeatureManager::UnInitializeLib(); + + if( isWlanS ) + { + // Dumps CCDWlanService Table + DumpTableL( &KCDWlanServiceRecord ); + + // Dumps CCDWlanDeviceSettings Table + DumpTableL( &KCDWlanDeviceSettingsRecord ); + + // Dumps CCDWLANSecSSID Table + DumpTableL( &KCDWLANSecSSIDTable ); + + // Dumps CCDDestNWTable Table + DumpTableL( &KCDDestNWTable ); + } + + // Dumps CCDVirtualIAPNextLayerRecord Table + DumpTableL( + &KCDVirtualIAPNextLayerRecord ); + + // Dumps CCDDataMobilitySelectionPolicyRecord Table + DumpTableL( + &KCDDataMobilitySelectionPolicyRecord ); + + // Dumps CCDSNAPMetadataRecord Table + DumpTableL( &KCDSNAPMetadataRecord ); + + // Dumps CCDGlobalBearerTypePriorizationRecord Table + DumpTableL( + &KCDGlobalBearerTypePriorizationRecord ); + + // Dumps CCDMIPServiceExtRecord Table + DumpTableL( &KCDMIPServiceExtRecord ); + + // Dumps CCDIAPMetadataRecord Table + DumpTableL( &KCDIAPMetadataRecord ); + + // Dumps CCDMIP4Record Table + DumpTableL( &KCDMIP4Record ); + + // Dumps CCDMIP6Record Table + DumpTableL( &KCDMIP6Record ); + + iFile.Close(); + } + + +// --------------------------------------------------------- +// CDumpTables::DumpTableL +// --------------------------------------------------------- +// +template void CDumpTables::DumpTableL( const TDesC* aTableName ) + { + + CLOG_WRITE_FORMAT( "Dump table: %S \n", aTableName ); + + iFile.WriteL( *aTableName ); + iFile.WriteL( KNewLine ); + + // Retreives the table the recordset and the recordinfo + TMDBElementId tableId = T::TableIdL( *iSession ); + + T* table = new (ELeave) T( tableId ); + + const SRecordTypeInfo* aRecordInfo = table->GetRecordInfo(); + + CommsDat::CMDBRecordSet* aRecordSet = + new (ELeave) CommsDat::CMDBRecordSet( tableId ); + + // Loads the table + TRAP_IGNORE( aRecordSet->LoadL( *iSession ) ); + + //The table has been loaded + TInt count = aRecordSet->iRecords.Count(); + CLOG_WRITE_FORMAT("Record count: %d", count ); + + + TBuf16 buf; + + // Goes throught the records + for ( TInt i = 0; i < count; i++ ) + { + // The closing (after last) field in the record has 0 iTypeId + // to indicate the end of the record. + for ( TInt j = 0; 0 < aRecordInfo[j].iTypeId; j++ ) + { + // Switch for different data types + switch( aRecordInfo[j].iValType ) + { + case EInt: + case EBool: + { + // Dumping TInt + TInt res( QUERY_INT_FIELD( + (*aRecordSet)[i], aRecordInfo[j].iTypeId ) ); + buf.Format( _L( "%d" ), res ); + iFile.WriteL ( buf ); + } + break; + + case EUint32: + case ELink: + { + // Dumping TUint32 + TUint32 res32( QUERY_UINT32_FIELD( + (*aRecordSet)[i], aRecordInfo[j].iTypeId ) ); + buf.Format( _L( "%d" ), res32 ); + iFile.WriteL ( buf ); + } + break; + + case EText: + case EMedText: + case ELongText: + { + // Dumping text16 + HBufC16* text16 = QUERY_HBUFC_FIELD( + (*aRecordSet)[i], aRecordInfo[j].iTypeId ); + WriteL ( text16 ); + } + break; + + case EDesC8: + { + // Dumping text8 + HBufC8* text8 = QUERY_HBUFC8_FIELD( + (*aRecordSet)[i], aRecordInfo[j].iTypeId ); + + WriteL ( text8 ); + } + break; + + default: + CLOG_WRITE_FORMAT("! warning: type not supported: %d", + aRecordInfo[j].iValType ); + break; + } + iFile.WriteL( KComma ); + + } + iFile.WriteL( KNewLine ); + } + } + +// --------------------------------------------------------- +// CDumpTables::OpenFileL +// --------------------------------------------------------- +// +TInt CDumpTables::OpenFileL( const TFileName& aFileName ) + { + ////CLOG_WRITE_FORMAT( "Output file name %S", aFileName ); + + TInt err = iRfs.Connect(); + + if( err == KErrNone ) + { + err = iFile.Replace( iRfs, aFileName, EFileStreamText | EFileWrite ); + } + + if( err == KErrNotFound ) + // file does not exist - create it + { + err=iFile.Create( iRfs, aFileName, EFileStreamText | EFileWrite ); + } + + if( err == KErrNone ) + { + // Write little-endian Unicode file header. + iFile.WriteUint16L( KLittleEndianUnicodeHeader ); + } + + if( err != KErrNone ) + { + iFile.Close(); + ////CLOG_WRITE_FORMAT( "!Error Output file cannot be opened: %S", aFileName ); + } + + return err; + } + + +// --------------------------------------------------------- +// CDumpTables::WriteL +// --------------------------------------------------------- +// +void CDumpTables::WriteL( HBufC8* aDes ) + { + + if( aDes ) + { + + CleanupStack::PushL( aDes ); + + HBufC16* text16 = HBufC16::NewL( aDes->Length() ); + text16->Des().Copy( aDes->Des() ); + + WriteL ( text16 ); + + CleanupStack::PopAndDestroy( aDes ); + } + + } + + +// --------------------------------------------------------- +// CDumpTables::WriteL +// --------------------------------------------------------- +// +void CDumpTables::WriteL( HBufC16* aDes ) + { + + if( aDes ) + { + CleanupStack::PushL( aDes ); + + TBool res = CheckCSVTransformNeedL( aDes ); + + // Need conversion + if( res ) + { + HBufC16* cvsFormat = TransformToCSVFormatLC( aDes ); + iFile.WriteL ( *cvsFormat ); + CleanupStack::PopAndDestroy( cvsFormat ); + } + else + { + iFile.WriteL ( *aDes ); + } + CleanupStack::PopAndDestroy( aDes ); + } + } + + +// --------------------------------------------------------- +// CDumpTables::TransformToCSVFormatLC +// --------------------------------------------------------- +// +HBufC16* CDumpTables::TransformToCSVFormatLC( const HBufC16* aField ) + { + CLOG_WRITE_FORMAT( "Transform needed: %S", aField ); + + // Length of the csv format string is calculated. + // "2" are the leading and trailing d.qquotes + TInt csvLen = aField->Length() + iNumOfDQuotes + 2; + HBufC16* csv = HBufC16::NewLC( csvLen ); + + TPtr16 ptr = csv->Des(); + + // Heading quote + ptr.Append( KDQuote ); + ptr.Append( *aField ); + + // Quotes might be duplicated + if( 0 < iNumOfDQuotes ) + { + // Heading quote step over + TInt pos = 1; + while( pos < ptr.Length() && pos != KErrNotFound ) + { + ptr = ptr.Mid( pos ); + pos = ptr.Find( KDQuote ); + if( pos != KErrNotFound ) + { + ptr.Insert( pos, KDQuote ); + pos+=2; + } + } + } + + // Tailing quote + ptr.Append( KDQuote ); + + CLOG_WRITE_FORMAT( "Transformed: %S", csv ); + + return csv; + } + + +// --------------------------------------------------------- +// CDumpTables::CheckCSVTransformNeedL +// --------------------------------------------------------- +// +TBool CDumpTables::CheckCSVTransformNeedL( HBufC16* aField ) + { + // Looks for comma, new line or carrige return characters. + // Only existance is necessary. If any of them exist the + // quoting is necessary + TInt cnrPos = aField->Find( KComma ); + if( cnrPos == KErrNotFound ) + { + cnrPos = aField->Find( KNewLine ); + if( cnrPos == KErrNotFound ) + { + cnrPos = aField->Find( KCRT ); + } + } + + // Serches for all dquote. Number is usefull for csv text creation + iNumOfDQuotes = 0; + TPtr16 ptr = aField->Des(); + + TInt quotePos = ptr.Find( KDQuote ); + while( quotePos != KErrNotFound ) + { + iNumOfDQuotes++; + ptr = ptr.Mid( quotePos+1 ); + quotePos = ptr.Find( KDQuote ); + } + + // csv file conversion necessary if comma... or quote is in the text. + return ( 0 < iNumOfDQuotes || cnrPos != KErrNotFound ); + } diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorbase.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,547 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorBase +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessorbase.h" +#include "cdcreaderbase.h" +#include "cdclogger.h" + +#include +#include +#include +#include +#include + + +using namespace CMManager; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProcessorBase::CProcessorBase +// Constructor. +// --------------------------------------------------------- +// +CProcessorBase::CProcessorBase( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames ) : + iFileReader( aFileReader ), + iProxyEnabled( EFalse ), + iIsProtected( EFalse ) + { + iCmManager = &aCmManager; + + iPluginArray = &aPluginArray; + iPluginName = &aPluginNames; + } + + +CProcessorBase::CProcessorBase( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ) : + iFileReader( aFileReader ), + iProxyEnabled( EFalse ), + iIsProtected( EFalse ) + { + iCmManager = &aCmManager; + + iPluginArray = &aPluginArray; + iPluginName = &aPluginNames; + + iDestArray = &aDestArray; + iDestName = &aDestNames; + } + + +// --------------------------------------------------------- +// CProcessorBase::~CProcessorBase +// Destructor. +// --------------------------------------------------------- +// +CProcessorBase::~CProcessorBase() + { + iPlugin.Close(); + if( iName ) + { + delete iName; + } + } + + +// --------------------------------------------------------- +// CProcessorBase::ParseFileL +// --------------------------------------------------------- +// +//PseudoCode: +// 0010 locates the next access point within the text file +// 0020 parses the location and reads the input data to TagContainer +// 0030 from TagContainer creates Access Point Item Object +// 0040 using the Access Point Item Object creates a new AP record in CommsDat +// 0050 clears TagContainer +// +void CProcessorBase::ParseFileL() + { + //LocateAP : locates the access points within the text file + while ( iFileReader->LocateAPL() ) + { + //ParseAPL : parses the location, reads the input data to TagContainer + iFileReader->ParseAPL(); + + //from TagContainer creates Access Point Item Object + ProcessTagL( iFileReader->FieldIDPresent() ); + + //adds the Access Point Item Object to CommsDB + ProcessAPL(); + + //clear TagContainer + TagContainer().Clear(); + + }//while + + CLOG_WRITE( "---------------------\n" ) + } + +// --------------------------------------------------------- +// CProcessorPacketData::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorBase::ProcessTagL( TBool /*aFieldIDPresent*/ ) + { + iProxyEnabled= EFalse; + iIsProtected = EFalse; + + Reset(); + TInt aCMId = -1; + for ( TInt idx(0); idx < TagContainer().Count(); idx++) + { + if ( TagContainer().FieldId( idx ) == ECmId) + { + HBufC16* ptrTag = TagContainer().Tag(idx); + TLex16 lex(ptrTag->Des()); + TInt err = lex.Val(aCMId); + if (err != KErrNone) + { + User::Leave(err); + } + break; + } + } + if (aCMId == -1) + { + iPlugin = iCmManager->CreateConnectionMethodL( iBearerType ); + CLOG_WRITE( "ConnectionMethod created without ECmId."); + } + else + { + iPlugin = iCmManager->CreateConnectionMethodL( iBearerType, aCMId); + CLOG_WRITE_FORMAT( "ConnectionMethod created. ECmId:%d", aCMId); + } + + for ( TInt idx(0); idx < TagContainer().Count(); idx++) + { + HBufC16* ptrTag = TagContainer().Tag(idx); + TInt field = TagContainer().FieldId( idx ); + + TBool processed = SetGeneralFieldL( field, ptrTag ); + if( !processed ) + { + ProcessSpecialFieldsL( field, ptrTag, idx ); + } + } + + AddToPluginArrayL(); + + } + +// -------------------------------------------------------- +// CProcessorBase::TagContainer() +// -------------------------------------------------------- +CTagContainer& CProcessorBase::TagContainer() + { + return iFileReader->TagContainer(); + } + + +// -------------------------------------------------------- +// CProcessorBase::AddToPluginArrayL() +// -------------------------------------------------------- +void CProcessorBase::AddToPluginArrayL() + { + if( !iName ) + { + CLOG_WRITE( "Error: No plugin name !!!" ) + } + else + { + const RCmConnectionMethodExt* newItem = new (ELeave) + RCmConnectionMethodExt( iPlugin ); + + iPluginArray->Append( newItem ); + iPluginName->Append( iName->AllocL() ); + + delete iName; + iName = NULL; + + iPlugin.Close(); + } + } + +// -------------------------------------------------------- +// CProcessorBase::GetLastPluginL() +// -------------------------------------------------------- +RCmConnectionMethodExt& CProcessorBase::GetLastPluginL() + { + return GetPluginL( PluginCount() - 1 ); + + } + +// -------------------------------------------------------- +// CProcessorBase::GetPluginL() +// -------------------------------------------------------- +RCmConnectionMethodExt& CProcessorBase::GetPluginL( TInt aPos ) + { + + return *(iPluginArray->operator[]( aPos )); + + } + +// -------------------------------------------------------- +// CProcessorBase::PluginCount() +// -------------------------------------------------------- +TInt CProcessorBase::PluginCount() + { + + return iPluginArray->Count(); + + } + +// --------------------------------------------------------- +// CProcessorBase::FindDestinationL +// --------------------------------------------------------- +// +RCmDestinationExt* CProcessorBase::FindDestinationL( HBufC* aName ) + { + for( TInt i(0); i < iDestName->Count(); i++ ) + { + HBufC *name = (*iDestName)[i]; + if( aName->Compare( *name ) == 0 ) + { + return (*iDestArray)[ i ]; + } + } + CLOG_WRITE_FORMAT("Warning: Destination not found: %S", aName ); + return NULL; + } + +// --------------------------------------------------------- +// CProcessorBase::GetDestinationIdL +// --------------------------------------------------------- +// +TInt CProcessorBase::GetDestinationIdL( HBufC16* aName ) + { + RCmDestinationExt* dest = FindDestinationL( aName ); + + TInt ret( KErrNotFound ); + if( dest != NULL ) + { + ret = dest->Id(); + } + + return ret; + } + +// --------------------------------------------------------- +// CProcessorBase::FindPluginL +// --------------------------------------------------------- +// +RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName ) + { + TInt pos; + return FindPluginL( aName, pos ); + } + +// --------------------------------------------------------- +// CProcessorBase::FindPluginL +// --------------------------------------------------------- +// +RCmConnectionMethodExt* CProcessorBase::FindPluginL( HBufC* aName, TInt& aPos ) + { + RCmConnectionMethodExt* ret( NULL ); + + aPos = CheckPluginName( aName ); + if ( aPos != KErrNotFound ) + { + ret = (*iPluginArray)[ aPos ]; + } + else + { + CLOG_WRITE_FORMAT("Warning: Connection method not found: %S", aName ); + } + + return ret; + } + +// --------------------------------------------------------- +// CProcessorBase::CheckPluginName +// --------------------------------------------------------- +// +TInt CProcessorBase::CheckPluginName( HBufC* aName ) + { + TInt ret( KErrNotFound ); + + for( TInt i = 0; i < iPluginName->Count() && ret == KErrNotFound; i++ ) + { + HBufC *name = (*iPluginName)[i]; + if( aName->Compare( *name ) == 0 ) + { + ret = i; + } + } + return ret; + } + + + +// --------------------------------------------------------- +// CProcessorBase::GetPluginIdL +// --------------------------------------------------------- +// +TInt CProcessorBase::GetPluginIdL( HBufC16* aName ) + { + RCmConnectionMethodExt* cm = FindPluginL( aName ); + + TInt ret( KErrNotFound ); + if( cm != NULL ) + { + ret = cm->GetIntAttributeL( CMManager::ECmIapId ); + } + + return ret; + } + + +// --------------------------------------------------------- +// CProcessorBase::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorBase::ProcessAPL() + { + RCmConnectionMethodExt& plugin = GetLastPluginL(); + if( iIsProtected ) + { + plugin.SetBoolAttributeL( ECmProtected, ETrue ); + } + + // Writes into the log file. + DoLogL(); + } + +// --------------------------------------------------------- +// CProcessorBase::ProcessAPL +// --------------------------------------------------------- +// +TBool CProcessorBase::SetGeneralFieldL( TInt aField, HBufC* aPtrTag ) + { + TBool processed( ETrue ); + switch( aField ) + { + case ECmName: + { + // If input is not empty + if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) + { + TInt pos = CheckPluginName( aPtrTag ); + if( pos != KErrNotFound ) + { + CLOG_WRITE_FORMAT("Warning: plugin exist. It might be renamed ! : %S", aPtrTag ); + } + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + if( !iName ) + { + iName = aPtrTag->AllocL(); + } + } + break; + } + case ECmStartPage: + { + // If input is not empty + if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + } + break; + } + case ECmHidden: //fall through + case ECmMetaHiddenAgent: //fall through + case ECmMetaHighlight: //fall through + { + if( aPtrTag->CompareF( KStrNo ) == 0 ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else if( aPtrTag->CompareF( KStrYes ) == 0 ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + switch ( aField ) + { + case ECmHidden: + CLOG_WRITE( "! Error : Invalid Hidden. Default:No"); + break; + case ECmMetaHiddenAgent: + CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No"); + break; + case ECmMetaHighlight: + CLOG_WRITE( "! Error : Invalid Highlight. Default:No"); + break; + } + } + break; + } + case ECmSeamlessnessLevel: + { + if ( aPtrTag->CompareF( KStrNotRoamedTo ) == 0 ) + { + iPlugin.SetIntAttributeL( aField, + CMManager::ESeamlessnessNotRoamedTo ); + } + else if ( aPtrTag->CompareF( KStrConfirmFirst ) == 0 ) + { + iPlugin.SetIntAttributeL( aField, + CMManager::ESeamlessnessConfirmFirst ); + } + else if ( aPtrTag->CompareF( KStrShowProgress ) == 0 ) + { + iPlugin.SetIntAttributeL( aField, + CMManager::ESeamlessnessShowprogress ); + } + else if ( aPtrTag->CompareF( KStrFullySeamless ) == 0 ) + { + iPlugin.SetIntAttributeL( aField, + CMManager::ESeamlessnessFullySeamless ); + } + break; + } + + case ECmProtected: + { + // Protection + if ( aPtrTag->CompareF( KStrYes ) == 0 ) + { + iIsProtected = ETrue; + } + else if ( aPtrTag->CompareF( KStrNo ) != 0 ) + { + CLOG_WRITE( "! Error : Invalid Protected value. Default:No" ) + } + break; + } + + default: + { + processed = EFalse; + } + } + + return processed; + } + +// --------------------------------------------------------- +// CProcessorBase::DoLogL +// --------------------------------------------------------- +// + +void CProcessorBase::DoLogL() + { + + TInt lastPos = iPluginArray->Count() - 1; + + CLOG_WRITE( "Internet Access Point created:" ) + CLOG_WRITE_FORMAT( "\t Connection name: %S ", (*iPluginName)[ lastPos ] ); + + if ( iIsProtected ) + { + CLOG_WRITE( "\t Protected" ) + } + else + { + CLOG_WRITE( "\t Not protected" ) + } + } +// --------------------------------------------------------- +// CProcessorBase::SetAddressFromServerL +// --------------------------------------------------------- +// + +void CProcessorBase::SetAddressFromServerL( TInt aIPField1, + TInt aIPField2, + TInt aAddrFromSField, + TInt aIPField1IP6, + TInt aIPField2IP6, + TInt aAddrFromSFieldIP6 ) + { + //calculate and set Ip6AddrFromServer + HBufC *pIp1 = NULL; + HBufC *pIp2 = NULL; + pIp1 = iPlugin.GetStringAttributeL( aIPField1IP6 ); + CleanupStack::PushL( pIp1 ); + pIp2 = iPlugin.GetStringAttributeL( aIPField2IP6 ); + CleanupStack::PushL( pIp2 ); + _LIT( KDynIpv6Address, "0:0:0:0:0:0:0:0" ); + if ( ( pIp1->Compare( KDynIpv6Address ) == 0 ) && + ( pIp2->Compare( KDynIpv6Address ) == 0 ) ) + { + iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, ETrue ); + } + else + { + iPlugin.SetBoolAttributeL( aAddrFromSFieldIP6, EFalse ); + } + CleanupStack::PopAndDestroy( 2,pIp1 ); + + //calculate and set AddrFromServer + pIp1 = iPlugin.GetStringAttributeL( aIPField1 ); + CleanupStack::PushL( pIp1 ); + pIp2 = iPlugin.GetStringAttributeL( aIPField2 ); + CleanupStack::PushL( pIp2 ); + _LIT( KDynIpAddress, "0.0.0.0" ); + if ( ( pIp1->Compare( KDynIpAddress ) == 0 ) && + ( pIp2->Compare( KDynIpAddress ) == 0 ) ) + { + iPlugin.SetBoolAttributeL( aAddrFromSField, ETrue ); + } + else + { + iPlugin.SetBoolAttributeL( aAddrFromSField, EFalse ); + } + CleanupStack::PopAndDestroy( 2,pIp1 ); + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessordn.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessordn.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,460 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorDN +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessordn.h" +#include "cdclogger.h" +#include "cdctagcontainer.h" + +using namespace CMManager; + +// CONSTANTS + +_LIT16( KDefaultDestinationName, "Default destination" ); +//_LIT16( KMetadataUserDefined, "UserDefined" ); +//_LIT16( KMetadataInternet, "Internet" ); + +// constants for TSnapPurpose +_LIT16( KPurposeUnknown, "UserDefined" ); +_LIT16( KPurposeInternet, "Internet" ); +_LIT16( KPurposeOperator, "Operator" ); +_LIT16( KPurposeMMS, "MMS" ); +_LIT16( KPurposeIntranet, "Intranet" ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProcessorDN::NewL +// --------------------------------------------------------- +// +CProcessorDN* CProcessorDN::NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames, + RArray& aCmInDest, + TBool aIsFirstRound ) + { + CProcessorDN* self = new ( ELeave ) CProcessorDN( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aDestArray, + aDestNames, + aCmInDest, + aIsFirstRound ); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); // self + return self; + } + + +// --------------------------------------------------------- +// CProcessorDN::~CProcessorDN +// --------------------------------------------------------- +// +CProcessorDN::~CProcessorDN() + { + iDestination.Close(); + } + + +// --------------------------------------------------------- +// CProcessorDN::ConstructL +// --------------------------------------------------------- +// +void CProcessorDN::ConstructL() + { + } + + +// --------------------------------------------------------- +// CProcessorDN::CProcessorDN +// --------------------------------------------------------- +// +CProcessorDN::CProcessorDN( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames, + RArray< TBool >& aCmInDest, + TBool aIsFirstRound ) : + CProcessorBase( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aDestArray, + aDestNames ), + iProtectionLevel( EProtLevel0 ), + iIsFirstRound( aIsFirstRound ) + { + iCmInDest = &aCmInDest; + } + + +// --------------------------------------------------------- +// CProcessorDN::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorDN::ProcessTagL( TBool /*aFieldIDPresent*/ ) + { + + iDestinationDropped = EFalse; + + iProtectionLevel = EProtLevel0; + + if( iIsFirstRound ) + { + TInt dnId = -1; + for ( TInt idx(0); idx < TagContainer().Count(); idx++) + { + if ( TagContainer().FieldId( idx ) == EDN_Id ) + { + HBufC16* ptrTag = TagContainer().Tag(idx); + TLex16 lex(ptrTag->Des()); + TInt err = lex.Val(dnId); + if (err != KErrNone) + { + CLOG_WRITE( "The destinaton Id field is bad."); + User::Leave(err); + } + break; + } + } + if (dnId == -1) + { + iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName ); + CLOG_WRITE( "Destinaton created without dnId."); + } + else + { + iDestination = iCmManager->CreateDestinationL( KDefaultDestinationName, dnId); + CLOG_WRITE_FORMAT( "Destinaton created. dnId:%d", dnId); + } + } + + HBufC *destName( NULL ); + TInt priority = 0; + RPointerArray names; + + for (TInt idx(0); idx < TagContainer().Count(); idx++) + { + HBufC16* ptrTag = TagContainer().Tag(idx); + TInt field = TagContainer().FieldId( idx ); + + if( iIsFirstRound && !iDestinationDropped ) + { + switch ( field ) + { + case EDN_Name: + { + // If more destinations exist with same name then one is kept + TRAPD( err, iDestination.SetNameL( *ptrTag ) ); + if( KErrAlreadyExists == err ) + { + CLOG_WRITE_FORMAT( + "Error: Destination exist: %S. It is dropped!", ptrTag ) + CLOG_WRITE( "\t \r\n" ) + iDestinationDropped = ETrue; + } + else + { + destName = ptrTag->AllocLC(); + } + } + break; + case EDN_Metadata: + { + if( !ptrTag->Compare( KPurposeUnknown ) ) + { + iDestination.SetMetadataL( ESnapMetadataPurpose, + ESnapPurposeUnknown ); + } + else if( !ptrTag->Compare( KPurposeInternet ) ) + { + iDestination.SetMetadataL( + ESnapMetadataPurpose, + ESnapPurposeInternet ); + } + else if( !ptrTag->Compare( KPurposeOperator ) ) + { + iDestination.SetMetadataL( + ESnapMetadataPurpose, + ESnapPurposeOperator ); + } + else if( !ptrTag->Compare( KPurposeMMS ) ) + { + iDestination.SetMetadataL( + ESnapMetadataPurpose, + ESnapPurposeMMS ); + } + else if( !ptrTag->Compare( KPurposeIntranet ) ) + { + iDestination.SetMetadataL( + ESnapMetadataPurpose, + ESnapPurposeIntranet ); + } + else + { + //no valid data is given - use default value + iDestination.SetMetadataL( ESnapMetadataPurpose, + ESnapPurposeUnknown ); + CLOG_WRITE( "! Error : Invalid Metadata. Default:User Defined"); + } + } + break; + case EDN_Protection: + { + TPtrC16 protPtr = ptrTag->Right( ptrTag->Length() ); + TLex16 lex( protPtr ); + TUint32 prot( 0 ); + if ( lex.Val( prot, EDecimal ) == KErrNone ) + { + if( prot <= EProtLevel3 ) // prot is unsigned so no need + // to check lower boundary + { + iProtectionLevel = TProtectionLevel( prot ); + } + else + { + //no valid data is given - use default value + iProtectionLevel = EProtLevel0; + CLOG_WRITE( "! Error : Invalid Protection level. Default:Level0"); + } + } + } + break; + case EDN_Hidden: + { + if( !ptrTag->Compare( KStrYes ) ) + { + iDestination.SetHiddenL( ETrue ); + } + else if( !ptrTag->Compare( KStrNo ) ) + { + iDestination.SetHiddenL( EFalse ); + } + else + { + //no valid data is given - use default value + iDestination.SetHiddenL( EFalse ); + CLOG_WRITE( "! Error : Invalid Hidden. Default:No"); + } + } + break; + case EDN_HiddenAgent: + { + if( !ptrTag->Compare( KStrYes ) ) + { + iDestination.SetMetadataL( ESnapMetadataHiddenAgent, ETrue ); + } + else if( !ptrTag->Compare( KStrNo ) ) + { + iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse ); + } + else + { + iDestination.SetMetadataL( ESnapMetadataHiddenAgent, EFalse ); + //no valid data is given - use default value + CLOG_WRITE( "! Error : Invalid HiddenAgent. Default:No"); + } + } + break; + case EDN_Highlighted: + { + if( !ptrTag->Compare( KStrYes ) ) + { + iDestination.SetMetadataL( ESnapMetadataHighlight, ETrue ); + } + else if( !ptrTag->Compare( KStrNo ) ) + { + iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse ); + } + else + { + iDestination.SetMetadataL( ESnapMetadataHighlight, EFalse ); + //no valid data is given - use default value + CLOG_WRITE( "! Error : Invalid Highlighted. Default:No"); + } + } + break; + } // switch + } // if + else if( !iIsFirstRound && !iDestinationDropped ) + { + switch ( field ) + { + case EDN_Name: + { + iDest = FindDestinationL( ptrTag ); + if( iDest == NULL ) + { + CLOG_WRITE_FORMAT( "Error: Destination not found: %S ", ptrTag ) + iDestinationDropped = ETrue; + } + else + { + CLOG_WRITE_FORMAT( "\t Destination name: %S ", ptrTag ) + } + } + break; + case EDN_IAPName: + { + TInt pos; + RCmConnectionMethodExt* plugin = FindPluginL( ptrTag, pos ); + if( plugin ) + { + TRAPD( err, iDest->AddConnectionMethodL( *plugin ) ); + // Set the priority according to the order in which the IAPs are in the XML + TRAPD( err2 ,iDest->ModifyPriorityL( *plugin, priority )); + if ( err2 != KErrNone ) + { + err2 = KErrNone; // to remove the compiler warnings + } + + iDest->UpdateL(); + priority++; + + if( err == KErrNone ) + { + CLOG_WRITE_FORMAT( "\t Added connection method: %S ", ptrTag ) + (*iCmInDest)[ pos ] = ETrue; + } + else + { + CLOG_WRITE_FORMAT( + "Warning connection method could not added: %S ", ptrTag ) + } + } + else + { + CLOG_WRITE_FORMAT( + "Warning: plugin could not added: %S ", ptrTag ) + } + } + break; + case EDN_EmbeddedDNName: + { + const RCmDestinationExt* embDestination = FindDestinationL( ptrTag ); + if( embDestination ) + { + + TRAPD( err, iDest->AddEmbeddedDestinationL( *embDestination ) ); + + if( err == KErrNone ) + { + CLOG_WRITE_FORMAT( "\t Added embedded destination: %S ", ptrTag ) + } + else + { + CLOG_WRITE_FORMAT( + "Warning embedded destination could not added: %S ", ptrTag ) + } + } + else + { + CLOG_WRITE_FORMAT( + "Warning embedded destination could not added: %S ", ptrTag ) + } + + } + break; + default: + { + break; + } + } // switch + + } // if + + }//for + + if( iIsFirstRound && !iDestinationDropped ) + { + RCmDestinationExt* newItem = new (ELeave) + RCmDestinationExt( iDestination ); + + iDest = newItem; + + iDestArray->Append( newItem ); + iDestName->Append( destName ); + CleanupStack::Pop( destName ); + } + } + + +// --------------------------------------------------------- +// CProcessorDN::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorDN::ProcessAPL() + { + if( !iDestinationDropped ) + { + if( iDest ) + { + if( iIsFirstRound ) + { + iDest->SetProtectionL( iProtectionLevel ); + } + iDest->UpdateL(); + + if( iIsFirstRound ) + { + DoLogL(); + } + else + { + CLOG_WRITE( "\t \r\n" ) + } + } + } + } + + +// --------------------------------------------------------- +// CProcessorDN::DoLogL +// --------------------------------------------------------- +// +void CProcessorDN::DoLogL() + { + HBufC16* tmp; + + tmp = iDestination.NameLC(); + + // Writes some data of the destination network into the log file. + CLOG_WRITE( "Destination Network created:" ) + CLOG_WRITE_FORMAT( "\t Destination name: %S ", tmp ) + TUint32 uid = iDest->Id(); + CLOG_WRITE_FORMAT( "\t Destination ID: %d", uid ); + + CLOG_WRITE( "\t \r\n" ) + + CleanupStack::PopAndDestroy( tmp ); // Removes tmp. + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorglobal.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorglobal.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,735 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorGlobal +* +*/ + + + + +// INCLUDE FILES + +#include "cdclogger.h" +#include "cdcerrors.h" +#include "cdctagcontainer.h" +#include "cdccommon.h" +#include "cmgenconnsettings.h" +#include "cdcprocessorglobal.h" + +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#else +#include +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +// CONSTANTS + +// Global settings record name +_LIT16( KGlobalSettingsRecordName, "DefaultRecordName-1" ); + +// Default GPRS record name +_LIT( KDefaultGPRSRecordName, "Dummy Default GPRS Settings" ); + +// Modem bearer names for GPRS/WCDMA Access Points +_LIT( KModemBearerPacketData, "GPRS Modem" ); + +// LAN bearer names for Wlan Access Points +_LIT( KLANBearerWlan, "WLANBearer" ); + + +// Structure that converts field ids to the corresponding table names +// and parameter types +typedef struct + { + TDbCreatorGlobalSettings iField; + const TText* iBearerTableName; + TBool iIsUIPriority; + } TPriorityConversion; + +const TPriorityConversion KPriorityConversionTable[] = + { + { EPriorityLan, KCDTypeNameLANService, EFalse }, + { EPriorityWlan, KCDTypeNameWLANServiceExt, EFalse }, + { EPriorityPan, KCDTypeNamePANServiceExt, EFalse }, + { EPriorityGprsIn, KCDTypeNameOutgoingWCDMA, EFalse }, + { EPriorityGprsOut, KCDTypeNameIncomingWCDMA, EFalse }, + { EPriorityDialOut, KCDTypeNameDialOutISP, EFalse }, + { EPriorityDialIn, KCDTypeNameDialInISP, EFalse }, + { EPriorityVpn, KCDTypeNameVPNService, EFalse }, + { EPriorityMip, KCDTypeNameMIPServiceExt, EFalse }, + { EUIPriorityLan, KCDTypeNameLANService, ETrue }, + { EUIPriorityWlan, KCDTypeNameWLANServiceExt, ETrue }, + { EUIPriorityPan, KCDTypeNamePANServiceExt, ETrue }, + { EUIPriorityGprsIn, KCDTypeNameOutgoingWCDMA, ETrue }, + { EUIPriorityGprsOut, KCDTypeNameIncomingWCDMA, ETrue }, + { EUIPriorityDialOut, KCDTypeNameDialOutISP, ETrue }, + { EUIPriorityDialIn, KCDTypeNameDialInISP, ETrue }, + { EUIPriorityVpn, KCDTypeNameVPNService, ETrue }, + { EUIPriorityMip, KCDTypeNameMIPServiceExt, ETrue }, + { EUnused, NULL, EFalse } + }; + + +// Maximum size to be allocated for table names +const TUint KMaxTableNameSize = 50; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProcessorGlobal::NewL +// --------------------------------------------------------- +// +CProcessorGlobal* CProcessorGlobal::NewL( + CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ) + { + CProcessorGlobal* self = new ( ELeave ) CProcessorGlobal( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aDestArray, + aDestNames ); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------- +// CProcessorGlobal::CProcessorGlobal +// --------------------------------------------------------- +// +CProcessorGlobal::CProcessorGlobal( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ) : + CProcessorBase( aFileReader, aCmManager, aPluginArray, aPluginNames, aDestArray, aDestNames ), + iAttachWhenNeeded ( EFalse ) + { + } + + +// --------------------------------------------------------- +// CProcessorGlobal::ConstructL +// --------------------------------------------------------- +// +void CProcessorGlobal::ConstructL() + { + iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); + + iSession->SetAttributeMask( ECDNoWriteButDelete | ECDHidden | ECDProtectedWrite | ECDPrivate ); // Check this + + // Create General connection settings struct and set the default values + iGenConnSettings = new (ELeave) TCmGenConnSettings; + iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanKnown; + iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageAutomatic; + iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageConfirm; + + CLOG_WRITE( "Initialising FeatureManager\n" ) + //checks if Wlan feature is supported + FeatureManager::InitializeLibL(); + iIsWlanS = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); + FeatureManager::UnInitializeLib(); + CLOG_WRITE( "FeatureManager closed\n" ) + } + + +// --------------------------------------------------------- +// CProcessorGlobal::~CProcessorGlobal +// --------------------------------------------------------- +// +CProcessorGlobal::~CProcessorGlobal() + { + if ( iSession ) + { + iSession->Close(); + delete iSession; + } + delete iGenConnSettings; + } + +// --------------------------------------------------------- +// CProcessorGlobal::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorGlobal::ProcessTagL( TBool /*aFieldIDPresent*/ ) + { + for (TInt idx(0); idx < TagContainer().Count(); idx++) + { + TDbCreatorGlobalSettings fieldId; + + fieldId = static_cast< TDbCreatorGlobalSettings > + ( TagContainer().FieldId( idx ) ); + + HBufC16* ptrTag = TagContainer().Tag(idx); + + switch( fieldId ) + { + case EGPRSAttachMode: + { + _LIT( KAttachWhenNeeded, "whenneeded" ); + _LIT( KAttachWhenAvailable, "whenavailable" ); + + if ( !ptrTag->CompareF( KAttachWhenNeeded ) ) + { + iAttachWhenNeeded = ETrue; + } + else if ( !ptrTag->CompareF( KAttachWhenAvailable ) ) + { + iAttachWhenNeeded = EFalse; + } + else + { + iAttachWhenNeeded = EFalse; + CLOG_WRITE( "! Error : invalid attach mode. Default:whenavailable" ); + } + + break; + } + + case EDefaultAP: + { + CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() ); + CleanupStack::PushL( db ); + + CCDDefaultWCDMARecord* defaultGPRS = static_cast< CCDDefaultWCDMARecord* > + ( CCDRecordBase::RecordFactoryL( KCDTIdDefaultWCDMARecord ) ); + + CleanupStack::PushL( defaultGPRS ); + + defaultGPRS->iRecordName.SetL( KDefaultGPRSRecordName ); + + defaultGPRS->FindL( *db ); + + defaultGPRS->iAPN.SetL( *ptrTag ); + + defaultGPRS->ModifyL( *db ); + + CleanupStack::PopAndDestroy( defaultGPRS ); + + db->Close(); + CleanupStack::PopAndDestroy( db ); + break; + } + + case EDefaultDnIcon: + { + // Convert default icon to int + TPtrC16 iconPtr = ptrTag->Right( ptrTag->Length() ); + TLex16 lex( iconPtr ); + TUint32 icon( 0 ); + if ( lex.Val( icon, EDecimal ) == KErrNone ) + { + // If there was no error, write default entry to SNAP + // Metadata table. + // First load SNAP table to get table id + CMDBGenericRecord* snapTable = static_cast< CMDBGenericRecord* > + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( snapTable ); + snapTable->InitializeL( TPtrC( KCDTypeNameSNAPMetadata ), + NULL ); + snapTable->LoadL( *iSession ); + // Then add default record to table + CCDSNAPMetadataRecord* defaultRecord = new( ELeave ) + CCDSNAPMetadataRecord( snapTable->TableId() ); + CleanupStack::PushL( defaultRecord ); + defaultRecord->SetRecordId( KCDNewRecordRequest ); + defaultRecord->iMetadata.SetL( 0 ); + defaultRecord->iIcon.SetL( icon ); + defaultRecord->StoreL( *iSession ); + + CleanupStack::PopAndDestroy( defaultRecord ); // defaultRecord + CleanupStack::PopAndDestroy( snapTable ); // snapTable + } + break; + } + + case EPriorityLan: + case EPriorityWlan: + case EPriorityPan: + case EPriorityGprsIn: + case EPriorityGprsOut: + case EPriorityDialOut: + case EPriorityDialIn: + case EPriorityVpn: + case EPriorityMip: + case EUIPriorityLan: + case EUIPriorityWlan: + case EUIPriorityPan: + case EUIPriorityGprsIn: + case EUIPriorityGprsOut: + case EUIPriorityDialOut: + case EUIPriorityDialIn: + case EUIPriorityVpn: + case EUIPriorityMip: + { + // Convert priority to int + TPtrC16 prioPtr = ptrTag->Right( ptrTag->Length() ); + TLex16 lex( prioPtr ); + TUint32 prio( 0 ); + if ( lex.Val( prio, EDecimal ) == KErrNone ) + { + UpdateGlobalBearerArrayL( fieldId, prio ); + } + break; + } + + case EGprsLastSocketActivityTimeout: + case EGprsLastSessionClosedTimeout: + case EGprsLastSocketClosedTimeout: + { + // Load modem bearer record + CCDModemBearerRecord* bearerRecord = static_cast< CCDModemBearerRecord * > + ( CCDRecordBase::RecordFactoryL( KCDTIdModemBearerRecord ) ); + CleanupStack::PushL( bearerRecord ); + + if( fieldId == EGprsLastSocketActivityTimeout + || fieldId == EGprsLastSessionClosedTimeout + || fieldId == EGprsLastSocketClosedTimeout ) + { + // Open the record "Gprs Modem" + bearerRecord->iRecordName.SetL( KModemBearerPacketData ); + } + + bearerRecord->FindL( *iSession ); // CHECK: Leaves if record not found + + // Convert input parameter + TLex lex( *ptrTag ); + + TInt timeout( 0 ); + + // If there are parameters that cannot be handled just leave. In that case the CommsDat creation + // fails and default is used instead. So it is easier for the variant engineer to detect + // that something went wrong. + if ( lex.Val( timeout ) != KErrNone) + { + CLOG_WRITE( "! Error : invalid NIF parameter for GPRS (socket/session timeout)" ); + User::Leave( KErrArgument ); + } + + // Set the parameter + if( fieldId == EGprsLastSocketActivityTimeout ) + { + bearerRecord->iLastSocketActivityTimeout.SetL( timeout ); + } + else if( fieldId == EGprsLastSessionClosedTimeout ) + { + bearerRecord->iLastSessionClosedTimeout.SetL( timeout ); + } + else + { + bearerRecord->iLastSocketClosedTimeout.SetL( timeout ); + } + + bearerRecord->ModifyL( *iSession ); + + CleanupStack::PopAndDestroy( bearerRecord ); + + break; + } + + case EWlanLastSocketActivityTimeout: + case EWlanLastSessionClosedTimeout: + case EWlanLastSocketClosedTimeout: + { + if( iIsWlanS ) + { + // Load LAN bearer record + CCDLANBearerRecord* bearerRecord = static_cast< CCDLANBearerRecord * > + ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) ); + CleanupStack::PushL( bearerRecord ); + + // Open the record "WlanBearer" + bearerRecord->iRecordName.SetL( KLANBearerWlan ); + + User::LeaveIfError( bearerRecord->FindL( *iSession ) ); + + // Convert the input paramater to UINT + TLex lex( *ptrTag ); + + TInt timeout( 0 ); + + // If there are parameters that cannot be handled just leave. In that case the CommsDat creation + // fails and default is used instead. So it is easier for the variant engineer to detect + // that something went wrong. + if ( lex.Val( timeout ) != KErrNone) + { + CLOG_WRITE( "! Error : invalid NIF parameter for WLAN (socket/session timeout)" ); + User::Leave( KErrArgument ); + } + + + // Set the paramter + if( fieldId == EWlanLastSocketActivityTimeout ) + { + bearerRecord->iLastSocketActivityTimeout.SetL( timeout ); + } + else if( fieldId == EWlanLastSessionClosedTimeout) + { + bearerRecord->iLastSessionClosedTimeout.SetL( timeout ); + } + else + { + bearerRecord->iLastSocketClosedTimeout.SetL( timeout ); + } + + bearerRecord->ModifyL( *iSession ); + CleanupStack::PopAndDestroy( bearerRecord ); + } + break; + } + + case EWlanBGScanInterval: + case EWlanUseDefSettings: + case EWlanLongRetry: + case EWlanShortRetry: + case EWlanRTS: + case EWlanTxPowerLevel: + case EWlanRadioMeasurements: + case EWlanPowerMode: + { + if( iIsWlanS ) + { + // Save the same value both to default and user settings records + TInt err; + TRAP( err, SaveGlobalWlanParameterL( KWlanDefaultSettings, fieldId, ptrTag ) ); + if( err != KErrNone ) + { + CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" ); + User::Leave( err ); + } + TRAP( err, SaveGlobalWlanParameterL( KWlanUserSettings, fieldId, ptrTag ) ); + if( err != KErrNone ) + { + CLOG_WRITE( "! Error : Could not save global WLAN parameter. Incorrect input?" ); + User::Leave( err ); + } + } + break; + } + + case EUsageOfWlan: + { + SetGenConnSettingWlanUsage( ptrTag ); + break; + } + + case ECellularDataUsageHome: + { + SetGenConnSettingCellularDataUsageHome( ptrTag ); + break; + } + + case ECellularDataUsageVisitor: + { + SetGenConnSettingCellularDataUsageVisitor( ptrTag ); + break; + } + + default: + break; + } + } + + if( iBearerArrayChanged ) + { + + CLOG_WRITE( "UpdateBearerPriorityArrayL\n" ) + + iCmManager->UpdateBearerPriorityArrayL( iBearerArray ); + iCmManager->CleanupGlobalPriorityArray( iBearerArray ); + + iBearerArray.Close(); + + CLOG_WRITE( "UpdateBearerPriorityArrayL end\n" ) + } + + // General Connection settings are always set + SetGenConnSettingsL(); + } + +// --------------------------------------------------------- +// CProcessorGlobal::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorGlobal::ProcessAPL() + { + CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() ); + CleanupStack::PushL( db ); + + CLOG_WRITE( "Global settings\n" ) + CLOG_WRITE( "---------------\n" ) + + CCDGlobalSettingsRecord* globalSettings = static_cast< CCDGlobalSettingsRecord* > + ( CCDRecordBase::RecordFactoryL( KCDTIdGlobalSettingsRecord ) ); + + CleanupStack::PushL( globalSettings ); + + globalSettings->iRecordName.SetL( KGlobalSettingsRecordName ); + + if( globalSettings->FindL( *db ) ) + { + //Gprs attach mode + if ( iAttachWhenNeeded ) + { + CLOG_WRITE( "GPRS attach mode : attach when needed\n" ) + globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenNeeded; + } + else + { + CLOG_WRITE( "GPRS attach mode : attach when available\n" ) + globalSettings->iGPRSAttachMode = RPacketService::EAttachWhenPossible; + } + } + + globalSettings->ModifyL( *db ); + + CleanupStack::PopAndDestroy( globalSettings ); + db->Close(); + CleanupStack::PopAndDestroy( db ); // db + } + + +// --------------------------------------------------------- +// CProcessorGlobal::UpdateGlobalBearerArrayL +// --------------------------------------------------------- +// +void CProcessorGlobal::UpdateGlobalBearerArrayL + ( TDbCreatorGlobalSettings aField, TUint32 aPrio ) + { + TUint itemIndex( 0 ); + + // Look up field from conversion table + while( EUnused != KPriorityConversionTable[ itemIndex ].iField ) + { + if( KPriorityConversionTable[ itemIndex ].iField == aField) + { + break; + } + ++itemIndex; + } + + // If found + if( EUnused != KPriorityConversionTable[ itemIndex ].iField ) + { + if( !iBearerArrayChanged ) + { + iCmManager->BearerPriorityArrayL( iBearerArray ); + iBearerArrayChanged = ETrue; + } + + + HBufC* tableName = HBufC::NewLC( KMaxTableNameSize ); + *tableName = TPtrC( KPriorityConversionTable[ itemIndex ] + .iBearerTableName ); + TBool foundBearer( EFalse ); + + // Find the appropriate bearer type + for( TInt i( 0 ); i < iBearerArray.Count(); ++i ) + { + if( !( ( iBearerArray )[ i ].iServiceType->Compare( *tableName ) ) ) + { + if( KPriorityConversionTable[ itemIndex ].iIsUIPriority ) + { + ( iBearerArray )[ i ].iUIPriority = aPrio; + } + else + { + ( iBearerArray )[ i ].iPriority = aPrio; + } + foundBearer = ETrue; + break; + } + } + + // If bearer was not found, add it to the table + if( !foundBearer ) + { + TBearerPriority newBearer; + newBearer.iServiceType = tableName; + if( KPriorityConversionTable[ itemIndex ].iIsUIPriority ) + { + newBearer.iUIPriority = aPrio; + } + else + { + newBearer.iPriority = aPrio; + } + iBearerArray.Append( newBearer ); + } + + CleanupStack::PopAndDestroy( tableName ); // tableName + } + } + +// --------------------------------------------------------- +// CProcessorGlobal::SetGenConnSettingWlanUsage +// --------------------------------------------------------- +// +void CProcessorGlobal::SetGenConnSettingWlanUsage( HBufC16* aPtrTag ) + { + // This parameter should't be set at all if WLAN isn't supported. + // However, CMM should take care of this in WriteGenConnSettingsL(). + if ( aPtrTag->CompareF( KStrManual ) == 0 ) + { + iGenConnSettings->iUsageOfWlan = ECmUsageOfWlanManual; + } + // else: Default value for the string is: "Known", set in ConstructL() + } + +// --------------------------------------------------------- +// CProcessorGlobal::SetGenConnSettingCellularDataUsageHome +// --------------------------------------------------------- +// +void CProcessorGlobal::SetGenConnSettingCellularDataUsageHome( HBufC16* aPtrTag ) + { + if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) + { + iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageAutomatic; + } + else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) + { + // This value can't be set if WLAN isn't supported + iGenConnSettings->iCellularDataUsageHome = ECmCellularDataUsageDisabled; + } + // else: Default value for the string is: "Confirm", set in ConstructL() + } + +// --------------------------------------------------------- +// CProcessorGlobal::SetGenConnSettingCellularDataUsageVisitor +// --------------------------------------------------------- +// +void CProcessorGlobal::SetGenConnSettingCellularDataUsageVisitor( HBufC16* aPtrTag ) + { + if ( aPtrTag->CompareF( KStrAutomatic ) == 0 ) + { + iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageAutomatic; + } + else if ( iIsWlanS && aPtrTag->CompareF( KStrWlanOnly ) == 0 ) + { + // This value can't be set if WLAN isn't supported + iGenConnSettings->iCellularDataUsageVisitor = ECmCellularDataUsageDisabled; + } + // else: Default value for the string is: "Confirm", set in ConstructL() + } + +// --------------------------------------------------------- +// CProcessorGlobal::SetGenConnSettingsL +// --------------------------------------------------------- +// +void CProcessorGlobal::SetGenConnSettingsL() + { + RCmManager cmManager; + cmManager.CreateTablesAndOpenL(); + CleanupClosePushL( cmManager ); + cmManager.WriteGenConnSettingsL( *iGenConnSettings ); + CleanupStack::PopAndDestroy( &cmManager ); + } + +//----------------------------------------------------------------------------- +// CProcessorGlobal::SaveGlobalWlanParameterL() +//----------------------------------------------------------------------------- +// +void CProcessorGlobal::SaveGlobalWlanParameterL( const TUint32 aTableType, const TDbCreatorGlobalSettings aField, const HBufC16* const aValue ) + { + // Initialize the record + CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* > + ( CCDRecordBase::RecordFactoryL( 0 ) ); + + CleanupStack::PushL( deviceSettingsTable ); + + deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); + + deviceSettingsTable->LoadL( *iSession ); + + // Open the record that matches aTableType (either default or user settings table) + + CMDBField* settingsTypeField = (CMDBField*)deviceSettingsTable->GetFieldByIdL(KCDTIdWlanDeviceSettingsType); + + settingsTypeField->SetL( aTableType ); + + deviceSettingsTable->FindL( *iSession ); + + // Convert the input parameter to integer + TLex lex( *aValue ); + + TInt value( 0 ); + User::LeaveIfError( lex.Val( value ) ); + + // Set the paramter value + + if ( aField == EWlanBGScanInterval ) + { + CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdBgScanInterval ); + field->SetL( value ); + } + else if ( aField == EWlanUseDefSettings ) + { + CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdUseDefaultSettings ); + field->SetL( value ); + } + else if ( aField == EWlanLongRetry ) + { + CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanLongRetry ); + field->SetL( value ); + } + else if ( aField == EWlanShortRetry ) + { + CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanShortRetry ); + field->SetL( value ); + } + else if ( aField == EWlanRTS ) + { + CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanRTSThreshold ); + field->SetL( value ); + } + else if ( aField == EWlanTxPowerLevel ) + { + CMDBField< TUint32 >* field = ( CMDBField< TUint32 >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdTxPowerLevel ); + field->SetL( value ); + } + else if ( aField == EWlanRadioMeasurements ) + { + CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdAllowRadioMeasurements ); + field->SetL( value ); + } + else if ( aField == EWlanPowerMode ) + { + CMDBField< TBool >* field = ( CMDBField< TBool >* ) deviceSettingsTable->GetFieldByIdL( KCDTIdWlanPowerMode ); + field->SetL( value ); + } + + deviceSettingsTable->ModifyL( *iSession ); + + CleanupStack::PopAndDestroy( deviceSettingsTable ); + } +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorlan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorlan.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,264 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorLan +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessorlan.h" +#include "cdclogger.h" +#include "cdctagcontainer.h" + +#include +#include +#include +#include +#include +#include + +using namespace CMManager; + +// CONSTANTS + +const TUint32 KDefaultPortNum = 80; + +// These constants are used to identify tags of iInFile. + +//Connection type +_LIT16( KStrContinuous, "Continuous" ); +_LIT16( KStrTemporary, "Temporary" ); + +_LIT16( KStrTrue, "True" ); +_LIT16( KStrFalse, "False" ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProcessorLan::NewL +// --------------------------------------------------------- +// +CProcessorLan* CProcessorLan::NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames ) + { + CProcessorLan* self = new ( ELeave ) CProcessorLan( aFileReader, + aCmManager, + aPluginArray, + aPluginNames ); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); // self + return self; + } + + +// --------------------------------------------------------- +// CProcessorLan::~CProcessorLan +// --------------------------------------------------------- +// +CProcessorLan::~CProcessorLan() + { + } + + +// --------------------------------------------------------- +// CProcessorLan::ConstructL +// --------------------------------------------------------- +// +void CProcessorLan::ConstructL() + { + } + + +// --------------------------------------------------------- +// CProcessorLan::CProcessorLan +// --------------------------------------------------------- +// +CProcessorLan::CProcessorLan( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames) : + CProcessorBase( aFileReader, + aCmManager, + aPluginArray, + aPluginNames ) + { + iBearerType = KUidLanBearerType; + } + + +// --------------------------------------------------------- +// CProcessorLan::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorLan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) + { + switch ( aField ) + { + case ECmWapIPGatewayAddress: + { + // Unicode 16-bit text + if ( aPtrTag->Length() ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + } + + break; + } + case ECmWapIPSecurity: + { + // TBool + if ( !aPtrTag->CompareF( KStrOn ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrOff ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + //no valid data is given - default data is used + iPlugin.SetBoolAttributeL( aField, ETrue ); + CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On"); + } + + break; + } + case ELanIpAddrFromServer: + case ELanIpDNSAddrFromServer: + { + // TBool + if ( !aPtrTag->CompareF( KStrTrue ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrFalse ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + //no valid data is given - default data is used + iPlugin.SetBoolAttributeL( aField, ETrue ); + CLOG_WRITE( "! Error : Invalid LAN server setting. Default:On"); + } + break; + } + case ECmWapIPWSPOption: + { + // UInt + if ( !aPtrTag->CompareF( KStrContinuous ) ) + { + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionOriented ); + } + else if ( !aPtrTag->CompareF( KStrTemporary ) ) + { + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionless ); + } + else + { + //no valid data is given - default data is used + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionOriented ); + CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous"); + } + + break; + } + case ECmProxyProtocolName: + { + // Do not enable proxy in this case yet + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + + case ECmProxyServerName: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // Long text + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + case ECmProxyPortNumber: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // TUint32 and should be read as text. + TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); + TLex16 lex( portptr ); + TUint32 portnum( 0 ); + if ( lex.Val( portnum, EDecimal ) == KErrNone ) + { + iPlugin.SetIntAttributeL( aField, portnum ); + } + else + { + //no valid data is given - default value is used + iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); + CLOG_WRITE( "! Error : Invalid port number. Default:80"); + } + break; + } + case ELanIfNetworks: + case ELanIpNetMask: + case ELanIpGateway: + case ELanIpAddr: + case ELanConfigDaemonManagerName: + case ELanConfigDaemonName: + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + case ELanIpNameServer1: + case ELanIpNameServer2: + case ELanIp6NameServer1: + case ELanIp6NameServer2: + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + SetAddressFromServerL( ELanIpNameServer1, + ELanIpNameServer2, + ELanIpDNSAddrFromServer, + ELanIp6NameServer1, + ELanIp6NameServer2, + ELanIp6DNSAddrFromServer ); + break; + } + default: + { + break; + } + }//switch + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorpacketdata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorpacketdata.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,473 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorPacketData +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessorpacketdata.h" +#include "cdclogger.h" +#include "cdctagcontainer.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace CMManager; + +// CONSTANTS + +const TUint32 KDefaultPortNum = 80; +const TInt32 KDefaultLinger = 0; +const TUint KIapColumn = 0x00000100; +const TUint KLingerColumn = 0x00000200; +const TUint KColumnMask = 0xFFFFFF00; +const TUint KRowMask = 0x000000FF; + +// These constants are used to identify tags of iInFile. + +//ISP types +_LIT16( KStrISPInternet, "0" ); +_LIT16( KStrISPWAP, "1" ); + +//Connection type +_LIT16( KStrContinuous, "Continuous" ); +_LIT16( KStrTemporary, "Temporary" ); + +//Password authentication +_LIT16( KStrPwdAuthNormal, "Normal" ); +_LIT16( KStrPwdAuthSecure, "Secure" ); + +//Network types +_LIT16( KStrNetworkIPv4, "IPv4" ); +_LIT16( KStrNetworkIPv6, "IPv6" ); + + +// ================= MEMBER FUNCTIONS ======================= +CLingerElement::~CLingerElement() + { + delete iName; + delete iLinger; + } +// --------------------------------------------------------- +// CProcessorPacketData::NewL +// --------------------------------------------------------- +// +CProcessorPacketData* CProcessorPacketData::NewL( + CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< CLingerElement >& aLingerSettings) + { + CProcessorPacketData* self = new ( ELeave ) CProcessorPacketData + ( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aLingerSettings); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); // self + return self; + } + + +// --------------------------------------------------------- +// CProcessorPacketData::~CProcessorPacketData +// --------------------------------------------------------- +// +CProcessorPacketData::~CProcessorPacketData() + { + } + + +// --------------------------------------------------------- +// CProcessorPacketData::ConstructL +// --------------------------------------------------------- +// +void CProcessorPacketData::ConstructL() + { + } + + +// --------------------------------------------------------- +// CProcessorPacketData::CProcessorPacketData +// --------------------------------------------------------- +// +CProcessorPacketData::CProcessorPacketData( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< CLingerElement >& aLingerSettings ) : + CProcessorBase( aFileReader, + aCmManager, + aPluginArray, + aPluginNames ) + + { + iLingerSettings = &aLingerSettings; + iBearerType = KUidPacketDataBearerType; + } + +// --------------------------------------------------------- +// CProcessorPacketData::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorPacketData::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) + { + + switch ( aField ) + { + case EPacketDataAPName: //fall through + case EPacketDataIFAuthName: //fall through + case EPacketDataIFAuthPass: //fall through + case EPacketDataIPAddr: //fall through + { + // Unicode 16-bit text + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + + break; + } + case EPacketDataIPNameServer1: //fall through + case EPacketDataIPNameServer2: //fall through + case EPacketDataIPIP6NameServer1: //fall through + case EPacketDataIPIP6NameServer2: //fall through + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + SetAddressFromServerL( EPacketDataIPNameServer1, + EPacketDataIPNameServer2, + EPacketDataIPDNSAddrFromServer, + EPacketDataIPIP6NameServer1, + EPacketDataIPIP6NameServer2, + EPacketDataIPIP6DNSAddrFromServer ); + break; + } + case ECmWapIPGatewayAddress: + { + // Unicode 16-bit text + if ( aPtrTag->Length() ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + } + + break; + } + case EPacketDataIFPromptForAuth: + { + // Boolean + if ( !aPtrTag->CompareF( KStrYes ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrNo ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + //no valid data is given - use default value + iPlugin.SetBoolAttributeL( aField, EFalse ); + CLOG_WRITE( "! Error : Invalid Prompt password. Default:No"); + } + + break; + } + case EPacketDataUseEdge: + { + // Boolean + if ( !aPtrTag->CompareF( KStrYes ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrNo ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + //no valid data is given - use default value + iPlugin.SetBoolAttributeL( aField, ETrue ); + CLOG_WRITE( "! Error : Invalid Use EDGE. Default:Yes"); + } + + break; + } + case EPacketDataLinger: + { + // Pair linger with name for later saving + CLingerElement* linger = new (ELeave) CLingerElement; + + CleanupStack::PushL( linger ); + + linger->iName = iName->AllocL(); + linger->iLinger = aPtrTag->AllocL(); + + iLingerSettings->AppendL(linger); + + CleanupStack::Pop( linger ); + break; + } + case ECmWapIPSecurity: + { + // TBool + if ( !aPtrTag->CompareF( KStrOn ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrOff ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + //no valid data is given - default data is used + iPlugin.SetBoolAttributeL( aField, ETrue ); + CLOG_WRITE( "! Error : Invalid WTLS security setting. Default:On"); + } + + break; + } + case ECmWapIPWSPOption: + { + // UInt + if ( !aPtrTag->CompareF( KStrContinuous ) ) + { + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionOriented ); + } + else if ( !aPtrTag->CompareF( KStrTemporary ) ) + { + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionless ); + } + else + { + //no valid data is given - default data is used + iPlugin.SetIntAttributeL( aField, + EWapWspOptionConnectionOriented ); + CLOG_WRITE( "! Error : Invalid connection type. Default:Continuous"); + } + + break; + } + + case ECmProxyProtocolName: + { + // Do not enable proxy in this case yet + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + + case ECmProxyServerName: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // Long text + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + case ECmProxyPortNumber: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // TUint32 and should be read as text. + TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); + TLex16 lex( portptr ); + TUint32 portnum( 0 ); + if ( lex.Val( portnum, EDecimal ) == KErrNone ) + { + iPlugin.SetIntAttributeL( aField, portnum ); + } + else + { + //no valid data is given - default value is used + iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); + CLOG_WRITE( "! Error : Invalid port number. Default:80"); + } + break; + } + case EPacketDataDisablePlainTextAuth: + { + // TBool + if ( !aPtrTag->CompareF( KStrPwdAuthNormal ) ) + { + // Normal, => auth. not secure, plain text NOT disabled + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else if ( !aPtrTag->CompareF( KStrPwdAuthSecure ) ) + { + // Secure, => auth. secure, plain text disabled + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else + { + //no valid data is given - default value is used + CLOG_WRITE( "! Error : Invalid password authentication. Default:Secure "); + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + break; + } + case EPacketDataPDPType: + { + if ( !aPtrTag->CompareF( KStrNetworkIPv4 ) ) + { + iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 ); + } + else if ( !aPtrTag->CompareF( KStrNetworkIPv6 ) ) + { + iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv6 ); + } + else + { + iPlugin.SetIntAttributeL( aField, RPacketContext::EPdpTypeIPv4 ); + CLOG_WRITE( "! Error : Invalid Network type. Default:IPv4" ) + } + break; + } + case EPacketDataApType: + { + if ( !aPtrTag->CompareF( KStrISPInternet ) ) + { + iPlugin.SetIntAttributeL( aField, 0 ); + } + else if ( !aPtrTag->CompareF( KStrISPWAP ) ) + { + iPlugin.SetIntAttributeL( aField, 1 ); + } + else + { + iPlugin.SetIntAttributeL( aField, 2 ); + } + break; + } + default: + { + break; + } + }//switch + } + +// --------------------------------------------------------- +// CProcessorPacketData::AddLingerL +// --------------------------------------------------------- +// +void CProcessorPacketData::AddLingerL( const TInt aIapId, const TInt aLingerInterval) + { + TInt err( KErrNone ); + + // Open repository + CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); + + // Find if an entry for "iapId" already exists in CentRep + RArray< TUint32 > foundKeys; + foundKeys.Reset(); + + err = repository->FindEqL( KIapColumn, // partial key + KColumnMask, // key mask + aIapId, // value + foundKeys ); // found keys + + if ( err == KErrNone || err == KErrNotFound ) + { + if ( foundKeys.Count() == 0 ) + { + // Add a new entry + TInt arrayCount( 0 ); + + // Get number of iapId&linger entries in Centrep + err = repository->Get( KPdpContextManagerLingerArrayCount, + arrayCount ); + + if ( err == KErrNone ) + { + arrayCount++; + + err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); + + if ( err == KErrNone ) + { + err = repository->Create( ( KLingerColumn | arrayCount ), + aLingerInterval ); + } + + if ( err == KErrNone ) + { + // Update number of iapId&linger entries in Centrep + err = repository->Set( KPdpContextManagerLingerArrayCount, + arrayCount ); + } + } + } + else + { + // Update existing entry on current row + TInt32 row = foundKeys[ 0 ] & KRowMask; + + err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); + } + } + + foundKeys.Close(); + CleanupStack::PopAndDestroy( repository ); + + User::LeaveIfError( err ); + } + +// --------------------------------------------------------- +// CProcessorPacketData::SaveLingerSettingsL +// --------------------------------------------------------- +// +void CProcessorPacketData::SaveLingerSettingsL() + { + for ( TInt i(0); i < iLingerSettings->Count(); i++ ) + { + TInt id = GetPluginIdL(((*iLingerSettings)[i])->iName); + + TLex16 lex(*((*iLingerSettings)[i])->iLinger); + TInt linger( 0 ); + if ( lex.Val( linger ) == KErrNone ) + { + AddLingerL( id, linger); + } + else + { + // no valid data is given - default value is used + AddLingerL( id, KDefaultLinger); + } + } + iLingerSettings->ResetAndDestroy(); + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorvpn.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorvpn.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,242 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorVpn +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessorvpn.h" +#include "cdclogger.h" +#include "cdctagcontainer.h" + +#include +#include +#include +#include +#include +#include + +using namespace CMManager; + +// CONSTANTS + +const TUint32 KDefaultPortNum = 80; + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProcessorVpn::NewL +// --------------------------------------------------------- +// +CProcessorVpn* CProcessorVpn::NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aUnderLying ) + { + CProcessorVpn* self = new ( ELeave ) CProcessorVpn( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aUnderLying ); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); // self + return self; + } + + +// --------------------------------------------------------- +// CProcessorVpn::~CProcessorVpn +// --------------------------------------------------------- +// +CProcessorVpn::~CProcessorVpn() + { + } + + +// --------------------------------------------------------- +// CProcessorVpn::ConstructL +// --------------------------------------------------------- +// +void CProcessorVpn::ConstructL() + { + } + + +// --------------------------------------------------------- +// CProcessorVpn::CProcessorVpn +// --------------------------------------------------------- +// +CProcessorVpn::CProcessorVpn( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aUnderLying ) : + + CProcessorBase( aFileReader, + aCmManager, + aPluginArray, + aPluginNames ) + { + iUnderLying = &aUnderLying; + iBearerType = KPluginVPNBearerTypeUid; + } + +// --------------------------------------------------------- +// CProcessorVpn::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorVpn::ProcessUnderLyingL( RPointerArray< RCmDestinationExt >& aDestArray, + RPointerArray< HBufC >& aDestNames ) + { + iDestArray = &aDestArray; + iDestName = &aDestNames; + + for( TInt i(0); i < iUnderLying->Count(); i++ ) + { + // Finds the vpn IAP by its name + RCmConnectionMethodExt* iPlugin = FindPluginL( (*iUnderLying)[i] ); + if( iPlugin != NULL ) + { + CLOG_WRITE_FORMAT( "Underlying set for:%S", (*iUnderLying)[i] ); + + // Finds the underlying IAP by its name + i++; + RCmConnectionMethodExt* up = FindPluginL( (*iUnderLying)[i] ); + if( up != NULL ) + { + iPlugin->SetIntAttributeL( ECmNextLayerIapId, + up->GetIntAttributeL( ECmIapId ) ); + iPlugin->UpdateL(); + + CLOG_WRITE_FORMAT( "Underlying IAP Set:%S", (*iUnderLying)[i] ); + } + else + { + // Underlyinf can be destination. If not IAP finds destination. + RCmDestinationExt* ud = FindDestinationL( (*iUnderLying)[i] ); + if( ud != NULL ) + { + iPlugin->SetIntAttributeL( ECmNextLayerSNAPId, ud->Id() ); + iPlugin->UpdateL(); + + CLOG_WRITE_FORMAT( "Underlying SNAP Set: %S", (*iUnderLying)[i] ); + } + } + } + } + } + + +// --------------------------------------------------------- +// CProcessorVpn::ProcessTagL +// --------------------------------------------------------- +// +void CProcessorVpn::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) + { + CLOG_WRITE_FORMAT( "field: %d", aField ); + switch ( aField ) + { + case ECmProxyProtocolName: + { + // Do not enable proxy in this case yet + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + + case ECmProxyServerName: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // Long text + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + case ECmProxyPortNumber: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + // TUint32 and should be read as text. + TPtrC16 portptr = aPtrTag->Right( aPtrTag->Length() ); + TLex16 lex( portptr ); + TUint32 portnum( 0 ); + if ( lex.Val( portnum, EDecimal ) == KErrNone ) + { + iPlugin.SetIntAttributeL( aField, portnum ); + } + else + { + //no valid data is given - default value is used + iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); + CLOG_WRITE( "! Error : Invalid port number. Default:80"); + } + break; + } + case EVPN_IapName: // Underlying IAP/destination + { + if( !iName ) + { + TInt len = aPtrTag->Length(); + + iName = HBufC::NewL( 8 + len ); + TPtr name = iName->Des(); + name.Append( _L( "VPN to " ) ); + name.Append( *aPtrTag ); + + SetGeneralFieldL( ECmName, iName ); + + } + + // Adds vpnIAP name - underlying IAP/Dest name pair to a list + if( iName ) + { + iUnderLying->AppendL( iName->AllocL() ); + iUnderLying->AppendL( aPtrTag->AllocL() ); + } + break; + } + case EVpnServicePolicy: + ////case ECmName: //fall through + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + if( !iName ) + { + iName = aPtrTag->AllocLC(); + } + + break; + } + default: + { + break; + } + }//switch + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcprocessorwlan.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcprocessorwlan.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,2317 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CProcessorWlan +* +*/ + + + + +// INCLUDE FILES + +#include "cdcprocessorwlan.h" +#include "cdclogger.h" +#include "cdcerrors.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace CMManager; + +// CONSTANTS + +// network modes. +_LIT16( KStrAd_hoc, "Ad-hoc" ); +_LIT16( KStrInfrastructure, "Infrastructure" ); // Default value. + +// security modes. +_LIT16( KStrWEP, "WEP" ); +_LIT16( KStr802_1x, "802.1x" ); +_LIT16( KStrWPA, "WPA" ); // WPA/WPA2 mixed mode +_LIT16( KStrWPA2, "WPA2" ); // WPA2-only mode +_LIT16( KStrOpen, "Open" ); // Default value. + +// default WLAN channel Id value +const TInt KDefaultChannelId = 0; +const TInt KMaximumChannelId = 11; + +// default port number +const TUint32 KDefaultPortNum = 0; + +// ratio between sizes of ascii and unicode characters +const TUint KAsciiUnicodeRatio = 2; + +// ================= MEMBER FUNCTIONS ======================= + +CEapTypeElement::~CEapTypeElement() + { + delete iEapSettings; + delete iName; + } + + +// --------------------------------------------------------- +// CProcessorWlan::NewL +// --------------------------------------------------------- +// +CProcessorWlan* CProcessorWlan::NewL( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aSecurityInfo, + RPointerArray< CEapTypeElement >& aEapSettings ) + { + CProcessorWlan* self = new ( ELeave ) CProcessorWlan( aFileReader, + aCmManager, + aPluginArray, + aPluginNames, + aSecurityInfo, + aEapSettings ); + CleanupStack::PushL( self ); + + // From base class + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +// --------------------------------------------------------- +// CProcessorWlan::ConstructL +// --------------------------------------------------------- +// +void CProcessorWlan::ConstructL() + { + iEmptyTag = KStrEmpty.operator const TDesC16&().Alloc(); + + Reset(); // iWepData, iWpaData + } + + +// --------------------------------------------------------- +// CProcessorWlan::CProcessorWlan +// --------------------------------------------------------- +// +CProcessorWlan::CProcessorWlan( CReaderBase* aFileReader, + RCmManagerExt& aCmManager, + RPointerArray< RCmConnectionMethodExt >& aPluginArray, + RPointerArray< HBufC >& aPluginNames, + RPointerArray< HBufC >& aSecurityInfo, + RPointerArray< CEapTypeElement >& aEapSettings ) : + CProcessorBase( aFileReader, + aCmManager, + aPluginArray, + aPluginNames ), + iSecurityMode( ESecurityModeOpen ), + iEapSettings( aEapSettings ), + iIsEasyWlan( ETrue ) + { + iBearerType = KUidWlanBearerType; + iSecurityInfo = &aSecurityInfo; + iDataStart = 0; + } + + +// --------------------------------------------------------- +// CProcessorWlan::~CProcessorWlan +// --------------------------------------------------------- +// +CProcessorWlan::~CProcessorWlan() + { + delete iEmptyTag; + REComSession::FinalClose(); + } + +// --------------------------------------------------------- +// CProcessorWlan::ProcessSpecialFieldsL +// --------------------------------------------------------- +// +void CProcessorWlan::ProcessSpecialFieldsL( TInt aField, HBufC* aPtrTag, TInt /*aDx*/ ) + { + switch( aField ) + { + // TDesC16 + case EWlanSSID: + { + if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + iIsEasyWlan = EFalse; + } + else + { + // Access point is Easy WLAN + iIsEasyWlan = ETrue; + } + break; + } + case EWlanIpAddr: + { + if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + } + break; + } + // TDesC16 + case EWlanIpGateway: //fall through + case EWlanIpNetMask: //fall through + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + case EWlanIpNameServer1: //fall through + case EWlanIpNameServer2: //fall through + case EWlanIp6NameServer1: //fall through + case EWlanIp6NameServer2: //fall through + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + SetAddressFromServerL( EWlanIpNameServer1, + EWlanIpNameServer2, + EWlanIpDNSAddrFromServer, + EWlanIp6NameServer1, + EWlanIp6NameServer2, + EWlanIp6DNSAddrFromServer ); + break; + } + // TUint32 + case EWlanSecurityMode: + { + + if ( aPtrTag->CompareF( KStrWEP ) == 0 ) + { + // WEP + iPlugin.SetIntAttributeL( aField, EWlanSecModeWep ); + iSecurityMode = ESecurityModeWEP; + } + else if ( aPtrTag->CompareF( KStr802_1x ) == 0 ) + { + // 802.1x + iPlugin.SetIntAttributeL( aField, EWlanSecMode802_1x ); + iSecurityMode = ESecurityMode802; + } + else if ( aPtrTag->CompareF( KStrWPA ) == 0 ) + { + // WPA/WPA2 mixed mode + iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa ); + iSecurityMode = ESecurityModeWPA; + } + else if ( aPtrTag->CompareF( KStrWPA2 ) == 0 ) + { + // WPA2 + iPlugin.SetIntAttributeL( aField, EWlanSecModeWpa2 ); + iSecurityMode = ESecurityModeWPA2; + } + else if ( aPtrTag->CompareF( KStrOpen ) == 0 ) + { + // Open network (default) + iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen ); + iSecurityMode = ESecurityModeOpen; + } + else + { + iPlugin.SetIntAttributeL( aField, EWlanSecModeOpen ); + iSecurityMode = ESecurityModeOpen; + CLOG_WRITE( "! Error : Invalid Security Mode. Default:Open" ) + } + break; + } + + // TUint32 + case EWlanConnectionMode: + { + + if ( !aPtrTag->CompareF( KStrAd_hoc ) ) + { + // Ad-hoc + iPlugin.SetIntAttributeL( aField, EAdhoc ); + } + else if ( !aPtrTag->CompareF( KStrInfrastructure ) ) + { + // Infrastructure + iPlugin.SetIntAttributeL( aField, EInfra ); + } + else + { + iPlugin.SetIntAttributeL( aField, EInfra ); + CLOG_WRITE( "! Error : Invalid Network Mode. Default:Infrastructure" ) + } + break; + } + + // TUint32 + case ECmProxyPortNumber: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + TLex16 lex( *aPtrTag ); + TUint32 tmp( 0 ); + if ( lex.Val( tmp, EDecimal ) == KErrNone ) + { + iPlugin.SetIntAttributeL( aField, tmp ); + } + else + { + //no valid data is given + iPlugin.SetIntAttributeL( aField, KDefaultPortNum ); + CLOG_WRITE( "! Error : Invalid port number. Default:0" ); + } + break; + } + // Long text. + case ECmStartPage: + { + + if ( aPtrTag->CompareF( KStrEmpty ) != 0 ) + { + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + } + break; + } + + case ECmProxyProtocolName: + { + // Do not enable proxy in this case yet + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + + // Long text. + case ECmProxyServerName: + { + // First set proxy usage to enabled + if( !iProxyEnabled ) + { + iPlugin.SetBoolAttributeL( ECmProxyUsageEnabled, ETrue ); + iProxyEnabled = ETrue; + } + iPlugin.SetStringAttributeL( aField, *aPtrTag ); + break; + } + // Bool + case EWlanScanSSID: + { + if ( !aPtrTag->CompareF( KStrYes ) ) + { + iPlugin.SetBoolAttributeL( aField, ETrue ); + } + else if ( !aPtrTag->CompareF( KStrNo ) ) + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + } + else + { + iPlugin.SetBoolAttributeL( aField, EFalse ); + CLOG_WRITE( "! Error : Invalid Scan SSID. Default:No" ) + } + break; + } + + // TUint32 + case EWlanChannelID: + { + TLex16 lex( *aPtrTag ); + TUint32 tmp( 0 ); + lex.Val( tmp, EDecimal ); + + if( tmp <= KMaximumChannelId ) + { + iPlugin.SetIntAttributeL( aField, tmp ); + } + else + { + // Default value + iPlugin.SetIntAttributeL( aField, KDefaultChannelId ); + CLOG_WRITE( "! Error : Invalid Chanel Id. Default:0" ) + } + break; + } + //WEP + case EWEPKeyInUse: + case EWEPAuthType: + case EWEPKey1Length: + case EWEPKey1Format: + case EWEPKey1Data: + case EWEPKey2Length: + case EWEPKey2Format: + case EWEPKey2Data: + case EWEPKey3Length: + case EWEPKey3Format: + case EWEPKey3Data: + case EWEPKey4Length: + case EWEPKey4Format: + case EWEPKey4Data: + { + if( iSecurityMode == ESecurityModeWEP ) + { + AddSecurityDataL( aField, aPtrTag, ETrue ); + } + } + break; + //WPA + case EWPAPresharedKey: + case EWPAKeyLength: + case EWPAEapMethod: + case EWPAUseOfPresharedKey: + { + if( iSecurityMode != ESecurityModeWEP && iSecurityMode != ESecurityModeOpen ) + { + AddSecurityDataL( aField, aPtrTag, EFalse ); + } + } + break; + + default: + // Check if this is EAP setting + if ( EAPSetting( aField ) ) + { + AddEAPSettingL( aField, aPtrTag ); + } + else + { + CLOG_WRITE_FORMAT( "! Warning: Unhandled setting for WLAN: %d", aField ); + } + break; + }//switch + } + + +// --------------------------------------------------------- +// CProcessorWlan::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorWlan::ProcessAPL() + { + + RCmConnectionMethodExt& iPlugin = GetLastPluginL(); + + if( iIsProtected ) + { + iPlugin.SetBoolAttributeL( ECmProtected, ETrue ); + } + + // Ensure that Easy WLAN is always an open network + if( iIsEasyWlan ) + { + iSecurityMode = ESecurityModeOpen; + } + + FillSecurityInfoL(); + + // Writes into the log file. + DoLogL(); + + Reset(); // iWepData, iWpaData + } + +// --------------------------------------------------------- +// CProcessorWlan::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorWlan::FillSecurityInfoL() + { + //Set Security mode settings + switch ( iSecurityMode ) + { + case ESecurityModeWEP: + if ( WEPFieldValidate() ) + { + FillSecurityInfoL( ETrue ); //WEP + } + else + { + CLOG_WRITE( "! Error : WEP settings are not valid." ) + } + break; + case ESecurityMode802: + case ESecurityModeWPA: + case ESecurityModeWPA2: + { + FillSecurityInfoL( EFalse ); //WPA + break; + } + default: + { + } + break; + } + } + +// --------------------------------------------------------- +// CProcessorWlan::ProcessAPL +// --------------------------------------------------------- +// +void CProcessorWlan::FillSecurityInfoL( TBool aIsWep ) + { + // iName has been deleted by Base. Name is retrieved from name array. + TInt lastPos = iPluginArray->Count() - 1; + HBufC* name = (*iPluginName)[ lastPos ]; + + // Name appended to the array + iSecurityInfo->Append( name->AllocL() ); + CLOG_WRITE_FORMAT( "FillSecurityInfoL %S", name ); + CLOG_WRITE_FORMAT( "FillSecurityInfoL start %d", iSecurityInfo->Count() ); + + if( aIsWep ) + { + // Security type appended to the array + iSecurityInfo->Append( KStrWEP.operator const TDesC16&().Alloc() ); + for( TInt i( 0 ); i < KWEPKeyNumOfFields; i++ ) + { + + if( iWepData[i] != NULL ) + { + CLOG_WRITE_FORMAT( "wep info %S", iWepData[i] ); + } + else + { + CLOG_WRITE( "wep info NULL" ); + } + iSecurityInfo->Append( iWepData[i] ); + } + } + else + { + // Security type appended to the array + switch ( iSecurityMode ) + { + case ESecurityMode802: + iSecurityInfo->Append( KStr802_1x.operator const TDesC16&().Alloc() ); + break; + case ESecurityModeWPA2: + iSecurityInfo->Append( KStrWPA2.operator const TDesC16&().Alloc() ); + break; + default: + iSecurityInfo->Append( KStrWPA.operator const TDesC16&().Alloc() ); + break; + } + + for( TInt i( 0 ); i < KWPAKeyNumOfFields; i++ ) + { + + if( iWpaData[i] != NULL ) + { + CLOG_WRITE_FORMAT( "wpa info %S", iWpaData[i] ); + } + else + { + CLOG_WRITE( "wep info NULL" ); + } + iSecurityInfo->Append( iWpaData[ i ] ); + } + } + + CLOG_WRITE_FORMAT( "FillSecurityInfoL end %d", iSecurityInfo->Count() ); + } + +// --------------------------------------------------------- +// CProcessorWlan::SaveSecurityInfoL +// --------------------------------------------------------- +// +void CProcessorWlan::SaveSecurityInfoL() + { + TInt i(0); + + while( i < iSecurityInfo->Count() ) + { + if( (*iSecurityInfo)[i] != NULL ) + { + CLOG_WRITE_FORMAT( "Sec Info: %S", (*iSecurityInfo)[i] ); + } + else + { + CLOG_WRITE( "Sec Info: NULL" ); + } + + i++; + } + + + i = 0; + + while( i < iSecurityInfo->Count() ) + { + CLOG_WRITE_FORMAT( "SaveSecurityInfoL %S", (*iSecurityInfo)[i] ); + + TInt id = GetPluginIdL( (*iSecurityInfo)[i] ); + if( id != KErrNotFound ) + { + i++; + SaveSecurityInfoL( i, id ); + } + else + { + CLOG_WRITE_FORMAT( "WLan IAp cannot find %S", (*iSecurityInfo)[i] ); + CLOG_WRITE( "Security save likely collapsed" ); + // Tries to look for an existing IAP. + i++; + } + } + + // EAP settings + CLOG_WRITE( "Starting EAP settings saving" ); + CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); + CleanupStack::PushL( session ); + + // Load IAP record in order to get the service id + for ( i = 0; i < iEapSettings.Count() ; i++ ) + { + CEapTypeElement* eap = iEapSettings[i]; + // + TInt id = GetPluginIdL( eap->iName ); + + CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * > + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + + CleanupStack::PushL( iapRecord ); + + iapRecord->SetRecordId( id ); + + iapRecord->LoadL( *session ); + + TInt serviceId = iapRecord->iService; + + CleanupStack::PopAndDestroy( iapRecord ); + + CEapType* eapType ( NULL ); + TRAPD( leave, + eapType = CEapType::NewL( ELan, + serviceId, + eap->iEapSettings->iEAPExpandedType ) ); + if ( leave == KErrNone ) + { + CleanupStack::PushL( eapType ); + + // Inner EAP + if ( eap->iEncapsulatingEapId != *EapExpandedTypeNone.GetType() ) + { + eapType->SetTunnelingType( eap->iEncapsulatingEapId ); + } + + // write EAP setting + eapType->SetConfigurationL(*eap->iEapSettings); + CleanupStack::PopAndDestroy( eapType ); + } + } + + session->Close(); + CleanupStack::PopAndDestroy( session ); + CLOG_WRITE( "Finished EAP settings saving" ); + + CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() ); +} + +// --------------------------------------------------------- +// CProcessorWlan::SaveSecurityInfoL +// --------------------------------------------------------- +// +void CProcessorWlan::SaveSecurityInfoL( TInt& aCounter, TInt aId ) + { + if( (*iSecurityInfo)[ aCounter ]->Compare( KStrWEP ) == 0 ) + { + aCounter++; + TInt end( aCounter + KWEPKeyNumOfFields ); + + for( TInt index(0); aCounter < end; aCounter++, index++ ) + { + if( (*iSecurityInfo)[ aCounter ] != NULL ) + { + CLOG_WRITE_FORMAT( "wep info %S", (*iSecurityInfo)[ aCounter ] ); + } + else + { + CLOG_WRITE( "wep info NULL" ); + } + iWepData[ index] = (*iSecurityInfo)[ aCounter ] ; + } + SaveWEPL( aId ); + } + else + { + + // Set security mode. + if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStr802_1x ) == 0 ) + { + // 802.1x + iSecurityMode = ESecurityMode802; + } + else if ( (*iSecurityInfo)[ aCounter ]->CompareF( KStrWPA2 ) == 0 ) + { + // WPA2 mode + iSecurityMode = ESecurityModeWPA2; + } + else + { + // WPA + iSecurityMode = ESecurityModeWPA; + } + + aCounter++; + TInt end( aCounter + KWPAKeyNumOfFields ); + + for( TInt index(0); aCounter < end; aCounter++, index++ ) + { + if( (*iSecurityInfo)[ aCounter ] != NULL ) + { + CLOG_WRITE_FORMAT( "wpa info %S", (*iSecurityInfo)[ aCounter ] ); + } + else + { + CLOG_WRITE( "wpa info NULL" ); + } + iWpaData[ index ] = (*iSecurityInfo)[ aCounter ] ; + } + SaveWPAL( aId ); + } + } + + + +// --------------------------------------------------------- +// WEP Security settings +// --------------------------------------------------------- + +// --------------------------------------------------------- +// CProcessorWlan::SaveWEPL +// --------------------------------------------------------- +// +void CProcessorWlan::SaveWEPL( TUint32 aIapId ) + { + CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); + CleanupStack::PushL( session ); + // Load IAP record + CCDIAPRecord* iapRecord = static_cast< CCDIAPRecord * > + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + CleanupStack::PushL( iapRecord ); + iapRecord->SetRecordId( aIapId ); + iapRecord->LoadL( *session ); + + // Load WLAN service table + // first get WLAN table id + CMDBGenericRecord* generic = static_cast + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( generic ); + generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); + generic->LoadL( *session ); + TMDBElementId wlanTableId = generic->TableId(); + + CMDBField* sidField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); + + TInt service = iapRecord->iService; + // prime with service id + *sidField = (TUint32)service; + + User::LeaveIfError( generic->FindL( *session ) ); + + // Save index of key in use + TUint32 keyInUse( WEPKeyInUse() ); + CMDBField* keyInUseField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepIndex ) ); + keyInUseField->SetL( keyInUse ); + + // Save authentication mode + TUint32 auth( WEPAuthentication() ); + CMDBField* authenticationField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanAuthMode ) ); + authenticationField->SetL( auth ); + + // Save WEP keys and key formats + if ( WEPFieldData( EWEPKey1Data )->Length() ) + { + CMDBField* wepKey1Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey1 ) ); + WriteKeyL( wepKey1Field, + WEPFieldData( EWEPKey1Data ), + WEPKeyFormat( EWEPKey1Format ) ); + CMDBField* formatKey1Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey1 ) ); + formatKey1Field->SetL( WEPKeyFormat( EWEPKey1Format ) ); + } + if ( WEPFieldData( EWEPKey2Data )->Length() ) + { + CMDBField* wepKey2Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey2 ) ); + WriteKeyL( wepKey2Field, + WEPFieldData( EWEPKey2Data ), + WEPKeyFormat( EWEPKey2Format ) ); + CMDBField* formatKey2Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey2 ) ); + formatKey2Field->SetL( WEPKeyFormat( EWEPKey2Format ) ); + } + if ( WEPFieldData( EWEPKey3Data )->Length() ) + { + CMDBField* wepKey3Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey3 ) ); + WriteKeyL( wepKey3Field, + WEPFieldData( EWEPKey3Data ), + WEPKeyFormat( EWEPKey3Format ) ); + CMDBField* formatKey3Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey3 ) ); + formatKey3Field->SetL( WEPKeyFormat( EWEPKey3Format ) ); + } + if ( WEPFieldData( EWEPKey4Data )->Length() ) + { + CMDBField* wepKey4Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWepKey4 ) ); + WriteKeyL( wepKey4Field, + WEPFieldData( EWEPKey4Data ), + WEPKeyFormat( EWEPKey4Format ) ); + CMDBField* formatKey4Field = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) ); + formatKey4Field->SetL( WEPKeyFormat( EWEPKey4Format ) ); + } + + generic->ModifyL( *session ); + + CleanupStack::PopAndDestroy( generic ); // generic + CleanupStack::PopAndDestroy( iapRecord ); // iapRecord + CleanupStack::PopAndDestroy( session ); // session + } + + +// --------------------------------------------------------- +// CProcessorWlan::WriteKeyL +// --------------------------------------------------------- +// +void CProcessorWlan::WriteKeyL( CMDBField* aKeyField, + HBufC16* aKey, + const TInt aKeyFormat ) + { + TBuf8 key; + + //convert to 8 bit + key.Copy( aKey->Des() ); + + if ( aKeyFormat == EAscii ) + { + // Must be converted to hexa and stored as a hexa + // Ascii key is half the length of Hex + HBufC8* buf8Conv = HBufC8::NewLC( key.Length() * KAsciiUnicodeRatio ); + ConvertAsciiToHex( key, buf8Conv ); + aKeyField->SetL( buf8Conv->Des() ); + CleanupStack::PopAndDestroy( buf8Conv ); + } + else if ( VerifyHex( key ) ) + { + //already in hexa format + aKeyField->SetL( key ); + } + else + { + CLOG_WRITE( "! Error : Invalid hexadecimal format" ) + } + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPFieldData +// --------------------------------------------------------- +// +HBufC16* CProcessorWlan::WEPFieldData( TDbCreatorWEPFields aFieldId ) + { + TInt index = WEPIndex( aFieldId ); + if( iWepData[ index ] == NULL ) + { + return iEmptyTag; + } + else + { + return iWepData[ index ]; + } + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPAuthentication +// --------------------------------------------------------- +// +TInt CProcessorWlan::WEPAuthentication() + { + HBufC16* authTypeStr = WEPFieldData( EWEPAuthType ); + TInt authType ( EAuthOpen ) ; + + _LIT16( KStrOpen, "Open" ); + _LIT16( KStrShared, "Shared" ); + + if ( authTypeStr->CompareF( KStrOpen ) == 0 ) + { + //CLOG_WRITE( "Authentication type : Open" ) + } + else if ( authTypeStr->CompareF( KStrShared ) == 0 ) + { + //CLOG_WRITE( "Authentication type : Shared" ) + authType = EAuthShared; + } + else + { + //aField is either empty or invalid + authType = KErrNotFound; + } + + return authType; + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPKeyInUse +// --------------------------------------------------------- +// +TInt CProcessorWlan::WEPKeyInUse() + { + HBufC16* keyStr = WEPFieldData( EWEPKeyInUse ); + TInt key ( EKeyNumber1 ) ; + + _LIT16( KStrKey1, "key1" ); + _LIT16( KStrKey2, "key2" ); + _LIT16( KStrKey3, "key3" ); + _LIT16( KStrKey4, "key4" ); + + if ( keyStr->CompareF( KStrKey1 ) == 0 ) + { + //CLOG_WRITE( "WEP key in use : key 1" ) + } + else if ( keyStr->CompareF( KStrKey2 ) == 0 ) + { + //CLOG_WRITE( "WEP key in use : key 2" ) + key = EKeyNumber2; + } + else if ( keyStr->CompareF( KStrKey3 ) == 0 ) + { + //CLOG_WRITE( "WEP key in use : key 3" ) + key = EKeyNumber3; + } + else if ( keyStr->CompareF( KStrKey4 ) == 0 ) + { + //CLOG_WRITE( "WEP key in use : key 4" ) + key = EKeyNumber4; + } + else + { + //aField is either empty or invalid + key = KErrNotFound; + } + + return key; + } + + + +// --------------------------------------------------------- +// CProcessorWlan::WEPKeyFormat +// --------------------------------------------------------- +// +TInt CProcessorWlan::WEPKeyFormat( TDbCreatorWEPFields aFieldId ) + { + __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Format || + aFieldId == EWEPKey2Format || + aFieldId == EWEPKey3Format || + aFieldId == EWEPKey4Format ), + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + HBufC16* keyFormatStr = WEPFieldData( aFieldId ); + TWEPKeyFormat keyFormat ( EAscii ) ; + + _LIT16( KStrAscii, "Ascii" ); + _LIT16( KStrHexadecimal, "Hexadecimal" ); + + if ( keyFormatStr->CompareF( KStrAscii ) == 0 ) + { + //CLOG_WRITE( "Key format : Ascii" ) + } + else if ( keyFormatStr->CompareF( KStrHexadecimal ) == 0 ) + { + //CLOG_WRITE( "Key format : Hexadecimal" ) + keyFormat = EHexadecimal; + } + else + { + CLOG_WRITE( "! Error : Invalid key format. Default:Ascii" ) + } + + return keyFormat; + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPKeyLength +// --------------------------------------------------------- +// +TWEPKeyLength CProcessorWlan::WEPKeyLength( TDbCreatorWEPFields aFieldId ) + { + __ASSERT_ALWAYS( ( aFieldId == EWEPKey1Length || + aFieldId == EWEPKey2Length || + aFieldId == EWEPKey3Length || + aFieldId == EWEPKey4Length ), + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + HBufC16* keyLengthStr = WEPFieldData( aFieldId ); + TWEPKeyLength keyLen ( E40Bits ) ; + + _LIT16( KStr64, "64" ); + _LIT16( KStr128, "128" ); + _LIT16( KStr256, "256" ); + + if ( keyLengthStr->CompareF( KStr64 ) == 0 ) + { + //CLOG_WRITE( "Key length : 64" ) + } + else if ( keyLengthStr->CompareF( KStr128 ) == 0 ) + { + //CLOG_WRITE( "Key length : 128" ) + keyLen = E104Bits; + } + else if ( keyLengthStr->CompareF( KStr256 ) == 0 ) + { + //CLOG_WRITE( "Key length : 256" ) + keyLen = E232Bits; + } + else + { + CLOG_WRITE( "! Error : Invalid key length. Default:64" ) + } + + return keyLen; + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPKeyValidLen +// --------------------------------------------------------- +// +TInt CProcessorWlan::WEPKeyValidLen(TInt aFormat , TWEPKeyLength aLen ) + { + __ASSERT_ALWAYS( aFormat == EAscii || aFormat == EHexadecimal, + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + __ASSERT_ALWAYS( aLen == E40Bits || aLen == E104Bits || aLen == E232Bits, + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + TInt len( 0 ); + + switch ( aFormat ) + { + case EAscii: + switch ( aLen ) + { + case E40Bits : len = KKeyDataLength40Bits / + KAsciiUnicodeRatio; + break; + case E104Bits : len = KKeyDataLength104Bits / + KAsciiUnicodeRatio; + break; + case E232Bits : len = KKeyDataLength232Bits / + KAsciiUnicodeRatio; + } + break; + case EHexadecimal: + switch ( aLen ) + { + case E40Bits : len = KKeyDataLength40Bits; + break; + case E104Bits : len = KKeyDataLength104Bits; + break; + case E232Bits : len = KKeyDataLength232Bits; + } + } + + return len; + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPIndex +// --------------------------------------------------------- +// +TInt CProcessorWlan::WEPIndex( TDbCreatorWEPFields aFieldId ) + { + __ASSERT_ALWAYS( aFieldId >= EWEPKeyInUse && aFieldId <= EWEPKey4Data, + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + return aFieldId - 0x1000 + iDataStart; + + ////return iWEPIndex[ aFieldId - 0x1000 ]; + } + +// --------------------------------------------------------- +// CProcessorWlan::WEPFieldValidate +// --------------------------------------------------------- +// +TBool CProcessorWlan::WEPFieldValidate() + { + TBool valid (ETrue); + + if ( ( WEPAuthentication() == KErrNotFound ) || + ( WEPKeyInUse() == KErrNotFound ) ) + { + valid = EFalse; + } + else + { + //gets the actual keylength + TInt keyLen[ KMaxNumberofKeys ] = { 0,0,0,0 }; + + keyLen[EKeyNumber1] = WEPFieldData( EWEPKey1Data )->Length(); + keyLen[EKeyNumber2] = WEPFieldData( EWEPKey2Data )->Length(); + keyLen[EKeyNumber3] = WEPFieldData( EWEPKey3Data )->Length(); + keyLen[EKeyNumber4] = WEPFieldData( EWEPKey4Data )->Length(); + + + //check validity of key1 length + TInt validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey1Format ), + WEPKeyLength( EWEPKey1Length ) ); + if ( keyLen[EKeyNumber1] && keyLen[EKeyNumber1] != validLen) + { + valid = EFalse; + CLOG_WRITE_FORMAT( "! Error : Key1 length is invalid %d", + keyLen[EKeyNumber1] ); + CLOG_WRITE_FORMAT( "ValidLen1: %d \n", validLen ); + } + else if ( keyLen[EKeyNumber2] ) + { + //check validity of key2 length + validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey2Format ), + WEPKeyLength( EWEPKey2Length ) ); + if ( keyLen[EKeyNumber2] != validLen ) + { + valid = EFalse; + CLOG_WRITE_FORMAT( "! Error : Key2 length is invalid %d", + keyLen[EKeyNumber2] ) + CLOG_WRITE_FORMAT( "ValidLen2: %d \n", validLen ); + } + else if ( keyLen[EKeyNumber3] ) + { + //check validity of key3 length + validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey3Format ), + WEPKeyLength( EWEPKey3Length ) ); + if ( keyLen[EKeyNumber3] != validLen ) + { + valid = EFalse; + CLOG_WRITE_FORMAT( "! Error : Key3 length is invalid %d", + keyLen[EKeyNumber3] ); + CLOG_WRITE_FORMAT( "ValidLen3: %d \n", validLen ); + } + else if ( keyLen[EKeyNumber4] ) + { + //check validity of key4 length + validLen = WEPKeyValidLen( WEPKeyFormat( EWEPKey4Format ), + WEPKeyLength( EWEPKey4Length ) ); + if ( keyLen[EKeyNumber4] != validLen ) + { + valid = EFalse; + CLOG_WRITE_FORMAT( "! Error : Key4 length is invalid %d", + keyLen[EKeyNumber4] ); + CLOG_WRITE_FORMAT( "ValidLen4: %d \n", validLen ); + }//if + }//else + }//else + }//else + }//else + + return valid; + } + +//---------------------------------------------------------- +// CProcessorWlan::ConvertAsciiToHex +//---------------------------------------------------------- +// +void CProcessorWlan::ConvertAsciiToHex( const TDesC8& aSource, + HBufC8*& aDest ) + { + _LIT( hex, "0123456789ABCDEF" ); + TInt size = aSource.Size(); + TPtr8 ptr = aDest->Des(); + for ( TInt ii = 0; ii < size; ii++ ) + { + TText8 ch = aSource[ii]; + ptr.Append( hex()[(ch/16)&0x0f] ); + ptr.Append( hex()[ch&0x0f] ); + } + } + +//---------------------------------------------------------- +// CWEPSecuritySettingsDlg::VerifyHex +//---------------------------------------------------------- +// +TBool CProcessorWlan::VerifyHex( const TDesC8& aHex ) + { + TBool err( ETrue ); + + for ( TInt i = 0; i < aHex.Length(); i++ ) + { + TChar c( aHex[i] ); + + if ( !c.IsHexDigit() ) + { + err = EFalse; + break; + } + } + + return err; + } + + +// --------------------------------------------------------- +// WPA Security settings +// --------------------------------------------------------- + + +// --------------------------------------------------------- +// CProcessorWlan::SaveWPAL +// --------------------------------------------------------- +// +void CProcessorWlan::SaveWPAL( TUint32 aIapId ) + { + CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" ); + + CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() ); + CleanupStack::PushL( session ); + + // Load IAP record + CCDIAPRecord* iapRecord = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); + CleanupStack::PushL( iapRecord ); + iapRecord->SetRecordId( aIapId ); + iapRecord->LoadL( *session ); + + // Load WLAN service table + // first get WLAN table id + CMDBGenericRecord* generic = static_cast + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( generic ); + + generic->InitializeL( TPtrC( WLAN_SERVICE ), NULL ); + generic->LoadL( *session ); + TMDBElementId wlanTableId = generic->TableId(); + CMDBField* sidField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanServiceId ) ); + + TInt service = iapRecord->iService; + // prime with service id + *sidField = (TUint32)service; + + User::LeaveIfError( generic->FindL( *session ) ); + + // Set WPA mode + CMDBField* enableWpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) ); + + enableWpaPskField->SetL( WPAPresharedKeyInUse() ); + + CLOG_WRITE( "Wrote enableWpaPskField" ); + + // Set security mode + CMDBField* secModeField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) ); + secModeField->SetL( iSecurityMode ); + + CLOG_WRITE( "Wrote securityMode" ); + + // Save EAP list + SetExpandedEapListL( service ); + CLOG_WRITE( "Wrote Expanded EAPList" ); + + // Save PreShared Key + TBuf8 keyWPA; + //convert to 8 bit + keyWPA.Copy( WPAFieldData( EWPAPresharedKey )->Des() ); + CMDBField* wpaPskField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) ); + wpaPskField->SetL( keyWPA ); + + CLOG_WRITE( "Wrote pre-shared key" ); + if ( keyWPA.Length() < 8 ) + { + CLOG_WRITE( "Error: WPA pre-shared key is less then 8 chars." ); + } + + // Check and save PreShared Key Length + TInt len( WPAKeyLength() ); + if ( len != keyWPA.Length() ) + { + CLOG_WRITE( "! Error : WPA key lengths do not match" ); + } + + CMDBField* keyLengthField = static_cast*> + ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) ); + keyLengthField->SetL( len ); + + generic->ModifyL( *session ); + + CleanupStack::PopAndDestroy( generic ); + CleanupStack::PopAndDestroy( iapRecord ); + CleanupStack::PopAndDestroy( session ); + CLOG_WRITE( "CProcessorWlan::SaveWPAL exit" ); + } + +// --------------------------------------------------------- +// CProcessorWlan::SetExpandedEapListL +// --------------------------------------------------------- +// +void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId ) + { + CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" ) + // Gets the text format eap list + HBufC16* eapList = WPAFieldData( EWPAEapMethod ); + + if ( eapList != NULL && 0 < eapList->Length() ) + { + // load general EAP settings If + CEapGeneralSettings* eapGs; + eapGs = CEapGeneralSettings::NewL( ELan, aServiceId ); + CleanupStack::PushL( eapGs ); + + // get lists of enabled/disabled EAPs for the IAP + RArray< TEapExpandedType > enabledEapMethods; + RArray< TEapExpandedType > disabledEapMethods; + + enabledEapMethods.Append( GetExpandedEapTypeIdL( *eapList ) ); + + // disabledEapMethods can be empty, SetEapMethods takes care of it, + // only enabledEapMethods is a must with correct contents + User::LeaveIfError( eapGs->SetEapMethods( enabledEapMethods, + disabledEapMethods ) ); + + CleanupStack::PopAndDestroy( eapGs ); + } + } + +// --------------------------------------------------------- +// CProcessorWlan::GetExpandedEapTypeId +// --------------------------------------------------------- +// +TEapExpandedType CProcessorWlan::GetExpandedEapTypeIdL( TDesC& aField ) + { + TUint8 resultByte; + TLex16 lex( aField.Ptr() ); + User::LeaveIfError( lex.Val( resultByte, EDecimal ) ); + + CLOG_WRITE_FORMAT( "CProcessorWlan::GetExpandedEapTypeIdL: EAP %d", + (int)resultByte ) + + switch ( resultByte ) + { + case 0x06: + { + return *EapExpandedTypeGtc.GetType(); + } + case 0x0d: + { + return *EapExpandedTypeTls.GetType(); + } + case 0x11: + { + return *EapExpandedTypeLeap.GetType(); + } + case 0x12: + { + return *EapExpandedTypeSim.GetType(); + } + case 0x15: + { + return *EapExpandedTypeTtls.GetType(); + } + case 0x17: + { + return *EapExpandedTypeAka.GetType(); + } + case 0x19: + { + return *EapExpandedTypePeap.GetType(); + } + case 0x1a: + { + return *EapExpandedTypeMsChapv2.GetType(); + } + case 0x2b: + { + return *EapExpandedTypeFast.GetType(); + } + case 0x01: + { + return *EapExpandedTypeProtectedSetup.GetType(); + } + case 0x62: + { + return *EapExpandedTypeTtlsPap.GetType(); + } + case 0x63: + { + return *EapExpandedPlainMsChapv2.GetType(); + } + default: + { + return *EapExpandedTypeNone.GetType(); + } + } + } + +// --------------------------------------------------------- +// CProcessorWlan::WPAIndex +// --------------------------------------------------------- +// +TInt CProcessorWlan::WPAIndex( TDbCreatorWPAFields aFieldId ) + { + __ASSERT_ALWAYS( aFieldId >= EWPAPresharedKey && aFieldId <= EWPAUseOfPresharedKey, + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + return aFieldId - 0x2000 + iDataStart; + } + +// --------------------------------------------------------- +// CProcessorWlan::WPAFieldData +// --------------------------------------------------------- +// +HBufC16* CProcessorWlan::WPAFieldData( TDbCreatorWPAFields aFieldId ) + { + TInt index = WPAIndex( aFieldId ); + if( iWpaData[ index ] == NULL ) + { + return iEmptyTag; + } + else + { + return iWpaData[ index ]; + } + } + +// --------------------------------------------------------- +// CProcessorWlan::WPAPresharedKeyInUse +// --------------------------------------------------------- +// +TBool CProcessorWlan::WPAPresharedKeyInUse() + { + HBufC16* useStr = WPAFieldData( EWPAUseOfPresharedKey ); + + TBool usePSK ( EFalse ) ; + + if ( useStr->CompareF( KStrYes ) == 0 ) + { + CLOG_WRITE( "Preshared key in use" ) + usePSK = ETrue; + } + else if ( useStr->CompareF( KStrNo ) == 0 ) + { + CLOG_WRITE( "Preshared key not in use" ); + } + else + { + //aField is either empty or invalid + CLOG_WRITE( "! Error : Invalid Use WPA preshared key. Default:No" ); + } + + return usePSK; + } + +// --------------------------------------------------------- +// CProcessorWlan::WPAKeyLength +// --------------------------------------------------------- +// +TInt CProcessorWlan::WPAKeyLength() + { + HBufC16* tag = WPAFieldData( EWPAKeyLength ); + + TInt num( 0 ); + TLex parser( tag->Des() ); + + if ( parser.Val( num ) != KErrNone ) + { + CLOG_WRITE( "! Error : Invalid input : WPA key length" ); + } + + return num; + } + +// --------------------------------------------------------- +// CProcessorWlan::AddSecurityDataL +// --------------------------------------------------------- +// +void CProcessorWlan::AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep ) + { + if( aIsWep ) + { + iWepData[ WEPIndex( (TDbCreatorWEPFields)aField ) ] = aPtrTag->AllocL(); + ////iWepData.Insert( aPtrTag->AllocL(), WEPIndex( (TDbCreatorWEPFields)aField ) ); + } + else + { + iWpaData[ WPAIndex( (TDbCreatorWPAFields)aField ) ] = aPtrTag->AllocL(); + ////iWpaData.Insert( aPtrTag->AllocL(), WPAIndex( (TDbCreatorWPAFields)aField ) ); + } + } + +// --------------------------------------------------------- +// CProcessorWlan::DoLogL +// --------------------------------------------------------- +// +void CProcessorWlan::DoLogL() + { + // Writes some data of the actual WLAN access point into the log file. + HBufC16* tmp; + RCmConnectionMethodExt& plugin = GetLastPluginL(); + + // Writes some data of the Internet acces point into the log file. + if ( iIsEasyWlan ) + { + CLOG_WRITE( "Easy WLAN Access Point created:" ) + } + else + { + CLOG_WRITE( "WLAN Access Point created:" ) + } + + CLOG_WRITE_FORMAT( "\t Connection name in array: %S ", + (*iPluginName)[ PluginCount() - 1] ); + + tmp = plugin.GetStringAttributeL( ECmName ); + if( tmp ) + { + CleanupStack::PushL( tmp ); + CLOG_WRITE_FORMAT( "\t Connection name: %S ", tmp ) + CleanupStack::PopAndDestroy( tmp ); + } + + // For the WLAN network name + tmp = plugin.GetStringAttributeL( EWlanSSID ); + if( tmp ) + { + CleanupStack::PushL( tmp ); + CLOG_WRITE_FORMAT( "\t Network name: %S", tmp ) + CleanupStack::PopAndDestroy( tmp ); + } + CLOG_WRITE( "\t \r\n" ) + } + + +// --------------------------------------------------------- +// CProcessorWlan::Reset +// --------------------------------------------------------- +// +void CProcessorWlan::Reset() + { + for( TInt i = 0; i < KWEPKeyNumOfFields; i++ ) + { + iWepData[i] = NULL; + } + for( TInt i = 0; i < KWPAKeyNumOfFields; i++ ) + { + iWpaData[i] = NULL; + } + } + +// --------------------------------------------------------- +// CProcessorWlan::EAPSetting +// --------------------------------------------------------- +// +TBool CProcessorWlan::EAPSetting( const TInt aField ) + { + // Checks if the supplied field is EAP settings and returns ETrue if it is + if ( aField > EEapParameterFirst + && aField < EEapParameterLast ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +// --------------------------------------------------------- +// CProcessorWlan::GetEapTypeIdFromSettingId +// --------------------------------------------------------- +// +TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField ) + { + switch ( aField ) + { + case EEapGtcUsername: + case EEapGtcSessionValidityTime: + case EEapGtcEncapsulation: + { + return *EapExpandedTypeGtc.GetType(); + } + case EEapTlsUsername: + case EEapTlsRealm: + case EEapTlsVerifyServerRealm: + case EEapTlsRequireClientAuth: + case EEapTlsSessionValidityTime: + case EEapTlsCipherSuites: + case EEapTlsUserCertSubjectKeyId: + case EEapTlsUserCertIssuerName: + case EEapTlsUserCertSerialNumber: + case EEapTlsCaCertSubjectKeyId: + case EEapTlsCaCertIssuerName: + case EEapTlsCaCertSerialNumber: + case EEapTlsEncapsulation: + { + return *EapExpandedTypeTls.GetType(); + } + case EEapLeapUsername: + case EEapLeapPassword: + case EEapLeapSessionValidityTime: + { + return *EapExpandedTypeLeap.GetType(); + } + case EEapSimUsername: + case EEapSimRealm: + case EEapSimUsePseudonyms: + case EEapSimSessionValidityTime: + case EEapSimEncapsulation: + { + return *EapExpandedTypeSim.GetType(); + } + case EEapTtlsUsername: + case EEapTtlsRealm: + case EEapTtlsVerifyServerRealm: + case EEapTtlsRequireClientAuth: + case EEapTtlsSessionValidityTime: + case EEapTtlsCipherSuites: + case EEapTtlsEncapsulatedTypes: + case EEapTtlsUserCertSubjectKeyId: + case EEapTtlsUserCertIssuerName: + case EEapTtlsUserCertSerialNumber: + case EEapTtlsCaCertSubjectKeyId: + case EEapTtlsCaCertIssuerName: + case EEapTtlsCaCertSerialNumber: + { + return *EapExpandedTypeTtls.GetType(); + } + case EEapAkaUsername: + case EEapAkaRealm: + case EEapAkaUsePseudonyms: + case EEapAkaSessionValidityTime: + case EEapAkaEncapsulation: + { + return *EapExpandedTypeAka.GetType(); + } + case EEapPeapUsername: + case EEapPeapRealm: + case EEapPeapVerifyServerRealm: + case EEapPeapRequireClientAuth: + case EEapPeapSessionValidityTime: + case EEapPeapCipherSuites: + case EEapPeapV0Allowed: + case EEapPeapV1Allowed: + case EEapPeapV2Allowed: + case EEapPeapEncapsulatedTypes: + case EEapPeapUserCertSubjectKeyId: + case EEapPeapUserCertIssuerName: + case EEapPeapUserCertSerialNumber: + case EEapPeapCaCertSubjectKeyId: + case EEapPeapCaCertIssuerName: + case EEapPeapCaCertSerialNumber: + { + return *EapExpandedTypePeap.GetType(); + } + case EEapMschapv2Username: + case EEapMschapv2Password: + case EEapMschapv2SessionValidityTime: + case EEapMschapv2Encapsulation: + { + return *EapExpandedTypeMsChapv2.GetType(); + } + case EEapFastUsername: + case EEapFastRealm: + case EEapFastVerifyServerRealm: + case EEapFastRequireClientAuth: + case EEapFastSessionValidityTime: + case EEapFastCipherSuites: + case EEapFastEncapsulatedTypes: + case EEapFastAuthProvModeAllowed: + case EEapFastUnauthProvModeAllowed: + case EEapFastWarnADHPNoPAC: + case EEapFastWarnADHPNoMatchingPAC: + case EEapFastWarnNotDefaultServer: + case EEapFastUserCertSubjectKeyId: + case EEapFastUserCertIssuerName: + case EEapFastUserCertSerialNumber: + case EEapFastCaCertSubjectKeyId: + case EEapFastCaCertIssuerName: + case EEapFastCaCertSerialNumber: + { + return *EapExpandedTypeFast.GetType(); + } + + case EMschapv2Username: + case EMschapv2Password: + case EMschapv2SessionValidityTime: + case EMschapv2Encapsulation: + { + return *EapExpandedPlainMsChapv2.GetType(); + } + default: + { + return *EapExpandedTypeNone.GetType(); + } + + } + } + +// --------------------------------------------------------- +// CProcessorWlan::AddEAPSetting +// --------------------------------------------------------- +// +void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue ) + { + TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField ); + if ( eapId == *EapExpandedTypeNone.GetType() ) + { + CLOG_WRITE( "! Error : Unknown EAP method" ); + User::Leave( KErrArgument ); + } + + TInt eapIndex(0); + // Search if the EAP instance already exists in the array for this + for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ ) + { + if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId ) + && ( iEapSettings[eapIndex]->iName != NULL ) + && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 )) + { + // Found it + break; + } + } + + if ( eapIndex == iEapSettings.Count() ) + { + // Not found. Create new + CEapTypeElement* newEap = new (ELeave) CEapTypeElement; + CleanupStack::PushL( newEap ); + + newEap->iEapSettings = new (ELeave) EAPSettings; + + newEap->iEapSettings->iEAPExpandedType = eapId; + + newEap->iName = iName->AllocL(); + + iEapSettings.AppendL(newEap); + + CleanupStack::Pop( newEap ); + + // Set the index to the newly created EAP settings instance + eapIndex = iEapSettings.Count() - 1; + + } + switch ( aField ) + { + case EEapGtcUsername: + case EEapTlsUsername: + case EEapLeapUsername: + case EEapSimUsername: + case EEapTtlsUsername: + case EEapAkaUsername: + case EEapPeapUsername: + case EEapMschapv2Username: + case EEapFastUsername: + case EMschapv2Username: + { + iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue ); + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; + break; + } + + case EEapLeapPassword: + case EEapMschapv2Password: + case EMschapv2Password: + { + iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue ); + iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse; + break; + } + + case EEapTlsRealm: + case EEapSimRealm: + case EEapTtlsRealm: + case EEapAkaRealm: + case EEapPeapRealm: + case EEapFastRealm: + { + iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue ); + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse; + break; + } + + case EEapGtcSessionValidityTime: + case EEapTtlsSessionValidityTime: + case EEapTlsSessionValidityTime: + case EEapSimSessionValidityTime: + case EEapLeapSessionValidityTime: + case EMschapv2SessionValidityTime: + case EEapAkaSessionValidityTime: + case EEapPeapSessionValidityTime: + case EEapMschapv2SessionValidityTime: + case EEapFastSessionValidityTime: + { + // Convert the input parameter to integer + TLex lex( *aValue ); + TUint value( 0 ); + if( lex.Val( value, EDecimal) != KErrNone ) + { + CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + iEapSettings[eapIndex]->iEapSettings->iSessionValidityTimePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iSessionValidityTime = value; + break; + } + + case EEapGtcEncapsulation: + case EEapTlsEncapsulation: + case EEapSimEncapsulation: + case EEapAkaEncapsulation: + case EEapMschapv2Encapsulation: + case EMschapv2Encapsulation: + { + TLex lex( *aValue ); + TUint eapTypeId( 0 ); + if( lex.Val( eapTypeId, EDecimal) != KErrNone ) + { + CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId ); + break; + } + + case EEapTlsVerifyServerRealm: + case EEapTtlsVerifyServerRealm: + case EEapPeapVerifyServerRealm: + case EEapFastVerifyServerRealm: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealmPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iVerifyServerRealm = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapTlsRequireClientAuth: + case EEapTtlsRequireClientAuth: + case EEapPeapRequireClientAuth: + case EEapFastRequireClientAuth: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthenticationPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iRequireClientAuthentication = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapTlsCipherSuites: + case EEapTtlsCipherSuites: + case EEapPeapCipherSuites: + case EEapFastCipherSuites: + { + TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) ); + if( err != KErrNone ) + { + CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + break; + } + + case EEapTlsUserCertSubjectKeyId: + case EEapTtlsUserCertSubjectKeyId: + case EEapPeapUserCertSubjectKeyId: + case EEapFastUserCertSubjectKeyId: + { + TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); + + TKeyIdentifier key; + + TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); + if( err != KErrNone ) + { + CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); + break; + } + + case EEapTlsUserCertIssuerName: + case EEapTtlsUserCertIssuerName: + case EEapPeapUserCertIssuerName: + case EEapFastUserCertIssuerName: + { + TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); + + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); + break; + } + + case EEapTlsUserCertSerialNumber: + case EEapTtlsUserCertSerialNumber: + case EEapPeapUserCertSerialNumber: + case EEapFastUserCertSerialNumber: + { + TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); + + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); + break; + } + + case EEapTlsCaCertSubjectKeyId: + case EEapTtlsCaCertSubjectKeyId: + case EEapPeapCaCertSubjectKeyId: + case EEapFastCaCertSubjectKeyId: + { + TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); + + TKeyIdentifier key; + + TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) ); + if( err != KErrNone ) + { + CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent(); + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; + break; + } + + case EEapTlsCaCertIssuerName: + case EEapTtlsCaCertIssuerName: + case EEapPeapCaCertIssuerName: + case EEapFastCaCertIssuerName: + { + TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerNamePresent(); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue ); + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; + + break; + } + + case EEapTlsCaCertSerialNumber: + case EEapTtlsCaCertSerialNumber: + case EEapPeapCaCertSerialNumber: + case EEapFastCaCertSerialNumber: + { + TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); + iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue ); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent(); + iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue ); + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificatePresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUseAutomaticCACertificate = EFalse; + break; + } + + case EEapSimUsePseudonyms: + case EEapAkaUsePseudonyms: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iUsePseudonymsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUsePseudonyms = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + break; + } + + case EEapTtlsEncapsulatedTypes: + case EEapPeapEncapsulatedTypes: + case EEapFastEncapsulatedTypes: + { + iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) ); + iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; + break; + } + + case EEapPeapV0Allowed: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv0Allowed = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapPeapV1Allowed: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv1Allowed = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapPeapV2Allowed: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iPEAPVersionsPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iPEAPv2Allowed = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapFastAuthProvModeAllowed: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowedPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iAuthProvModeAllowed = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapFastUnauthProvModeAllowed: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowedPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iUnauthProvModeAllowed = EFalse; + } + else + { + + CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapFastWarnADHPNoPAC: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPACPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoPAC = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapFastWarnADHPNoMatchingPAC: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPACPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnADHPNoMatchingPAC = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + case EEapFastWarnNotDefaultServer: + { + if ( !aValue->CompareF( KStrYes ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = ETrue; + } + else if ( !aValue->CompareF( KStrNo ) ) + { + iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServerPresent = ETrue; + iEapSettings[eapIndex]->iEapSettings->iWarnNotDefaultServer = EFalse; + } + else + { + CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() ); + User::Leave( KErrArgument ); + } + + break; + } + + default: + { + + } + } + } +// --------------------------------------------------------- +// CProcessorWlan::FillCipherSuitesL +// --------------------------------------------------------- +// +void CProcessorWlan::FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex ) + { + if ( iEapSettings[aEapIndex] == NULL ) + { + User::Leave( KErrArgument ); + } + + iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Reset(); + iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = EFalse; // init to EFalse + + TChar plus( '+' ); + + TBuf8<256> tmpBuf; + tmpBuf.Copy( *aPtrTag); + + TInt length = tmpBuf.Length(); + + for ( TInt i = 0 ; i + 3 < length ; i += 5) + { + if ( tmpBuf[i] == plus ) + { + TLex8 lex( tmpBuf.Mid( i + 1, 3) ); + TUint suite; + User::LeaveIfError( lex.Val( suite ) ); + iEapSettings[aEapIndex]->iEapSettings->iCipherSuites.Append(suite); + iEapSettings[aEapIndex]->iEapSettings->iCipherSuitesPresent = ETrue; + } + } + } + +// --------------------------------------------------------- +// CProcessorWlan::FindCertificateEntry +// --------------------------------------------------------- +// +TUint CProcessorWlan::FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex ) + { + TUint certIndex( 0 ); + for( certIndex = 0; certIndex < iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ; certIndex++ ) + { + if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType ) + { + // Found + break; + } + } + if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() ) + { + // Not found. Create + EapCertificateEntry* entry; + entry = new (ELeave) EapCertificateEntry; + entry->SetCertType( aCertType ); + + iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry ); + + certIndex = iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() - 1; + } + return certIndex; + } + +// --------------------------------------------------------- +// CProcessorWlan::ConvertSubjectKeyIdToBinary +// --------------------------------------------------------- +// +void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey) + { + TInt err( KErrNone ); + + // Define literals to search the subject key for possible 0X/0x beginning + _LIT(KHexIdLC, "0x"); + _LIT(KHexIdUC, "0X"); + TBuf<2> hexIdBuf; + + // The lenght of the key given as input + TInt keyLen = aSubjectKeyIdString->Length(); + + // setting the given key to the key buffer + TBuf8<256> origKey; + + origKey.Copy( *aSubjectKeyIdString ); + origKey.SetLength(keyLen); + + TLex8 tmpByte; + TUint16 byte; + + // Remove possible spaces from the beginning + origKey.TrimLeft(); + + // the key should be atleast two chars long + if (origKey.Length() >= 2) + { + // Copy the two left most characters in to the buffer + hexIdBuf.Copy(origKey.Left(2)); + + // If the first characters are 0x or 0X, then thet should be ignored + if (hexIdBuf.Compare(KHexIdLC) == 0 + || hexIdBuf.Compare(KHexIdUC) == 0) + { + // delete two characters + origKey.Delete(0, 2); + } + } + + + // looping the subject key through, removing whitespaces + for (TInt i = 0; i < KKeyIdentifierLength; i++) + { + // removing white spaces from the left side of the key + origKey.TrimLeft(); + // check that there are characters left + if (origKey.Length() >= 2) + { + // pick the two left most bytes from the key + tmpByte = origKey.Left(2); + // convert byte into binary format + err = tmpByte.Val(byte, EHex); + + // check whether conversion to decimal went ok + if (err != KErrNone) + { + // if there are problems, then leave the loop + break; + } + + // store the appended byte into the key variable + aBinaryKey.Append(byte); + // delete two characters from the left side of the character array in the buffer + origKey.Delete(0, 2); + } + else { + // leave the loop, no characters are left + break; + } + } + User::LeaveIfError( err ); + } + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcreaderbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcreaderbase.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CReaderBase +* +*/ + + + + +// INCLUDE FILES + +#include "cdcreaderbase.h" +#include "cdclogger.h" + +#include "cdcerrors.h" +#include "cdccommon.h" + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +//--------------------------------------------------------- +// Constructor & Destructor +//--------------------------------------------------------- +// +CReaderBase::~CReaderBase() + { + CLOSE_LOG; + //no implementation required + delete iTagContainer; + + iInputFile.Close(); + iFs.Close(); + } + + +CReaderBase::CReaderBase( TDbCreatorInputFile aFileType, + TDbCreatorFeatures aFeature ): + iCurrentFeature( aFeature ), + iTagContainer( NULL ), + iFileType( aFileType ) + { + //no implementation required + } + +// --------------------------------------------------------- +// CProcessorBase::ConstructL +// --------------------------------------------------------- +// +void CReaderBase::ConstructL( const TDesC& aInFileName ) + { + User::LeaveIfError( iFs.Connect() ); + + TInt error( iInputFile.Open( iFs, aInFileName, + EFileShareReadersOnly | EFileStream | EFileRead ) ); + + if ( error == KErrNotFound ) + { + User::Leave( KErrNotFound ); + } + else if ( error ) + { + User::Leave( KErrFileCannotBeOpened ); + } + else + { + //nothing to do + } + + ////iFs.MkDirAll( KFullLogDir ); + + CREATE_LOG; + + ////User::LeaveIfError( iLogFile.Connect() ); + ////iLogFile.CreateLog( KLogDir, KLogFile , EFileLoggingModeAppend ); + + iTagContainer = CTagContainer::NewL(); + } + + +// --------------------------------------------------------- +// CProcessorBase::TagContainer +// --------------------------------------------------------- +// +CTagContainer& CReaderBase::TagContainer() + { + return *iTagContainer; + } + + +// --------------------------------------------------------- +// CProcessorBase::InputFile +// --------------------------------------------------------- +// +RFile& CReaderBase::InputFile() + { + return iInputFile; + } + + +// --------------------------------------------------------- +// CProcessorBase::FileLogger +// --------------------------------------------------------- +// +RFileLogger& CReaderBase::FileLogger() + { + return iLogFile; + } + + +// --------------------------------------------------------- +// CProcessorBase::FieldIDPresent +// --------------------------------------------------------- +// +TBool CReaderBase::FieldIDPresent() + { + return ( iFileType == EFileXML ); + } + + +// --------------------------------------------------------- +// CProcessorBase::CurrentFeature +// --------------------------------------------------------- +// +TDbCreatorFeatures CReaderBase::CurrentFeature() + { + return iCurrentFeature; + } + +//End of file diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcreaderxml.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcreaderxml.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,1821 @@ +/* +* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Implementation of the class CReaderXML +*/ + +// INCLUDE FILES + +#include "cdcreaderxml.h" +#include "cdclogger.h" + +#include +#include +#include +#include +#include +#include +#include + +using namespace CMManager; + +//TYPE DECLARATION + +//CONSTANTS +// +// Literals in XML header +_LIT16( KXmlVersion, "xml version" ); +_LIT16( KEncoding, "encoding" ); +_LIT16( KEncodingUtf8, "UTF-8" ); + +// File tail marker +_LIT16( KFileTail, ""); +_LIT16( KFileTail2, ""); + +// Feature head markers +_LIT16( KFeatureHeadPacketData, "" ); +_LIT16( KFeatureHeadWLAN, "" ); +_LIT16( KFeatureHeadLAN, "" ); +_LIT16( KFeatureHeadVPN, "" ); +_LIT16( KFeatureHeadGlobal, "" ); +_LIT16( KFeatureHeadDN, "" ); + +// Feature tail markers +_LIT16( KFeatureTailPacketData, "" ); +_LIT16( KFeatureTailWLAN, "" ); +_LIT16( KFeatureTailLAN, "" ); +_LIT16( KFeatureTailVPN, "" ); +_LIT16( KFeatureTailGlobal, "" ); +_LIT16( KFeatureTailDN, "" ); + +// Feature data head markers +_LIT16( KDataHeadPacketData, "" ); +_LIT16( KDataHeadWLAN, "" ); +_LIT16( KDataHeadLAN, "" ); +_LIT16( KDataHeadVPN, "" ); +_LIT16( KDataHeadDN, "" ); + +// Feature data tail markers +_LIT16( KDataTailPacketData, "" ); +_LIT16( KDataTailWLAN, "" ); +_LIT16( KDataTailLAN, "" ); +_LIT16( KDataTailVPN, "" ); +_LIT16( KDataTailDN, "" ); + +// Parameter Markers +// ParamValue +_LIT16( KParamValueHead, ">" ); +_LIT16( KParamValueTail, "" ); + + +//maximum line size +const TInt16 KMaxLineSize = 1024; +//maximum item (tag) size +const TInt16 KMaxItemLength = 100; + +// ratio between ascii and unicode character sizes +const TUint KAsciiUnicodeRatio = 2; + +// Following table contains the input parameter names: +// +// Name Type Description +//---------------------------------------------------------------------------- +//General & Gprs specific: +//======================== +//KConnectionName string The name of the access point. +//KProtected string Protection +//KHidden string CM/DN is hidden +//KHiddenAgent string CM/DN is not shown in CConnDlg +//KHighlighted string CM/DN is highlighted in CConnDlg +//KSeamlessness string Seamlessness value +//KGprs_AP_Name string Access point name. +//KUserName string Login user name +//KPromptPassword string Prompts the user for username and +// password +//KPassword string Login password. +//KPasswordAuthType string Disables plain text authentication. +//KWAPGatewayIP string WAP gateway address (IP address). +//KStartingPage string WAP start page URL. +//KWTLS_Security string Attempts a secure WTLS connection +// to the gateway. +//KWAP_ConnectionType string Indicates whether a connection- +// oriented or connectionless API +// should be used. +//KPhoneIP string IP address of the interface. +//KPrimaryNameServer string IP address of the primary name +// server. +//KSecondaryNameServer string IP address of the secondary name +// server. +//KProxyServerAddress string Proxy server address. +//KProxyPortNumber string Proxy port number. +//KProxyProtocolName string Proxy protocol name. +//KPrimaryIP6NameServer string IP address of the primary IPv6 +// name server. +//KSecondaryIP6NameServer string IP address of the secondary IPv6 +// name server. +//KNetworkType string Network type: IPv4 or IPv6 +//KGprsUseEdge string Sets the GprsUseEdge parameter +//============= +//LAN specific: +//============= +//KLanIfNetworks string Network protcols +//KLanIpNetMask string IP net mask of interface +//KLanIpGateway string IP address of gateway +//============== +//WLAN specific: +//============== +//KNetworkName string The name of the WLAN network +//KNetworkMode string The WLAN network mode +//KSecurityMode string The security mode of the WLAN network +//KWlanIpGatewayAddress string IP address of gateway +//KWlanIpNetMask string IP net mask of interface +//KWlanChannelId integer 802.11 Channel ID (1-14) + +//--------------- +//WEP security +//--------------- +//WEPKeyInUse integer Index of the default WEP key +//WEPAuthType string WEP authentication mode. +//WEPKey1Length string Key length of WEP key1. 64, 128, 256 bit. +//WEPKey1Format string Format of WEP key 1. ASCII or Hexadecimal +//WEPKey1Data string Data of WEP key1 +//WEPKey2Length string Key length of WEP key2. 64, 128, 256 bit. +//WEPKey2Format string Format of WEP key 2. ASCII or Hexadecimal +//WEPKey2Data string Data of WEP key2 +//WEPKey3Length string Key length of WEP key3. 64, 128, 256 bit. +//WEPKey3Format string Format of WEP key 3. ASCII or Hexadecimal +//WEPKey3Data string Data of WEP key3 +//WEPKey4Length string Key length of WEP key4. 64, 128, 256 bit. +//WEPKey4Format string Format of WEP key 4. ASCII or Hexadecimal +//WEPKey4Data string Data of WEP key4 +//--------------- +//WPA security +//--------------- +//WPAPresharedKey string WPA/WPA2 pre-shared key in plain text. +//WPAKeyLength integer The length of the WPA/WPA2 pre-shared key. +//WPAEapMethod string A EAP method in use +//WPAUseOfPresharedKey string WPA/WPA2 pre-shared key usage. +//============= +//VPN specific: +//============= +//KVpnIapName string IAP name used for the connection +//KVpnServicePolicy string Service policy ID +//==================== +//Destination Networks +//==================== +//KDN_Name string The name of the Destination Network +//KDN_Icon integer Index of icon assigned to the DN +//KDN_Metadata string Destination type +//KDN_Protection integer Protection level of the DN +//KDN_Hidden integer Shows whether DN is hidden or not +//KDN_IAPName string Name of a Connection Method that is +// bound to the DN +//KDN_IAPName2..10 string Same as above +//KDN_EmbeddedDN string Name of an Embedded DN that is bound +// to the DN +//=============== +//Global settings +//=============== +//KAttachMode string Gprs attach mode +//KDefaultAP string Default Gprs access point +//KTableProtection string Table level protection +//KDefaultDnIcon integer Default icon for DNs +//KPriorityLan integer Default priority for Lan bearer type +//KPriorityWlan integer Default priority for WLan bearer type +//KPriorityPan integer Default priority for Pan bearer type +//KPriorityGprsOut integer Default priority for outgoing Gprs +// bearer type +//KPriorityGprsIn integer Default priority for incoming Gprs +// bearer type +//KPriorityCdma2k integer Default priority for CDMA2000 bearer type +//KPriorityDialOut integer Default priority for incoming dial +// bearer type +//KPriorityDialIn integer Default priority for outgoing dial +// bearer type +//KPriorityVpn integer Default priority for Vpn bearer type +//KPriorityMip integer Default priority for Mip bearer type +//KUIPriorityLan integer Default UI priority for Lan bearer type +//KUIPriorityWlan integer Default UI priority for WLan bearer type +//KUIPriorityPan integer Default UI priority for Pan bearer type +//KUIPriorityGprsOut integer Default UI priority for outgoing Gprs +// bearer type +//KUIPriorityGprsIn integer Default UI priority for incoming Gprs +// bearer type +//KUIPriorityCdma2k integer Default UI priority for CDMA2000 +// bearer type +//KUIPriorityDialOut integer Default UI priority for incoming dial +// bearer type +//KUIPriorityDialIn integer Default UI priority for outgoing dial +// bearer type +//KUIPriorityVpn integer Default UI priority for Vpn bearer type +//KUIPriorityMip integer Default UI priority for Mip bearer type + +//KDefaultConnectionType integer Default connection method type +//KDefaultConnectionName string Default connection method name + +//KUsageOfWlan integer Usage of known WLAN networks, automatical or manual +//KSeamlessnessHome integer Cellular data usage in home network +//KSeamlessnessVisitor integer Cellular data usage in foreign networks + + +//KGprsLastSocketActivityTimeout integer +//KGprsLastSessionClosedTimeout integer The time how long Gprs PDP context stays active +// after the last application using the connection was closed. +//KGprsLastSocketClosedTimeout integer +//KCsdLastSocketActivityTimeout integer +//KCsdLastSessionClosedTimeout integer +//KCsdLastSocketClosedTimeout integer +//KWlanLastSocketActivityTimeout integer +//KWlanLastSessionClosedTimeout integer +//KWlanLastSocketClosedTimeout integer +//KWlanBGScanInterval integer +//KWlanUseDefSettings integer +//KWlanLongRetry integer +//KWlanShortRetry integer +//KWlanRTS integer +//KWlanTxPowerLevel integer +//KWlanRadioMeasurements integer +//KWlanPowerMode integer Whether WLAN power save is on or off + + +//String literals defined for input parameters + +//General & Gprs specific +_LIT16( KConnectionName, "ConnectionName" ); +_LIT16( KConnectionId, "ConnectionId" ); +_LIT16( KProtected, "Protected" ); +_LIT16( KHidden, "Hidden" ); +_LIT16( KHiddenAgent, "HiddenAgent" ); +_LIT16( KHighlighted, "Highlighted" ); +_LIT16( KSeamlessness, "Seamlessness" ); +_LIT16( KGprs_AP_Name, "Gprs_AP_Name" ); +_LIT16( KUserName, "UserName" ); +_LIT16( KPromptPassword, "PromptPassword" ); +_LIT16( KPassword, "Password" ); +_LIT16( KPasswordAuthType, "PasswordAuthenticationType" ); +_LIT16( KWAPGatewayIP, "WAPGatewayIP" ); +_LIT16( KStartingPage, "StartingPage" ); +_LIT16( KWTLS_Security, "WTLS_Security" ); +_LIT16( KWAP_ConnectionType, "WAP_ConnectionType" ); +_LIT16( KPhoneIP, "PhoneIP" ); +_LIT16( KPrimaryNameServer, "PrimaryNameServer" ); +_LIT16( KSecondaryNameServer, "SecondaryNameServer" ); +_LIT16( KProxyServerAddress, "ProxyServerAddress" ); +_LIT16( KProxyPortNumber, "ProxyPortNumber" ); +_LIT16( KProxyProtocolName, "ProxyProtocolName"); +_LIT16( KPrimaryIP6NameServer, "PrimaryIP6NameServer" ); +_LIT16( KSecondaryIP6NameServer, "SecondaryIP6NameServer" ); +_LIT16( KNetworkType, "NetworkType"); +_LIT16( KIspType, "IspType" ); +_LIT16( KGprsUseEdge, "GprsUseEdge"); +_LIT16( KLinger, "Linger"); + +//Lan specific +_LIT16( KLanIfNetworks, "LanIfNetworks" ); +_LIT16( KLanIpNetMask, "LanIpNetMask" ); +_LIT16( KLanIpGateway, "LanIpGateway" ); +_LIT16( KLanIpAddrFromServer, "IpAddrFromServer" ); +_LIT16( KLanIpDNSAddrFromServer, "IpDNSAddrFromServer" ); +_LIT16( KLanConfigDaemonManagerName,"ConfigDaemonManagerName" ); +_LIT16( KLanConfigDaemonName, "ConfigDaemonName" ); + +//Wlan specific +_LIT16( KNetworkName, "NetworkName" ); +_LIT16( KNetworkMode, "NetworkMode" ); +_LIT16( KSecurityMode, "SecurityMode" ); +_LIT16( KWlanIpGatewayAddress, "WlanIpGatewayAddress" ); +_LIT16( KWlanIpNetMask, "WlanIpNetMask" ); +_LIT16( KWlanScanSSId, "WlanScanSSId" ); +_LIT16( KWlanChannelId, "WlanChannelId" ); + +//WEP security +_LIT16( KWEPKeyInUse, "WEPKeyInUse" ); +_LIT16( KWEPAuthType, "WEPAuthType" ); +_LIT16( KWEPKey1Length, "WEPKey1Length" ); +_LIT16( KWEPKey1Format, "WEPKey1Format" ); +_LIT16( KWEPKey1Data, "WEPKey1Data" ); +_LIT16( KWEPKey2Length, "WEPKey2Length" ); +_LIT16( KWEPKey2Format, "WEPKey2Format" ); +_LIT16( KWEPKey2Data, "WEPKey2Data" ); +_LIT16( KWEPKey3Length, "WEPKey3Length" ); +_LIT16( KWEPKey3Format, "WEPKey3Format" ); +_LIT16( KWEPKey3Data, "WEPKey3Data" ); +_LIT16( KWEPKey4Length, "WEPKey4Length" ); +_LIT16( KWEPKey4Format, "WEPKey4Format" ); +_LIT16( KWEPKey4Data, "WEPKey4Data" ); + +//WPA security +_LIT16( KWPAPresharedKey, "WPAPresharedKey" ); +_LIT16( KWPAKeyLength, "WPAKeyLength" ); +_LIT16( KWPAEapMethod, "WPAEapMethod"); +_LIT16( KWPAUseOfPresharedKey, "WPAUseOfPresharedKey" ); + +//EAP security +_LIT16( KEapGtcUsername, "EapGtcUsername" ); +_LIT16( KEapGtcSessionValidityTime, "EapGtcSessionValidityTime" ); +_LIT16( KEapGtcEncapsulation, "EapGtcEncapsulation" ); + + +_LIT16( KEapTlsUsername, "EapTlsUsername" ); +_LIT16( KEapTlsRealm, "EapTlsRealm" ); +_LIT16( KEapTlsVerifyServerRealm, "EapTlsVerifyServerRealm" ); +_LIT16( KEapTlsRequireClientAuth, "EapTlsRequireClientAuth" ); +_LIT16( KEapTlsSessionValidityTime, "EapTlsSessionValidityTime" ); +_LIT16( KEapTlsCipherSuites, "EapTlsCipherSuites" ); +_LIT16( KEapTlsUserCertSubjectKeyId,"EapTlsUserCertSubjectKeyId" ); +_LIT16( KEapTlsUserCertIssuerName, "EapTlsUserCertIssuerName" ); +_LIT16( KEapTlsUserCertSerialNumber,"EapTlsUserCertSerialNumber" ); +_LIT16( KEapTlsCaCertSubjectKeyId, "EapTlsCaCertSubjectKeyId" ); +_LIT16( KEapTlsCaCertIssuerName, "EapTlsCaCertIssuerName" ); +_LIT16( KEapTlsCaCertSerialNumber, "EapTlsCaCertSerialNumber" ); +_LIT16( KEapTlsEncapsulation, "EapTlsEncapsulation" ); + + +_LIT16( KEapLeapUsername, "EapLeapUsername" ); +_LIT16( KEapLeapPassword, "EapLeapPassword" ); +_LIT16( KEapLeapSessionValidityTime,"EapLeapSessionValidityTime" ); + + +_LIT16( KEapSimUsername, "EapSimUsername" ); +_LIT16( KEapSimRealm, "EapSimRealm" ); +_LIT16( KEapSimUsePseudonyms, "EapSimUsePseudonyms" ); +_LIT16( KEapSimSessionValidityTime, "EapSimSessionValidityTime" ); +_LIT16( KEapSimEncapsulation, "EapSimEncapsulation" ); + +_LIT16( KEapTtlsUsername, "EapTtlsUsername" ); +_LIT16( KEapTtlsRealm, "EapTtlsRealm" ); +_LIT16( KEapTtlsVerifyServerRealm, "EapTtlsVerifyServerRealm" ); +_LIT16( KEapTtlsRequireClientAuth, "EapTtlsRequireClientAuth" ); +_LIT16( KEapTtlsSessionValidityTime,"EapTtlsSessionValidityTime" ); +_LIT16( KEapTtlsCipherSuites, "EapTtlsCipherSuites" ); +_LIT16( KEapTtlsEncapsulatedTypes, "EapTtlsEncapsulatedTypes" ); +_LIT16( KEapTtlsUserCertSubjectKeyId,"EapTtlsUserCertSubjectKeyId" ); +_LIT16( KEapTtlsUserCertIssuerName, "EapTtlsUserCertIssuerName" ); +_LIT16( KEapTtlsUserCertSerialNumber,"EapTtlsUserCertSerialNumber" ); +_LIT16( KEapTtlsCaCertSubjectKeyId, "EapTtlsCaCertSubjectKeyId" ); +_LIT16( KEapTtlsCaCertIssuerName, "EapTtlsCaCertIssuerName" ); +_LIT16( KEapTtlsCaCertSerialNumber, "EapTtlsCaCertSerialNumber" ); + +_LIT16( KEapAkaUsername, "EapAkaUsername" ); +_LIT16( KEapAkaRealm, "EapAkaRealm" ); +_LIT16( KEapAkaUsePseudonyms, "EapAkaUsePseudonyms" ); +_LIT16( KEapAkaSessionValidityTime, "EapAkaSessionValidityTime" ); +_LIT16( KEapAkaEncapsulation, "EapAkaEncapsulation" ); + +_LIT16( KEapPeapUsername, "EapPeapUsername" ); +_LIT16( KEapPeapRealm, "EapPeapRealm" ); +_LIT16( KEapPeapVerifyServerRealm, "EapPeapVerifyServerRealm" ); +_LIT16( KEapPeapRequireClientAuth, "EapPeapRequireClientAuth" ); +_LIT16( KEapPeapSessionValidityTime,"EapPeapSessionValidityTime" ); +_LIT16( KEapPeapCipherSuites, "EapPeapCipherSuites" ); +_LIT16( KEapPeapV0Allowed, "EapPeapV0Allowed" ); +_LIT16( KEapPeapV1Allowed, "EapPeapV1Allowed" ); +_LIT16( KEapPeapV2Allowed, "EapPeapV2Allowed" ); +_LIT16( KEapPeapEncapsulatedTypes, "EapPeapEncapsulatedTypes" ); +_LIT16( KEapPeapUserCertSubjectKeyId,"EapPeapUserCertSubjectKeyId" ); +_LIT16( KEapPeapUserCertIssuerName, "EapPeapUserCertIssuerName" ); +_LIT16( KEapPeapUserCertSerialNumber,"EapPeapUserCertSerialNumber" ); +_LIT16( KEapPeapCaCertSubjectKeyId, "EapPeapCaCertSubjectKeyId" ); +_LIT16( KEapPeapCaCertIssuerName, "EapPeapCaCertIssuerName" ); +_LIT16( KEapPeapCaCertSerialNumber, "EapPeapCaCertSerialNumber" ); + +_LIT16( KEapMschapv2Username, "EapMschapv2Username" ); +_LIT16( KEapMschapv2Password, "EapMschapv2Password" ); +_LIT16( KEapMschapv2SessionValidityTime,"EapMschapv2SessionValidityTime" ); +_LIT16( KEapMschapv2Encapsulation, "EapMschapv2Encapsulation" ); + +_LIT16( KEapFastUsername, "EapFastUsername" ); +_LIT16( KEapFastRealm, "EapFastRealm" ); +_LIT16( KEapFastVerifyServerRealm, "EapFastVerifyServerRealm" ); +_LIT16( KEapFastRequireClientAuth, "EapFastRequireClientAuth" ); +_LIT16( KEapFastSessionValidityTime,"EapFastSessionValidityTime" ); +_LIT16( KEapFastCipherSuites, "EapFastCipherSuites" ); +_LIT16( KEapFastEncapsulatedTypes, "EapFastEncapsulatedTypes" ); +_LIT16( KEapFastAuthProvModeAllowed,"EapFastAuthProvModeAllowed" ); +_LIT16( KEapFastUnauthProvModeAllowed,"EapFastUnauthProvModeAllowed" ); +_LIT16( KEapFastWarnADHPNoPAC, "EapFastWarnADHPNoPAC" ); +_LIT16( KEapFastWarnADHPNoMatchingPAC,"EapFastWarnADHPNoMatchingPAC" ); +_LIT16( KEapFastWarnNotDefaultServer,"EapFastWarnNotDefaultServer" ); +_LIT16( KEapFastUserCertSubjectKeyId,"EapFastUserCertSubjectKeyId" ); +_LIT16( KEapFastUserCertIssuerName, "EapFastUserCertIssuerName" ); +_LIT16( KEapFastUserCertSerialNumber,"EapFastUserCertSerialNumber" ); +_LIT16( KEapFastCaCertSubjectKeyId, "EapFastCaCertSubjectKeyId" ); +_LIT16( KEapFastCaCertIssuerName, "EapFastCaCertIssuerName" ); +_LIT16( KEapFastCaCertSerialNumber, "EapFastCaCertSerialNumber" ); + +_LIT16( KMschapv2Username, "Mschapv2Username" ); +_LIT16( KMschapv2Password, "Mschapv2Password" ); +_LIT16( KMschapv2SessionValidityTime,"Mschapv2SessionValidityTime" ); +_LIT16( KMschapv2Encapsulation, "Mschapv2Encapsulation" ); + + +//VPN specific +_LIT16( KVpnIapName, "IAP_Name" ); +_LIT16( KVpnServicePolicy, "Policy_ID" ); + +//DN specific +_LIT16( KDN_Name, "Name" ); +_LIT16( KDN_Id, "DNId" ); +_LIT16( KDN_Icon, "Icon" ); +_LIT16( KDN_Metadata, "Metadata" ); +_LIT16( KDN_Protection, "Protection" ); +_LIT16( KDN_EmbeddedDNName, "EmbeddedDN" ); +_LIT16( KDN_IAPName, "IAP" ); + +// Needed because of Customization Tool limitations +_LIT16( KDN_IAPName2, "IAP2" ); +_LIT16( KDN_IAPName3, "IAP3" ); +_LIT16( KDN_IAPName4, "IAP4" ); +_LIT16( KDN_IAPName5, "IAP5" ); +_LIT16( KDN_IAPName6, "IAP6" ); +_LIT16( KDN_IAPName7, "IAP7" ); +_LIT16( KDN_IAPName8, "IAP8" ); +_LIT16( KDN_IAPName9, "IAP9" ); +_LIT16( KDN_IAPName10, "IAP10" ); + +//Global settings +_LIT16( KAttachMode, "Attachmode" ); +_LIT16( KDefaultAP, "DefaultAP" ); +_LIT16( KDefaultDnIcon, "DefaultDnIcon" ); +_LIT16( KPriorityLan, "PriorityLan" ); +_LIT16( KPriorityWlan, "PriorityWlan" ); +_LIT16( KPriorityPan, "PriorityPan" ); +_LIT16( KPriorityGprsOut, "PriorityGprsOut" ); +_LIT16( KPriorityGprsIn, "PriorityGprsIn" ); +_LIT16( KPriorityCdma2k, "PriorityCdma2k" ); +_LIT16( KPriorityDialOut, "PriorityDialOut" ); +_LIT16( KPriorityDialIn, "PriorityDialIn" ); +_LIT16( KPriorityVpn, "PriorityVpn" ); +_LIT16( KPriorityMip, "PriorityMip" ); +_LIT16( KUIPriorityLan, "UIPriorityLan" ); +_LIT16( KUIPriorityWlan, "UIPriorityWlan" ); +_LIT16( KUIPriorityPan, "UIPriorityPan" ); +_LIT16( KUIPriorityGprsOut, "UIPriorityGprsOut" ); +_LIT16( KUIPriorityGprsIn, "UIPriorityGprsIn" ); +_LIT16( KUIPriorityCdma2k, "UIPriorityCdma2k" ); +_LIT16( KUIPriorityDialOut, "UIPriorityDialOut" ); +_LIT16( KUIPriorityDialIn, "UIPriorityDialIn" ); +_LIT16( KUIPriorityVpn, "UIPriorityVpn" ); +_LIT16( KUIPriorityMip, "UIPriorityMip" ); +_LIT16( KUsageOfWlan, "UsageOfWlan" ); +_LIT16( KCellularDataUsageHome, "CellularDataUsageHome" ); +_LIT16( KCellularDataUsageVisitor, "CellularDataUsageVisitor" ); +_LIT16( KGprsLastSocketActivityTimeout, "GprsLastSocketActivityTimeout" ); +_LIT16( KGprsLastSessionClosedTimeout, "GprsLastSessionClosedTimeout" ); +_LIT16( KGprsLastSocketClosedTimeout, "GprsLastSocketClosedTimeout" ); +_LIT16( KWlanLastSocketActivityTimeout, "WlanLastSocketActivityTimeout" ); +_LIT16( KWlanLastSessionClosedTimeout, "WlanLastSessionClosedTimeout" ); +_LIT16( KWlanLastSocketClosedTimeout, "WlanLastSocketClosedTimeout" ); +_LIT16( KWlanBGScanInterval, "WlanBGScanInterval" ); +_LIT16( KWlanUseDefSettings, "WlanUseDefSettings" ); +_LIT16( KWlanLongRetry, "WlanLongRetry" ); +_LIT16( KWlanShortRetry, "WlanShortRetry" ); +_LIT16( KWlanRTS, "WlanRTS" ); +_LIT16( KWlanTxPowerLevel, "WlanTxPowerLevel" ); +_LIT16( KWlanRadioMeasurements, "WlanRadioMeasurements" ); +_LIT16( KWlanPowerMode, "WlanPowerMode" ); + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CReaderXML::NewL +// --------------------------------------------------------- +// +CReaderXML* CReaderXML::NewLC( const TDesC& aInFileName, + const TDbCreatorInputCharSet aCharSet ) + { + CReaderXML* self = new ( ELeave ) CReaderXML( aCharSet ); + + CleanupStack::PushL( self ); + + self->CReaderBase::ConstructL( aInFileName ); + self->ConstructL(); + + return self; + } + + +// --------------------------------------------------------- +// CReaderXML::ConstructL +// --------------------------------------------------------- +// +void CReaderXML::ConstructL() + { + //if charset is not given as a parameter - detect it + if ( iCharSet == ECharSetUnknown ) + { + DetectEncodingL(); + } + + FillPacketDataParams(); + FillLanParams(); + FillWLanParams(); + FillVpnParams(); + FillGlobalParams(); + FillDNParams(); + } + + +// --------------------------------------------------------- +// CReaderXML::CReaderXML +// --------------------------------------------------------- +// +CReaderXML::CReaderXML( const TDbCreatorInputCharSet aCharSet ) : + CReaderBase( EFileXML, EFeatureNone ), + iCharSet( aCharSet ), + iLine ( NULL ), + iFoundGlobal( EFalse ) + { + //no implementation required + } + + +// --------------------------------------------------------- +// CReaderXML::~CReaderXML +// --------------------------------------------------------- +// +CReaderXML::~CReaderXML() + { + delete iLine; + + iPDParams.Close(); + iLanParams.Close(); + iWLanParams.Close(); + iVpnParams.Close(); + iGlobalParams.Close(); + iDNParams.Close(); + } + + +// --------------------------------------------------------- +// CReaderXML::LocateFeature +// --------------------------------------------------------- +// +void CReaderXML::LocateFeatureL() + { + iCurrentFeature = EFeatureNone; + TInt result( KErrNone ); + TBool eof( EFalse ); + + //looks for the next feature + while ( !eof && CurrentFeature() == EFeatureNone ) + { + //reads the next line + result = ReadLineL(); + + if ( result == KErrEof ) + { + //end of file + eof = ETrue; + } + else if ( result ) + { + //other error + User::Leave( result ); + } + else + { + //no error + if ( iLine->FindF( KFileTail ) == KErrNone || + iLine->FindF( KFileTail2 ) == KErrNone ) + { + //end of file is reached ("/variantvariant" found) + eof = ETrue; + } + else + { + //try to recognize a feature + iCurrentFeature = DetectFeatureHead(); + }//else + }//else + }//while + } + + +// --------------------------------------------------------- +// CReaderXML::LocateAP +// --------------------------------------------------------- +// +TBool CReaderXML::LocateAPL() + { + TBool found( EFalse ); //found feature data + TBool eofea( EFalse ); //end of feature + + if ( CurrentFeature() == EFeatureGlobal ) + { + //for Global settings there is no feature data header + found = iFoundGlobal; + iFoundGlobal = EFalse; + } + else + { + //looks for the next feature header + while ( !eofea && !found ) + { + User::LeaveIfError( ReadLineL() ); + + if ( DetectFeatureTail() ) + { + //feature tail is detected - no more data to process + eofea = ETrue; + } + else + { + //looks for feature data header + switch ( CurrentFeature() ) + { + case EFeaturePacketData: + found = ( iLine->FindF( KDataHeadPacketData ) != KErrNotFound ); + break; + case EFeatureWLAN: + found = ( iLine->FindF( KDataHeadWLAN ) != KErrNotFound ); + break; + case EFeatureLAN: + found = ( iLine->FindF( KDataHeadLAN ) != KErrNotFound ); + break; + case EFeatureVPN: + found = ( iLine->FindF( KDataHeadVPN ) != KErrNotFound ); + break; + case EFeatureDN: + found = ( iLine->FindF( KDataHeadDN ) != KErrNotFound ); + break; + }//switch + }//else + }//while + }//else + + return found; + + } + + +// --------------------------------------------------------- +// CReaderXML::ParseAPL +// --------------------------------------------------------- +// +void CReaderXML::ParseAPL() + { + do + { + User::LeaveIfError( ReadLineL() ); + TInt fieldId = DetectParam(); + + if ( fieldId != KErrNotFound ) + { + HBufC16* param = ReadParam( EParamValue ); + if ( param ) + { + ConvertSpecialXMLChars( param ); + CleanupStack::PushL( param ); + TagContainer().AddL( param , fieldId ); + CleanupStack::Pop( param ); + } + else + { + //simply skip line + } + } + + } + while ( !DetectTailAP() ); + } + +// --------------------------------------------------------- +// CReaderXML::Reset +// --------------------------------------------------------- +// +TInt CReaderXML::Reset() + { + iFilePos = 0; + return InputFile().Seek( ESeekStart, iFilePos ); + } + + +// --------------------------------------------------------- +// CReaderXML::ToDoLog +// --------------------------------------------------------- +// +void CReaderXML::ToDoLog() + { + CLOG_WRITE( "Line :" ) + FileLogger().Write( *iLine ); + CLOG_WRITE( "--------------------------------------------\n\n" ) + } + +// --------------------------------------------------------- +// Private methods +// --------------------------------------------------------- + +// --------------------------------------------------------- +// CReaderXML::ReadLine +// --------------------------------------------------------- +// +TInt CReaderXML::ReadLineL() + { + //go to the actual position + TInt result = InputFile().Seek(ESeekStart, iFilePos); + + //temporary buffer for line + TBuf8 buf; + + if (result == KErrNone) + { + result = InputFile().Read(buf, buf.MaxSize()); + } + + //if seeking and reading both succesful extract one line form the buffer + if (result == KErrNone) + { + TPtrC8 ptrBuf8; + ptrBuf8.Set( buf ); + + if (result == KErrNone || result == KErrEof) + { + switch ( iCharSet ) + { + case ECharSetUnicode: + { + //simply copy to a Unicode descriptor + TPtrC16 ptrBuf16( ( TText16* )ptrBuf8.Ptr(), \ + ptrBuf8.Length() / KAsciiUnicodeRatio ); + + TPtrC16 ptrLine; + result = ExtractLine(ptrBuf16, ptrLine); + + if ( result == KErrNone ) + { + delete iLine; + iLine = NULL; + iLine = ptrLine.AllocL(); + + //Increment the file position + iFilePos += iLine->Length() * KAsciiUnicodeRatio; + } + + break; + } + case ECharSetAscii: + case ECharSetUtf8: + default: + { + //conversion to Unicode is needed + HBufC16* hBuf16 = HBufC16::NewLC( KMaxLineSize ); + TPtr16 ptrBuf16( hBuf16->Des() ); + + if( iCharSet == ECharSetUtf8 ) + { + CnvUtfConverter::ConvertToUnicodeFromUtf8 + ( ptrBuf16, ptrBuf8 ); + } + else + { + ptrBuf16.Copy( ptrBuf8 ); + } + + TPtrC16 ptrLine; + result = ExtractLine(ptrBuf16, ptrLine); + + if ( result == KErrNone ) + { + delete iLine; + iLine = NULL; + iLine = ptrLine.AllocL(); + + // Increment the file position + // Line in unicode format converted back to UTF-8 + // for getting the right lenght and osition in file + CnvUtfConverter::ConvertFromUnicodeToUtf8( + buf, iLine->Des() ); + iFilePos += buf.Length(); + } + + CleanupStack::PopAndDestroy( hBuf16 ); + + break; + }//case + }//switch + }//if + }//if + + return result; + } + + +// --------------------------------------------------------- +// CReaderXML::ExtractLine +// --------------------------------------------------------- +// +TInt CReaderXML::ExtractLine(const TPtrC16& aBuffer, TPtrC16& aLine) + { + // Whitespace characters + const TChar KSpace = ' '; + const TChar KNewLine = '\n'; + const TChar KCarriageReturn = '\r'; + const TChar KTab = '\t'; + const TChar KTagStart = '<'; + + + // A line is considered to contain one parameter. It starts from the + // current position and lasts until the end of the current parameter. + // The end is detected by looking for the characters ">" and "<" with + // any number of white spaces between them. The next line will start at + // the "<" character. + TBool lineEndFound( EFalse ); + TBool tagEndFound( EFalse ); + TInt pos( 0 ); + while( !lineEndFound && pos < aBuffer.Length() ) + { + if( !tagEndFound && KParamNameTail.iBuf[ 0 ] == aBuffer[ pos ] ) + { + tagEndFound = ETrue; + } + else if( tagEndFound && KParamNameHead.iBuf[ 0 ] == aBuffer[ pos ] ) + { + lineEndFound = ETrue; + break; + } + + else if( ( KSpace != aBuffer[ pos ] ) && + ( KNewLine != aBuffer[ pos ] ) && + ( KCarriageReturn != aBuffer[ pos ] ) && + ( KTab != aBuffer[ pos ] ) && + tagEndFound ) + { + tagEndFound = EFalse; + } + ++pos; + } + + if( !lineEndFound ) + { + //End of line not found--malformed xml file or no more data + //get highest file position; and check EoF + TInt hiPos = 0; + + if (InputFile().Size(hiPos) != KErrNone) + { + return KErrGeneral; + } + + //check for end of file + if ( aBuffer.Length() < KMaxLineSize ) + { + aLine.Set( aBuffer ); + return KErrEof; + } + else + { + return KErrNotFound; + } + } + + aLine.Set( aBuffer.Left( pos ) ); + + return KErrNone ; + } + +// --------------------------------------------------------- +// CReaderXML::DetectFeatureHead +// --------------------------------------------------------- +// +TDbCreatorFeatures CReaderXML::DetectFeatureHead() + { + TDbCreatorFeatures feature( EFeatureNone ); + + if ( iLine->FindF( KFeatureHeadPacketData ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeaturePacketData" ); + feature = EFeaturePacketData; + } + else if ( iLine->FindF( KFeatureHeadWLAN ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureWLAN" ); + feature = EFeatureWLAN; + } + else if ( iLine->FindF( KFeatureHeadLAN ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureLAN" ); + feature = EFeatureLAN; + } + else if ( iLine->FindF( KFeatureHeadVPN ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureVPN" ); + feature = EFeatureVPN; + } + else if ( iLine->FindF( KFeatureHeadDN ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureDN" ); + feature = EFeatureDN; + } + else if ( iLine->FindF( KFeatureHeadGlobal ) != KErrNotFound ) + { + CLOG_WRITE( "CReaderXML::DetectFeatureHead(): EFeatureGlobal" ); + feature = EFeatureGlobal; + iFoundGlobal = ETrue; + } + else + { + //feature not found + } + + return feature; + + } + + +// --------------------------------------------------------- +// CReaderXML::DetectFeatureTail +// --------------------------------------------------------- +// +TBool CReaderXML::DetectFeatureTail() + { + TBool found( EFalse ); + + switch ( CurrentFeature() ) + { + case EFeaturePacketData: + found = ( iLine->FindF( KFeatureTailPacketData ) != KErrNotFound ); + break; + case EFeatureWLAN: + found = ( iLine->FindF( KFeatureTailWLAN ) != KErrNotFound ); + break; + case EFeatureLAN: + found = ( iLine->FindF( KFeatureTailLAN ) != KErrNotFound ); + break; + case EFeatureVPN: + found = ( iLine->FindF( KFeatureTailVPN ) != KErrNotFound ); + break; + case EFeatureDN: + found = ( iLine->FindF( KFeatureTailDN ) != KErrNotFound ); + break; + case EFeatureGlobal: + found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound ); + break; + } + + return found; + } + + +// --------------------------------------------------------- +// CReaderXML::DetectTailAP +// --------------------------------------------------------- +// +TBool CReaderXML::DetectTailAP() + { + TBool found( EFalse ); + + switch ( CurrentFeature() ) + { + case EFeaturePacketData: + found = ( iLine->FindF( KDataTailPacketData ) != KErrNotFound ); + break; + case EFeatureWLAN: + found = ( iLine->FindF( KDataTailWLAN ) != KErrNotFound ); + break; + case EFeatureLAN: + found = ( iLine->FindF( KDataTailLAN ) != KErrNotFound ); + break; + case EFeatureVPN: + found = ( iLine->FindF( KDataTailVPN ) != KErrNotFound ); + break; + case EFeatureDN: + found = ( iLine->FindF( KDataTailDN ) != KErrNotFound ); + break; + case EFeatureGlobal: + //there is no data tail for Global settings -- looks for feature tail + found = ( iLine->FindF( KFeatureTailGlobal ) != KErrNotFound ); + break; + } + + return found; + } + + +// --------------------------------------------------------- +// CReaderXML::DetectParamL +// --------------------------------------------------------- +// +TInt CReaderXML::DetectParam() + { + TInt fieldId( KErrNotFound ); //field id of detected parameter + RArray *params( NULL ); //pointer to the table used + //for or detection + + switch ( CurrentFeature() ) + { + case EFeaturePacketData: + params = &iPDParams; + break; + case EFeatureWLAN: + params = &iWLanParams; + break; + case EFeatureLAN: + params = &iLanParams; + break; + case EFeatureVPN: + params = &iVpnParams; + break; + case EFeatureDN: + params = &iDNParams; + break; + case EFeatureGlobal: + params = &iGlobalParams; + break; + default: + User::Panic( KPanicInvalidCase, KErrInvalidCase ); + } + + //looks for parameter match + HBufC16* paramName = ReadParam( EParamName ); + if ( paramName == NULL ) + { + return fieldId; + } + + TBool found ( EFalse ); + for ( TInt idx = 0; idx < params->Count() && !found; idx++ ) + { + if ( paramName->CompareF( (*params)[idx].iParam ) == 0 ) + { + fieldId = (*params)[idx].iId; + found = ETrue; + } + } + + delete paramName; + return fieldId; + } + + +// --------------------------------------------------------- +// CReaderXML::ReadParam +// --------------------------------------------------------- +// +HBufC16* CReaderXML::ReadParam( TParamSegment aSegment ) + { + TBuf tag; //local buffer + TInt posh( 0 ); //header position + TInt post( 0 ); //tail position + HBufC16* ret = NULL; // returned pointer + + // calculation of the position + // + // EParamValue: posh| post| + // | | + // EParamName: posh| post|| | + // ¡ ¡¡ ¡ + // ParamValue + + switch ( aSegment ) + { + case EParamValue: + posh = iLine->Find( KParamValueHead ) + 1; + post = iLine->Find( KParamValueTail ); + break; + case EParamName: + posh = iLine->Find( KParamNameHead ) + 1; + post = iLine->Find( KParamNameTail ); + break; + default: + break; + } + + if ( posh == KErrNotFound || post == KErrNotFound || post == 0 ) + { + //line must contain header and tail and longer than 0 + ret = NULL; + } + else + { + // Copis the value to the local buffer and allocates buffer + tag.Copy( iLine->Mid( posh, post - posh ) ); + ret = tag.Alloc(); + // Checks the result. + if( ret == NULL ) + { + CLOG_WRITE_FORMAT( "! Warning: tag could not be allocated %S:", + &tag ); + } +// Debugging help; commented out for clearer log. +// else +// { +// if (aSegment == EParamValue) +// { +// CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: value %S", &tag ); +// } +// else if (aSegment == EParamName) +// { +// CLOG_WRITE_FORMAT( "CReaderXML::ReadParam: name %S", &tag ); +// } +// } + } + return ret; + } + + +// --------------------------------------------------------- +// CReaderXML::DetectEncoding +// --------------------------------------------------------- +// +void CReaderXML::DetectEncodingL() + { + TInt originalPos( iFilePos ); //stores original file position + TBool found( EFalse ); + + for ( TInt i = ECharSetUnicode; i >= ECharSetAscii && !found; i--) + { + //assumes that the first line contains version and encoding info + iFilePos = 0; + iCharSet = static_cast( i ); + + if ( ReadLineL() == KErrNone ) + { + if( iCharSet == ECharSetAscii ) + { + if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) || + ( iLine->FindF( KEncoding ) != KErrNotFound ) ) + { + if( iLine->FindF( KEncodingUtf8 ) != KErrNotFound ) + { + iCharSet = ECharSetUtf8; + } + found = ETrue; + } + } + else if( iCharSet == ECharSetUnicode ) + { + if ( ( iLine->FindF( KXmlVersion ) != KErrNotFound ) || + ( iLine->FindF( KEncoding ) != KErrNotFound ) ) + { + found = ETrue; + } + } + } + } + iFilePos = originalPos; + } + +// --------------------------------------------------------- +// CReaderXML::ConvertSpecialXMLChars +// --------------------------------------------------------- +// +void CReaderXML::ConvertSpecialXMLChars( HBufC* aPtrTag ) + { + if ( aPtrTag == NULL ) + { + return; + } + _LIT16( escapeStart, "&" ); + + //check if there are parameters to be replaced, if not: return + if ( aPtrTag->Des().Find( escapeStart ) == KErrNotFound ) + { + return; + } + + _LIT16( spXML1, "<" ); + _LIT16( sp1, "<" ); + ReplaceInString( aPtrTag, spXML1, sp1 ); + _LIT16( spXML2, "&" ); + _LIT16( sp2, "&" ); + ReplaceInString( aPtrTag, spXML2, sp2 ); + _LIT16( spXML3, ">" ); + _LIT16( sp3, ">" ); + ReplaceInString( aPtrTag, spXML3, sp3 ); + _LIT16( spXML4, """ ); + _LIT16( sp4, "\"" ); + ReplaceInString( aPtrTag, spXML4, sp4 ); + _LIT16( spXML5, "'" ); + _LIT16( sp5, "\'" ); + ReplaceInString( aPtrTag, spXML5, sp5 ); + _LIT16( spXML6, "¡" ); + _LIT16( sp6, "\u00a1" ); + ReplaceInString( aPtrTag, spXML6, sp6 ); + _LIT16( spXML7, "¢" ); + _LIT16( sp7, "\u00a2" ); + ReplaceInString( aPtrTag, spXML7, sp7 ); + _LIT16( spXML8, "£" ); + _LIT16( sp8, "\u00a3" ); + ReplaceInString( aPtrTag, spXML8, sp8 ); + _LIT16( spXML9, "¤" ); + _LIT16( sp9, "\u00a4" ); + ReplaceInString( aPtrTag, spXML9, sp9 ); + _LIT16( spXML10, "¥" ); + _LIT16( sp10, "\u00a5" ); + ReplaceInString( aPtrTag, spXML10, sp10 ); + _LIT16( spXML11, "¦" ); + _LIT16( sp11, "\u00a6" ); + ReplaceInString( aPtrTag, spXML11, sp11 ); + _LIT16( spXML12, "§" ); + _LIT16( sp12, "\u00a7" ); + ReplaceInString( aPtrTag, spXML12, sp12 ); + _LIT16( spXML13, "¨" ); + _LIT16( sp13, "\u00a8" ); + ReplaceInString( aPtrTag, spXML13, sp13 ); + _LIT16( spXML14, "©" ); + _LIT16( sp14, "\u00a9" ); + ReplaceInString( aPtrTag, spXML14, sp14 ); + _LIT16( spXML15, "ª" ); + _LIT16( sp15, "\u00aa" ); + ReplaceInString( aPtrTag, spXML15, sp15 ); + _LIT16( spXML16, "«" ); + _LIT16( sp16, "\u00ab" ); + ReplaceInString( aPtrTag, spXML16, sp16 ); + _LIT16( spXML17, "¬" ); + _LIT16( sp17, "\u00ac" ); + ReplaceInString( aPtrTag, spXML17, sp17 ); + _LIT16( spXML18, "®" ); + _LIT16( sp18, "\u00ae" ); + ReplaceInString( aPtrTag, spXML18, sp18 ); + _LIT16( spXML19, "¯" ); + _LIT16( sp19, "\u00af" ); + ReplaceInString( aPtrTag, spXML19, sp19 ); + _LIT16( spXML20, "°" ); + _LIT16( sp20, "\u00b0" ); + ReplaceInString( aPtrTag, spXML20, sp20 ); + _LIT16( spXML21, "±" ); + _LIT16( sp21, "\u00b1" ); + ReplaceInString( aPtrTag, spXML21, sp21 ); + _LIT16( spXML22, "²" ); + _LIT16( sp22, "\u00b2" ); + ReplaceInString( aPtrTag, spXML22, sp22 ); + _LIT16( spXML23, "³" ); + _LIT16( sp23, "\u00b3" ); + ReplaceInString( aPtrTag, spXML23, sp23 ); + _LIT16( spXML24, "´" ); + _LIT16( sp24, "\u00b4" ); + ReplaceInString( aPtrTag, spXML24, sp24 ); + _LIT16( spXML25, "µ" ); + _LIT16( sp25, "\u00b5" ); + ReplaceInString( aPtrTag, spXML25, sp25 ); + _LIT16( spXML26, "¶" ); + _LIT16( sp26, "\u00b6" ); + ReplaceInString( aPtrTag, spXML26, sp26 ); + _LIT16( spXML27, "·" ); + _LIT16( sp27, "\u00b7" ); + ReplaceInString( aPtrTag, spXML27, sp27 ); + _LIT16( spXML28, "¸" ); + _LIT16( sp28, "\u00b8" ); + ReplaceInString( aPtrTag, spXML28, sp28 ); + _LIT16( spXML29, "¹" ); + _LIT16( sp29, "\u00b9" ); + ReplaceInString( aPtrTag, spXML29, sp29 ); + _LIT16( spXML30, "º" ); + _LIT16( sp30, "\u00ba" ); + ReplaceInString( aPtrTag, spXML30, sp30 ); + _LIT16( spXML31, "»" ); + _LIT16( sp31, "\u00bb" ); + ReplaceInString( aPtrTag, spXML31, sp31 ); + _LIT16( spXML32, "¼" ); + _LIT16( sp32, "\u00bc" ); + ReplaceInString( aPtrTag, spXML32, sp32 ); + _LIT16( spXML33, "½" ); + _LIT16( sp33, "\u00bd" ); + ReplaceInString( aPtrTag, spXML33, sp33 ); + _LIT16( spXML34, "¾" ); + _LIT16( sp34, "\u00be" ); + ReplaceInString( aPtrTag, spXML34, sp34 ); + _LIT16( spXML35, "¿" ); + _LIT16( sp35, "\u00bf" ); + ReplaceInString( aPtrTag, spXML35, sp35 ); + _LIT16( spXML36, "À" ); + _LIT16( sp36, "\u00c0" ); + ReplaceInString( aPtrTag, spXML36, sp36 ); + _LIT16( spXML37, "Á" ); + _LIT16( sp37, "\u00c1" ); + ReplaceInString( aPtrTag, spXML37, sp37 ); + _LIT16( spXML38, "Â" ); + _LIT16( sp38, "\u00c2" ); + ReplaceInString( aPtrTag, spXML38, sp38 ); + _LIT16( spXML39, "Ã" ); + _LIT16( sp39, "\u00c3" ); + ReplaceInString( aPtrTag, spXML39, sp39 ); + _LIT16( spXML40, "Ä" ); + _LIT16( sp40, "\u00c4" ); + ReplaceInString( aPtrTag, spXML40, sp40 ); + _LIT16( spXML41, "Å" ); + _LIT16( sp41, "\u00c5" ); + ReplaceInString( aPtrTag, spXML41, sp41 ); + _LIT16( spXML42, "Æ" ); + _LIT16( sp42, "\u00c6" ); + ReplaceInString( aPtrTag, spXML42, sp42 ); + _LIT16( spXML43, "Ç" ); + _LIT16( sp43, "\u00c7" ); + ReplaceInString( aPtrTag, spXML43, sp43 ); + _LIT16( spXML44, "È" ); + _LIT16( sp44, "\u00c8" ); + ReplaceInString( aPtrTag, spXML44, sp44 ); + _LIT16( spXML45, "É" ); + _LIT16( sp45, "\u00c9" ); + ReplaceInString( aPtrTag, spXML45, sp45 ); + _LIT16( spXML46, "Ê" ); + _LIT16( sp46, "\u00ca" ); + ReplaceInString( aPtrTag, spXML46, sp46 ); + _LIT16( spXML47, "Ë" ); + _LIT16( sp47, "\u00cb" ); + ReplaceInString( aPtrTag, spXML47, sp47 ); + _LIT16( spXML48, "Ì" ); + _LIT16( sp48, "\u00cc" ); + ReplaceInString( aPtrTag, spXML48, sp48 ); + _LIT16( spXML49, "Í" ); + _LIT16( sp49, "\u00cd" ); + ReplaceInString( aPtrTag, spXML49, sp49 ); + _LIT16( spXML50, "Î" ); + _LIT16( sp50, "\u00ce" ); + ReplaceInString( aPtrTag, spXML50, sp50 ); + _LIT16( spXML51, "Ï" ); + _LIT16( sp51, "\u00cf" ); + ReplaceInString( aPtrTag, spXML51, sp51 ); + _LIT16( spXML52, "Ð" ); + _LIT16( sp52, "\u00d0" ); + ReplaceInString( aPtrTag, spXML52, sp52 ); + _LIT16( spXML53, "Ñ" ); + _LIT16( sp53, "\u00d1" ); + ReplaceInString( aPtrTag, spXML53, sp53 ); + _LIT16( spXML54, "Ò" ); + _LIT16( sp54, "\u00d2" ); + ReplaceInString( aPtrTag, spXML54, sp54 ); + _LIT16( spXML55, "Ó" ); + _LIT16( sp55, "\u00d3" ); + ReplaceInString( aPtrTag, spXML55, sp55 ); + _LIT16( spXML56, "Ô" ); + _LIT16( sp56, "\u00d4" ); + ReplaceInString( aPtrTag, spXML56, sp56 ); + _LIT16( spXML57, "Õ" ); + _LIT16( sp57, "\u00d5" ); + ReplaceInString( aPtrTag, spXML57, sp57 ); + _LIT16( spXML58, "Ö" ); + _LIT16( sp58, "\u00d6" ); + ReplaceInString( aPtrTag, spXML58, sp58 ); + _LIT16( spXML59, "×" ); + _LIT16( sp59, "\u00d7" ); + ReplaceInString( aPtrTag, spXML59, sp59 ); + _LIT16( spXML60, "Ø" ); + _LIT16( sp60, "\u00d8" ); + ReplaceInString( aPtrTag, spXML60, sp60 ); + _LIT16( spXML61, "Ù" ); + _LIT16( sp61, "\u00d9" ); + ReplaceInString( aPtrTag, spXML61, sp61 ); + _LIT16( spXML62, "Ú" ); + _LIT16( sp62, "\u00da" ); + ReplaceInString( aPtrTag, spXML62, sp62 ); + _LIT16( spXML63, "Û" ); + _LIT16( sp63, "\u00db" ); + ReplaceInString( aPtrTag, spXML63, sp63 ); + _LIT16( spXML64, "Ü" ); + _LIT16( sp64, "\u00dc" ); + ReplaceInString( aPtrTag, spXML64, sp64 ); + _LIT16( spXML65, "Ý" ); + _LIT16( sp65, "\u00dd" ); + ReplaceInString( aPtrTag, spXML65, sp65 ); + _LIT16( spXML66, "Þ" ); + _LIT16( sp66, "\u00de" ); + ReplaceInString( aPtrTag, spXML66, sp66 ); + _LIT16( spXML67, "ß" ); + _LIT16( sp67, "\u00df" ); + ReplaceInString( aPtrTag, spXML67, sp67 ); + _LIT16( spXML68, "à" ); + _LIT16( sp68, "\u00e0" ); + ReplaceInString( aPtrTag, spXML68, sp68 ); + _LIT16( spXML69, "á" ); + _LIT16( sp69, "\u00e1" ); + ReplaceInString( aPtrTag, spXML69, sp69 ); + _LIT16( spXML70, "â" ); + _LIT16( sp70, "\u00e2" ); + ReplaceInString( aPtrTag, spXML70, sp70 ); + _LIT16( spXML71, "ã" ); + _LIT16( sp71, "\u00e3" ); + ReplaceInString( aPtrTag, spXML71, sp71 ); + _LIT16( spXML72, "ä"); + _LIT16( sp72, "\u00e4" ); + ReplaceInString( aPtrTag, spXML72, sp72 ); + _LIT16( spXML73, "å" ); + _LIT16( sp73, "\u00e5" ); + ReplaceInString( aPtrTag, spXML73, sp73 ); + _LIT16( spXML74, "æ" ); + _LIT16( sp74, "\u00e6" ); + ReplaceInString( aPtrTag, spXML74, sp74 ); + _LIT16( spXML75, "&acedil;" ); + _LIT16( sp75, "\u00e7" ); + ReplaceInString( aPtrTag, spXML75, sp75 ); + _LIT16( spXML76, "è" ); + _LIT16( sp76, "\u00e8" ); + ReplaceInString( aPtrTag, spXML76, sp76 ); + _LIT16( spXML77, "é" ); + _LIT16( sp77, "\u00e9" ); + ReplaceInString( aPtrTag, spXML77, sp77 ); + _LIT16( spXML78, "ê" ); + _LIT16( sp78, "\u00ea" ); + ReplaceInString( aPtrTag, spXML78, sp78 ); + _LIT16( spXML79, "ë" ); + _LIT16( sp79, "\u00eb" ); + ReplaceInString( aPtrTag, spXML79, sp79 ); + _LIT16( spXML80, "ì" ); + _LIT16( sp80, "\u00ec" ); + ReplaceInString( aPtrTag, spXML80, sp80 ); + _LIT16( spXML81, "í" ); + _LIT16( sp81, "\u00ed" ); + ReplaceInString( aPtrTag, spXML81, sp81 ); + _LIT16( spXML82, "î" ); + _LIT16( sp82, "\u00ee" ); + ReplaceInString( aPtrTag, spXML82, sp82 ); + _LIT16( spXML83, "ï" ); + _LIT16( sp83, "\u00ef" ); + ReplaceInString( aPtrTag, spXML83, sp83 ); + _LIT16( spXML84, "ð" ); + _LIT16( sp84, "\u00f0" ); + ReplaceInString( aPtrTag, spXML84, sp84 ); + _LIT16( spXML85, "ñ" ); + _LIT16( sp85, "\u00f1" ); + ReplaceInString( aPtrTag, spXML85, sp85 ); + _LIT16( spXML86, "ò" ); + _LIT16( sp86, "\u00f2" ); + ReplaceInString( aPtrTag, spXML86, sp86 ); + _LIT16( spXML87, "ó" ); + _LIT16( sp87, "\u00f3" ); + ReplaceInString( aPtrTag, spXML87, sp87 ); + _LIT16( spXML88, "ô" ); + _LIT16( sp88, "\u00f4" ); + ReplaceInString( aPtrTag, spXML88, sp88 ); + _LIT16( spXML89, "õ" ); + _LIT16( sp89, "\u00f5" ); + ReplaceInString( aPtrTag, spXML89, sp89 ); + _LIT16( spXML90, "ö" ); + _LIT16( sp90, "\u00f6" ); + ReplaceInString( aPtrTag, spXML90, sp90 ); + _LIT16( spXML91, "÷" ); + _LIT16( sp91, "\u00f7" ); + ReplaceInString( aPtrTag, spXML91, sp91 ); + _LIT16( spXML92, "ø" ); + _LIT16( sp92, "\u00f8" ); + ReplaceInString( aPtrTag, spXML92, sp92 ); + _LIT16( spXML93, "ù" ); + _LIT16( sp93, "\u00f9" ); + ReplaceInString( aPtrTag, spXML93, sp93 ); + _LIT16( spXML94, "ú" ); + _LIT16( sp94, "\u00fa" ); + ReplaceInString( aPtrTag, spXML94, sp94 ); + _LIT16( spXML95, "û" ); + _LIT16( sp95, "\u00fb" ); + ReplaceInString( aPtrTag, spXML95, sp95 ); + _LIT16( spXML96, "ü" ); + _LIT16( sp96, "\u00fc" ); + ReplaceInString( aPtrTag, spXML96, sp96 ); + _LIT16( spXML97, "ý" ); + _LIT16( sp97, "\u00fd" ); + ReplaceInString( aPtrTag, spXML97, sp97 ); + _LIT16( spXML98, "þ" ); + _LIT16( sp98, "\u00de" ); + ReplaceInString( aPtrTag, spXML98, sp98 ); + _LIT16( spXML99, "ÿ" ); + _LIT16( sp99, "\u00ff" ); + ReplaceInString( aPtrTag, spXML99, sp99 ); + _LIT16( spXML100, "Œ" ); + _LIT16( sp100, "\u0152" ); + ReplaceInString( aPtrTag, spXML100, sp100 ); + _LIT16( spXML101, "œ" ); + _LIT16( sp101, "\u0153" ); + ReplaceInString( aPtrTag, spXML101, sp101 ); + _LIT16( spXML102, "Š" ); + _LIT16( sp102, "\u0160" ); + ReplaceInString( aPtrTag, spXML102, sp102 ); + _LIT16( spXML103, "š" ); + _LIT16( sp103, "\u0161" ); + ReplaceInString( aPtrTag, spXML103, sp103 ); + _LIT16( spXML104, "Ÿ" ); + _LIT16( sp104, "\u0178" ); + ReplaceInString( aPtrTag, spXML104, sp104 ); + _LIT16( spXML105, "ƒ" ); + _LIT16( sp105, "\u0192" ); + ReplaceInString( aPtrTag, spXML105, sp105 ); + _LIT16( spXML106, "ˆ" ); + _LIT16( sp106, "\u02c6" ); + ReplaceInString( aPtrTag, spXML106, sp106 ); + _LIT16( spXML107, "˜" ); + _LIT16( sp107, "\u02dc" ); + ReplaceInString( aPtrTag, spXML107, sp107 ); + } + +// --------------------------------------------------------- +// CReaderXML::Replace +// --------------------------------------------------------- +// +void CReaderXML::ReplaceInString( HBufC* aPtrTag, + const TDesC& aSpXML, + const TDesC& aSp ) + { + if( aPtrTag == NULL ) + { + return; + } + TInt strPos = aPtrTag->Des().Find(aSpXML); + while ( strPos != KErrNotFound ) + { + aPtrTag->Des().Replace(strPos, aSpXML.Length() , aSp); + strPos = aPtrTag->Des().Find(aSpXML); + } + } + +//maximum number of VPN AP parameters + + +void CReaderXML::FillPacketDataParams() + { + iPDParams.Append( EInputParams( ECmName, KConnectionName ) ); + iPDParams.Append( EInputParams( ECmId, KConnectionId ) ); + iPDParams.Append( EInputParams( ECmProtected, KProtected ) ); + iPDParams.Append( EInputParams( ECmHidden, KHidden ) ); + iPDParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); + iPDParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); + iPDParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); + iPDParams.Append( EInputParams( EPacketDataAPName, KGprs_AP_Name ) ); + iPDParams.Append( EInputParams( EPacketDataIFAuthName, KUserName ) ); + iPDParams.Append( EInputParams( EPacketDataIFPromptForAuth, KPromptPassword ) ); + iPDParams.Append( EInputParams( EPacketDataIFAuthPass, KPassword ) ); + iPDParams.Append( EInputParams( EPacketDataDisablePlainTextAuth, KPasswordAuthType ) ); + iPDParams.Append( EInputParams( ECmWapIPGatewayAddress, KWAPGatewayIP ) ); + iPDParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); + iPDParams.Append( EInputParams( ECmWapIPSecurity, KWTLS_Security ) ); + iPDParams.Append( EInputParams( ECmWapIPWSPOption, KWAP_ConnectionType ) ); + iPDParams.Append( EInputParams( EPacketDataIPAddr, KPhoneIP ) ); + iPDParams.Append( EInputParams( EPacketDataIPNameServer1, KPrimaryNameServer ) ); + iPDParams.Append( EInputParams( EPacketDataIPNameServer2, KSecondaryNameServer ) ); + iPDParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); + iPDParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); + iPDParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); + iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer1, KPrimaryIP6NameServer ) ); + iPDParams.Append( EInputParams( EPacketDataIPIP6NameServer2, KSecondaryIP6NameServer ) ); + iPDParams.Append( EInputParams( EPacketDataApType, KIspType ) ); + iPDParams.Append( EInputParams( EPacketDataPDPType, KNetworkType ) ); + iPDParams.Append( EInputParams( EPacketDataUseEdge, KGprsUseEdge ) ); + iPDParams.Append( EInputParams( EPacketDataLinger, KLinger ) ); + }; + +void CReaderXML::FillLanParams() + { + iLanParams.Append( EInputParams( ECmName, KConnectionName ) ); + iLanParams.Append( EInputParams( ECmId, KConnectionId ) ); + iLanParams.Append( EInputParams( ECmProtected, KProtected ) ); + iLanParams.Append( EInputParams( ECmHidden, KHidden ) ); + iLanParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); + iLanParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); + iLanParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); + iLanParams.Append( EInputParams( ECmWapIPGatewayAddress, KWAPGatewayIP ) ); + iLanParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); + iLanParams.Append( EInputParams( ECmWapIPSecurity, KWTLS_Security ) ); + iLanParams.Append( EInputParams( ECmWapIPWSPOption, KWAP_ConnectionType ) ); + iLanParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); + iLanParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); + iLanParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); + iLanParams.Append( EInputParams( ELanIfNetworks, KLanIfNetworks ) ); + iLanParams.Append( EInputParams( ELanIpNetMask, KLanIpNetMask ) ); + iLanParams.Append( EInputParams( ELanIpGateway, KLanIpGateway ) ); + iLanParams.Append( EInputParams( ELanIpAddr, KPhoneIP ) ); + iLanParams.Append( EInputParams( ELanIpNameServer1, KPrimaryNameServer ) ); + iLanParams.Append( EInputParams( ELanIpNameServer2, KSecondaryNameServer ) ); + iLanParams.Append( EInputParams( ELanIp6NameServer1, KPrimaryIP6NameServer ) ); + iLanParams.Append( EInputParams( ELanIp6NameServer2, KSecondaryIP6NameServer ) ); + iLanParams.Append( EInputParams( ELanIpAddrFromServer, KLanIpAddrFromServer ) ); + iLanParams.Append( EInputParams( ELanIpDNSAddrFromServer, KLanIpDNSAddrFromServer ) ); + iLanParams.Append( EInputParams( ELanConfigDaemonManagerName, KLanConfigDaemonManagerName ) ); + iLanParams.Append( EInputParams( ELanConfigDaemonName, KLanConfigDaemonName ) ); + }; + +//Binds WLAN access point parameters to field IDs +void CReaderXML::FillWLanParams() + { + iWLanParams.Append( EInputParams( ECmName, KConnectionName ) ); + iWLanParams.Append( EInputParams( ECmId, KConnectionId ) ); + iWLanParams.Append( EInputParams( ECmProtected, KProtected ) ); + iWLanParams.Append( EInputParams( ECmHidden, KHidden ) ); + iWLanParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); + iWLanParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); + iWLanParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); + iWLanParams.Append( EInputParams( ECmStartPage, KStartingPage ) ); + iWLanParams.Append( EInputParams( EWlanSSID, KNetworkName ) ); + iWLanParams.Append( EInputParams( EWlanConnectionMode, KNetworkMode ) ); + iWLanParams.Append( EInputParams( EWlanSecurityMode, KSecurityMode ) ); + iWLanParams.Append( EInputParams( EWlanIpNameServer1, KPrimaryNameServer ) ); + iWLanParams.Append( EInputParams( EWlanIpNameServer2, KSecondaryNameServer ) ); + iWLanParams.Append( EInputParams( EWlanIp6NameServer1, KPrimaryIP6NameServer ) ); + iWLanParams.Append( EInputParams( EWlanIp6NameServer2, KSecondaryIP6NameServer ) ); + iWLanParams.Append( EInputParams( EWlanIpGateway, KWlanIpGatewayAddress ) ); + iWLanParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); + iWLanParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); + iWLanParams.Append( EInputParams( EWlanIpNetMask, KWlanIpNetMask ) ); + iWLanParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); + iWLanParams.Append( EInputParams( EWlanIpAddr, KPhoneIP ) ); + iWLanParams.Append( EInputParams( EWlanScanSSID, KWlanScanSSId ) ); + iWLanParams.Append( EInputParams( EWlanChannelID, KWlanChannelId ) ); + iWLanParams.Append( EInputParams( EWEPKeyInUse, KWEPKeyInUse ) ); + iWLanParams.Append( EInputParams( EWEPAuthType, KWEPAuthType ) ); + iWLanParams.Append( EInputParams( EWEPKey1Length, KWEPKey1Length ) ); + iWLanParams.Append( EInputParams( EWEPKey1Format, KWEPKey1Format ) ); + iWLanParams.Append( EInputParams( EWEPKey1Data, KWEPKey1Data ) ); + iWLanParams.Append( EInputParams( EWEPKey2Length, KWEPKey2Length ) ); + iWLanParams.Append( EInputParams( EWEPKey2Format, KWEPKey2Format ) ); + iWLanParams.Append( EInputParams( EWEPKey2Data, KWEPKey2Data ) ); + iWLanParams.Append( EInputParams( EWEPKey3Length, KWEPKey3Length ) ); + iWLanParams.Append( EInputParams( EWEPKey3Format, KWEPKey3Format ) ); + iWLanParams.Append( EInputParams( EWEPKey3Data, KWEPKey3Data ) ); + iWLanParams.Append( EInputParams( EWEPKey4Length, KWEPKey4Length ) ); + iWLanParams.Append( EInputParams( EWEPKey4Format, KWEPKey4Format ) ); + iWLanParams.Append( EInputParams( EWEPKey4Data, KWEPKey4Data ) ); + iWLanParams.Append( EInputParams( EWPAPresharedKey, KWPAPresharedKey ) ); + iWLanParams.Append( EInputParams( EWPAKeyLength, KWPAKeyLength ) ); + iWLanParams.Append( EInputParams( EWPAEapMethod, KWPAEapMethod ) ); + iWLanParams.Append( EInputParams( EWPAUseOfPresharedKey, KWPAUseOfPresharedKey ) ); + iWLanParams.Append( EInputParams( EEapGtcUsername, KEapGtcUsername ) ); + iWLanParams.Append( EInputParams( EEapGtcSessionValidityTime, KEapGtcSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapGtcEncapsulation, KEapGtcEncapsulation ) ); + iWLanParams.Append( EInputParams( EEapTlsUsername, KEapTlsUsername ) ); + iWLanParams.Append( EInputParams( EEapTlsRealm, KEapTlsRealm ) ); + iWLanParams.Append( EInputParams( EEapTlsVerifyServerRealm, KEapTlsVerifyServerRealm ) ); + iWLanParams.Append( EInputParams( EEapTlsRequireClientAuth, KEapTlsRequireClientAuth ) ); + iWLanParams.Append( EInputParams( EEapTlsSessionValidityTime, KEapTlsSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapTlsCipherSuites, KEapTlsCipherSuites ) ); + iWLanParams.Append( EInputParams( EEapTlsUserCertSubjectKeyId, KEapTlsUserCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapTlsUserCertIssuerName, KEapTlsUserCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapTlsUserCertSerialNumber, KEapTlsUserCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapTlsCaCertSubjectKeyId, KEapTlsCaCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapTlsCaCertIssuerName, KEapTlsCaCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapTlsCaCertSerialNumber, KEapTlsCaCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapTlsEncapsulation, KEapTlsEncapsulation ) ); + iWLanParams.Append( EInputParams( EEapLeapUsername, KEapLeapUsername ) ); + iWLanParams.Append( EInputParams( EEapLeapPassword, KEapLeapPassword ) ); + iWLanParams.Append( EInputParams( EEapLeapSessionValidityTime, KEapLeapSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapSimUsername, KEapSimUsername ) ); + iWLanParams.Append( EInputParams( EEapSimRealm, KEapSimRealm ) ); + iWLanParams.Append( EInputParams( EEapSimUsePseudonyms, KEapSimUsePseudonyms ) ); + iWLanParams.Append( EInputParams( EEapSimSessionValidityTime, KEapSimSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapSimEncapsulation, KEapSimEncapsulation ) ); + iWLanParams.Append( EInputParams( EEapTtlsUsername, KEapTtlsUsername ) ); + iWLanParams.Append( EInputParams( EEapTtlsRealm, KEapTtlsRealm ) ); + iWLanParams.Append( EInputParams( EEapTtlsVerifyServerRealm, KEapTtlsVerifyServerRealm ) ); + iWLanParams.Append( EInputParams( EEapTtlsRequireClientAuth, KEapTtlsRequireClientAuth ) ); + iWLanParams.Append( EInputParams( EEapTtlsSessionValidityTime, KEapTtlsSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapTtlsCipherSuites, KEapTtlsCipherSuites ) ); + iWLanParams.Append( EInputParams( EEapTtlsEncapsulatedTypes, KEapTtlsEncapsulatedTypes ) ); + iWLanParams.Append( EInputParams( EEapTtlsUserCertSubjectKeyId, KEapTtlsUserCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapTtlsUserCertIssuerName, KEapTtlsUserCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapTtlsUserCertSerialNumber, KEapTtlsUserCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapTtlsCaCertSubjectKeyId, KEapTtlsCaCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapTtlsCaCertIssuerName, KEapTtlsCaCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapTtlsCaCertSerialNumber, KEapTtlsCaCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapAkaUsername, KEapAkaUsername ) ); + iWLanParams.Append( EInputParams( EEapAkaRealm, KEapAkaRealm ) ); + iWLanParams.Append( EInputParams( EEapAkaUsePseudonyms, KEapAkaUsePseudonyms ) ); + iWLanParams.Append( EInputParams( EEapAkaSessionValidityTime, KEapAkaSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapAkaEncapsulation, KEapAkaEncapsulation ) ); + iWLanParams.Append( EInputParams( EEapPeapUsername, KEapPeapUsername ) ); + iWLanParams.Append( EInputParams( EEapPeapRealm, KEapPeapRealm ) ); + iWLanParams.Append( EInputParams( EEapPeapVerifyServerRealm, KEapPeapVerifyServerRealm ) ); + iWLanParams.Append( EInputParams( EEapPeapRequireClientAuth, KEapPeapRequireClientAuth ) ); + iWLanParams.Append( EInputParams( EEapPeapSessionValidityTime, KEapPeapSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapPeapCipherSuites, KEapPeapCipherSuites ) ); + iWLanParams.Append( EInputParams( EEapPeapV0Allowed, KEapPeapV0Allowed ) ); + iWLanParams.Append( EInputParams( EEapPeapV1Allowed, KEapPeapV1Allowed ) ); + iWLanParams.Append( EInputParams( EEapPeapV2Allowed, KEapPeapV2Allowed ) ); + iWLanParams.Append( EInputParams( EEapPeapEncapsulatedTypes, KEapPeapEncapsulatedTypes ) ); + iWLanParams.Append( EInputParams( EEapPeapUserCertSubjectKeyId, KEapPeapUserCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapPeapUserCertIssuerName, KEapPeapUserCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapPeapUserCertSerialNumber, KEapPeapUserCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapPeapCaCertSubjectKeyId, KEapPeapCaCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapPeapCaCertIssuerName, KEapPeapCaCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapPeapCaCertSerialNumber, KEapPeapCaCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapMschapv2Username, KEapMschapv2Username ) ); + iWLanParams.Append( EInputParams( EEapMschapv2Password, KEapMschapv2Password ) ); + iWLanParams.Append( EInputParams( EEapMschapv2SessionValidityTime, KEapMschapv2SessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapMschapv2Encapsulation, KEapMschapv2Encapsulation ) ); + iWLanParams.Append( EInputParams( EEapFastUsername, KEapFastUsername ) ); + iWLanParams.Append( EInputParams( EEapFastRealm, KEapFastRealm ) ); + iWLanParams.Append( EInputParams( EEapFastVerifyServerRealm, KEapFastVerifyServerRealm ) ); + iWLanParams.Append( EInputParams( EEapFastRequireClientAuth, KEapFastRequireClientAuth ) ); + iWLanParams.Append( EInputParams( EEapFastSessionValidityTime, KEapFastSessionValidityTime ) ); + iWLanParams.Append( EInputParams( EEapFastCipherSuites, KEapFastCipherSuites ) ); + iWLanParams.Append( EInputParams( EEapFastEncapsulatedTypes, KEapFastEncapsulatedTypes ) ); + iWLanParams.Append( EInputParams( EEapFastAuthProvModeAllowed, KEapFastAuthProvModeAllowed ) ); + iWLanParams.Append( EInputParams( EEapFastUnauthProvModeAllowed, KEapFastUnauthProvModeAllowed ) ); + iWLanParams.Append( EInputParams( EEapFastWarnADHPNoPAC, KEapFastWarnADHPNoPAC ) ); + iWLanParams.Append( EInputParams( EEapFastWarnADHPNoMatchingPAC, KEapFastWarnADHPNoMatchingPAC ) ); + iWLanParams.Append( EInputParams( EEapFastWarnNotDefaultServer, KEapFastWarnNotDefaultServer ) ); + iWLanParams.Append( EInputParams( EEapFastUserCertSubjectKeyId, KEapFastUserCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapFastUserCertIssuerName, KEapFastUserCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapFastUserCertSerialNumber, KEapFastUserCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EEapFastCaCertSubjectKeyId, KEapFastCaCertSubjectKeyId ) ); + iWLanParams.Append( EInputParams( EEapFastCaCertIssuerName, KEapFastCaCertIssuerName ) ); + iWLanParams.Append( EInputParams( EEapFastCaCertSerialNumber, KEapFastCaCertSerialNumber ) ); + iWLanParams.Append( EInputParams( EMschapv2Username, KMschapv2Username ) ); + iWLanParams.Append( EInputParams( EMschapv2Password, KMschapv2Password ) ); + iWLanParams.Append( EInputParams( EMschapv2SessionValidityTime, KMschapv2SessionValidityTime ) ); + iWLanParams.Append( EInputParams( EMschapv2Encapsulation, KMschapv2Encapsulation ) ); + }; + + + +void CReaderXML::FillVpnParams() + { + iVpnParams.Reset(); + + iVpnParams.Append( EInputParams( ECmName, KConnectionName ) ); + iVpnParams.Append( EInputParams( ECmId, KConnectionId ) ); + iVpnParams.Append( EInputParams( ECmProtected, KProtected ) ); + iVpnParams.Append( EInputParams( ECmHidden, KHidden ) ); + iVpnParams.Append( EInputParams( ECmMetaHiddenAgent, KHiddenAgent ) ); + iVpnParams.Append( EInputParams( ECmMetaHighlight, KHighlighted ) ); + iVpnParams.Append( EInputParams( ECmSeamlessnessLevel, KSeamlessness ) ); + iVpnParams.Append( EInputParams( ECmProxyServerName, KProxyServerAddress ) ); + iVpnParams.Append( EInputParams( ECmProxyPortNumber, KProxyPortNumber ) ); + iVpnParams.Append( EInputParams( ECmProxyProtocolName, KProxyProtocolName ) ); + iVpnParams.Append( EInputParams( EVPN_IapName, KVpnIapName ) ); + iVpnParams.Append( EInputParams( EVpnServicePolicy, KVpnServicePolicy ) ); + + }; + +//Binds Gobal settings parameters to field IDs +void CReaderXML::FillGlobalParams() + { + iGlobalParams.Append( EInputParams( EGPRSAttachMode, KAttachMode ) ); + iGlobalParams.Append( EInputParams( EDefaultAP, KDefaultAP) ); + iGlobalParams.Append( EInputParams( EDefaultDnIcon, KDefaultDnIcon ) ); + iGlobalParams.Append( EInputParams( EPriorityLan, KPriorityLan ) ); + iGlobalParams.Append( EInputParams( EPriorityWlan, KPriorityWlan ) ); + iGlobalParams.Append( EInputParams( EPriorityPan, KPriorityPan ) ); + iGlobalParams.Append( EInputParams( EPriorityGprsOut, KPriorityGprsOut ) ); + iGlobalParams.Append( EInputParams( EPriorityGprsIn, KPriorityGprsIn ) ); + iGlobalParams.Append( EInputParams( EPriorityCdma2k, KPriorityCdma2k ) ); + iGlobalParams.Append( EInputParams( EPriorityDialOut, KPriorityDialOut ) ); + iGlobalParams.Append( EInputParams( EPriorityDialIn, KPriorityDialIn ) ); + iGlobalParams.Append( EInputParams( EPriorityVpn, KPriorityVpn ) ); + iGlobalParams.Append( EInputParams( EPriorityMip, KPriorityMip ) ); + iGlobalParams.Append( EInputParams( EUIPriorityLan, KUIPriorityLan ) ); + iGlobalParams.Append( EInputParams( EUIPriorityWlan, KUIPriorityWlan ) ); + iGlobalParams.Append( EInputParams( EUIPriorityPan, KUIPriorityPan ) ); + iGlobalParams.Append( EInputParams( EUIPriorityGprsOut, KUIPriorityGprsOut ) ); + iGlobalParams.Append( EInputParams( EUIPriorityGprsIn, KUIPriorityGprsIn ) ); + iGlobalParams.Append( EInputParams( EUIPriorityCdma2k, KUIPriorityCdma2k ) ); + iGlobalParams.Append( EInputParams( EUIPriorityDialOut, KUIPriorityDialOut ) ); + iGlobalParams.Append( EInputParams( EUIPriorityDialIn, KUIPriorityDialIn ) ); + iGlobalParams.Append( EInputParams( EUIPriorityVpn, KUIPriorityVpn ) ); + iGlobalParams.Append( EInputParams( EUIPriorityMip, KUIPriorityMip ) ); + iGlobalParams.Append( EInputParams( EUsageOfWlan, KUsageOfWlan ) ); + iGlobalParams.Append( EInputParams( ECellularDataUsageHome, KCellularDataUsageHome ) ); + iGlobalParams.Append( EInputParams( ECellularDataUsageVisitor, KCellularDataUsageVisitor ) ); + iGlobalParams.Append( EInputParams( EGprsLastSocketActivityTimeout, KGprsLastSocketActivityTimeout ) ); + iGlobalParams.Append( EInputParams( EGprsLastSessionClosedTimeout, KGprsLastSessionClosedTimeout ) ); + iGlobalParams.Append( EInputParams( EGprsLastSocketClosedTimeout, KGprsLastSocketClosedTimeout ) ); + iGlobalParams.Append( EInputParams( EWlanLastSocketActivityTimeout, KWlanLastSocketActivityTimeout ) ); + iGlobalParams.Append( EInputParams( EWlanLastSessionClosedTimeout, KWlanLastSessionClosedTimeout ) ); + iGlobalParams.Append( EInputParams( EWlanLastSocketClosedTimeout, KWlanLastSocketClosedTimeout ) ); + iGlobalParams.Append( EInputParams( EWlanBGScanInterval, KWlanBGScanInterval ) ); + iGlobalParams.Append( EInputParams( EWlanUseDefSettings, KWlanUseDefSettings ) ); + iGlobalParams.Append( EInputParams( EWlanLongRetry, KWlanLongRetry ) ); + iGlobalParams.Append( EInputParams( EWlanShortRetry, KWlanShortRetry ) ); + iGlobalParams.Append( EInputParams( EWlanRTS, KWlanRTS ) ); + iGlobalParams.Append( EInputParams( EWlanTxPowerLevel, KWlanTxPowerLevel ) ); + iGlobalParams.Append( EInputParams( EWlanRadioMeasurements, KWlanRadioMeasurements ) ); + iGlobalParams.Append( EInputParams( EWlanPowerMode, KWlanPowerMode ) ); + + }; + +//Describes a Destination Network +void CReaderXML::FillDNParams() + { + iDNParams.Append( EInputParams( EDN_Name, KDN_Name ) ); + iDNParams.Append( EInputParams( EDN_Id, KDN_Id ) ); + iDNParams.Append( EInputParams( EDN_Icon, KDN_Icon ) ); + iDNParams.Append( EInputParams( EDN_Metadata, KDN_Metadata ) ); + iDNParams.Append( EInputParams( EDN_Protection, KDN_Protection ) ); + iDNParams.Append( EInputParams( EDN_Hidden, KHidden ) ); + iDNParams.Append( EInputParams( EDN_HiddenAgent, KHiddenAgent ) ); + iDNParams.Append( EInputParams( EDN_Highlighted, KHighlighted ) ); + iDNParams.Append( EInputParams( EDN_EmbeddedDNName, KDN_EmbeddedDNName ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName ) ); + // Needed because of Customization Tool limitations + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName2 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName3 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName4 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName5 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName6 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName7 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName8 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName9 ) ); + iDNParams.Append( EInputParams( EDN_IAPName, KDN_IAPName10 ) ); + }; + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdctagcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdctagcontainer.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,145 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Method definitions of the class CTagContainer. +* +*/ + + + +#include "cdctagcontainer.h" +#include "cdcerrors.h" + +//CONSTANTS +const TInt KGranularity = 20; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Constructor of ETag +// --------------------------------------------------------- +CTagContainer::ETag::ETag( HBufC16* aTag, TInt aFieldId ): + iFieldId( aFieldId ), + iTag( aTag ) + { + //no implementation needed + } + +// --------------------------------------------------------- +// Destructor of ETag +// --------------------------------------------------------- +CTagContainer::ETag::~ETag() + { + delete iTag; + } + +// --------------------------------------------------------- +// TTagContainer NewL +// --------------------------------------------------------- +// +CTagContainer* CTagContainer::NewL() + { + CTagContainer* self = new ( ELeave ) CTagContainer(); + CleanupStack::PushL( self ); + + // From Base class + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------- +// TTagContainer ConstructL +// --------------------------------------------------------- +// +void CTagContainer::ConstructL() + { + iTags = new (ELeave) CArrayPtrSeg( KGranularity ); + } + +// --------------------------------------------------------- +// TTagContainer Constructor +// --------------------------------------------------------- +// +CTagContainer::CTagContainer() + { + } + +// --------------------------------------------------------- +// TTagContainer Destructor +// --------------------------------------------------------- +// +CTagContainer::~CTagContainer() + { + Clear(); + delete iTags; + } + +// --------------------------------------------------------- +// CTagContainer::Clear +// --------------------------------------------------------- +// +void CTagContainer::Clear() + { + iTags->ResetAndDestroy(); + } + +// --------------------------------------------------------- +// CTagContainer::Add +// --------------------------------------------------------- +// +void CTagContainer::AddL( HBufC16* aTag, TInt aFieldId ) + { + ETag* tag = new (ELeave) ETag( aTag, aFieldId ); + //lint -sem( iTags->AppendL, custodial(1) ) + + CleanupStack::PushL( tag ); + iTags->AppendL( tag ); + CleanupStack::Pop( tag ); + } + +// --------------------------------------------------------- +// CTagContainer::Tag +// --------------------------------------------------------- +// +HBufC16* CTagContainer::Tag( TUint aIdx ) + { + __ASSERT_ALWAYS( aIdx < Count(), + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + return iTags->At(aIdx)->iTag; + } + +// --------------------------------------------------------- +// CTagContainer::FieldId +// --------------------------------------------------------- +// +TInt CTagContainer::FieldId( TUint aIdx ) + { + __ASSERT_ALWAYS( aIdx < Count(), + User::Panic ( KPanicOutOfRange, KErrOutOfRange ) ); + + return iTags->At( aIdx )->iFieldId; + } + +// --------------------------------------------------------- +// CTagContainer::Count +// --------------------------------------------------------- +// +TInt CTagContainer::Count() + { + return iTags->Count(); + } + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcwlandevicesettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcwlandevicesettings.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CWlanDeviceSettings +* +*/ + + + +// INCLUDE FILES +#include "cdcwlandevicesettings.h" +#include "cdclogger.h" + +#include +#include + +#include +#include +#include +#include + + +// CONSTANTS +// WLAN Device Settings table - default settings +const TUint32 KDefaultBGScanInterval = 0xFFFFFFFF; // Automatic scan +const TBool KDefaultUseDefSettings = ETrue; +const TUint32 KDefaultLongRetry = 4; +const TUint32 KDefaultShortRetry = 7; +const TUint32 KDefaultRTS = 2347; +const TUint32 KDefaultTxPowerLevel = 100; //mW +const TBool KDefaultRadioMeasurements = ETrue; +const TBool KDefaultWlanPowerMode = ETrue; + +// Increase version every time the content of the table changes +const TUint32 KWlanDeviceSettingsTableVersion = 9; + + +// ================= MEMBER FUNCTIONS ====================== + +// --------------------------------------------------------- +// Constructor +// --------------------------------------------------------- +// +CWlanDeviceSettings::CWlanDeviceSettings() + { + } + + +// --------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// --------------------------------------------------------- +// +void CWlanDeviceSettings::ConstructL() + { + DEBUG( "CWlanDeviceSettings::ConstructL()" ) + + iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); + + // Open the WLAN device settings table. + if( !iSession->IsInTransaction() ) + { + iSession->OpenTransactionL(); + } + OpenTableL(); + iSession->CommitTransactionL(); + DEBUG( "CWlanDeviceSettings::ConstructL() Tables opened ok." ) + } + + +// --------------------------------------------------------- +// Static constructor. +// --------------------------------------------------------- +// +CWlanDeviceSettings* CWlanDeviceSettings::NewL() + { + DEBUG( "CWlanDeviceSettings::NewL()" ) + + CWlanDeviceSettings* self = new (ELeave) CWlanDeviceSettings; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// Destructor +// --------------------------------------------------------- +// +CWlanDeviceSettings::~CWlanDeviceSettings() + { + DEBUG( "CWlanDeviceSettings::~CWlanDeviceSettings()" ) + + if ( iSession ) + { + iSession->Close(); + delete iSession; + } + } + + +// --------------------------------------------------------- +// CWlanDeviceSettings::GetDefaultSettings +// --------------------------------------------------------- +// +void CWlanDeviceSettings::GetDefaultSettings( SWlanDeviceSettings& aSettings ) + { + DEBUG( "CWlanDeviceSettings::GetDefaultSettings()" ) + + aSettings.backgroundScanInterval = KDefaultBGScanInterval; + aSettings.savedBgScanInterval = KDefaultBGScanInterval; + aSettings.useDefaultSettings = KDefaultUseDefSettings; + aSettings.longRetry = KDefaultLongRetry; + aSettings.shortRetry = KDefaultShortRetry; + aSettings.rts = KDefaultRTS; + aSettings.txPowerLevel = KDefaultTxPowerLevel; + aSettings.radioMeasurements = KDefaultRadioMeasurements; + aSettings.powerMode = KDefaultWlanPowerMode; + } + + +// --------------------------------------------------------- +// CWlanDeviceSettings::OpenTableL +// --------------------------------------------------------- +// +void CWlanDeviceSettings::OpenTableL() + { + DEBUG( "CWlanDeviceSettings::OpenTableL()" ) + + // See if there is a record whose device settings type is + // 'WLAN default settings' + CMDBGenericRecord* deviceSettingsTable = static_cast< CMDBGenericRecord* > + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( deviceSettingsTable ); + deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); + deviceSettingsTable->LoadL( *iSession ); + + CMDBElement* tableType = deviceSettingsTable->GetFieldByIdL + ( KCDTIdWlanDeviceSettingsType ); + CMDBField< TUint32 >* tableTypeField = + static_cast< CMDBField< TUint32 >* >( tableType ); + tableTypeField->SetL( KWlanDefaultSettings ); + + if( !deviceSettingsTable->FindL( *iSession ) ) + { + // If not, store empty record + deviceSettingsTable->SetRecordId( KCDNewRecordRequest ); + deviceSettingsTable->StoreL( *iSession ); + // And fill it with data + FillRecordL( KWlanDefaultSettings, deviceSettingsTable ); + deviceSettingsTable->ModifyL( *iSession ); + } + CleanupStack::PopAndDestroy( deviceSettingsTable ); + + // See if there is a record whose device settings type is + // 'WLAN user settings' + deviceSettingsTable = static_cast< CMDBGenericRecord* > + ( CCDRecordBase::RecordFactoryL( 0 ) ); + CleanupStack::PushL( deviceSettingsTable ); + deviceSettingsTable->InitializeL( TPtrC( WLAN_DEVICE_SETTINGS ), NULL ); + deviceSettingsTable->LoadL( *iSession ); + + tableType = deviceSettingsTable->GetFieldByIdL( KCDTIdWlanDeviceSettingsType ); + tableTypeField = static_cast< CMDBField< TUint32 >* >( tableType ); + tableTypeField->SetL( KWlanUserSettings ); + + if( !deviceSettingsTable->FindL( *iSession ) ) + { + // If not, store empty record + deviceSettingsTable->SetRecordId( KCDNewRecordRequest ); + deviceSettingsTable->StoreL( *iSession ); + // And fill it with data + FillRecordL( KWlanUserSettings, deviceSettingsTable ); + deviceSettingsTable->ModifyL( *iSession ); + } + CleanupStack::PopAndDestroy( deviceSettingsTable ); + } + + +// --------------------------------------------------------- +// CWlanDeviceSettings::FillRecordL +// --------------------------------------------------------- +// + +void CWlanDeviceSettings::FillRecordL( TUint32 aTableType, + CMDBGenericRecord* aRecord ) + { + DEBUG1( "CWlanDeviceSettings::NewRecordL() Type=%d", aTableType ) + + SWlanDeviceSettings settings; + GetDefaultSettings( settings ); + + // Device Settings Type + CMDBElement* tableType = aRecord->GetFieldByIdL + ( KCDTIdWlanDeviceSettingsType ); + CMDBField< TUint32 >* tableTypeField = + static_cast< CMDBField< TUint32 >* >( tableType ); + tableTypeField->SetL( aTableType ); + + // Table Version + CMDBElement* tableVersion = aRecord->GetFieldByIdL + ( KCDTIdTableVersion ); + CMDBField< TUint32 >* tableVersionField = + static_cast< CMDBField< TUint32 >* >( tableVersion ); + + tableVersionField->SetL( KWlanDeviceSettingsTableVersion ); + + // BG Scan Interval + CMDBElement* bgScanInterval = aRecord->GetFieldByIdL + ( KCDTIdBgScanInterval ); + CMDBField< TUint32 >* bgScanIntervalField = + static_cast< CMDBField< TUint32 >* >( bgScanInterval ); + bgScanIntervalField->SetL( settings.backgroundScanInterval ); + + // Saved BG Scan Interval + CMDBElement* savedBgScanInterval = aRecord->GetFieldByIdL + ( KCDTIdSavedBgScanInterval ); + CMDBField< TUint32 >* savedBgScanIntervalField = + static_cast< CMDBField< TUint32 >* >( savedBgScanInterval ); + savedBgScanIntervalField->SetL( settings.savedBgScanInterval ); + + // Use Default Settings + CMDBElement* useDefaultSettings = aRecord->GetFieldByIdL + ( KCDTIdUseDefaultSettings ); + CMDBField< TBool >* useDefaultSettingsField = + static_cast< CMDBField< TBool >* >( useDefaultSettings ); + useDefaultSettingsField->SetL( settings.useDefaultSettings ); + + // Long Retry + CMDBElement* longRetry = aRecord->GetFieldByIdL( KCDTIdWlanLongRetry ); + CMDBField< TUint32 >* longRetryField = + static_cast< CMDBField< TUint32 >* >( longRetry ); + longRetryField->SetL( settings.longRetry ); + + // Short Retry + CMDBElement* shortRetry = aRecord->GetFieldByIdL( KCDTIdWlanShortRetry ); + CMDBField< TUint32 >* shortRetryField = + static_cast< CMDBField< TUint32 >* >( shortRetry ); + shortRetryField->SetL( settings.shortRetry ); + + // RTS Threshold + CMDBElement* rts = aRecord->GetFieldByIdL( KCDTIdWlanRTSThreshold ); + CMDBField< TUint32 >* rtsField = + static_cast< CMDBField< TUint32 >* >( rts ); + rtsField->SetL( settings.rts ); + + // TX Power Level + CMDBElement* txPowerLevel = aRecord->GetFieldByIdL( KCDTIdTxPowerLevel ); + CMDBField< TUint32 >* txPowerLevelField = + static_cast< CMDBField< TUint32 >* >( txPowerLevel ); + txPowerLevelField->SetL( settings.txPowerLevel ); + + // Radio Measurements + CMDBElement* radioMeasurements = aRecord->GetFieldByIdL + ( KCDTIdAllowRadioMeasurements ); + CMDBField< TBool >* radioMeasurementsField = + static_cast< CMDBField< TBool >* >( radioMeasurements ); + radioMeasurementsField->SetL( settings.radioMeasurements ); + + // Power Mode + CMDBElement* powerMode = aRecord->GetFieldByIdL( KCDTIdWlanPowerMode ); + CMDBField< TBool >* powerModeField = + static_cast< CMDBField< TBool >* >( powerMode ); + powerModeField->SetL( settings.powerMode ); + } + +// End of File diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/commsdatcreator/src/cdcwlantables.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/commsdatcreator/src/cdcwlantables.cpp Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,252 @@ +/* +* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of the class CWlanTables +* +*/ + + + + +// INCLUDE FILES +#include "cdclogger.h" +#include "cdcwlantables.h" + +#include + +// CONSTANTS +/// Modem bearer names for WLAN connection methods +_LIT( KWlanBearerName, "WLANBearer" ); +_LIT( KWlanBearerAgent, "wlanagt.agt" ); +_LIT( KWlanBearerNif, "wlannif" ); + +_LIT( KWlanLDDName, "not used" ); +_LIT( KWlanPDDName, "not used" ); +const TInt KWlanLastSocketActivityTimeout = -1; +const TInt KWlanLastSessionClosedTimeout = 1; +const TInt KWlanLastSocketClosedTimeout = -1; + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CWlanTables::NewL +// --------------------------------------------------------- +// +CWlanTables* CWlanTables::NewL() + { + + CWlanTables* self = new ( ELeave ) CWlanTables; + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + + +// --------------------------------------------------------- +// CWlanTables::CWlanTables +// --------------------------------------------------------- +// +CWlanTables::CWlanTables() + { + //no implementation needed + } + + +// --------------------------------------------------------- +// CWlanTables::ConstructL +// --------------------------------------------------------- +// +void CWlanTables::ConstructL() + { + iSession = CMDBSession::NewL( CMDBSession::LatestVersion() ); + } + + +// --------------------------------------------------------- +// CWlanTables::~CWlanTables +// --------------------------------------------------------- +// +CWlanTables::~CWlanTables() + { + if ( iSession ) + { + iSession->Close(); + delete iSession; + } + } + + +// --------------------------------------------------------- +// CreateWlanServiceTableL +// --------------------------------------------------------- +// +void CWlanTables::CheckAndCreateTablesL() + { + // Check WLAN Device Settings Table (creates if does not exist). + CreateWlanDeviceSettingsTableL(); + + // Check WLAN Service Table (creates if does not exist). + CreateWlanServiceTableL(); + + // Check WLAN Secondary SSID Table (creates if does not exist). + CreateWlanSecSSIDTableL(); + + // Check WLAN bearer record (creates if does not exist). + CreateWlanBearerRecordL(); + } + +// --------------------------------------------------------- +// CreateWlanServiceTableL +// --------------------------------------------------------- +// +void CWlanTables::CreateWlanServiceTableL() + { + //checks whether table exists + TInt error( KErrNone ); + + TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) ); + if( error == KErrNotFound ) + { + //table not found -- add new table + CCDWlanServiceRecord::CreateTableL( *iSession ); + + //check result + TRAP( error, CCDWlanServiceRecord::TableIdL( *iSession ) ); + + if ( error == KErrNone ) + { + CLOG_WRITE( "Added WLAN service table" ) + } + } + else if ( error == KErrNone) + { + CLOG_WRITE( "WLAN service table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CreateWlanDeviceTableL +// --------------------------------------------------------- +// +void CWlanTables::CreateWlanDeviceSettingsTableL() + { + //checks whether table exists + TInt error( KErrNone ); + + TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) ); + if( error == KErrNotFound ) + { + //table not found -- add new table + CCDWlanDeviceSettingsRecord::CreateTableL( *iSession ); + + //check result + TRAP( error, CCDWlanDeviceSettingsRecord::TableIdL( *iSession ) ); + if ( error == KErrNone ) + { + CLOG_WRITE( "Added Device Settings table" ) + } + } + else if ( error == KErrNone) + { + CLOG_WRITE( "Device Settings table already exists" ) + } + else + { + //do nothing + } + } + + +// --------------------------------------------------------- +// CreateWlanSecSSIDTableL +// --------------------------------------------------------- +// +void CWlanTables::CreateWlanSecSSIDTableL() + { + //checks whether table exists + TInt error( KErrNone ); + + TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) ); + if( error == KErrNotFound ) + { + //table not found -- add new table + CCDWLANSecSSIDTable::CreateTableL( *iSession ); + + //check result + TRAP( error, CCDWLANSecSSIDTable::TableIdL( *iSession ) ); + + if ( error == KErrNone ) + { + CLOG_WRITE( "Added Secondary SSID table" ) + } + } + else if ( error == KErrNone) + { + CLOG_WRITE( "Secondary SSID table already exists" ) + } + else + { + //do nothing + } + } + +// --------------------------------------------------------- +// CreateWlanBearerRecordL +// --------------------------------------------------------- +// +void CWlanTables::CreateWlanBearerRecordL() + { + CCDLANBearerRecord* record = static_cast + ( CCDRecordBase::RecordFactoryL( KCDTIdLANBearerRecord ) ); + CleanupStack::PushL( record ); + + record->iRecordName.SetL( TPtrC( KWlanBearerName ) ); + + if ( !record->FindL( *iSession ) ) + { // bearer not found -> create dummy values. Copied from CmManager initialization. + record->SetRecordId( KCDNewRecordRequest ); + + record->iBearerAgent.SetL( KWlanBearerAgent ); + record->iRecordName.SetL( KWlanBearerName ); + record->iLanBearerNifName.SetL( KWlanBearerNif ); + record->iLanBearerLddName.SetL( KWlanLDDName ); + record->iLanBearerPddName.SetL( KWlanPDDName ); + record->iLastSocketActivityTimeout.SetL( + ( TUint32 )KWlanLastSocketActivityTimeout ); + record->iLastSessionClosedTimeout.SetL( + (TUint32 )KWlanLastSessionClosedTimeout ); + record->iLastSocketClosedTimeout.SetL( + ( TUint32 )KWlanLastSocketClosedTimeout ); + record->StoreL( *iSession ); + CLOG_WRITE( "Added WLAN bearer record" ); + } + else + { + CLOG_WRITE( "WLAN bearer record already exists" ); + } + + CleanupStack::PopAndDestroy( record ); + } + + + +// End of File. diff -r bbe4544dfd31 -r dd6aaa97e7b1 dbcreator/conf/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dbcreator/conf/bld.inf Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information for the DbCreator Config files and ROM +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +commsdatcreator.confml MW_LAYER_CONFML(commsdatcreator.confml) +commsdatcreator_01.gcfml MW_LAYER_GCFML(commsdatcreator_01.gcfml) +commsdatcreator.implml MW_LAYER_CRML(commsdatcreator.implml) +../rom/commsdatcreator.iby CORE_MW_LAYER_IBY_EXPORT_PATH(commsdatcreator.iby) diff -r bbe4544dfd31 -r dd6aaa97e7b1 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r bbe4544dfd31 -r dd6aaa97e7b1 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Mon Aug 23 13:40:12 2010 +0300 @@ -0,0 +1,1 @@ +