201021
authorhgs
Mon, 24 May 2010 20:51:35 +0300
changeset 32 5c4486441ae6
parent 31 c16e04725da3
child 33 d15c703eefa3
201021
alwayson_net_plugin/pdpcontextmanager2/conf/CI_pdpcontextmanager2.confml
alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2.confml
alwayson_net_plugin/pdpcontextmanager2/group/bld.inf
bearermanagement/mpm/bwins/mpmdefaultconnectionu.def
bearermanagement/mpm/eabi/mpmdefaultconnectionu.def
bearermanagement/mpm/group/bld.inf
bearermanagement/mpm/group/mpmdefaultconnectionclient.mmp
bearermanagement/mpm/group/mpmserver.mmp
bearermanagement/mpm/inc/mpmcommsdataccess.h
bearermanagement/mpm/inc/mpmdefaultconnection.h
bearermanagement/mpm/inc/mpmdefaultconnserver.h
bearermanagement/mpm/inc/mpmdefaultconnserversession.h
bearermanagement/mpm/inc/mpmiapselection.h
bearermanagement/mpm/inc/mpmserver.h
bearermanagement/mpm/inc/mpmserver.inl
bearermanagement/mpm/inc/mpmstarter.h
bearermanagement/mpm/inc/mpmwlanquerydialog.h
bearermanagement/mpm/src/mpmcommsdataccess.cpp
bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp
bearermanagement/mpm/src/mpmdefaultconnection.cpp
bearermanagement/mpm/src/mpmdefaultconnserver.cpp
bearermanagement/mpm/src/mpmdefaultconnserversession.cpp
bearermanagement/mpm/src/mpmiapselection.cpp
bearermanagement/mpm/src/mpmserver.cpp
bearermanagement/mpm/src/mpmserversession.cpp
bearermanagement/mpm/src/mpmstarter.cpp
bearermanagement/mpm/src/mpmwlanquerydialog.cpp
bearermanagement/mpm/src/rmpmdefaultconnection.cpp
cmmanager/cmapplsettingsui/res/cmradiodialog.docml
cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp
cmmanager/cmmgr/cmmplugins/cmpluginvpn/data/10281BBE.rss
cmmanager/cmmgr/cmmplugins/cmpluginvpn/group/bld.inf
cmmanager/cmmgr/cmmplugins/cmpluginvpn/group/cmpluginvpn.mmp
cmmanager/cmmgr/cmmplugins/cmpluginvpn/inc/cmpluginvpn.h
cmmanager/cmmgr/cmmplugins/cmpluginvpn/rom/cmmpluginvpn.iby
cmmanager/cmmgr/cmmplugins/cmpluginvpn/src/cmpluginvpn.cpp
cmmanager/cmmgr/cmmplugins/cmpluginvpn/src/cmpluginvpnproxy.cpp
cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/OstTraceDefinitions.h
cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/cmpluginvpnTraces.h
cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/fixed_id.definitions
cmmanager/cmmgr/cmmplugins/group/bld.inf
cmmanager/cmmgr/cmmserver/src/cmmcache.cpp
cmmanager/cpdestinationplugin/inc/cpadddestinationentryitemdata.h
cmmanager/cpdestinationplugin/inc/cpdestinationentryitem.h
cmmanager/cpdestinationplugin/inc/cpiapitem.h
cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp
cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp
cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp
cmmanager/cpdestinationplugin/src/cpiapitem.cpp
cmmanager/cpipsettingsplugin/src/cpipsettingsview.cpp
cmmanager/cppacketdataapplugin/inc/cppacketdataapadvancedview.h
cmmanager/cppacketdataapplugin/tsrc/ut/hbautotest.cpp
cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.cpp
cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.h
cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.cpp
connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp
connectionmonitoring/indicatorobserver/inc/indicatorobserver.h
connectionmonitoring/indicatorobserver/src/indicatorobserver.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ChangeConnectionDlg.h
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp
connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp
connectionutilities/ConnectionDialogs/group/ConnectionUiUtilities.mmp
data/cccccc00_emulator.cre
dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h
dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h
dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp
dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp
dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp
dbcreator/commsdatcreator/Src/cdcreaderxml.cpp
dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp
dbcreator/conf/CI_commsdatcreator.confml
dbcreator/conf/commsdatcreator.confml
dbcreator/conf/commsdatcreator.content
dbcreator/conf/commsdatcreator.implml
dbcreator/conf/commsdatcreator.ruleml
dbcreator/group/bld.inf
group/bld.inf
inc/meshpreface1.cfg
ipcm_plat/connection_settings_shim_api/inc/cmmanagerdefines_shim.h
ipcm_plat/flextimer_api/group/bld.inf
ipcm_plat/flextimer_api/inc/flexperiodic.h
ipcm_plat/flextimer_api/inc/flextimer.h
ipcm_plat/flextimer_api/inc/rflextimer.h
ipcm_plat/group/bld.inf
ipcm_pub/connection_settings_api/inc/cmpluginvpndef.h
keepalive/flextimer/client/bwins/flextimerclientu.def
keepalive/flextimer/client/eabi/flextimerclientu.def
keepalive/flextimer/client/group/bld.inf
keepalive/flextimer/client/group/flextimerclient.mmp
keepalive/flextimer/client/rom/flextimerclient.iby
keepalive/flextimer/client/src/flexperiodic.cpp
keepalive/flextimer/client/src/flextimer.cpp
keepalive/flextimer/client/src/rflextimer.cpp
keepalive/flextimer/client/traces/OstTraceDefinitions.h
keepalive/flextimer/client/traces/fixed_id.definitions
keepalive/flextimer/doc_pub/flextimer_for_clients.chm
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/classesfordox.h
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/dox_base_settings.cfg
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_clients.cfg
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_clients.dox
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_devs.cfg
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimerComponents.png
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimerWindowConcept.png
keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimersExample.png
keepalive/flextimer/group/bld.inf
keepalive/flextimer/server/engine/bwins/flextimerengineu.def
keepalive/flextimer/server/engine/eabi/flextimerengineu.def
keepalive/flextimer/server/engine/group/bld.inf
keepalive/flextimer/server/engine/group/flextimerengine.mmp
keepalive/flextimer/server/engine/inc/flextimercontainer.h
keepalive/flextimer/server/engine/inc/flextimercontainer.inl
keepalive/flextimer/server/engine/inc/flextimerengine.h
keepalive/flextimer/server/engine/inc/flextimeritem.h
keepalive/flextimer/server/engine/inc/flextimeritem.inl
keepalive/flextimer/server/engine/inc/flextimerwakeuptimer.h
keepalive/flextimer/server/engine/inc/mflextimerwakeuptimercb.h
keepalive/flextimer/server/engine/rom/flextimerengine.iby
keepalive/flextimer/server/engine/src/flextimercontainer.cpp
keepalive/flextimer/server/engine/src/flextimerengine.cpp
keepalive/flextimer/server/engine/src/flextimeritem.cpp
keepalive/flextimer/server/engine/src/flextimerwakeuptimer.cpp
keepalive/flextimer/server/engine/traces/OstTraceDefinitions.h
keepalive/flextimer/server/engine/traces/fixed_id.definitions
keepalive/flextimer/server/group/bld.inf
keepalive/flextimer/server/group/flextimerserver.mmp
keepalive/flextimer/server/inc/flextimercommon.h
keepalive/flextimer/server/inc/flextimerpanic.h
keepalive/flextimer/server/inc/flextimerserver.h
keepalive/flextimer/server/inc/flextimersession.h
keepalive/flextimer/server/inc/flextimersession.inl
keepalive/flextimer/server/inc/mflextimerservice.h
keepalive/flextimer/server/inc/mflextimerservicecb.h
keepalive/flextimer/server/rom/flextimerserver.iby
keepalive/flextimer/server/src/flextimerserver.cpp
keepalive/flextimer/server/src/flextimersession.cpp
keepalive/flextimer/test/flextimer_build.bat
keepalive/flextimer/test/testflextimer/bmarm/testflextimeru.def
keepalive/flextimer/test/testflextimer/bwins/testflextimeru.def
keepalive/flextimer/test/testflextimer/eabi/testflextimeru.def
keepalive/flextimer/test/testflextimer/flextimerservermonitor/bwins/flextimerservermonitorclientu.def
keepalive/flextimer/test/testflextimer/flextimerservermonitor/eabi/flextimerservermonitorclientu.def
keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/bld.inf
keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/flextimerservermonitorclient.mmp
keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/flextimerservermonitorserver.mmp
keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorcommon.h
keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorserver.h
keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorsession.h
keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/rflextimerservermonitor.h
keepalive/flextimer/test/testflextimer/flextimerservermonitor/rom/flextimerservermonitor.iby
keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/flextimerservermonitorserver.cpp
keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/flextimerservermonitorsession.cpp
keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/rflextimerservermonitor.cpp
keepalive/flextimer/test/testflextimer/flextimerservermonitor/traces/OstTraceDefinitions.h
keepalive/flextimer/test/testflextimer/group/bld.inf
keepalive/flextimer/test/testflextimer/group/testflextimer.mmp
keepalive/flextimer/test/testflextimer/group/testflextimer.pkg
keepalive/flextimer/test/testflextimer/group/testflextimer_doxyfile.txt
keepalive/flextimer/test/testflextimer/group/testflextimer_nrm.mmp
keepalive/flextimer/test/testflextimer/inc/inheritedcflextimer.h
keepalive/flextimer/test/testflextimer/inc/inheritedcflextimer2.h
keepalive/flextimer/test/testflextimer/inc/testcflextimer.h
keepalive/flextimer/test/testflextimer/inc/testflexperiodic.h
keepalive/flextimer/test/testflextimer/inc/testflextimer.h
keepalive/flextimer/test/testflextimer/inc/testrflextimer.h
keepalive/flextimer/test/testflextimer/init/testflextimer.ini
keepalive/flextimer/test/testflextimer/rom/testflextimer.iby
keepalive/flextimer/test/testflextimer/src/inheritedcflextimer.cpp
keepalive/flextimer/test/testflextimer/src/inheritedcflextimer2.cpp
keepalive/flextimer/test/testflextimer/src/testcflextimer.cpp
keepalive/flextimer/test/testflextimer/src/testflexperiodic.cpp
keepalive/flextimer/test/testflextimer/src/testflextimer.cpp
keepalive/flextimer/test/testflextimer/src/testrflextimer.cpp
keepalive/group/bld.inf
Binary file alwayson_net_plugin/pdpcontextmanager2/conf/CI_pdpcontextmanager2.confml has changed
Binary file alwayson_net_plugin/pdpcontextmanager2/conf/pdpcontextmanager2.confml has changed
--- a/alwayson_net_plugin/pdpcontextmanager2/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/alwayson_net_plugin/pdpcontextmanager2/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -26,6 +26,7 @@
 ../rom/pdpcontextmanager2.iby CORE_MW_LAYER_IBY_EXPORT_PATH(pdpcontextmanager2.iby)
 
 
+../conf/CI_pdpcontextmanager2.confml		APP_LAYER_CONFML(CI_pdpcontextmanager2.confml)
 ../conf/pdpcontextmanager2.confml		APP_LAYER_CONFML(pdpcontextmanager2.confml)
 ../conf/pdpcontextmanager2_102071F5.crml	APP_LAYER_CRML(pdpcontextmanager2_102071F5.crml)
 
--- a/bearermanagement/mpm/bwins/mpmdefaultconnectionu.def	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-EXPORTS
-	?ClearDefaultIAP@RMPMDefaultConnection@@QAEHXZ @ 1 NONAME ; int RMPMDefaultConnection::ClearDefaultIAP(void)
-	?Close@RMPMDefaultConnection@@QAEXXZ @ 2 NONAME ; void RMPMDefaultConnection::Close(void)
-	?Connect@RMPMDefaultConnection@@QAEHXZ @ 3 NONAME ; int RMPMDefaultConnection::Connect(void)
-	?SetDefaultIAP@RMPMDefaultConnection@@QAEHH@Z @ 4 NONAME ; int RMPMDefaultConnection::SetDefaultIAP(int)
-	?Version@RMPMDefaultConnection@@QBE?AVTVersion@@XZ @ 5 NONAME ; class TVersion RMPMDefaultConnection::Version(void) const
-
--- a/bearermanagement/mpm/eabi/mpmdefaultconnectionu.def	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-EXPORTS
-	_ZN21RMPMDefaultConnection13SetDefaultIAPEi @ 1 NONAME
-	_ZN21RMPMDefaultConnection15ClearDefaultIAPEv @ 2 NONAME
-	_ZN21RMPMDefaultConnection5CloseEv @ 3 NONAME
-	_ZN21RMPMDefaultConnection7ConnectEv @ 4 NONAME
-	_ZNK21RMPMDefaultConnection7VersionEv @ 5 NONAME
-
--- a/bearermanagement/mpm/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -24,7 +24,6 @@
 ../inc/rmpm.h                   |../../../inc/rmpm.h
 ../inc/rmpm.inl                 |../../../inc/rmpm.inl
 ../rom/mpm.iby                  CORE_MW_LAYER_IBY_EXPORT_PATH(mpm.iby)
-../rom/mpmdefaultconnection.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mpmdefaultconnection.iby)
 ../rom/mpmserver.iby            CORE_MW_LAYER_IBY_EXPORT_PATH(mpmserver.iby)
 ../conf/mpm.confml              MW_LAYER_CONFML(mpm.confml)
 ../conf/mpm_101f6d12.crml       MW_LAYER_CRML(mpm_101f6d12.crml)
@@ -33,7 +32,6 @@
 PRJ_MMPFILES
 mpmclient.mmp
 mpmserver.mmp
-mpmdefaultconnectionclient.mmp
 mpmserver_platsim.mmp // mpmserver-variant for Platsim
 
 PRJ_TESTMMPFILES
--- a/bearermanagement/mpm/group/mpmdefaultconnectionclient.mmp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2004-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: MPM server client interface library
-*
-*/
-
-#include <platform_paths.hrh>
-
-TARGET            mpmdefaultconnection.dll
-TARGETTYPE        dll
-
-UID               0x1000008d 0x101F6D33
-
-VENDORID          VID_DEFAULT
-CAPABILITY        CAP_CLIENT_DLL
-
-SOURCEPATH        ../src
-SOURCE            rmpmdefaultconnection.cpp
-
-USERINCLUDE       ../inc
-MW_LAYER_SYSTEMINCLUDE 
-
-LIBRARY           euser.lib
-DEBUGLIBRARY      flogger.lib
--- a/bearermanagement/mpm/group/mpmserver.mmp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/group/mpmserver.mmp	Mon May 24 20:51:35 2010 +0300
@@ -45,11 +45,7 @@
 SOURCE            mpmconfirmdlg.cpp
 SOURCE            mpmconfirmdlgstarting.cpp
 SOURCE            mpmconfirmdlgroaming.cpp
-SOURCE            mpmdefaultconnection.cpp
-SOURCE            mpmdefaultconnserver.cpp
-SOURCE            mpmdefaultconnserversession.cpp
 SOURCE            mpmcommsdataccess.cpp
-SOURCE            mpmwlanquerydialog.cpp
 SOURCE            mpmiapselection.cpp
 SOURCE            mpmcsidwatcher.cpp
 SOURCE            mpmdialogbase.cpp
--- a/bearermanagement/mpm/inc/mpmcommsdataccess.h	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmcommsdataccess.h	Mon May 24 20:51:35 2010 +0300
@@ -358,6 +358,14 @@
         * @return Snap id.
         */
         TUint32 DestinationIdL( CMManager::TSnapPurpose aSnapPurpose );
+        
+        /**
+        * Returns the default connection values
+        * @since symbian^4
+        * @param aType The type of the id
+        * @param aId The id of the snap or the iap
+        */
+        void GetDefaultConnectionL( TCmDefConnType& aType, TUint32& aId );
         	
         /**
         * Finds the real IAP behind the virtual IAP.
--- a/bearermanagement/mpm/inc/mpmdefaultconnection.h	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +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: Handles logic of selecting default connection, 
-*              stores selected default connection when necessary.
-*
-*/
-
-#ifndef C_DEFAULTCONNECTION_H
-#define C_DEFAULTCONNECTION_H
-
-#include <e32base.h>
-#include <cmdefconnvalues.h>
-
-const TCmDefConnType KDefaultMode = ECmDefConnAlwaysAsk;
-const TUint32 KDefaultConnectionId = 0;
-
-class CMPMServer;
-/**
- *  Class handling default connection
- *  The class handles logic of selecting default connection
- *  based on the registered Default connections, user selection 
- *  stored in CommsDat and values queried from user.
- *
- *  The default connection can be queried from the class by 
- *  MPM Server session starting a connection. Following 
- *  example describes the behaviour expected from the session.
- *
- *  @code
- *  TCmDefConnType mode(0);
- *  TUint id(0);
- *  iMyServer.DefaultConnection().GetDefaultConnection( mode, id );
- *  if( mode == ECmDefConnAlwaysAsk )
- *      {
- *      //implicit connection start
- *      }
- *  else if (mode == ECmDefConnAskOnce)
- *      {
- *      if( id == 0 )
- *          {
- *          // Implicit connection start
- *          //
- *          // User selection must be registered by the session 
- *          // with call:
- *          MyServer().DefaultConnection().
- *                 SetAskOnceDefaultConnection( aId );
- *
- *          // When BM connection is added under the MPM server object
- *          // the parameter aUsingAskOnce must be set to ETrue in call
- *          MyServer().CMAppendBMConnection( connId, snap, iapId, 
- *                                           state, ETrue );
- *          }
- *      else  
- *          {
- *          // Explicit connection start using SNAP or IAP from
- *          // parameters.    
- *          //
- *          // When BM connection is added under the MPM server object
- *          // the parameter aUsingAskOnce must be set to ETrue in call
- *          MyServer().CMAppendBMConnection( connId, snap, iapId, 
- *                                           state, ETrue );
- *          }
- *      }
- *      else // snap or iap
- *          {
- *          // Explicit connection start using SNAP or IAP from
- *          //parameters
- *          }
- *      } 
- *  @endcode
- *
- *  @lib mpmserver.exe
- *  @since S60 v3.2
- */
-class CMPMDefaultConnection : public CBase
-    {
-
-public:
-
-    /**
-     * Two-phased constructor.
-     * @param aServer Reference to MPM Server
-     */
-    static CMPMDefaultConnection* NewL( const CMPMServer* aServer );
-    
-
-    /**
-    * Destructor.
-    */
-    virtual ~CMPMDefaultConnection();
-
-    /**
-     * Sets IAP to be used as default connection
-     *
-     * @since S60 v3.2
-     * @param aIapId The IAP to be set as default connection
-     * return KErrNone if succesful, KErrArgument if id was not accepted
-     */
-    TInt SetDefaultIAP( TInt aIapId );
-
-    /**
-     * Clear IAP from being used as default connection,
-     * if one is set
-     *
-     * @since S60 v3.2
-     */
-    void ClearDefaultIAP();
-
-    /**
-     * Get the current default connection value 
-     *
-     * @since S60 v3.2
-     * @param aMode Points to snap or specific iap.
-     * @param aConnection CommsDat elementId of the IAP or SNAP to be used. 
-     * 0 if not defined.
-     *
-     */
-    void GetDefaultConnectionL( TCmDefConnType& aMode, 
-                                TUint32& aConnection );
-    
-private:
-
-    /**
-     * Converts int value to TCmDefaultConnection
-     * Leaves with KErrArgument is value no in the range
-     *
-     * @since S60 v3.2
-     * @param aInt Int value
-     * @return TCmDefConn value
-     */    
-    TCmDefConnType IntToCmDefConnTypeL( const TUint& aInt );
-
-    /**
-     * Reads default connection setting from commsdat.
-     * If no entry is found default values are returned.
-     *
-     * @since S60 v3.2
-     * @param aType Default connection setting type
-     * @param aId Default connection id
-     */    
-    void ReadDefConnSettingL( TCmDefConnType& aType,
-                              TUint32&          aId );
-    /**
-     * C++ default constructor.
-     */
-    CMPMDefaultConnection( const CMPMServer* aServer );
-    
-    /**
-     * 2nd phase constructor.
-     */
-    void ConstructL();
-    
-
-private: // data
-
-    /**
-     * CommsDat element id of IAP registered by Wlan active idle plugin, 
-     * 0 if not defined
-     */
-    TUint32 iDefaultIapId;
-
-    /**
-     * Pointer to the MPM Server object
-     * Not own
-     */
-    const CMPMServer* iServer;
-
-    };
-
-#endif // CMPMDEFAULTCONNECTION
--- a/bearermanagement/mpm/inc/mpmdefaultconnserver.h	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +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: Server allows registering IAP to be used as default connection
-*
-*/
-
-#ifndef CMPMDEFAULTCONNSERVER_H
-#define CMPMDEFAULTCONNSERVER_H
-
-#include <e32base.h>
-
-#include "mpmserver.h"
-
-class CMPMServer;
-
-/**
- *  Server allows registering IAP to be used as default connection.
- *  Server allows WLAN Active Idle plug-in to register the started 
- *  WLAN IAP as default connection. Only one client is served at the time.
- *
- *
- *  @lib MPMServer.exe
- *  @since S60 v3.2
- */
-class CMPMDefaultConnServer : public CPolicyServer
-    {
-
-public:
-
-    /**
-     * Two-phased constructor.
-     */
-    static CMPMDefaultConnServer* NewL( CMPMServer* aMPMServer );
-
-    /**
-    * Destructor.
-    */
-    virtual ~CMPMDefaultConnServer();
-
-    /**
-     * Creates new session
-     *
-     * @since S60 v3.2
-     * @return MPMServer object
-     */
-    CMPMServer* MPMServer();
-
-// from base class CServer2
-
-
-    /**
-     * From CServer2
-     * Creates new session
-     *
-     * @since S60 v3.2
-     * @param aVersion Version information
-     * @param aMessage Message, not used here
-     */
-    CSession2* NewSessionL( const TVersion& aVersion,
-                            const RMessage2& aMessage) const;
-
-private:
-
-    CMPMDefaultConnServer( CMPMServer* aMPMServer );
-
-    void ConstructL();
-
-
-private: // data
-
-    /**
-     * Reference to MPM Server for storing the default IAP. 
-     * Not own.
-     */
-    CMPMServer* iMPMServer;
-
-    };
-
-#endif // CMPMDEFAULTCONNSERVER_H
--- a/bearermanagement/mpm/inc/mpmdefaultconnserversession.h	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +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: Session to MPM Default Connection server
-*
-*/
-
-#ifndef CMPMDEFAULTCONNSERVERSESSION_H
-#define CMPMDEFAULTCONNSERVERSESSION_H
-
-#include <e32base.h>
-#include "mpmdefaultconnserver.h"
-
-
-/**
- *  Session to MPM Default Connection server
- *
- *  @lib MPMServer.exe
- *  @since S60 v3.2
- */
-class CMPMDefaultConnServerSession : public CSession2
-    {
-
-public:
-
-    /**
-     * Two-phased constructor.
-     */
-    static CMPMDefaultConnServerSession* NewL( CMPMDefaultConnServer* aServer );
-    
-
-    /**
-    * Destructor.
-    */
-    virtual ~CMPMDefaultConnServerSession();
-
-   /**
-     * Returns the default connection server object
-     *
-     * @since S60 v3.2
-     * @return Default Connection server pointer
-     */
-     CMPMDefaultConnServer* DefaultConnServer();
-
-
-// from base class CSession2
-
-      /**
-       * From CSession2.
-       * Serves client request
-       *
-       * @since S60 v3.2
-       * @param aMessage Message from client
-       */
-       void ServiceL( const RMessage2& aMessage );
-
-
-private:
-
-    CMPMDefaultConnServerSession( CMPMDefaultConnServer* aServer );
-
-    void ConstructL();
-    
-    /**
-     * Store IAP to be used as default connection in MPM Server
-     *
-     * @since S60 v3.2
-     * @param aMessage Client message containing the IAP
-     */
-    void SetDefaultIAP( const RMessage2& aMessage );
-
-    /**
-     * Clear IAP from being used as default connection in MPM Server
-     *
-     * @since S60 v3.2
-     */
-    void ClearDefaultIAP( const RMessage2& aMessage );
-
-
-private: // data
-
-    
-    /**
-     * Poiter to DefaultConnServer object. Not own
-     */
-    CMPMDefaultConnServer* iDefaultConnServer;
-
-    };
-
-#endif // CMPMDEFAULTCONNSERVERSESSION_H
--- a/bearermanagement/mpm/inc/mpmiapselection.h	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmiapselection.h	Mon May 24 20:51:35 2010 +0300
@@ -23,7 +23,6 @@
 #include "mpmserversession.h"
 #include "mpmcommsdataccess.h"
 
-class CMPMWlanQueryDialog;
 class CMPMConfirmDlgStarting;
 class TMpmConnPref;
 
@@ -91,16 +90,13 @@
 
 public:
     /**
-     * Starts Wlan query if Iap is wlan iap.
+     * Returns true if given iap is a wlan iap.
      *
      * @param aIapId Id of Iap
-     * @param aIsRoaming True if wlan query is for roaming
-     * @return ETrue if wlan query was started
-     * @since S60 v3.2
+     * @return ETrue if iap aIap is wlan
+     * @since symbian^4
      */
-    TBool StartWlanQueryIfNeededL(
-        TUint32 aIapId,
-        TBool aIsRoaming = EFalse );
+    TBool IsIapWlanL( TUint32 aIapId );
 
     /**
      * Part of selecting best IAP at connection start. Called when WLAN scan
@@ -123,18 +119,6 @@
     void ChooseIapComplete( TInt aError, const TMpmConnPref* aPolicyPref );
 
     /**
-     * Callback function used after Wlan network has been selected. 
-     * Uses HandleUserIapSelectionL to complete IAP selection.
-     *
-     * @since 3.2
-     * @param aError Error code from selection
-     * @param aIapId Element id of IAP record if different than reported before. 
-     * May be 0, when error occurred in selection or when no new Iap id is set.
-     *
-     */
-    void UserWlanSelectionDoneL( TInt aError, TUint32 aIapId );
-
-    /**
      * Stops displaying the starting dialog.
      *
      * @since 3.2
@@ -305,9 +289,6 @@
     // Pointer to Confirmation dialog.
     CMPMConfirmDlgStarting* iConfirmDlgStarting;
 
-    // Pointer to Wlan query dialog.
-    CMPMWlanQueryDialog* iWlanDialog;
-
     // Stores the boolean value whether next best iaps 
     // exists in explicit connection start.
     TBool iNextBestExists;
--- a/bearermanagement/mpm/inc/mpmserver.h	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmserver.h	Mon May 24 20:51:35 2010 +0300
@@ -191,7 +191,6 @@
 class CMPMConfirmDlgRoaming;
 class CMPMConfirmDlgStarting;
 class CMPMDefaultConnection;
-class CMPMWlanQueryDialog;
 
 // CLASS DECLARATION
 /**
@@ -610,40 +609,6 @@
         inline CArrayPtrFlat<CMPMConfirmDlgStarting>* StartingQueue();
 
         /**
-        * Appends aDlg to the iWlanQueryQueue.
-        * @since 3.2
-        * @param aDlg Pointer to the CMPMConfirmDlgWlanQuery object.
-        */
-        void AppendWlanQueryQueueL( CMPMWlanQueryDialog* aDlg );
-
-        /**
-        * Removes the first item from the iWlanQueryQueue.
-        * @since 3.2
-        */
-        inline void RemoveFromWlanQueryQueue( CMPMWlanQueryDialog* aDlg );
-
-        /**
-        * Get the WlanQueryQueue.
-        * @since 3.2
-        * @return Pointer to the WlanQueryQueue.
-        */
-        inline CArrayPtrFlat<CMPMWlanQueryDialog>* WlanQueryQueue();
-
-        /**
-        * Get the first item in iWlanQueryQueue.
-        * @since 3.2
-        * @return Pointer to the first item in iWlanQueryQueue.
-        */
-        inline CMPMWlanQueryDialog* FirstInWlanQueryQueue();
-
-        /**
-        * Get the Default Connection object.
-        * @since 3.2
-        * @return Pointer to the Default Connection object.
-        */
-        CMPMDefaultConnection* DefaultConnection(); 
-
-        /**
         * Returns true if there is a started connection
         * 
         * @since 3.2
@@ -924,12 +889,6 @@
         // Solves problem with overlapping Starting Dialogs
         CArrayPtrFlat<CMPMConfirmDlgStarting>* iStartingQueue;
 
-        // Solves problem with overlapping Wlan Queries
-        CArrayPtrFlat<CMPMWlanQueryDialog>* iWlanQueryQueue;
-        
-        // Handles Default Connection selection
-        CMPMDefaultConnection* iDefaultConnection;
-
         // Keeps track of the number of connections
         TUint iConnectionCounter;
 
--- a/bearermanagement/mpm/inc/mpmserver.inl	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmserver.inl	Mon May 24 20:51:35 2010 +0300
@@ -99,43 +99,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMPMServer::RemoveFromWlanQueryQueue
-// -----------------------------------------------------------------------------
-//
-inline void CMPMServer::RemoveFromWlanQueryQueue( CMPMWlanQueryDialog* aDlg )
-    {
-    for ( TInt i = 0; i < iWlanQueryQueue->Count(); i++ )
-        {
-        if ( iWlanQueryQueue->At( i ) == aDlg )
-            {
-            iWlanQueryQueue->Delete( i );
-            break;
-            }
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CMPMServer::WlanQueryQueue
-// -----------------------------------------------------------------------------
-//
-inline CArrayPtrFlat<CMPMWlanQueryDialog>* CMPMServer::WlanQueryQueue()
-    {
-    return iWlanQueryQueue;
-    }
-
-// -----------------------------------------------------------------------------
-// CMPMServer::FirstInWlanQueryQueue
-// -----------------------------------------------------------------------------
-//
-inline CMPMWlanQueryDialog* CMPMServer::FirstInWlanQueryQueue()
-    {
-    if ( iWlanQueryQueue->Count() == 0 )
-        return NULL;
-    else
-        return iWlanQueryQueue->At( 0 );
-    }
-
-// -----------------------------------------------------------------------------
 // CMPMServer::IncrementConnections
 // -----------------------------------------------------------------------------
 //
--- a/bearermanagement/mpm/inc/mpmstarter.h	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/inc/mpmstarter.h	Mon May 24 20:51:35 2010 +0300
@@ -44,13 +44,6 @@
         static CServer2* CreateAndStartServerL();
 
         /**
-        * Creates and starts server Default connection server.
-        * @since 3.2
-        * @return Pointer to the server object.
-        */
-        static CServer2* CreateDefaultConnServerL( CMPMServer* aMPMServer );
-
-        /**
         * Gets server name.
         * @since 3.0
         * @return Descriptor of the server name.
--- a/bearermanagement/mpm/inc/mpmwlanquerydialog.h	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2008-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: Handles displaying wlan related dialogs
-*
-*/
-
-
-#ifndef MPMWLANQUERYDIALOG_H
-#define MPMWLANQUERYDIALOG_H
-
-#include <e32std.h>
-#include <wdbifwlansettings.h> //for struct
-#include <ConnectionUiUtilities.h>
-
-#include "mpmcommsdataccess.h"
-
-// ID of OfflineWlanNote dialog
-const TUid KUidCOfflineWlanNoteDlg = { 0x101FD671 };
-
-/**
- * This structure is copied from ConnectionUiUtilitiesCommon.h,
- * but given here a different name.
- * Defines preferences of the Wlan Network
- */
-class TMpmWlanNetworkPrefs
-    {
-public:
-    TWlanSsid                           iSsId;        ///< Ssid of Wlan network
-    TWlanConnectionMode                 iNetworkMode; ///< mode of Wlan network
-    TWlanConnectionSecurityMode         iSecMode;     ///< Security mode of Wlan network
-    TBool                               iProtectedSetupSupported; 
-                                        ///< Wlan network supports Protected Setup
-    };
-
-class CMPMIapSelection;
-
-/**
- *  Handles displaying wlan related dialogs
- *
- *  @lib mpmserver.exe
- *  @since S60 v3.2
- */
-class CMPMWlanQueryDialog : public CActive
-    {
-
-enum TWlanQueryState
-    {
-    EOffline
-    };
-
-public:
-
-    static CMPMWlanQueryDialog* NewL( CMPMIapSelection&  aSession,
-                                      TUint32            aSelectedWlanIap );
-
-    /**
-    * Destructor.
-    */
-    virtual ~CMPMWlanQueryDialog();
-
-public: // Functions from base classes
-
-        /**
-        * From CActive. Cancels UI dialogs.
-        * @since 3.2
-        */        
-        void DoCancel();
-        
-        /**
-        * From CActive. Run when UI dialog finished.
-        * @since 3.2
-        */               
-        void RunL();
-        
-        /**
-        * From CActive. Run if RunL leaves.
-        * @since 3.2
-        * @param aError Error that caused leave.
-        * @return KErrNone
-        */
-        TInt RunError( TInt aError );
-
-public:
-
-        /**
-        * Starts displaying wlan dialogs if necessary
-        * @since 3.2
-        */
-        void StartWlanQueryL();
-
-private:
-
-        /**
-         * Propagates wlan network selection as an initial value for the dialog,
-         * Used if there are several dialogs queued.
-         *
-         * @param aDialogStatus  Status of the dialog when destroyed.
-         * @since 3.2
-         */
-        void OfferInformation( TInt aDialogStatus );
-
-        CMPMWlanQueryDialog( CMPMIapSelection&  aIapSelection,
-                             TUint32            aSelectedWlanIap );
-
-        void ConstructL();
-
-private: // data
-
-        // Reference to iap selection object
-        CMPMIapSelection& iIapSelection;
-
-        // Stores data for offline note
-        TPckgBuf<TBool> iOfflineReply;
-        
-        // Stores data for wlan network guery
-        TPckgBuf<TMpmWlanNetworkPrefs> iNetworkPrefs;
-        
-        //Interfce to Notifier
-        RNotifier iNotifier;
-
-        //State of querying Wlan settings
-        TWlanQueryState iWlanQueryState;
-            
-        // Connection Ui Utilities pointer
-        CConnectionUiUtilities* iConnUiUtils;
-        
-        // Wlan iap
-        TUint32 iWlanIapId;
-        
-        // Flag that can be used to cancel the dialog startup based on earlier dialog
-        TInt iOverrideStatus;
-    };
-
-#endif // MPMWLANQUERYDIALOG_H
--- a/bearermanagement/mpm/src/mpmcommsdataccess.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmcommsdataccess.cpp	Mon May 24 20:51:35 2010 +0300
@@ -2500,4 +2500,26 @@
     return destinationId;
     }
 
+// -----------------------------------------------------------------------------
+// CMPMCommsDatAccess::GetDefaultConnectionL
+// -----------------------------------------------------------------------------
+//
+void CMPMCommsDatAccess::GetDefaultConnectionL( TCmDefConnType& aType, TUint32& aId )
+    {
+    MPMLOGSTRING( "CMPMCommsDatAccess::GetDefaultConnectionL" )
+
+    RCmManager rCmManager;
+    CleanupClosePushL( rCmManager ); 
+    rCmManager.CreateTablesAndOpenL();
+    
+    TCmDefConnValue defConnValue;
+    rCmManager.ReadDefConnL( defConnValue );
+    
+    aType = defConnValue.iType;
+    aId = defConnValue.iId;
+    
+    CleanupStack::PopAndDestroy( &rCmManager );
+    
+    }
+
 //  End of File
--- a/bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmconfirmdlgstarting.cpp	Mon May 24 20:51:35 2010 +0300
@@ -203,11 +203,11 @@
     {
     MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectThisTime", iConnId )
     
-    TBool wlanNeeded( EFalse );
-    TRAPD( err, wlanNeeded = iIapSelection.StartWlanQueryIfNeededL( iIAP ) )
+    TBool isWlan( EFalse );
+    TRAPD( err, isWlan = iIapSelection.IsIapWlanL( iIAP ) )
     if( err == KErrNone )
         {
-        if( !wlanNeeded )
+        if( !isWlan )
             {
             if ( iIapState == CMPMIapSelection::EImplicitConnection )
                 {
@@ -228,9 +228,6 @@
                                             EStarting,
                                             iSession );
 
-                // Complete the ChooseBestIAP message with 
-                // KErrNone if user selected yes.
-                // 
                 MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectThisTime:\
 Complete KErrNone", iConnId )
                 iIapSelection.ChooseIapComplete( KErrNone, &iPref );                        
@@ -265,11 +262,11 @@
             }
         } 
     
-    TBool wlanNeeded( EFalse );
-    TRAPD( err, wlanNeeded = iIapSelection.StartWlanQueryIfNeededL( iIAP ) )
+    TBool isWlan( EFalse );
+    TRAPD( err, isWlan = iIapSelection.IsIapWlanL( iIAP ) )
     if( err == KErrNone )
         {
-        if( !wlanNeeded )
+        if( !isWlan )
             {
             if ( iIapState == CMPMIapSelection::EImplicitConnection )
                 {
@@ -290,8 +287,6 @@
                                             EStarting,
                                             iSession );
 
-                 // Complete the ChooseBestIAP message with 
-                 // KErrNone if user selected yes.
                  // 
                  MPMLOGSTRING2( "CMPMConfirmDlgStarting<0x%x>::UserSelectedConnectAutomatically:\
 Complete KErrNone", iConnId )
--- a/bearermanagement/mpm/src/mpmdefaultconnection.cpp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +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: Handles defualt connection logic
-*
-*/
-
-#include <metadatabase.h>
-#include <datamobilitycommsdattypes.h>
-#include <cmdefconnvalues.h>
-#include "mpmdefaultconnection.h"
-#include "mpmserversession.h" //KShift8
-#include "mpmserver.h" 
-#include "mpmlogger.h"
-#include "mpmcommsdataccess.h"
-
-using namespace CommsDat;
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::NewL
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnection* CMPMDefaultConnection::NewL( const CMPMServer* aServer)
-    {
-    CMPMDefaultConnection * self = new (ELeave) 
-    CMPMDefaultConnection( aServer );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-    
-
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnection::~CMPMDefaultConnection()
-    {
-    }
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::SetDefaultIAP
-// ---------------------------------------------------------------------------
-//
-TInt CMPMDefaultConnection::SetDefaultIAP( TInt aIapId )
-    {
-    TInt err( KErrNone );
-    //check validity
-    if( ( aIapId ) > 0 && ( aIapId <= KCDMaxRecords ) )
-        {
-        iDefaultIapId = aIapId;
-        MPMLOGSTRING2(
-            "CMPMDefaultConnection::SetDefaultIAP Set default connection iap: %d", 
-            aIapId)
-        }
-    else
-        {
-        err = KErrArgument;
-        MPMLOGSTRING2(
-            "CMPMDefaultConnection::SetDefaultIAP Invalid iap: %d", 
-            aIapId)
-        }    
-    return err;
-    }
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::ClearDefaultIAP
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnection::ClearDefaultIAP()
-    {
-    iDefaultIapId = 0;
-    MPMLOGSTRING( "CMPMDefaultConnection::ClearDefaultIAP:\
- cleared default iap" )
-    }
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::GetDefaultConnectionL
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnection::GetDefaultConnectionL( TCmDefConnType& aMode, 
-                                                   TUint32& aConnection )
-    {
-    // first option is registered default iap
-    if( iDefaultIapId )
-        {
-        MPMLOGSTRING2( "CMPMDefaultConnection::GetDefaultConnectionL:\
- default iap set as id %d", iDefaultIapId )
-        aMode = ECmDefConnConnectionMethod;
-        aConnection = iDefaultIapId;
-        }
-    else
-        {
-        MPMLOGSTRING( "CMPMDefaultConnection::GetDefaultConnectionL:\
- getting value from commsdat" )
-
-        // read global commsdat setting     
-        //
-        TRAPD( err, ReadDefConnSettingL( aMode, aConnection ) )
-
-        if( err != KErrNone )
-            {
-            //use default values
-            //
-            aMode = KDefaultMode;
-            aConnection = KDefaultConnectionId;
-            }
-
-        MPMLOGSTRING3( "CMPMDefaultConnection::GetDefaultConnectionL: \
-found type %d, id %d", aMode, aConnection )                
-          
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnection::CMPMDefaultConnection( const CMPMServer* aServer ) : 
-    iServer( aServer )
-    {
-    
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::ConstructL
-// ---------------------------------------------------------------------------
-//    
-void CMPMDefaultConnection::ConstructL()
-    {
-    
-    }
-    
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::IntToCmDefConnType
-// ---------------------------------------------------------------------------
-//
-TCmDefConnType CMPMDefaultConnection::IntToCmDefConnTypeL( const TUint& aInt )
-    {
-    TCmDefConnType type( TCmDefConnType ( 0 ) );
-
-    if( aInt == ECmDefConnDestination )
-        {
-        type = ECmDefConnDestination;
-        }
-    else if( aInt == ECmDefConnConnectionMethod )
-        {
-        type = ECmDefConnConnectionMethod;
-        }
-    else
-        {
-        MPMLOGSTRING2( "CMPMDefaultConnection::IntToCmDefConnType:\
- incorrect value %d", aInt )
-        User::Leave( KErrArgument );
-        }
-    
-    return type;    
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnection::ReadDefConnSetting
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnection::ReadDefConnSettingL( TCmDefConnType& aType,
-                                                 TUint32&        aId )
-    {
-    MPMLOGSTRING( "CMPMDefaultConnection::ReadDefConnSettingL " )
-    CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() ); 
-    TMDBElementId tableId = CCDDefConnRecord::TableIdL( *db );     
-
-    // fetch value from commsdat using record set to be able 
-    // to load any and all records in the table.
-    // we don't want to make assumptions on id
-    //
-    CMDBRecordSet<CMDBGenericRecord> * recordSet = new ( ELeave )
-    CMDBRecordSet<CMDBGenericRecord>( tableId );
-    CleanupStack::PushL( recordSet );
-    recordSet->LoadL( *db );
-    
-    CCDDefConnRecord* dconn = new (ELeave) CCDDefConnRecord( tableId );
-    CleanupStack::PushL( dconn );
-    if( recordSet->iRecords.Count() )
-        {
-        // load the first entry found
-        dconn->SetElementId( CMPMCommsDatAccess::GetRealElementId( recordSet->iRecords[0] ) );
-        dconn->LoadL( *db );
-        aType = IntToCmDefConnTypeL( dconn->iDefConnType );
-        aId = dconn->iDefConnUid;
-        }
-    else
-        {
-        // nothing found, use default value
-        // 
-        MPMLOGSTRING( "CMPMDefaultConnection::ReadDefConnSettingL \
-no entry found" )
-        aType = KDefaultMode;
-        aId = KDefaultConnectionId;
-        }
-    db->Close();
-    CleanupStack::PopAndDestroy( dconn );
-    CleanupStack::PopAndDestroy( recordSet );
-    CleanupStack::PopAndDestroy( db );
-    }
--- a/bearermanagement/mpm/src/mpmdefaultconnserver.cpp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +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: Default connection server implementation
-*
-*/
-
-#include "mpmdefaultconnserver.h"
-#include "mpmdefaultconnserversession.h"
-#include "mpmlogger.h"
-#include "mpmserver.h"
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServer::CMPMDefaultConnServer( CMPMServer* aMPMServer )
-    : CPolicyServer( CPolicyServer::EPriorityStandard, KMPMPolicy ),
-    iMPMServer( aMPMServer )
-    {        
-    }
-
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServer::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnServer::ConstructL()
-    {
-    MPMLOGSTRING( "MPMDefConnServer starting" )
-    StartL(KMPMDefaultConnectionServerName);
-    }
-
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServer::NewL
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServer* CMPMDefaultConnServer::NewL( CMPMServer* aMPMServer )
-    {
-    CMPMDefaultConnServer* self = new ( ELeave ) CMPMDefaultConnServer( aMPMServer );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServer::~CMPMDefaultConnServer()
-    {
-
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServer::MPMServer
-// ---------------------------------------------------------------------------
-//
-CMPMServer* CMPMDefaultConnServer::MPMServer()
-    {
-    return iMPMServer;
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServer::NewSessionL
-// From class CServer2.
-// ---------------------------------------------------------------------------
-//
-CSession2* CMPMDefaultConnServer::NewSessionL( const TVersion& /*aVersion*/,
-                                               const RMessage2& /*aMessage*/) const
-    {
-    //create session
-    return CMPMDefaultConnServerSession::NewL( 
-        const_cast<CMPMDefaultConnServer*> ( this ) );
-    }
-
-
--- a/bearermanagement/mpm/src/mpmdefaultconnserversession.cpp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +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: Session to MPM Default Connection server
-*
-*/
-
-#include <featmgr.h>
-
-#include "mpmdefaultconnserversession.h"
-#include "mpmdefaultconnserver.h"
-#include "mpmdefaultconnection.h"
-#include "mpmcommon.h"
-#include "mpmserver.h"
-#include "mpmlogger.h"
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::NewL
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServerSession* CMPMDefaultConnServerSession::NewL( 
-    CMPMDefaultConnServer* aServer )
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::NewL" )
-    CMPMDefaultConnServerSession* self = new ( ELeave ) CMPMDefaultConnServerSession( aServer );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServerSession::~CMPMDefaultConnServerSession()
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::~CMPMDefaultConnServerSession" )
-    DefaultConnServer()->MPMServer()->DefaultConnection()->ClearDefaultIAP();
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::DefaultConnServer
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServer* CMPMDefaultConnServerSession::DefaultConnServer()
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::DefaultConnServer" )
-    return iDefaultConnServer; 
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::ServiceL
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnServerSession::ServiceL( const RMessage2& aMessage )
-    {
-    MPMLOGSTRING2( "CMPMDefaultConnServerSession::ServiceL %d ", 
-                   aMessage.Function() )
-    switch ( aMessage.Function() )
-        {
-        case EMPMDefaultConnectionSetDefaultIap:
-            {
-            SetDefaultIAP( aMessage );
-            break;
-            }
-        case EMPMDefaultConnectionClearDefaultIap:
-            {
-            ClearDefaultIAP( aMessage);
-            break;
-            }
-        default:
-            {
-            aMessage.Complete( KErrNotSupported );
-			MPMLOGSTRING( 
-			    "CMPMDefaultConnServerSession::ServiceL: Unsupported message type" )
-            }                   
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CMPMDefaultConnServerSession::CMPMDefaultConnServerSession( 
-CMPMDefaultConnServer* aServer )
-    : CSession2(), 
-      iDefaultConnServer( aServer ) 
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::CMPMDefaultConnServerSession" )
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnServerSession::ConstructL()
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::SetDefaultIAP
-// Store IAP to be used as default connection in MPM Server
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnServerSession::SetDefaultIAP( const RMessage2& aMessage )
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::SetDefaultIAP" )
-    TInt iap( 0 ), err( KErrNone );
-    iap = aMessage.Int0();
-    err = DefaultConnServer()->MPMServer()->DefaultConnection()->SetDefaultIAP( iap );
-    aMessage.Complete( err );
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMDefaultConnServerSession::ClearDefaultIAP
-// Clear IAP from being used as default connection in MPM Server
-// ---------------------------------------------------------------------------
-//
-void CMPMDefaultConnServerSession::ClearDefaultIAP( const RMessage2& aMessage )
-    {
-    MPMLOGSTRING( "CMPMDefaultConnServerSession::ClearDefaultIAP" )
-    DefaultConnServer()->MPMServer()->DefaultConnection()->ClearDefaultIAP();
-    aMessage.Complete( KErrNone );
-    }
--- a/bearermanagement/mpm/src/mpmiapselection.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Mon May 24 20:51:35 2010 +0300
@@ -21,8 +21,6 @@
 #include "mpmcommsdataccess.h"
 #include "mpmconnmonevents.h"
 #include "mpmconfirmdlgstarting.h"
-#include "mpmdefaultconnection.h"
-#include "mpmwlanquerydialog.h"
 #include "extendedconnpref.h"
 
 // ---------------------------------------------------------------------------
@@ -38,7 +36,6 @@
       iStoredIapInfo(),
       iSession( aSession ),
       iConfirmDlgStarting( NULL ),
-      iWlanDialog( NULL ),
       iNextBestExists( EFalse ),
       iUserSelectionIapId( 0 ),
       iUserSelectionSnapId( 0 ),
@@ -86,7 +83,6 @@
     StopDisplayingStartingDlg();
     
     delete iConfirmDlgStarting;
-    delete iWlanDialog;
     }
 
 // -----------------------------------------------------------------------------
@@ -185,7 +181,7 @@
         // Default connection is requested.
 
         MPMLOGSTRING( "CMPMIapSelection::ChooseIapL:\
- Default Connection" )
+            Default Connection" )
 
         if ( iSession->UseUserConnPref() )
             {
@@ -201,39 +197,17 @@
             return;
             }
 
+        // Read the default connection values
         TCmDefConnType type( TCmDefConnType( 0 ) );
         TUint32 id( 0 );
-        iSession->MyServer().DefaultConnection()->GetDefaultConnectionL( type, id );
+        iCommsDatAccess->GetDefaultConnectionL( type, id );
         
         MPMLOGSTRING3( "CMPMIapSelection::ChooseIapL:\
- default connection type %d id %d", type, id )
-       
-        if( type == ECmDefConnConnectionMethod )
-            {
-            iChooseIapPref.SetIapId( id );
-            iChooseIapPref.SetSnapId( 0 );
-            ExplicitConnectionL();
-            }
-        else if( type == ECmDefConnDestination )
-            { 
-            iChooseIapPref.SetSnapId( id );
-            ExplicitConnectionL();
-            }
-        else
-            {
-            if( iCommsDatAccess->IsSnapEmptyL( id ) )
-                {
-                // start implicit connection
-                ImplicitConnectionL();
-                return;
-                }
-
-            iChooseIapPref.SetSnapId( id );
-
-            // start connection as if explicitly defined 
-            // by application
-            ExplicitConnectionL();
-            }       
+            default connection type %d id %d", type, id )
+        
+        // set the received snap id and open the connection
+        iChooseIapPref.SetSnapId( id );
+        ExplicitConnectionL();
         }
     else if ( iChooseIapPref.ConnType() == TMpmConnPref::EConnTypeExplicit )
         {
@@ -350,13 +324,8 @@
         iChooseIapPref.SetIapId( validateIapId );
         iChooseIapPref.SetNetId( retNetId );
 
-        // In case offline mode is enabled, only LAN or WLAN is allowed.
-        // If some other bearer has been requested, then error code 
-        // KErrGprsOfflineMode should be returned instead of KErrNone.
-        // 
-        
-        if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() ||                 
-             iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) )
+        if ( !iapTypeLanOrWlan &&                  
+             iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown )
             {
             ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref );
             }
@@ -365,9 +334,13 @@
             TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( validateIapId );
             if( wlanType != ENotWlanIap )
                 {
-                iChooseIapState = EExplicitConnection;
-                iWlanDialog = CMPMWlanQueryDialog::NewL( *this, validateIapId );
-                iWlanDialog->StartWlanQueryL();
+                // Add info into the BM connections
+                iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), 
+                                    iChooseIapPref.SnapId(),
+                                    validateIapId,
+                                    EStarting,
+                                    *iSession );
+                ChooseIapComplete( KErrNone, &iChooseIapPref );
                 return;                
                 }
 
@@ -514,8 +487,8 @@
         {
         ChooseIapComplete( KErrGprsServicesNotAllowed, NULL );
         }
-    else if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() ||                 
-               iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) )
+    else if ( !iapTypeLanOrWlan &&                 
+               iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown )
         {
         // In case offline mode is enabled, only LAN or WLAN is allowed.
         // If some other bearer has been requested, then error code 
@@ -572,19 +545,14 @@
             }
         else
             {
-            if ( !StartWlanQueryIfNeededL( validateIapId ) )
-                {
-                // Add info into the BM connections
-                //
-                iSession->MyServer().AppendBMConnection( connId, 
+            // Add info into the BM connections
+            //
+            iSession->MyServer().AppendBMConnection( connId, 
                         snap, 
                         validateIapId, 
                         EStarting,
                         *iSession );
-                ChooseIapComplete( KErrNone, &iChooseIapPref );
-
-                }
-
+            ChooseIapComplete( KErrNone, &iChooseIapPref );
             }
         }
 
@@ -623,26 +591,18 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMPMIapSelection::StartWlanQueryIfNeededL
+// CMPMIapSelection::IsIapWlanL
 // -----------------------------------------------------------------------------
 //
-TBool CMPMIapSelection::StartWlanQueryIfNeededL( TUint32 aIapId, TBool aIsRoaming )
+TBool CMPMIapSelection::IsIapWlanL( TUint32 aIapId )
     {
-    MPMLOGSTRING3( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, isRoaming %d ", 
-                   aIapId,
-                   aIsRoaming )
-    TBool wlanQueryNeeded( EFalse );
-    // If wlan iap check if offline note needed
+    MPMLOGSTRING2( "CMPMIapSelection::StartWlanQueryIfNeededL iap %d, ", aIapId)
     TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( aIapId );
-    if( wlanType != ENotWlanIap )
+    if( wlanType != EWlanIap )
         {
-        iIsRoaming = aIsRoaming;
-        iChooseIapState = EExplicitConnection;
-        iWlanDialog = CMPMWlanQueryDialog::NewL( *this, aIapId );
-        iWlanDialog->StartWlanQueryL();
-        wlanQueryNeeded = ETrue;
+        return EFalse;
         }
-    return wlanQueryNeeded;
+    return ETrue;
     }
 
 // -----------------------------------------------------------------------------
@@ -719,12 +679,6 @@
     const TMpmConnPref* aPolicyPref )
     {
     MPMLOGSTRING2( "CMPMIapSelection::ChooseIapComplete aError = %d", aError )
-        
-    if( iWlanDialog )
-        {
-        delete iWlanDialog;
-        iWlanDialog = NULL;
-        }
 
     iSession->ChooseIapComplete( aError, aPolicyPref );
     // Set choose iap state to none
@@ -735,62 +689,6 @@
     iImplicitState = EImplicitStart;
     }
 
-
-// -----------------------------------------------------------------------------
-// CMPMIapSelection::UserWlanSelectionDoneL
-// -----------------------------------------------------------------------------
-//
-void CMPMIapSelection::UserWlanSelectionDoneL( TInt aError, TUint32 aIapId )
-    {
-    MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL" )
-
-    if( iIsRoaming )
-        {
-        iIsRoaming = EFalse;
-        iSession->MigrateCallbackL( aError );
-        delete iWlanDialog;
-        iWlanDialog = NULL;
-        }
-    else
-        {
-        if( aError != KErrNone )
-            {
-            MPMLOGSTRING2( "CMPMIapSelection::UserWlanSelectionDoneL - Error = %d, completing", aError ) 
-            ChooseIapComplete( aError, NULL );        
-            }
-        else
-            {
-            if( iChooseIapState == EImplicitConnection )
-                {
-                iUserSelectionIapId = aIapId;
-                ImplicitConnectionL();    
-                }
-            else if( iChooseIapState == EExplicitConnection )
-                {
-                MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL completing explicit iap connection" ) 
-                iChooseIapPref.SetIapId( aIapId );
-                // Add info into the BM connections
-                //
-                iSession->MyServer().AppendBMConnection( iSession->ConnectionId(), 
-                                                         iChooseIapPref.SnapId(),
-                                                         aIapId,
-                                                         EStarting,
-                                                         *iSession );
-                delete iWlanDialog;
-                iWlanDialog = NULL;
-
-                ChooseIapComplete( KErrNone, &iChooseIapPref );
-                }
-            else
-                {
-                MPMLOGSTRING( "CMPMIapSelection::UserWlanSelectionDoneL - error, no connection state" ) 
-                }
-            
-            }
-        
-        }
-    }
-
 // -----------------------------------------------------------------------------
 // CMPMIapSelection::HandleUserSelectionError
 // -----------------------------------------------------------------------------
@@ -867,15 +765,10 @@
     MPMLOGSTRING( "CMPMIapSelection::ImplicitConnectionWlanNoteL" )
     
     TWlanIapType wlanType = iCommsDatAccess->CheckWlanL( iUserSelectionIapId );
-    // In case offline mode is enabled, only LAN or WLAN is allowed.
-    // If some other bearer has been requested, then error code 
-    // KErrGprsOfflineMode should be returned instead of KErrNone.
-    // 
+
     if( wlanType != ENotWlanIap )
         {
-        iChooseIapState = EImplicitConnection;
-        iWlanDialog = CMPMWlanQueryDialog::NewL( *this, iUserSelectionIapId );
-        iWlanDialog->StartWlanQueryL();
+        ImplicitConnectionL();
         return;                
         }
     else
@@ -936,8 +829,8 @@
                                    iapTypeLanOrWlan,
                                    *iSession );
                                    
-    if ( !iapTypeLanOrWlan && ( iSession->MyServer().IsPhoneOffline() ||            
-            iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown ) )
+    if ( !iapTypeLanOrWlan &&            
+            iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMRoamingStatusUnknown )
         {
         MPMLOGSTRING2( "CMPMIapSelection::CompleteImplicitConnectionL: Completing with code = %i",
                 KErrGprsOfflineMode )
@@ -959,13 +852,6 @@
         iChooseIapPref.SetIapId( iUserSelectionIapId );
         iChooseIapPref.SetNetId( retNetId );
             
-        
-        if( iWlanDialog )
-            {
-            delete iWlanDialog;
-            iWlanDialog = NULL;
-            }
-        
         ChooseIapComplete( KErrNone, &iChooseIapPref );
         }
     
--- a/bearermanagement/mpm/src/mpmserver.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Mon May 24 20:51:35 2010 +0300
@@ -37,9 +37,7 @@
 #include "mpmdisconnectdlg.h"
 #include "mpmconfirmdlgroaming.h"
 #include "mpmconfirmdlgstarting.h"
-#include "mpmdefaultconnection.h"
 #include "mpmcommsdataccess.h"
-#include "mpmwlanquerydialog.h"
 #include "mpmprivatecrkeys.h"
 #include "mpmcsidwatcher.h"
 #include "mpmdatausagewatcher.h"
@@ -89,8 +87,6 @@
       iDisconnectQueue( NULL ), 
       iRoamingQueue( NULL ), 
       iStartingQueue( NULL ),
-      iWlanQueryQueue( NULL ),
-      iDefaultConnection( NULL ), 
       iConnectionCounter( 0 ),
       iOfflineMode( ECoreAppUIsNetworkConnectionAllowed )
     {
@@ -163,11 +159,6 @@
     iStartingQueue = new ( ELeave ) CArrayPtrFlat<CMPMConfirmDlgStarting>( KGranularity ); 
     iStartingQueue->Reset();
 
-    iWlanQueryQueue = new ( ELeave ) CArrayPtrFlat<CMPMWlanQueryDialog>( KGranularity );
-    iWlanQueryQueue->Reset();
-    
-    iDefaultConnection = CMPMDefaultConnection::NewL( this );    
-
     // Create central repository watcher and start it
     iMpmCsIdWatcher = CMpmCsIdWatcher::NewL();
     iMpmCsIdWatcher->StartL();
@@ -253,12 +244,6 @@
         }
     delete iStartingQueue;
 
-    while ( iWlanQueryQueue && iWlanQueryQueue->Count() > 0 )
-        {
-        iWlanQueryQueue->Delete( 0 );
-        }
-    delete iWlanQueryQueue;
-
     delete iEvents;
 
     for ( TInt i = 0; i < iBlackListIdList.Count(); i++ )
@@ -281,8 +266,6 @@
     iMobilePhone.Close();
     iTelServer.Close();
     
-    delete iDefaultConnection;
-    
     delete iMpmCsIdWatcher;    
     
     delete iMpmDataUsageWatcher;    
@@ -1366,18 +1349,6 @@
 #endif // _DEBUG
     }
 
-
-// -----------------------------------------------------------------------------
-// CMPMServer::DefaultConnection
-// -----------------------------------------------------------------------------
-//
-CMPMDefaultConnection* CMPMServer::DefaultConnection()
-    {
-    MPMLOGSTRING( "CMPMServer::DefaultConnection:\
- Default Connection" )
-    return iDefaultConnection;
-    }
-
 // -----------------------------------------------------------------------------
 // CMPMServer::StartedConnectionExists
 // -----------------------------------------------------------------------------
@@ -1412,22 +1383,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMPMServer::AppendWlanQueryQueueL
-// -----------------------------------------------------------------------------
-//
-void CMPMServer::AppendWlanQueryQueueL( CMPMWlanQueryDialog* aDlg )
-    {
-    if( aDlg )
-        {
-        iWlanQueryQueue->AppendL( aDlg );
-        }
-    else
-        {
-        MPMLOGSTRING( "CMPMServer::AppendWlanQueryQueueL argument NULL, Error" )
-        }
-    }
-
-// -----------------------------------------------------------------------------
 // CMPMServer::StopConnections
 // -----------------------------------------------------------------------------
 //
--- a/bearermanagement/mpm/src/mpmserversession.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Mon May 24 20:51:35 2010 +0300
@@ -43,7 +43,6 @@
 #include "mpmconfirmdlgroaming.h"
 #include "mpmlogger.h"
 #include "mpmpropertydef.h"
-#include "mpmdefaultconnection.h"
 #include "mpmiapselection.h"
 #include "mpmcsidwatcher.h"
 
@@ -435,7 +434,7 @@
     
     MPMLOGSTRING3( "CMPMServerSession::HandleServerChooseIapL - iap %d \
 connType %d", mpmConnPref.IapId(), mpmConnPref.ConnType() )
-
+    
     iIapSelection->ChooseIapL( mpmConnPref );
 
     if ( iAppUid == iMyServer.CsIdWatcher()->ConnectScreenId() )
@@ -963,10 +962,6 @@
 	    if( aError == KErrNone )
 	        {
 	        iMigrateState = EMigrateOfflineConfirmation;
-    	    if( IapSelectionL()->StartWlanQueryIfNeededL( iMigrateIap, ETrue ) )
-	            {
-	            return;
-                }
 	        }
 	    }
 	else if( iMigrateState == EMigrateOfflineConfirmation )
@@ -3314,7 +3309,8 @@
     // Show error popup if it's allowed per client request
     if ( ChooseBestIapCalled() && (!( iIapSelection->MpmConnPref().NoteBehaviour() &
             TExtendedConnPref::ENoteBehaviourConnDisableNotes ))
-            && ( aError != KErrNone ) )
+            && ( aError != KErrNone ) 
+			&& ( iIapSelection->MpmConnPref().SnapId() == 0 ) )
         {
         // Note: Below function shows the discreet popup only if the error code
         // belongs to the set of errors that are shown to the user.
--- a/bearermanagement/mpm/src/mpmstarter.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/bearermanagement/mpm/src/mpmstarter.cpp	Mon May 24 20:51:35 2010 +0300
@@ -26,7 +26,6 @@
 #include "mpmstarter.h"
 #include "mpmserver.h"
 #include "mpmlogger.h"
-#include "mpmdefaultconnserver.h"
 
 // ============================= LOCAL FUNCTIONS ===============================
 
@@ -46,11 +45,6 @@
     // create the server
     CServer2* server = MPMStarter::CreateAndStartServerL();
     CleanupStack::PushL( server );
-       
-    // create default connection server
-    CServer2* server2 = MPMStarter::CreateDefaultConnServerL( 
-    static_cast<CMPMServer*> ( server ) );
-    CleanupStack::PushL( server2 );
 
     User::LeaveIfError( RThread::RenameMe( MPMStarter::ServerName() ) );
 
@@ -61,7 +55,6 @@
     CActiveScheduler::Start();
     //
     // Cleanup the server and scheduler
-    CleanupStack::PopAndDestroy( server2 );
     CleanupStack::PopAndDestroy( server );
     CleanupStack::PopAndDestroy( s );
     }
@@ -113,17 +106,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// MPMStarter::CreateDefaultConnServerL
-// create default connection server object
-// -----------------------------------------------------------------------------
-//
-CServer2* MPMStarter::CreateDefaultConnServerL( CMPMServer* aMPMServer )
-    {
-    MPMLOGSTRING( "MPMStarter::CreateDefaultConnServerL" )
-    return CMPMDefaultConnServer::NewL( aMPMServer );
-    }
-
-// -----------------------------------------------------------------------------
 // MPMStarter::ServerName
 // return server name
 // -----------------------------------------------------------------------------
--- a/bearermanagement/mpm/src/mpmwlanquerydialog.cpp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/*
-* Copyright (c) 2008 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: Handles displaying wlan dialogs
-*
-*/
-
-
-#include <wlanmgmtcommon.h>
-#include <e32std.h>
-#include <utf.h>
-#include <cmpluginwlandef.h>
-#include <ctsydomainpskeys.h>
-
-#include "mpmwlanquerydialog.h"
-#include "mpmiapselection.h"
-#include "mpmconnmonevents.h"
-#include "mpmlogger.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::CMPMWlanQueryDialog
-// ---------------------------------------------------------------------------
-//
-CMPMWlanQueryDialog::CMPMWlanQueryDialog( CMPMIapSelection&  aIapSelection,
-                                          TUint32            aWlanIapId )
-  : CActive( CActive::EPriorityStandard ),
-    iIapSelection( aIapSelection ),
-    iWlanQueryState( EOffline ),
-    iWlanIapId( aWlanIapId ),
-    iOverrideStatus( KErrNone )    
-    {
-    CActiveScheduler::Add( this );
-    }
-    
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMPMWlanQueryDialog::ConstructL()
-    {
-    User::LeaveIfError(iNotifier.Connect());
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::NewL
-// ---------------------------------------------------------------------------
-//
-CMPMWlanQueryDialog* CMPMWlanQueryDialog::NewL( CMPMIapSelection&  aSession,
-                                                TUint32            aWlanIapElementId )
-    {
-    CMPMWlanQueryDialog* self = new( ELeave ) CMPMWlanQueryDialog( aSession,
-                                                                   aWlanIapElementId );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::~CMPMWlanQueryDialog
-// ---------------------------------------------------------------------------
-//
-CMPMWlanQueryDialog::~CMPMWlanQueryDialog()
-    {
-    MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog enters" )
-
-    // Check if this dialog instance was not started but only added to the queue
-    if ( iIapSelection.Session()->MyServer().FirstInWlanQueryQueue() != this )
-        {
-        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog, not a active delete" )
-
-        // Close notifier
-        iNotifier.Close();
-        
-        // We're not first in the queue, thus we can just delete.
-        // But remember the pointer in the array.
-        iIapSelection.Session()->MyServer().RemoveFromWlanQueryQueue( this );
-        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog exits (break)" )
-        return;
-        }
-
-    // Cancel previous dialogs if any.
-    Cancel();
-
-    // Close notifier
-    iNotifier.Close();
-
-    // Remove self from the queue
-    iIapSelection.Session()->MyServer().RemoveFromWlanQueryQueue( this );
-
-    // Start the next query
-    CMPMWlanQueryDialog* dlg = iIapSelection.Session()->MyServer().FirstInWlanQueryQueue();
-    if ( dlg )
-        {
-        MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog starts new dialog" )
-        dlg->OfferInformation( iStatus.Int() );
-        // In destructor we cannot let the query leave
-        TRAPD( err, dlg->StartWlanQueryL(); )
-        if ( err != KErrNone )
-            {
-            MPMLOGSTRING2( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog caught Leave %d, executing RunError()", err )
-            dlg->RunError( err );
-            }
-        }
-
-    MPMLOGSTRING( "CMPMWlanQueryDialog::~CMPMWlanQueryDialog exits" )
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::DoCancel
-// ---------------------------------------------------------------------------
-//
-void CMPMWlanQueryDialog::DoCancel()
-    {
-    MPMLOGSTRING2( "CMPMWlanQueryDialog::DoCancel state %d", iWlanQueryState )
-    if ( iWlanQueryState == EOffline )
-        {
-        iNotifier.CancelNotifier( KUidCOfflineWlanNoteDlg );
-        }
-    }
-    
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::RunL
-// ---------------------------------------------------------------------------
-//
-void CMPMWlanQueryDialog::RunL()
-    {
-    MPMLOGSTRING3( "CMPMWlanQueryDialog::RunL status %d state %d", 
-                   iStatus.Int(), 
-                   iWlanQueryState )
-
-    if( iWlanQueryState == EOffline )
-        {
-        if( iStatus.Int() == KErrNone )
-            {
-            iIapSelection.Session()->MyServer().SetOfflineWlanQueryResponse(
-                    EOfflineResponseYes );
-            }
-        else if ( iStatus.Int() == KErrCancel )
-            {
-            iIapSelection.Session()->MyServer().SetOfflineWlanQueryResponse(
-                    EOfflineResponseNo );
-            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL offline query returned %d", 
-                           iStatus.Int() )
-            }
-        else
-            {
-            MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL offline query returned %d", 
-                           iStatus.Int() )
-            }
-        }
-    // if an error was given through OfferInformation() -call we abort the execution.
-    //
-    else if ( iOverrideStatus != KErrNone )
-        {
-        MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery inherited error %d", iOverrideStatus )
-        iIapSelection.UserWlanSelectionDoneL( iOverrideStatus, iWlanIapId );
-        }
-    else
-        {
-		MPMLOGSTRING2( "CMPMWlanQueryDialog::RunL, unknown state: %d", iWlanQueryState )
-        User::Leave( KErrCancel );
-        }
-        
-    iIapSelection.UserWlanSelectionDoneL( iStatus.Int(), iWlanIapId );
-    
-    iWlanIapId = 0;
-    }
-
-// ---------------------------------------------------------------------------
-// CMPMWlanQueryDialog::RunError
-// ---------------------------------------------------------------------------
-//
-TInt CMPMWlanQueryDialog::RunError( TInt aError )
-    {
-    MPMLOGSTRING2( "CMPMWlanQueryDialog::RunError failed with %d", aError )
-    iIapSelection.ChooseIapComplete( aError, NULL );    
-    return KErrNone;
-    }
-
-// -----------------------------------------------------------------------------
-// CMPMWlanQueryDialog::StartWlanQueryL
-// -----------------------------------------------------------------------------
-//
-void CMPMWlanQueryDialog::StartWlanQueryL()
-    {
-    MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery" )
-    
-    TUint32 activeWlanIap = iIapSelection.Session()->MyServer().IsWlanConnectionStartedL( 
-        iIapSelection.Session()->MyServer().CommsDatAccess() );
-
-    // Get EmergencyCallInfo via Publish & Subscribe
-    // 
-    TInt emergencyCallEstablished( 0 );
-    RProperty::Get( KPSUidCtsyEmergencyCallInfo, 
-                    KCTSYEmergencyCallInfo, 
-                    emergencyCallEstablished );  
-    MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery KCTSYEmergencyCallInfo = %d", 
-                   emergencyCallEstablished )
-
-    // Get note behaviour setting
-    TUint32 noteBehaviour( 0 );
-    noteBehaviour = iIapSelection.MpmConnPref().NoteBehaviour();
-    MPMLOGSTRING2( "CMPMWlanQueryDialog::StartWlanQuery noteBehaviour = %d", noteBehaviour )
-    
-    if( !emergencyCallEstablished && 
-        iIapSelection.Session()->MyServer().IsPhoneOffline() && 
-        !activeWlanIap && 
-        iIapSelection.Session()->MyServer().OfflineWlanQueryResponse() != EOfflineResponseYes &&
-        iOverrideStatus == KErrNone )
-        {
-        if ( noteBehaviour & TExtendedConnPref::ENoteBehaviourConnDisableQueries )
-            {
-            MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery offline note query not shown due to disabled queries" )
-            iIapSelection.UserWlanSelectionDoneL( KErrPermissionDenied, iWlanIapId );
-            }
-        else
-            {
-            MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery, starting offline note" )            
-            iWlanQueryState = EOffline;
-            iNotifier.StartNotifierAndGetResponse( iStatus, 
-                                                   KUidCOfflineWlanNoteDlg, 
-                                                   KNullDesC8(), 
-                                                   iOfflineReply );
-            SetActive();
-            }
-        }
-    else
-        {
-        MPMLOGSTRING( "CMPMWlanQueryDialog::StartWlanQuery no wlan dialog to show" )
-        iIapSelection.UserWlanSelectionDoneL( KErrNone, iWlanIapId );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CMPMWlanQueryDialog::OfferInformation
-// -----------------------------------------------------------------------------
-//
-void CMPMWlanQueryDialog::OfferInformation( TInt aDialogStatus )
-    {
-    TOfflineWlanQueryResponse offlineResponse =
-            iIapSelection.Session()->MyServer().OfflineWlanQueryResponse();
-    if ( offlineResponse != EOfflineResponseUndefined )
-        {
-        MPMLOGSTRING3( "CMPMWlanQueryDialog<0x%x>::OfferInformation: offline response %d",
-                       iIapSelection.Session()->ConnectionId(),
-                       offlineResponse )
-        iOverrideStatus = aDialogStatus;
-        }
-
-#ifdef _LOG
-    else
-        {
-        MPMLOGSTRING( "CMPMWlanQueryDialog::OfferInformation, information not taken." ) 
-        }
-#endif 
-    }
-
--- a/bearermanagement/mpm/src/rmpmdefaultconnection.cpp	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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: Client interface to MPM Default Connection server
-*
-*/
-
-#include "rmpmdefaultconnection.h"
-#include "mpmcommon.h"
-#include "mpmlogger.h"
-
-_LIT( KPanicCategory, "MPM Default Connection Client" );
-
-// ---------------------------------------------------------------------------
-// RMPMDefaultConnection::Connect
-// Creates connection to server
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt RMPMDefaultConnection::Connect()
-    {
-    MPMLOGSTRING("RMPMDefaultConnection::Connect" )
-    TInt r( KErrNone );
-    if( !iClientConnected ) 
-        {
-        MPMLOGSTRING("RMPMDefaultConnection::Connect: Connecting to server")
-        r = CreateSession( KMPMDefaultConnectionServerName, Version(), KNumDefConnMessageSlots );
-        if(r == KErrNone)
-            {
-            iClientConnected = ETrue;
-            }
-        else
-            {
-            MPMLOGSTRING2("RMPMDefaultConnection::Connect: \
-Error occurred %d", r )
-            Close();
-            }
-        }
-    return r;
-    }
-
-// ---------------------------------------------------------------------------
-// RMPMDefaultConnection::Close
-// Closes connection to server
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void RMPMDefaultConnection::Close()
-    {
-    MPMLOGSTRING("RMPMDefaultConnection::Close" )
-    RSessionBase::Close();
-    iClientConnected = EFalse;
-    }
-
-// ---------------------------------------------------------------------------
-// RMPMDefaultConnection::SetDefaultIAP
-// Sets IAP to be used as default connection
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt RMPMDefaultConnection::SetDefaultIAP( TInt aIapId )
-    {
-    __ASSERT_ALWAYS( iClientConnected, 
-                     User::Panic( KPanicCategory, 
-                                  ERMPMPanicClientNotConnected ) );
-    MPMLOGSTRING("RMPMDefaultConnection::SetDefaultIAP" )
-    return SendReceive( EMPMDefaultConnectionSetDefaultIap, TIpcArgs( aIapId ) );
-    }
-
-// ---------------------------------------------------------------------------
-//RMPMDefaultConnection::ClearDefaultIAP
-// Clears IAP from being used as default connection
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt RMPMDefaultConnection::ClearDefaultIAP()
-    {
-    __ASSERT_ALWAYS( iClientConnected, 
-                     User::Panic( KPanicCategory, 
-                                  ERMPMPanicClientNotConnected ) );
-    MPMLOGSTRING("RMPMDefaultConnection::ClearDefaultIAP" )
-    return SendReceive( EMPMDefaultConnectionClearDefaultIap );
-    }
-
-// -----------------------------------------------------------------------------
-// RMPMDefaultConnection::Version
-// Returns version number
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TVersion RMPMDefaultConnection::Version() const
-    {
-    MPMLOGSTRING("RMPMDefaultConnection::Version" )
-    return TVersion(KMPMServerMajorVersionNumber,
-                    KMPMServerMinorVersionNumber,
-                    KMPMServerBuildVersionNumber);
-    }
--- a/cmmanager/cmapplsettingsui/res/cmradiodialog.docml	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cmapplsettingsui/res/cmradiodialog.docml	Mon May 24 20:51:35 2010 +0300
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="1.0">
+<hbdocument version="1.1">
     <object name="okAction" type="HbAction">
         <string name="role" value="HbDialog:primaryAction"/>
         <string locid="txt_common_button_ok" name="text"/>
@@ -14,10 +14,10 @@
         <bool name="backgroundFaded" value="TRUE"/>
         <integer name="timeout" value="0"/>
         <enums name="dismissPolicy" value="NoDismiss"/>
-        <ref object="okAction" role="HbDialog:primaryAction"/>
-        <ref object="cancelAction" role="HbDialog:secondaryAction"/>
+        <ref object="okAction" role="HbWidget:addAction"/>
+        <ref object="cancelAction" role="HbWidget:addAction"/>
     </widget>
-    <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
         <uistate name="Common ui state" sections="#common"/>
     </metadata>
 </hbdocument>
--- a/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cmmgr/cmmpluginbase/src/ccmpluginbaseeng.cpp	Mon May 24 20:51:35 2010 +0300
@@ -33,7 +33,7 @@
 using namespace CMManager;
 using namespace CommsDat;
 
-const TInt KApMaxConnNameLength = 30;
+const TInt KApMaxConnNameLength = 50;
 _LIT( KFormatPostfix, "%02d" );
 _LIT( KFormatLargePostfix, "%d" );
 _LIT( KFormatNameWithPostfix, "%S(%S)" );
@@ -930,45 +930,34 @@
     CopyAttributes( iapRecord, proxyRecord );
     CheckIfNameModifiedL( iapRecord, proxyRecord );
 
-    if ( proxyRecord->iUseProxyServer )
+    delete iProxyRecord;
+    iProxyRecord = NULL;
+
+    iProxyRecord = static_cast<CCDProxiesRecord*>(
+            CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
+    iProxyRecord->SetElementId( proxyRecord->ElementId() );
+
+    if ( !iProxyRecord->RecordId() )
         {
-        delete iProxyRecord;
-        iProxyRecord = NULL;
-
-        iProxyRecord = static_cast<CCDProxiesRecord*>(
-                CCDRecordBase::CreateCopyRecordL( *proxyRecord ) );
-        iProxyRecord->SetElementId( proxyRecord->ElementId() );
-
-        if ( !iProxyRecord->RecordId() )
+        // New proxy setting -> create new record.
+        iProxyRecord->iService = iServiceRecord->RecordId();
+        iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
+
+        // By default protocol is set to "http".
+        if ( TPtrC( proxyRecord->iProtocolName ).Length() == 0 )
             {
-            // New proxy setting -> create new record.
-            iProxyRecord->iService = iServiceRecord->RecordId();
-            iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
-
-            // By default protocol is set to "http".
-            if ( TPtrC( proxyRecord->iProtocolName ).Length() == 0 )
-                {
-                iProxyRecord->iProtocolName.SetL( KDefProxyProtocolName );
-                }
-
-            iProxyRecord->SetRecordId( KCDNewRecordRequest );
-            iProxyRecord->StoreL( iSession );
-            proxyRecord->SetElementId( iProxyRecord->ElementId() );
-            proxyRecord->iService = iServiceRecord->RecordId();
-            proxyRecord->iServiceType.SetL( iIapRecord->iServiceType );
+            iProxyRecord->iProtocolName.SetL( KDefProxyProtocolName );
             }
-        else
-            // Already existing record -> update only.
-            {
-            iProxyRecord->ModifyL( iSession );
-            }
+
+        iProxyRecord->SetRecordId( KCDNewRecordRequest );
+        iProxyRecord->StoreL( iSession );
+        CopyRecordFieldsL( *iProxyRecord, *proxyRecord );
+        proxyRecord->SetElementId( iProxyRecord->ElementId() );
         }
     else
+        // Already existing record -> update only.
         {
-        if ( iProxyRecord->RecordId() )
-            {
-            iProxyRecord->DeleteL( iSession );
-            }
+        iProxyRecord->ModifyL( iSession );
         }
 
     OstTraceFunctionExit0( CCMPLUGINBASEENG_UPDATEPROXYRECORDL_EXIT );
@@ -1965,7 +1954,6 @@
     proxyRecord->iServerName.SetL( aProxyServer );
     if ( !aProxyServer.Length() )
         {
-        proxyRecord->iPortNumber = 0;
         proxyRecord->iUseProxyServer = EFalse;
         }
     else
@@ -2330,14 +2318,7 @@
                     aClientPluginInstance->iBearerSpecRecordArray ) );
             if ( err )
                 {
-                if ( err == KErrNotFound )
-                    {
-                    retVal = EFalse;
-                    }
-                else
-                    {
-                    User::Leave( err );
-                    }
+                retVal = EFalse;
                 }
             }
             break;
@@ -2387,7 +2368,12 @@
             break;
         case ECmVirtual:
             {
-            retVal = EFalse;
+            // This is bearer specific attribute  
+            TRAPD( err, retVal = GetBearerInfoBoolL( aAttribute ) );
+            if ( err )
+                {
+                retVal = EFalse;
+                }
             }
             break;
         case ECmWapIPSecurity:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/data/10281BBE.rss	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006-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: 
+*      ECom resource descriptor for VPN plug-in 
+*      
+*
+*/
+
+#include "ecom/RegistryInfo.rh"
+
+// Because attribute enums had to be added to namespace CMManager
+// it's not possible to included cmpluginvpndef.h.
+// Thus bearer type id had to be redefined here.
+#define KPluginVPNBearerTypeUid   0x10281BBD
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10281BBE;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x10207377; // = KCMPluginInterfaceUid. Do NOT modify it!!!
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KPluginVPNBearerTypeUid;
+                    version_no = 1;
+                    display_name = "VPN";
+                    default_data = "VPN";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009-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 VPN plugin.   
+*      
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// export iby files
+../rom/cmmpluginvpn.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(cmmpluginvpn.iby)
+
+PRJ_MMPFILES
+cmpluginvpn.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/group/cmpluginvpn.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009-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: 
+*      Project specification for LAN Plugin.   
+*      
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET      cmpluginvpn.dll
+UID         0x10009D8D 0x10281BBE
+
+TARGETTYPE		PLUGIN
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH  ../src
+
+SOURCE      cmpluginvpnproxy.cpp
+SOURCE      cmpluginvpn.cpp
+
+SOURCEPATH  ../data
+
+START RESOURCE 10281BBE.rss
+TARGET cmpluginvpn.rsc
+END
+
+// Component specific internal headers 
+USERINCLUDE         ../inc 
+USERINCLUDE         ../../../cmmcommon/inc
+USERINCLUDE         ../traces
+
+
+// ADO specific internal headers 
+SYSTEMINCLUDE		../../../database/inc
+
+//Macro to /epoc32 headers
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY	ecom.lib
+LIBRARY featmgr.lib
+LIBRARY commsdat.lib
+LIBRARY	cmmpluginbase.lib
+LIBRARY cmmanagerdatabase.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/inc/cmpluginvpn.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2009-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 VPN CmManager plugin interface implementation 
+*      
+*
+*/
+
+#ifndef CMPLUGINVPN_H
+#define CMPLUGINVPN_H
+
+// INCLUDES
+#include <cmpluginbaseeng.h>
+#include <cmpluginvpndef.h>
+
+// FORWARD DECLARATION
+class CCDVirtualIAPNextLayerRecord;
+
+/**
+*  CCmPluginVpn defines the functionality of vpn bearer support.
+*  Most of the API is inherited from CCmPluginBaseEng class.
+*/
+NONSHARABLE_CLASS( CCmPluginVpn ) : public CCmPluginBaseEng
+    {
+    public: // Constructors and destructor
+        /**
+         * Two phased constructor.
+         * @return Returns the VPN plugin object.
+         */      
+		static CCmPluginVpn* NewL( TCmPluginInitParam* aInitParam );
+
+        /**
+         * Destructor.
+         */      
+        virtual ~CCmPluginVpn();
+
+    public: // From CCmPluginBaseEng
+        /**
+         * Creates a new instance of VPN bearer plugin. The instance
+         * created represents a bearer, not a connection method.
+         * @param aInitParam Initialization data.
+         * @return Returns CCmPluginBaseEng type pointer which represents pure
+         * bearer instance for the cmm server.
+         */
+        virtual CCmPluginBaseEng* CreateInstanceL( 
+                TCmPluginInitParam& aInitParam ) const;
+                
+        /**
+         * Following GetBearerInfoXXXL methods return the values of the 
+         * requested attributes. These values are bearerspecific so they
+         * don't vary between CMs with same bearer type.
+         * @param aAttribute An attribute identifier.
+         * @return Returns the value requested. If not found leaves with
+         * KErrNotFound error code. 
+         */
+        virtual TUint32 GetBearerInfoIntL( TUint32 aAttribute ) const;
+        
+        virtual TBool GetBearerInfoBoolL( TUint32 aAttribute ) const;
+
+        virtual HBufC* GetBearerInfoStringL( TUint32 aAttribute ) const;
+        
+        virtual HBufC8* GetBearerInfoString8L( TUint32 aAttribute ) const;
+
+        /**
+         * Checks if the plug-in can handle the Connection Method identified
+         * with parameter aIapId.
+         * @param aIapId IAPId of the AP to be checked
+         * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
+         */
+        TBool CanHandleIapIdL( TUint32 aIapId ) const;
+         
+        /**
+         * Checks if the plug-in can handle the given IAP record.
+         * @param aIapRecord IAP record to be checked
+         * @return ETrue if plug-in can handle the IAP, otherwise EFalse.
+         */
+        TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const;
+
+        /**
+         * Requests CommsDat table ids to be observed for changes by the cmm
+         * server. If a table used is not mentioned to be modified a bearer
+         * shouldn't return this. Bearers do not reset the array before adding
+         * ids.
+         * @param aTableIdArray A reference to an array where plugin must add
+         * the ids of the tables it want's to be observed.
+         */
+        void GetBearerTableIdsToBeObservedL( RArray<TUint32>& aTableIdArray ) const;
+
+        
+        /**
+         * Creates a copy of all bearer specific CommsDat data for the client.
+         * Called as result of GetPluginDataL().
+         * @param aRecordArray An array where the copy the records. Only 
+         * the bearer specific implementation knows the amount and order
+         * of these records in the array.
+         */
+        virtual void GetBearerSpecificRecordsL( 
+                RPointerArray<CommsDat::CCDRecordBase>& aRecordArray );
+
+        /**
+         * Following GetBearerXXXXAttribute methods get only the
+         * fields in records in pointer arrays(parameters).
+         * @param aAttribute Identifier of the requested value.
+         * @param aGenRecordArray An array containing pointers to generic 
+         * records of the Connection Method.
+         * @param aBearerSpecRecordArray An array containing pointers to bearer
+         * specific records of the Connection Method. aAttribute
+         * parameter should identify one field(integer, boolean string)
+         * in one of these records. 
+         * @return Returns the requested value. In error case leaves with 
+         * system-wide error code.
+         */
+
+        virtual TUint32 GetBearerIntAttributeL( 
+                TUint32 aAttribute, 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+        
+        virtual TBool GetBearerBoolAttributeL( 
+                TUint32 aAttribute, 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+                                         
+        virtual HBufC* GetBearerStringAttributeL( 
+                TUint32 aAttribute, 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+        
+        virtual HBufC8* GetBearerString8AttributeL( 
+                TUint32 aAttribute, 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Following SetBearerXXXXAttribute methods set only the
+         * fields in records in pointer arrays(parameters). They are not 
+         * allowed to update the original records in plugins.
+         * @param aAttribute Identifier of the field to set.
+         * @param aValue The value to set.
+         * @param aGenRecordArray An array containing pointers to generic 
+         * records of the Connection Method.
+         * @param aBearerSpecRecordArray An array containing pointers to bearer
+         * specific records of the Connection Method. aAttribute
+         * parameter should identify one field(integer, boolean string)
+         * in one of these records. 
+         * @return None.
+         */
+
+        virtual void SetBearerIntAttributeL( 
+                TUint32 aAttribute, 
+                TUint32 aValue, 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+        
+        virtual void SetBearerBoolAttributeL( 
+                TUint32 aAttribute, 
+                TBool aValue,
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+                                         
+        virtual void SetBearerStringAttributeL( 
+                TUint32 aAttribute, 
+                const TDesC16& aValue,
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        virtual void SetBearerString8AttributeL( 
+                TUint32 aAttribute, 
+                const TDesC8& aValue,                                                    
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Inherited from CCmPluginBaseEng. 
+         * Implementation is empty.
+         */
+        virtual void PreparePluginToLoadRecordsL();
+        
+        /**
+         * Inherited from CCmPluginBaseEng. 
+         * Implementation is empty.
+         * @param aCopyInstance Client side data instance.
+         */
+        virtual void PrepareToCopyDataL( CCmPluginBaseEng* aCopyInstance );
+
+        /**
+         * Inherited from CCmPluginBaseEng. 
+         * Implementation is empty.
+         * @param aGenRecordArray Reference to generic records pointer array.
+         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         * pointer array.
+         */
+        virtual void PreparePluginToUpdateRecordsL(
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Plugin can prepare to delete the Connection Method with this 
+         * function. Called from DeleteL() before any record would be 
+         * deleted. No records are deleted here.
+         */
+        virtual void PrepareToDeleteRecordsL();
+
+        /**
+         * Loads the service record. Service record type is known and loaded by 
+         * plugin(bearer specific) part of the implementation even if the record
+         * is saved to the generic side. Service record is linked to IAP record.
+         */
+        virtual void LoadServiceRecordL();
+
+        /**
+         * Creates the service records.
+         */
+        virtual void CreateServiceRecordL();
+
+        /**
+         * Update service record.
+         * @param aGenRecordArray Reference to generic records pointer array.
+         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         * pointer array.
+         */
+        virtual void UpdateServiceRecordL( 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Copies the service record. Bearer specific part knows the type of it's
+         * service record.
+         * @return Returns the service record pointer. 
+         */
+        virtual CommsDat::CCDRecordBase* CopyServiceRecordL();
+
+        /**
+         * Returns the service record id of the Connection Method.
+         * @return Returns the id of the service record id of the Connection Method.
+         */
+        virtual TUint32 ServiceRecordId() const;
+
+        /**
+         * Returns the service record name of the Connection Method.
+         * @param aServiceName Name of the service record the CM's iap record 
+         * points to.
+         */
+        virtual void ServiceRecordNameLC( HBufC* &aServiceName );
+
+        /**
+         * Inherited class loads all the bearer specific records after 
+         * loading generic records. Called from LoadL(). 
+         */
+        virtual void LoadBearerRecordsL();
+
+        /**
+         * Creates bearer specific records.
+         */
+        virtual void CreateBearerRecordsL();
+
+        /**
+         * Update bearer specific records.
+         * @param aGenRecordArray Reference to generic records pointer array.
+         * @param aBearerSpecRecordArray Reference to bearer specific records 
+         */
+        virtual void UpdateBearerRecordsL( 
+                RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+                RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray );
+
+        /**
+         * Plugin(generic part) can delete bearer specific records
+         * with this function. Called from DeleteL().
+         */
+        virtual void DeleteBearerRecordsL();
+
+         /** 
+          * Resets the bearer specific records. 
+          */
+         virtual void ResetBearerRecords();
+
+        /**
+         * Copies the bearer specific records to copy instance given as 
+         * parameter. 
+         * @param aCopyInstance Pointer to instance where to copy.
+         */
+        virtual void CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance );
+
+        /**
+         * Returns the bearer record id of the Connection Method.
+         * @param aRecordId Id of the bearer record this CM's iap record 
+         * points to.
+         */
+        virtual void BearerRecordIdL( TUint32& aRecordId );
+
+        /**
+         * Returns the bearer record name of the Connection Method.
+         * @param aBearerName Name of the bearer record this CM's iap record 
+         * points to.
+         */
+        virtual void BearerRecordNameLC( HBufC* &aBearerName );
+
+        
+    private: // Constructors
+        /**
+        * Constructor.
+        */      
+		CCmPluginVpn( TCmPluginInitParam* aInitParam );
+
+        /**
+        * Second phase constructor. Leaves on failure.
+        */      
+		void ConstructL();   
+		
+		/**
+		 * Gets the default priority and default UI priority 
+		 * from the CommsDat.
+		 */
+		TUint32 GetDefPriorityL( const TUint32 aAttribute ) const;
+		
+		/**
+		 * Gets the virtual bearer record from the CommsDat.
+		 */
+		CommsDat::CCDVirtualBearerRecord* GetVirtualBearerRecordLC() const;
+		
+		/**
+		 * Type casts the service record in the base class to 
+		 * CommsDat::CCDVPNServiceRecord type. 
+		 */
+		CommsDat::CCDVPNServiceRecord& ServiceRecord() const;
+		
+		/**
+		 * Virtual table Id
+		 */
+		CommsDat::TMDBElementId                 iVirtualTableId;
+		
+		/**
+		 * Bearer priority table id
+		 */
+		CommsDat::TMDBElementId                 iBearerPriorityTableId;
+		
+		/**
+		 * Virtual IAP next layer record
+		 */
+		CCDVirtualIAPNextLayerRecord*           iVirtualIapNextLayerRecord;
+    };
+    
+#endif //CMPLUGINVPN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/rom/cmmpluginvpn.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009-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: 
+* cmpluginvpn.dll to ROM.
+*
+*/
+#ifndef CMMPLUGINVPN_IBY__
+#define CMMPLUGINVPN_IBY__
+
+ECOM_PLUGIN(cmpluginvpn.dll,10281BBE.rsc)
+
+
+#endif // CMMPLUGINVPN_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/src/cmpluginvpn.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,1181 @@
+/*
+* Copyright (c) 2009-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 VPN CmManager Plugin interface implementation 
+*      
+*
+*/
+
+ 
+// INCLUDE FILES
+#include <commsdattypesv1_1.h>
+#include <datamobilitycommsdattypes.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginvpndef.h>
+#include <featmgr.h>
+#include <publicruntimeids.hrh>
+
+#include "cmpluginvpn.h"
+#include "cmmserverdefs.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmpluginvpnTraces.h"
+#endif
+
+using namespace CommsDat;
+using namespace CMManager;
+
+
+
+_LIT( KVpnVirtualBearerName, "vpnbearer" );
+_LIT( KVpnVirtualBearerAgent, "vpnconnagt.agt" );
+_LIT( KVpnVirtualBearerNif, "tunnelnif" );
+
+static const TInt KVirtualIAPNextLayerRecordIndex = 0;
+
+// constants needed for the virtualbearer table
+static const TInt KNoTimeout = -1;
+static const TUint32 KLastSessionTimeout = 3;
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::NewL
+// ---------------------------------------------------------------------------
+//
+CCmPluginVpn* CCmPluginVpn::NewL( TCmPluginInitParam* aInitParam )
+	{	
+    OstTraceFunctionEntry0( CCMPLUGINVPN_NEWL_ENTRY );
+    
+	CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( aInitParam );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	
+	OstTraceFunctionExit0( CCMPLUGINVPN_NEWL_EXIT );
+	return self;		
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CreateInstanceL
+// ---------------------------------------------------------------------------
+//
+CCmPluginBaseEng* CCmPluginVpn::CreateInstanceL( TCmPluginInitParam& aInitParam ) const
+	{
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CREATEINSTANCEL_ENTRY );
+
+    CCmPluginVpn* self = new( ELeave ) CCmPluginVpn( &aInitParam );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+
+	OstTraceFunctionExit0( CCMPLUGINVPN_CREATEINSTANCEL_EXIT );
+	return self;				
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::~CCmPluginVpn
+// ---------------------------------------------------------------------------
+//
+CCmPluginVpn::~CCmPluginVpn()
+	{
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CCMPLUGINVPN_ENTRY );
+    
+    ResetBearerRecords();
+    
+	OstTraceFunctionExit0( CCMPLUGINVPN_CCMPLUGINVPN_EXIT );
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CCmPluginVpn
+// ---------------------------------------------------------------------------
+//
+CCmPluginVpn::CCmPluginVpn( TCmPluginInitParam* aInitParam )
+	: CCmPluginBaseEng( aInitParam ), iVirtualTableId(0), 
+	  iBearerPriorityTableId(0), iVirtualIapNextLayerRecord(NULL)
+	{
+    OstTraceFunctionEntry0( DUP1_CCMPLUGINVPN_CCMPLUGINVPN_ENTRY );
+    
+    iBearerType = KPluginVPNBearerTypeUid;
+	
+    OstTraceFunctionExit0( DUP1_CCMPLUGINVPN_CCMPLUGINVPN_EXIT );
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::ConstructL()
+	{    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CONSTRUCTL_ENTRY );
+    
+    if (!FeatureManager::FeatureSupported( KFeatureIdFfVpnClient ) )
+        {   
+        User::Leave( KErrNotSupported );
+        }
+    
+    TRAP_IGNORE( iVirtualTableId = 
+                        CCDVirtualIAPNextLayerRecord::TableIdL( iSession ) );       
+    
+    if( !iVirtualTableId )
+        {
+        iVirtualTableId = CCDVirtualIAPNextLayerRecord::CreateTableL( iSession );
+        }
+            
+    TRAP_IGNORE( iBearerPriorityTableId =
+            CCDGlobalBearerTypePriorizationRecord::TableIdL( iSession ) );
+
+    if ( !iBearerPriorityTableId )
+        {
+        iBearerPriorityTableId =
+                CCDGlobalBearerTypePriorizationRecord::CreateTableL( iSession );
+        }
+    
+	CCmPluginBaseEng::ConstructL();
+	    
+	OstTraceFunctionExit0( CCMPLUGINVPN_CONSTRUCTL_EXIT );
+	}
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerInfoIntL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::GetBearerInfoIntL( TUint32 aAttribute ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOINTL_ENTRY );
+
+    TUint32 retVal( 0 );
+    switch ( aAttribute )
+        {
+        case ECmSeamlessnessLevel:
+            {
+            retVal = ESeamlessnessShowprogress;
+            }
+            break;
+        case ECmBearerType:
+            {             
+            retVal = iBearerType;
+            }
+            break;
+        case ECmCommsDBBearerType:
+            {                         
+            retVal = KCommDbBearerVirtual;
+            }
+            break;
+        case ECmExtensionLevel:
+            {
+            retVal = KExtensionBaseLevel;
+            }
+            break;
+        case ECmDefaultUiPriority: //falls through
+        case ECmDefaultPriority:
+            {
+            retVal = GetDefPriorityL( aAttribute );
+            }
+            break;
+            
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOINTL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerInfoBoolL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::GetBearerInfoBoolL( TUint32 aAttribute ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOBOOLL_ENTRY );
+    
+    TBool retVal( EFalse );
+
+    switch ( aAttribute )
+        {
+        case ECmCoverage:
+            {
+            //This parameter is not actually in use for the VPN.
+            //ConnMon component can make a proper coverage discovery for the VPN,
+            //but CmManager just returns the default value.
+            retVal = EFalse;
+            }
+            break;
+        case ECmDestination:
+            {
+            retVal = EFalse;
+            }
+            break;
+        case ECmBearerHasUi:
+            {                
+            retVal = EFalse;
+            }
+            break;
+        case ECmIPv6Supported:
+            {            
+            retVal = EFalse;
+            }
+            break;
+        case ECmVirtual:
+            {
+            retVal = ETrue;
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }    
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOBOOLL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerInfoStringL
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmPluginVpn::GetBearerInfoStringL( TUint32 /*aAttribute*/ ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOSTRINGL_ENTRY );
+    
+    User::Leave( KErrNotSupported );
+     
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOSTRINGL_EXIT );
+    
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerInfoString8L
+// ---------------------------------------------------------------------------
+//
+HBufC8* CCmPluginVpn::GetBearerInfoString8L( TUint32 /*aAttribute*/ ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINFOSTRING8L_ENTRY );
+
+    User::Leave( KErrNotSupported );
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINFOSTRING8L_EXIT );
+ 
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::CanHandleIapIdL( TUint32 aIapId ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY );
+
+    TBool retVal( EFalse );
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+        
+    CleanupStack::PushL( iapRecord );
+    iapRecord->SetRecordId( aIapId );
+    
+    iapRecord->LoadL( iSession );
+    retVal = CanHandleIapIdL( iapRecord );
+    
+    CleanupStack::PopAndDestroy( iapRecord );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT );
+    return retVal;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CanHandleIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const
+    {
+    OstTraceFunctionEntry0( DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY );
+    TBool retVal( EFalse );
+        
+    if( TPtrC(aIapRecord->iServiceType) == TPtrC(KCDTypeNameVPNService) ||
+        TPtrC(aIapRecord->iBearerType) == TPtrC(KCDTypeNameVirtualBearer) )
+        {
+        // Further comparision is to find exact info that the IAP can handle by this plugin
+        CMDBRecordSet<CCDVirtualBearerRecord>* bearersRS = 
+                new(ELeave) CMDBRecordSet<CCDVirtualBearerRecord>
+                                                   (KCDTIdVirtualBearerRecord);
+        CleanupStack::PushL( bearersRS );
+
+        CCDVirtualBearerRecord* bearerRecord = 
+                static_cast<CCDVirtualBearerRecord *>
+                    (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+
+        CleanupStack::PushL( bearerRecord );
+    
+        // Find entries used "vpnconnagt.agt" as agent from Table VirtualBearer
+        bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent );
+    
+        bearersRS->iRecords.AppendL( bearerRecord );
+
+        CleanupStack::Pop( bearerRecord );
+        bearerRecord = NULL;
+        
+        if ( bearersRS->FindL( iSession ) )
+            {
+            TUint32 recordId = (*bearersRS)[0]->RecordId();
+            TPtrC bearerName( (*bearersRS)[0]->iRecordName.GetL() );
+        
+            // Further comparing record ID referred to by this VPN IAP with entry ID in table VirtualBearer
+            // And also comparing bear name with our expected one "vpnbearer"
+            if( recordId == aIapRecord->iBearer && 
+                bearerName == TPtrC( KVpnVirtualBearerName ) )
+                {
+                retVal = ETrue;
+                }
+            }        
+        CleanupStack::PopAndDestroy( bearersRS );
+        }
+    
+    OstTraceFunctionExit0( DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerTableIdsToBeObservedL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::GetBearerTableIdsToBeObservedL( RArray<TUint32>& aTableIdArray ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY );
+    
+    aTableIdArray.AppendL( KCDTIdVirtualBearerRecord );
+    aTableIdArray.AppendL( iVirtualTableId );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerSpecificRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::GetBearerSpecificRecordsL(RPointerArray<CommsDat::CCDRecordBase>& aRecordArray )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_ENTRY );
+       
+    __ASSERT_DEBUG( iVirtualIapNextLayerRecord != NULL, User::Invariant() );  
+            
+    CCDVirtualIAPNextLayerRecord* virtualIapNextLayerRecordCopy = 
+                new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    CleanupStack::PushL( virtualIapNextLayerRecordCopy );
+    
+    TUint value = iVirtualIapNextLayerRecord->iIAP;
+    virtualIapNextLayerRecordCopy->iIAP = value;
+    
+    value = iVirtualIapNextLayerRecord->iNextLayerSNAP;
+    virtualIapNextLayerRecordCopy->iNextLayerSNAP = value;
+    
+    value = iVirtualIapNextLayerRecord->iNextLayerIAP;
+    virtualIapNextLayerRecordCopy->iNextLayerIAP = value;
+    
+    virtualIapNextLayerRecordCopy->SetElementId( iVirtualIapNextLayerRecord->ElementId() );
+    User::LeaveIfError( aRecordArray.Append( virtualIapNextLayerRecordCopy ) );
+    CleanupStack::Pop( virtualIapNextLayerRecordCopy );    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerIntAttributeL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::GetBearerIntAttributeL( 
+        TUint32 aAttribute, 
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_ENTRY );
+    
+    CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *>                
+                                                        ( aGenRecordArray[KServiceRecordIndex] );
+        
+    TUint32 retVal( 0 );
+    switch( aAttribute )
+        {
+        case ECmExtensionLevel:   
+            {
+            retVal = KExtensionBaseLevel;
+            }
+            break;
+        case ECmCommsDBBearerType:
+            {
+            TCommsDBBearerTechnology bearer = KCommDbBearerVirtual; 
+            retVal = bearer;
+            }
+            break;
+        case ECmNextLayerIapId: //falls through
+        case EVpnIapId:
+            {            
+            TUint recordId = serviceRecord->iServiceIAP;
+            if (recordId != 0)
+                {
+                CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                                        ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+                
+                CleanupStack::PushL( iapRecord );
+                iapRecord->SetRecordId( recordId );
+                iapRecord->LoadL( iSession );
+                retVal = iapRecord->RecordId();
+                CleanupStack::PopAndDestroy( iapRecord );                             
+                }
+            }
+            break;
+        case EVpnNetworkId: //falls through      
+        case ECmNextLayerSNAPId:
+            {
+            TUint recordId = serviceRecord->iServiceSNAP;
+            if (recordId != 0)
+                {
+                CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *>
+                                                        ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+                CleanupStack::PushL( accessPointRecord );
+                accessPointRecord->SetRecordId( recordId );
+                accessPointRecord->LoadL( iSession );
+                retVal = accessPointRecord->iRecordTag;
+                CleanupStack::PopAndDestroy( accessPointRecord );
+                
+                if (aAttribute == EVpnNetworkId)
+                    {
+                    __ASSERT_DEBUG( retVal >= KCmmDestIdIntervalMin, User::Invariant() );
+                    retVal -= KCmmDestIdIntervalMin;
+                    }
+                }
+            }
+            break;
+        default:
+            {
+            retVal = GetBearerInfoIntL( aAttribute );
+            }
+            break;
+        }
+    
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+TBool CCmPluginVpn::GetBearerBoolAttributeL( 
+        TUint32 aAttribute, 
+        RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_ENTRY );
+    //We don't have IAP specific bool attributes, but the bearer specific
+    //attributes may also be asked this way...
+    TBool retVal = GetBearerInfoBoolL( aAttribute );              
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_EXIT );
+    return retVal;
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerStringAttributeL
+// ---------------------------------------------------------------------------
+//
+HBufC* CCmPluginVpn::GetBearerStringAttributeL( 
+        TUint32 aAttribute, 
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_ENTRY );
+    
+    CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *>                
+                                                        ( aGenRecordArray[KServiceRecordIndex] );
+
+    HBufC* retVal =  NULL;
+    switch( aAttribute )
+        {
+        case EVpnServicePolicy:
+            {
+            retVal = TPtrC( serviceRecord->iServicePolicy ).AllocL();
+            }
+            break;
+        default:
+            {
+            retVal = GetBearerInfoStringL( aAttribute );
+            }
+            break;
+        }
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetBearerString8AttributeL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CCmPluginVpn::GetBearerString8AttributeL( 
+        TUint32 aAttribute, 
+        RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_ENTRY );
+    
+    HBufC8* retVal = GetBearerInfoString8L( aAttribute );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::SetBearerIntAttributeL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetBearerIntAttributeL( 
+        TUint32 aAttribute, 
+        TUint32 aValue, 
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_ENTRY );
+
+    CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *>                
+                                                    (aGenRecordArray[KServiceRecordIndex]);
+
+    CCDVirtualIAPNextLayerRecord* virtualIapNextLayerRecord = static_cast<CCDVirtualIAPNextLayerRecord*>
+                                                        (aBearerSpecRecordArray[KVirtualIAPNextLayerRecordIndex]);
+
+    
+    switch(aAttribute)
+        {
+        case ECmNextLayerIapId: //falls through
+        case EVpnIapId:
+            {
+            if( aValue == 0 || aValue >= (KCmmConnMethodIdIntervalMax - 2) )
+                {
+                User::Leave( KErrArgument );
+                }            
+            
+            //Tries to find corresponding IAP record.
+            CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                                    ( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) );
+                
+            CleanupStack::PushL( iapRecord );
+            iapRecord->SetRecordId( aValue );            
+            TRAPD(err, iapRecord->LoadL( iSession ));
+            if ( err == KErrNotFound )
+                {
+                User::Leave( KErrArgument );
+                }
+            User::LeaveIfError( err );
+            
+            serviceRecord->iServiceIAP = iapRecord->RecordId();
+            serviceRecord->iServiceNetwork = 0;
+            serviceRecord->iServiceSNAP = 0;
+            virtualIapNextLayerRecord->iNextLayerIAP.SetL( aValue );
+            virtualIapNextLayerRecord->iNextLayerSNAP = 0;
+            CleanupStack::PopAndDestroy( iapRecord );
+            }
+            break;
+        case EVpnNetworkId: //falls through
+            {
+            if ( aValue == 0 || aValue > (KCmmDestIdIntervalLegacyMax - 2) )
+                {
+                User::Leave( KErrArgument );
+                }
+            } //falls through
+        case ECmNextLayerSNAPId:
+            {
+            if ( aValue <= (KCmmDestIdIntervalLegacyMax - 2) )
+                {
+                aValue += KCmmDestIdIntervalMin;
+                }
+            
+            if ( aValue <= KCmmDestIdIntervalMin ||
+                 aValue > KCmmDestIdIntervalMax - 2 )
+                {
+                User::Leave( KErrArgument );
+                }
+            
+            CCDAccessPointRecord* accessPointRecord = static_cast<CCDAccessPointRecord *>
+                                                    ( CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) );
+            CleanupStack::PushL( accessPointRecord );
+            accessPointRecord->iRecordTag = aValue;
+            if ( accessPointRecord->FindL( iSession ) )
+                {
+                serviceRecord->iServiceIAP = 0;
+                serviceRecord->iServiceNetwork = 0;
+                serviceRecord->iServiceSNAP = accessPointRecord->RecordId();
+                virtualIapNextLayerRecord->iNextLayerIAP = 0;
+                virtualIapNextLayerRecord->iNextLayerSNAP.SetL( aValue );
+                }
+            else
+                {
+                User::Leave( KErrArgument );
+                }            
+            CleanupStack::PopAndDestroy( accessPointRecord );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::SetBearerBoolAttributeL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetBearerBoolAttributeL( 
+        TUint32 /*aAttribute*/, 
+        TBool /*aValue*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_ENTRY );
+    
+    User::Leave( KErrNotSupported );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_EXIT );
+    }
+  
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::SetBearerStringAttributeL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetBearerStringAttributeL( 
+        TUint32 aAttribute, 
+        const TDesC16& aValue,
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_ENTRY );
+
+    CCDVPNServiceRecord* serviceRecord = static_cast<CCDVPNServiceRecord *>                
+                                                    ( aGenRecordArray[KServiceRecordIndex] );
+
+    switch(aAttribute)
+        {
+        case EVpnServicePolicyName:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        case EVpnServicePolicy:
+            {
+            serviceRecord->iServicePolicy.SetL( aValue );
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;
+        }    
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::SetBearerString8AttributeL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::SetBearerString8AttributeL( 
+        TUint32 /*aAttribute*/, 
+        const TDesC8& /*aValue*/,                                                    
+        RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_ENTRY );
+
+    User::Leave( KErrNotSupported );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::PreparePluginToLoadRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::PreparePluginToLoadRecordsL()
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::PrepareToCopyDataL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::PrepareToCopyDataL( CCmPluginBaseEng* /*aCopyInstance*/ )
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::PreparePluginToUpdateRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::PreparePluginToUpdateRecordsL(
+        RPointerArray<CommsDat::CCDRecordBase>& /*aGenRecordArray*/,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::PrepareToDeleteRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::PrepareToDeleteRecordsL()
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::LoadServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::LoadServiceRecordL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_LOADSERVICERECORDL_ENTRY );
+    
+    __ASSERT_DEBUG( iServiceRecord == NULL, User::Invariant() );
+    
+    if( TPtrC( KCDTypeNameVPNService ) == iIapRecord->iServiceType )
+        {
+        iServiceRecord = static_cast<CCDVPNServiceRecord *>
+                    ( CCDRecordBase::RecordFactoryL(KCDTIdVPNServiceRecord) );
+        iServiceRecord->SetRecordId( iIapRecord->iService );
+        iServiceRecord->LoadL( iSession );        
+        }
+    else
+        // this IAP service is not supported by this plugin.
+        {
+        User::Leave( KErrNotSupported );
+        }    
+    OstTraceFunctionExit0( CCMPLUGINVPN_LOADSERVICERECORDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CreateServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::CreateServiceRecordL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CREATESERVICERECORDL_ENTRY );
+    
+    delete iServiceRecord; 
+    iServiceRecord = NULL;
+    
+    iServiceRecord = static_cast<CCDVPNServiceRecord *>
+                    ( CCDRecordBase::RecordFactoryL( KCDTIdVPNServiceRecord ) );
+    
+    ServiceRecord().iServicePolicy.SetL( KNullDesC );
+    ServiceRecord().iServiceIAP = 0;
+    ServiceRecord().iServiceNetwork = 0;
+    ServiceRecord().iServiceSNAP = 0;
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_CREATESERVICERECORDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::UpdateServiceRecordL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::UpdateServiceRecordL( 
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& /*aBearerSpecRecordArray*/ )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_UPDATESERVICERECORDL_ENTRY );
+        
+    // Delete the original record and create a copy from the parameter
+    delete iServiceRecord;
+    iServiceRecord = NULL;
+
+    CCDVPNServiceRecord* vpnServiceRecordFrom =
+            static_cast<CCDVPNServiceRecord *>( aGenRecordArray[KServiceRecordIndex] );
+
+    
+    iServiceRecord = static_cast<CCDVPNServiceRecord*>
+                                  ( CCDRecordBase::CreateCopyRecordL( *vpnServiceRecordFrom ) );
+    iServiceRecord->SetElementId( vpnServiceRecordFrom->ElementId() );
+    
+    if ( !iServiceRecord->RecordId() )
+        {
+        iServiceRecord->SetRecordId( KCDNewRecordRequest );
+        iServiceRecord->StoreL( iSession );
+        
+        vpnServiceRecordFrom->SetElementId( ServiceRecord().ElementId() );
+        }
+    else
+        {
+        iServiceRecord->ModifyL( iSession );
+        }    
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_UPDATESERVICERECORDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CopyServiceRecordL
+// ---------------------------------------------------------------------------
+//
+CommsDat::CCDRecordBase* CCmPluginVpn::CopyServiceRecordL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_COPYSERVICERECORDL_ENTRY );
+    
+    __ASSERT_DEBUG( iServiceRecord != NULL, User::Invariant());    
+    CCDRecordBase* serviceRecord = static_cast<CCDVPNServiceRecord*>
+                                  ( CCDRecordBase::CreateCopyRecordL( *iServiceRecord ) );     
+    OstTraceFunctionExit0( CCMPLUGINVPN_COPYSERVICERECORDL_EXIT );
+    return serviceRecord;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecordId
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::ServiceRecordId() const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORDID_ENTRY );
+    
+    TUint32 retVal = ServiceRecord().RecordId();
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORDID_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecordNameLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::ServiceRecordNameLC( HBufC* &aServiceName )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORDNAMELC_ENTRY );    
+    aServiceName = TPtrC( KCDTypeNameVPNService ).AllocLC();      
+    OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORDNAMELC_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::LoadBearerRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::LoadBearerRecordsL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_LOADBEARERRECORDSL_ENTRY );
+    
+    delete iVirtualIapNextLayerRecord;
+    iVirtualIapNextLayerRecord = NULL;
+            
+    CMDBRecordSet<CCDVirtualIAPNextLayerRecord>* virtualRS = 
+              new(ELeave) CMDBRecordSet<CCDVirtualIAPNextLayerRecord>( iVirtualTableId );
+    CleanupStack::PushL( virtualRS );
+    
+    CCDVirtualIAPNextLayerRecord* record = 
+                            new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    
+    record->iIAP = iIapRecord->RecordId();
+    CleanupStack::PushL( record );
+    virtualRS->iRecords.AppendL( record );
+    CleanupStack::Pop( record );
+    record = NULL;
+    
+    if( virtualRS->FindL( iSession ) )
+        {
+        iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+        iVirtualIapNextLayerRecord->SetRecordId( (*virtualRS)[0]->RecordId() );        
+        iVirtualIapNextLayerRecord->LoadL( iSession );        
+        }
+    else
+        {        
+        User::Leave( KErrNotFound );
+        }
+    
+    CleanupStack::PopAndDestroy( virtualRS );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_LOADBEARERRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CreateBearerRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::CreateBearerRecordsL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_CREATEBEARERRECORDSL_ENTRY );
+
+    delete iVirtualIapNextLayerRecord;
+    iVirtualIapNextLayerRecord = NULL;
+    
+    iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_CREATEBEARERRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::UpdateBearerRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::UpdateBearerRecordsL( 
+        RPointerArray<CommsDat::CCDRecordBase>& aGenRecordArray,
+        RPointerArray<CommsDat::CCDRecordBase>& aBearerSpecRecordArray )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_UPDATEBEARERRECORDSL_ENTRY );
+        
+    delete iVirtualIapNextLayerRecord;
+    iVirtualIapNextLayerRecord = NULL;
+    
+    iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    
+    CCDVirtualIAPNextLayerRecord* virtualIAPNextLayerRecordFrom = 
+            static_cast<CCDVirtualIAPNextLayerRecord*>(aBearerSpecRecordArray[KVirtualIAPNextLayerRecordIndex]);
+    
+    CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *>
+                            ( aGenRecordArray[KIapRecordIndex] );
+
+    
+    TUint value = iapRecord->RecordId();
+    iVirtualIapNextLayerRecord->iIAP = value;
+    value = virtualIAPNextLayerRecordFrom->iNextLayerSNAP;
+    iVirtualIapNextLayerRecord->iNextLayerSNAP = value;
+    value = virtualIAPNextLayerRecordFrom->iNextLayerIAP;
+    iVirtualIapNextLayerRecord->iNextLayerIAP = value;    
+    iVirtualIapNextLayerRecord->SetElementId(virtualIAPNextLayerRecordFrom->ElementId());
+    
+    if ( !iVirtualIapNextLayerRecord->RecordId() )
+        {
+        iVirtualIapNextLayerRecord->SetRecordId( KCDNewRecordRequest );
+        iVirtualIapNextLayerRecord->StoreL( iSession );
+        virtualIAPNextLayerRecordFrom->SetElementId( iVirtualIapNextLayerRecord->ElementId() );
+        }
+    else
+        {
+        iVirtualIapNextLayerRecord->ModifyL( iSession );
+        }
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_UPDATEBEARERRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::DeleteBearerRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::DeleteBearerRecordsL()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_DELETEBEARERRECORDSL_ENTRY );    
+    iVirtualIapNextLayerRecord->DeleteL( iSession );
+    OstTraceFunctionExit0( CCMPLUGINVPN_DELETEBEARERRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ResetBearerRecords
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::ResetBearerRecords()
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_RESETBEARERRECORDS_ENTRY );
+    
+    delete iVirtualIapNextLayerRecord;
+    iVirtualIapNextLayerRecord = NULL;    
+    OstTraceFunctionExit0( CCMPLUGINVPN_RESETBEARERRECORDS_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::CopyBearerRecordsL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::CopyBearerRecordsL( CCmPluginBaseEng* aCopyInstance ) 
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_COPYBEARERRECORDSL_ENTRY );
+    
+    __ASSERT_DEBUG(iVirtualIapNextLayerRecord != NULL, User::Invariant());
+           
+    CCmPluginVpn* plugin = static_cast<CCmPluginVpn*>( aCopyInstance );
+
+    __ASSERT_DEBUG(plugin->iVirtualIapNextLayerRecord == NULL, User::Invariant());
+        
+    plugin->iVirtualIapNextLayerRecord = new (ELeave) CCDVirtualIAPNextLayerRecord( iVirtualTableId );
+    TUint value = iVirtualIapNextLayerRecord->iIAP;
+    plugin->iVirtualIapNextLayerRecord->iIAP = value;
+    value = iVirtualIapNextLayerRecord->iNextLayerSNAP;
+    plugin->iVirtualIapNextLayerRecord->iNextLayerSNAP = value;
+    value = iVirtualIapNextLayerRecord->iNextLayerIAP;
+    plugin->iVirtualIapNextLayerRecord->iNextLayerIAP = value;    
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_COPYBEARERRECORDSL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::BearerRecordIdL
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::BearerRecordIdL( TUint32& aRecordId )
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_BEARERRECORDIDL_ENTRY );
+    
+    CCDVirtualBearerRecord* bearerRecord = GetVirtualBearerRecordLC();
+    aRecordId = bearerRecord->RecordId();
+    CleanupStack::PopAndDestroy(bearerRecord);
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_BEARERRECORDIDL_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::BearerRecordNameLC
+// ---------------------------------------------------------------------------
+//
+void CCmPluginVpn::BearerRecordNameLC( HBufC* &aBearerName )
+    {   
+    OstTraceFunctionEntry0( CCMPLUGINVPN_BEARERRECORDNAMELC_ENTRY );
+    
+    aBearerName = TPtrC( KCDTypeNameVirtualBearer ).AllocLC();
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_BEARERRECORDNAMELC_EXIT );
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::ServiceRecord
+// ---------------------------------------------------------------------------
+//
+CCDVPNServiceRecord& CCmPluginVpn::ServiceRecord() const
+    {    
+    OstTraceFunctionEntry0( CCMPLUGINVPN_SERVICERECORD_ENTRY );
+    
+    CCDVPNServiceRecord& serviceRecord = *static_cast<CCDVPNServiceRecord*>( iServiceRecord );
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_SERVICERECORD_EXIT );
+    return serviceRecord;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetVirtualBearerRecordLC
+// ---------------------------------------------------------------------------
+//
+CCDVirtualBearerRecord* CCmPluginVpn::GetVirtualBearerRecordLC() const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_ENTRY );
+        
+    //First tries to load the virtual bearer record.
+    //If the loading fails creates a new one.
+    CMDBRecordSet<CCDVirtualBearerRecord>* bearersRS = 
+            new(ELeave) CMDBRecordSet<CCDVirtualBearerRecord>
+                                               (KCDTIdVirtualBearerRecord);
+    CleanupStack::PushL( bearersRS );
+
+    CCDVirtualBearerRecord* bearerRecord = 
+            static_cast<CCDVirtualBearerRecord *>
+                (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+
+    CleanupStack::PushL( bearerRecord );
+
+    // Find entries used "vpnconnagt.agt" as agent from Table VirtualBearer
+    bearerRecord->iBearerAgent.SetL( KVpnVirtualBearerAgent );
+    bearersRS->iRecords.AppendL( bearerRecord );
+
+    CleanupStack::Pop( bearerRecord );
+    bearerRecord = NULL;
+    
+    CCDVirtualBearerRecord* retVal = NULL;
+    if ( bearersRS->FindL( iSession ) )
+        {
+        for (TInt i = 0; i < bearersRS->iRecords.Count(); ++i)
+            {            
+            TPtrC bearerName( (*bearersRS)[i]->iRecordName.GetL() );
+    
+            // Further comparing record ID referred to by this VPN IAP with entry ID in table VirtualBearer
+            // And also comparing bear name with our expected one "vpnbearer"
+            if( bearerName == TPtrC( KVpnVirtualBearerName ) )
+                {
+                TUint32 recordId = (*bearersRS)[i]->RecordId();
+                retVal = static_cast<CCDVirtualBearerRecord *>
+                                            (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+                CleanupStack::PushL(retVal);
+                retVal->SetRecordId( recordId );
+                retVal->LoadL( iSession );
+                CleanupStack::Pop(retVal);
+                break;
+                }
+            }
+        }         
+    CleanupStack::PopAndDestroy( bearersRS );
+
+    //If iVirtualBearerRecord is still NULL the loading has failed we try to create a new 
+    //entry to the table.
+    if (retVal == NULL)
+        {
+        retVal = static_cast<CCDVirtualBearerRecord *>
+                                    (CCDRecordBase::RecordFactoryL(KCDTIdVirtualBearerRecord));
+        CleanupStack::PushL(retVal);
+        retVal->iRecordName.SetL( KVpnVirtualBearerName );
+        retVal->iBearerAgent.SetL( KVpnVirtualBearerAgent );
+        retVal->iVirtualBearerNifName.SetL(KVpnVirtualBearerNif);
+        retVal->iLastSocketActivityTimeout = (TUint32)KNoTimeout;
+        retVal->iLastSessionClosedTimeout = KLastSessionTimeout;
+        retVal->iLastSocketClosedTimeout = (TUint32)KNoTimeout;
+        retVal->iBearerTechnology = KCommDbBearerVirtual;
+        retVal->SetRecordId( KCDNewRecordRequest );
+        
+        retVal->StoreL( iSession );
+        }
+    else
+        {
+        CleanupStack::PushL(retVal);
+        }
+    
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_EXIT );
+    return retVal;
+    }
+
+// ---------------------------------------------------------------------------
+// CCmPluginVpn::GetDefPriorityL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCmPluginVpn::GetDefPriorityL( const TUint32 aAttribute ) const
+    {
+    OstTraceFunctionEntry0( CCMPLUGINVPN_GETDEFPRIORITYL_ENTRY );
+    
+    TUint32 retVal( KDataMobilitySelectionPolicyPriorityWildCard );
+
+    CCDGlobalBearerTypePriorizationRecord* priorityRecord =
+            new( ELeave ) CCDGlobalBearerTypePriorizationRecord( iBearerPriorityTableId );
+    CleanupStack::PushL( priorityRecord );
+
+    priorityRecord->iServiceType.SetL( TPtrC( KCDTypeNameVPNService ) );
+
+    if ( priorityRecord->FindL( iSession ) )
+        {
+        priorityRecord->LoadL( iSession );
+
+        switch ( aAttribute )
+            {
+            case ECmDefaultPriority:
+                {
+                retVal = priorityRecord->iPriority;
+                }
+                break;
+            case ECmDefaultUiPriority:
+                {
+                retVal = priorityRecord->iUIPriority;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    CleanupStack::PopAndDestroy( priorityRecord );
+
+    OstTraceFunctionExit0( CCMPLUGINVPN_GETDEFPRIORITYL_EXIT );
+    return retVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/src/cmpluginvpnproxy.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006-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: 
+*       VPN plug-in's ECom proxy descriptor. 
+*      
+*
+*/
+
+#include "cmpluginvpn.h"
+#include <e32std.h>
+#include <ecom/ImplementationProxy.h>
+
+// Exported proxy for instantiation method resolution
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KPluginVPNBearerTypeUid, CCmPluginVpn::NewL)
+    };
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+    return ImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/OstTraceDefinitions.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/cmpluginvpnTraces.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,90 @@
+// Created by TraceCompiler 2.2.2
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __CMPLUGINVPNTRACES_H__
+#define __CMPLUGINVPNTRACES_H__
+
+#define KOstTraceComponentID 0x10281bbe
+
+#define CCMPLUGINVPN_NEWL_ENTRY 0x8a0001
+#define CCMPLUGINVPN_NEWL_EXIT 0x8a0002
+#define CCMPLUGINVPN_CREATEINSTANCEL_ENTRY 0x8a0003
+#define CCMPLUGINVPN_CREATEINSTANCEL_EXIT 0x8a0004
+#define CCMPLUGINVPN_CCMPLUGINVPN_ENTRY 0x8a0005
+#define CCMPLUGINVPN_CCMPLUGINVPN_EXIT 0x8a0006
+#define DUP1_CCMPLUGINVPN_CCMPLUGINVPN_ENTRY 0x8a0007
+#define DUP1_CCMPLUGINVPN_CCMPLUGINVPN_EXIT 0x8a0008
+#define CCMPLUGINVPN_CONSTRUCTL_ENTRY 0x8a0009
+#define CCMPLUGINVPN_CONSTRUCTL_EXIT 0x8a000a
+#define CCMPLUGINVPN_GETBEARERINFOINTL_ENTRY 0x8a000b
+#define CCMPLUGINVPN_GETBEARERINFOINTL_EXIT 0x8a000c
+#define CCMPLUGINVPN_GETBEARERINFOBOOLL_ENTRY 0x8a000d
+#define CCMPLUGINVPN_GETBEARERINFOBOOLL_EXIT 0x8a000e
+#define CCMPLUGINVPN_GETBEARERINFOSTRINGL_ENTRY 0x8a000f
+#define CCMPLUGINVPN_GETBEARERINFOSTRINGL_EXIT 0x8a0010
+#define CCMPLUGINVPN_GETBEARERINFOSTRING8L_ENTRY 0x8a0011
+#define CCMPLUGINVPN_GETBEARERINFOSTRING8L_EXIT 0x8a0012
+#define CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY 0x8a0013
+#define CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT 0x8a0014
+#define DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY 0x8a0015
+#define DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT 0x8a0016
+#define CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY 0x8a0017
+#define CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT 0x8a0018
+#define CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_ENTRY 0x8a0019
+#define CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_EXIT 0x8a001a
+#define CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_ENTRY 0x8a001b
+#define CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_EXIT 0x8a001c
+#define CCMPLUGINVPN_LOADSERVICERECORDL_ENTRY 0x8a001d
+#define CCMPLUGINVPN_LOADSERVICERECORDL_EXIT 0x8a001e
+#define CCMPLUGINVPN_CREATESERVICERECORDL_ENTRY 0x8a001f
+#define CCMPLUGINVPN_CREATESERVICERECORDL_EXIT 0x8a0020
+#define CCMPLUGINVPN_COPYSERVICERECORDL_ENTRY 0x8a0021
+#define CCMPLUGINVPN_COPYSERVICERECORDL_EXIT 0x8a0022
+#define CCMPLUGINVPN_SERVICERECORDNAMELC_ENTRY 0x8a0023
+#define CCMPLUGINVPN_SERVICERECORDNAMELC_EXIT 0x8a0024
+#define CCMPLUGINVPN_LOADBEARERRECORDSL_ENTRY 0x8a0025
+#define CCMPLUGINVPN_LOADBEARERRECORDSL_EXIT 0x8a0026
+#define CCMPLUGINVPN_CREATEBEARERRECORDSL_ENTRY 0x8a0027
+#define CCMPLUGINVPN_CREATEBEARERRECORDSL_EXIT 0x8a0028
+#define CCMPLUGINVPN_DELETEBEARERRECORDSL_ENTRY 0x8a0029
+#define CCMPLUGINVPN_DELETEBEARERRECORDSL_EXIT 0x8a002a
+#define CCMPLUGINVPN_RESETBEARERRECORDS_ENTRY 0x8a002b
+#define CCMPLUGINVPN_RESETBEARERRECORDS_EXIT 0x8a002c
+#define CCMPLUGINVPN_COPYBEARERRECORDSL_ENTRY 0x8a002d
+#define CCMPLUGINVPN_COPYBEARERRECORDSL_EXIT 0x8a002e
+#define CCMPLUGINVPN_BEARERRECORDIDL_ENTRY 0x8a002f
+#define CCMPLUGINVPN_BEARERRECORDIDL_EXIT 0x8a0030
+#define CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_ENTRY 0x8a0031
+#define CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_EXIT 0x8a0032
+#define CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_ENTRY 0x8a0033
+#define CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_EXIT 0x8a0034
+#define CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_ENTRY 0x8a0035
+#define CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_EXIT 0x8a0036
+#define CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_ENTRY 0x8a0037
+#define CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_EXIT 0x8a0038
+#define CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_ENTRY 0x8a0039
+#define CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_EXIT 0x8a003a
+#define CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_ENTRY 0x8a003b
+#define CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_EXIT 0x8a003c
+#define CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_ENTRY 0x8a003d
+#define CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_EXIT 0x8a003e
+#define CCMPLUGINVPN_UPDATESERVICERECORDL_ENTRY 0x8a003f
+#define CCMPLUGINVPN_UPDATESERVICERECORDL_EXIT 0x8a0040
+#define CCMPLUGINVPN_SERVICERECORDID_ENTRY 0x8a0041
+#define CCMPLUGINVPN_SERVICERECORDID_EXIT 0x8a0042
+#define CCMPLUGINVPN_UPDATEBEARERRECORDSL_ENTRY 0x8a0043
+#define CCMPLUGINVPN_UPDATEBEARERRECORDSL_EXIT 0x8a0044
+#define CCMPLUGINVPN_BEARERRECORDNAMELC_ENTRY 0x8a0045
+#define CCMPLUGINVPN_BEARERRECORDNAMELC_EXIT 0x8a0046
+#define CCMPLUGINVPN_SERVICERECORD_ENTRY 0x8a0047
+#define CCMPLUGINVPN_SERVICERECORD_EXIT 0x8a0048
+#define CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_ENTRY 0x8a0049
+#define CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_EXIT 0x8a004a
+#define CCMPLUGINVPN_GETDEFPRIORITYL_ENTRY 0x8a004b
+#define CCMPLUGINVPN_GETDEFPRIORITYL_EXIT 0x8a004c
+
+
+#endif
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmmanager/cmmgr/cmmplugins/cmpluginvpn/traces/fixed_id.definitions	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,79 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_FLOW=0x8a
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_BEARERRECORDIDL_ENTRY=0x2f
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_BEARERRECORDIDL_EXIT=0x30
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_BEARERRECORDNAMELC_ENTRY=0x45
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_BEARERRECORDNAMELC_EXIT=0x46
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY=0x13
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT=0x14
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CCMPLUGINVPN_ENTRY=0x5
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CCMPLUGINVPN_EXIT=0x6
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CONSTRUCTL_ENTRY=0x9
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CONSTRUCTL_EXIT=0xa
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_COPYBEARERRECORDSL_ENTRY=0x2d
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_COPYBEARERRECORDSL_EXIT=0x2e
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_COPYSERVICERECORDL_ENTRY=0x21
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_COPYSERVICERECORDL_EXIT=0x22
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATEBEARERRECORDSL_ENTRY=0x27
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATEBEARERRECORDSL_EXIT=0x28
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATEINSTANCEL_ENTRY=0x3
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATEINSTANCEL_EXIT=0x4
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATESERVICERECORDL_ENTRY=0x1f
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_CREATESERVICERECORDL_EXIT=0x20
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_DELETEBEARERRECORDSL_ENTRY=0x29
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_DELETEBEARERRECORDSL_EXIT=0x2a
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_ENTRY=0x31
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERBOOLATTRIBUTEL_EXIT=0x32
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOBOOLL_ENTRY=0xd
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOBOOLL_EXIT=0xe
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOINTL_ENTRY=0xb
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOINTL_EXIT=0xc
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOSTRING8L_ENTRY=0x11
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOSTRING8L_EXIT=0x12
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOSTRINGL_ENTRY=0xf
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINFOSTRINGL_EXIT=0x10
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_ENTRY=0x1b
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERINTATTRIBUTEL_EXIT=0x1c
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_ENTRY=0x19
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSPECIFICRECORDSL_EXIT=0x1a
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_ENTRY=0x35
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSTRING8ATTRIBUTEL_EXIT=0x36
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_ENTRY=0x33
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERSTRINGATTRIBUTEL_EXIT=0x34
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY=0x17
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT=0x18
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETDEFPRIORITYL_ENTRY=0x4b
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETDEFPRIORITYL_EXIT=0x4c
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_ENTRY=0x49
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_GETVIRTUALBEARERRECORDLC_EXIT=0x4a
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_LOADBEARERRECORDSL_ENTRY=0x25
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_LOADBEARERRECORDSL_EXIT=0x26
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_LOADSERVICERECORDL_ENTRY=0x1d
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_LOADSERVICERECORDL_EXIT=0x1e
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_NEWL_ENTRY=0x1
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_NEWL_EXIT=0x2
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_RESETBEARERRECORDS_ENTRY=0x2b
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_RESETBEARERRECORDS_EXIT=0x2c
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORDID_ENTRY=0x41
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORDID_EXIT=0x42
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORDNAMELC_ENTRY=0x23
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORDNAMELC_EXIT=0x24
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORD_ENTRY=0x47
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SERVICERECORD_EXIT=0x48
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_ENTRY=0x37
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERBOOLATTRIBUTEL_EXIT=0x38
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_ENTRY=0x3b
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERINTATTRIBUTEL_EXIT=0x3c
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_ENTRY=0x39
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERSTRING8ATTRIBUTEL_EXIT=0x3a
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_ENTRY=0x3d
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_SETBEARERSTRINGATTRIBUTEL_EXIT=0x3e
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_UPDATEBEARERRECORDSL_ENTRY=0x43
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_UPDATEBEARERRECORDSL_EXIT=0x44
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_UPDATESERVICERECORDL_ENTRY=0x3f
+[TRACE]TRACE_FLOW[0x8A]_CCMPLUGINVPN_UPDATESERVICERECORDL_EXIT=0x40
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_ENTRY=0x15
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCMPLUGINVPN_CANHANDLEIAPIDL_EXIT=0x16
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCMPLUGINVPN_CCMPLUGINVPN_ENTRY=0x7
+[TRACE]TRACE_FLOW[0x8A]_DUP1_CCMPLUGINVPN_CCMPLUGINVPN_EXIT=0x8
+[[OBSOLETE]][TRACE]TRACE_FATAL[0x81]_CCMPLUGINVPN_LOADBEARERRECORDSL=0x1
--- a/cmmanager/cmmgr/cmmplugins/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cmmgr/cmmplugins/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -28,7 +28,7 @@
 #include "../cmpluginpacketdata/group/bld.inf"
 #include "../cmpluginlan/group/bld.inf"
 #include "../cmpluginwlan/group/bld.inf"
+#include "../cmpluginvpn/group/bld.inf"
 //#include "../cmpluginembdestination/group/bld.inf"
-//#include "../cmpluginvpn/group/bld.inf"
 
 // End of File
--- a/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cmmgr/cmmserver/src/cmmcache.cpp	Mon May 24 20:51:35 2010 +0300
@@ -2421,21 +2421,11 @@
         {
         iTrans->OpenTransactionLC();
 
-        TUint defConnType( 0 );
-        TUint internetSnapId( 0 );
-        iInstanceMapping->InternetDestinationIdL( internetSnapId );
-        if ( internetSnapId )
-            {
-            defConnType = ECmDefConnDestination;
-            }
-
         aGenConnSettings.iUsageOfWlan = ECmUsageOfWlanKnown;
         aGenConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic;
         aGenConnSettings.iCellularDataUsageVisitor = ECmCellularDataUsageConfirm;
 
         defConnRecord->SetRecordId( KCDNewRecordRequest );
-        defConnRecord->iDefConnType = defConnType;
-        defConnRecord->iDefConnUid = internetSnapId;
         defConnRecord->iUsageOfWlan = ( TUint )aGenConnSettings.iUsageOfWlan;
         defConnRecord->iCellularDataUsageHome = ( TUint )aGenConnSettings.iCellularDataUsageHome;
         defConnRecord->iCellularDataUsageVisitor = ( TUint )aGenConnSettings.iCellularDataUsageVisitor;
--- a/cmmanager/cpdestinationplugin/inc/cpadddestinationentryitemdata.h	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/inc/cpadddestinationentryitemdata.h	Mon May 24 20:51:35 2010 +0300
@@ -59,7 +59,6 @@
 	void showErrorNote();
     
 private slots:
-
     void onLaunchView();
 	
 private: // data
@@ -70,10 +69,6 @@
 	HbInputDialog      *mDialog;
 	//! New Destination name query's OK action
 	HbAction           *mOkAction;
-	
-	//! Maximun length for destination name
-	static const int DestinationNameMaxLength = 30;
-	
 };
 
 #endif //CPADDDESTINATIONENTRYITEMDATA_H
--- a/cmmanager/cpdestinationplugin/inc/cpdestinationentryitem.h	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/inc/cpdestinationentryitem.h	Mon May 24 20:51:35 2010 +0300
@@ -63,6 +63,7 @@
 public slots:
     void updateDestinationView();
     void showItemMenu(QPointF position);
+    void openDestination();
     void renameDestination();
     void confirmDestinationDelete();
     void deleteDestination();
@@ -112,9 +113,6 @@
     HbInputDialog      *mDialog;
     //! New Destination name query's OK action
     HbAction           *mOkAction;
-    
-    //! Maximun length for destination name
-    static const int DestinationNameMaxLength = 30;
 };
 
 #endif /* CPDESTINATIONENTRYITEM_H */
--- a/cmmanager/cpdestinationplugin/inc/cpiapitem.h	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/inc/cpiapitem.h	Mon May 24 20:51:35 2010 +0300
@@ -67,6 +67,7 @@
     void queryDialogClosed();
     void deleteConfirmed();
     void updateIap(const QModelIndex index);
+    void openIap();
 
 protected:
     
--- a/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpadddestinationentryitemdata.cpp	Mon May 24 20:51:35 2010 +0300
@@ -61,9 +61,6 @@
     mDialog(0)
 {
     OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_CPADDDESTINATIONENTRYITEMDATA_ENTRY);
-    // Fix connections
-    itemDataHelper.removeConnection(this,SIGNAL(pressed()),this,SLOT(onLaunchView()));
-    itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(onLaunchView()));
     OstTraceFunctionExit0(CPADDDESTINATIONENTRYITEMDATA_CPADDDESTINATIONENTRYITEMDATA_EXIT);
 }
 
@@ -85,17 +82,21 @@
     OstTraceFunctionEntry0(CPADDDESTINATIONENTRYITEMDATA_ONLAUNCHVIEW_ENTRY);
     mDialog = new HbInputDialog();
     mDialog->setAttribute(Qt::WA_DeleteOnClose);
-    mDialog->lineEdit()->setMaxLength(DestinationNameMaxLength);
+    mDialog->lineEdit()->setMaxLength(CMManagerShim::CmNameLength);
     mDialog->clearActions();
     mDialog->setPromptText(hbTrId("txt_occ_dialog_destination_name"));
     mDialog->setInputMode(HbInputDialog::TextInput);
-    mOkAction = new HbAction(hbTrId("txt_common_button_ok"));
+    mOkAction = new HbAction(
+        hbTrId("txt_common_button_ok"),
+        mDialog);
     bool connected = connect(mOkAction, 
                              SIGNAL(triggered()), 
                              this, 
                              SLOT(setNewDestinationName()));
     Q_ASSERT(connected);
-    HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"));
+    HbAction *cancelAction = new HbAction(
+        hbTrId("txt_common_button_cancel"),
+        mDialog);
     mDialog->addAction(mOkAction);
     mDialog->addAction(cancelAction);
     mDialog->show();
@@ -201,7 +202,9 @@
     QString info = hbTrId("txt_occ_info_invalid_name");
     note->setText(info);
     note->setTimeout(HbPopup::NoTimeout);
-    HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok"));
+    HbAction *errorOk = new HbAction(
+        hbTrId("txt_common_button_ok"),
+        note);
     bool connected = connect(
         errorOk,
         SIGNAL(triggered()),
--- a/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpdestinationentryitem.cpp	Mon May 24 20:51:35 2010 +0300
@@ -93,7 +93,6 @@
     OstTraceFunctionEntry0(DUP1_CPDESTINATIONENTRYITEMDATA_CPDESTINATIONENTRYITEMDATA_ENTRY);
     delete mCmm;
     delete mAps;
-    delete mOkAction;
     OstTraceFunctionExit0(DUP1_CPDESTINATIONENTRYITEMDATA_CPDESTINATIONENTRYITEMDATA_EXIT);
 }
 
@@ -216,7 +215,7 @@
         // Add priority to item if not Uncategorised "Destination"
         if (mDestinationId  != 0) {
             // Access Points are listed in priority order.
-            QString priority = hbTrId("txt_occ_dblist_val_priority_l1", i);
+            QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(i + 1);
             iapDataItem->setContentWidgetData(QString("additionalText"), priority);
         }
         
@@ -294,6 +293,14 @@
 }
 
 /*!
+   Opens selected destination.
+ */
+void CpDestinationEntryItemData::openDestination()
+{    
+    onLaunchView();
+}
+
+/*!
     Prompts user for new destination name and makes 
     the change in commsdat if new name is valid.
     
@@ -304,17 +311,22 @@
     OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_RENAMEDESTINATION_ENTRY);
     mDialog = new HbInputDialog();
     mDialog->setAttribute(Qt::WA_DeleteOnClose);
-    mDialog->lineEdit()->setMaxLength(DestinationNameMaxLength);
+    mDialog->lineEdit()->setMaxLength(CMManagerShim::CmNameLength);
     mDialog->clearActions();
     mDialog->setPromptText(hbTrId("txt_occ_dialog_destination_name"));
     mDialog->setInputMode(HbInputDialog::TextInput);
-    mOkAction = new HbAction(hbTrId("txt_common_button_ok"));
+    mDialog->setValue(mDestinationName);
+    mOkAction = new HbAction(
+        hbTrId("txt_common_button_ok"),
+        mDialog);
     bool connected = connect(mOkAction, 
                              SIGNAL(triggered()), 
                              this, 
                              SLOT(saveNewDestinationName()));
     Q_ASSERT(connected);
-    HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"));
+    HbAction *cancelAction = new HbAction(
+        hbTrId("txt_common_button_cancel"),
+        mDialog);
     mDialog->addAction(mOkAction);
     mDialog->addAction(cancelAction);
     mDialog->show();
@@ -332,7 +344,9 @@
     note->setAttribute(Qt::WA_DeleteOnClose);
     note->setText(hbTrId("txt_occ_info_delete_snap").arg(mDestinationName));
     note->clearActions();
-    HbAction *okAction = new HbAction(hbTrId("txt_common_button_yes"));
+    HbAction *okAction = new HbAction(
+        hbTrId("txt_common_button_yes"),
+        note);
     note->addAction(okAction);
     bool connected = connect(
         okAction, 
@@ -340,7 +354,9 @@
         this, 
         SLOT(deleteDestination()));
     Q_ASSERT(connected);
-    HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_no"));
+    HbAction *cancelAction = new HbAction(
+        hbTrId("txt_common_button_no"),
+        note);
     note->addAction(cancelAction);
     note->setTimeout(HbPopup::NoTimeout);
     note->show();
@@ -496,7 +512,7 @@
     Q_UNUSED(widgetItem);
     for (int i = 0; i < mList->count(); i++) {
         HbListWidgetItem *item = mList->item(i);
-        QString priority = hbTrId("txt_occ_dblist_val_priority_l1", i);
+        QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(i + 1);
         item->setSecondaryText(priority);
     }
     OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_UPDATEINDEX_EXIT);
@@ -609,7 +625,7 @@
             item->setData(apList[i]->getIntAttribute(CMManagerShim::CmId), Hb::IndexFeedbackRole);
 
             uint pri = destination->priority(apList[i].data());
-            QString priority = hbTrId("txt_occ_dblist_val_priority_l1", pri);
+            QString priority = hbTrId("txt_occ_dblist_val_priority_l1").arg(pri);
             item->setSecondaryText(priority);
         
             mList->addItem(item);
@@ -653,8 +669,12 @@
     OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_CREATEITEMMENU_ENTRY);
     HbMenu *menu = new HbMenu();
     menu->setAttribute(Qt::WA_DeleteOnClose);
+    HbAction *openDestAction = menu->addAction(hbTrId("txt_common_menu_open"));
+    bool connected = 
+        connect(openDestAction, SIGNAL(triggered()), this, SLOT(openDestination()));
+    Q_ASSERT(connected);
     HbAction *renameDestAction = menu->addAction(hbTrId("txt_common_menu_rename_item"));
-    bool connected = 
+    connected = 
         connect(renameDestAction, SIGNAL(triggered()), this, SLOT(renameDestination()));
     Q_ASSERT(connected);
     HbAction *deleteDestAction = menu->addAction(hbTrId("txt_common_menu_delete"));
@@ -678,41 +698,44 @@
 
 /*!
     This function is called when user selects OK from destination
-    name query popup. The given name is valited and if the name is
-    valid, new destination is created in commsdat with given name.
-    If validation fails user is promted again for destination name.
+    name query popup. The given name is validated and if the name is
+    valid, new destination name is saved to commsdat. If validation fails
+    user is prompted again for destination name.
  */
 void CpDestinationEntryItemData::saveNewDestinationName()
 {
     OstTraceFunctionEntry0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_ENTRY);
     QString destinationName = mDialog->value().toString();
-    bool destinationNameInvalid = true;
-    CmManagerShim *cmm = NULL;
-    CmDestinationShim *destination = NULL;
-    
-    try {
-        cmm = new CmManagerShim();
-        if (isDestinationNameValid(destinationName, cmm)) {
-            destination = cmm->destination(mDestinationId);
-            destination->setName(destinationName);
-            destination->update();
-            mDestinationName = destinationName;
-            destinationNameInvalid = false;
+    if (destinationName != mDestinationName) {
+        // Destination name was changed
+        bool destinationNameInvalid = true;
+        CmManagerShim *cmm = NULL;
+        CmDestinationShim *destination = NULL;
+        
+        try {
+            cmm = new CmManagerShim();
+            if (isDestinationNameValid(destinationName, cmm)) {
+                destination = cmm->destination(mDestinationId);
+                destination->setName(destinationName);
+                destination->update();
+                mDestinationName = destinationName;
+                destinationNameInvalid = false;
+            }
+        } catch (const std::exception&) {
+            OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT);
+            return;
         }
-    } catch (const std::exception&) {
-        OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT);
-        return;
-    }
-    delete destination;
-    delete cmm;
-    
-    if (destinationNameInvalid) {   
-        // Validation function has modified destination name 
-        // to be error string
-        showRenameError(destinationName);
-    } else {
-        OstTrace0(TRACE_NORMAL, CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME, "CpDestinationEntryItemData::saveNewDestinationName: emit destination changed");
-        emit destChanged();
+        delete destination;
+        delete cmm;
+        
+        if (destinationNameInvalid) {   
+            // Validation function has modified destination name 
+            // to be error string
+            showRenameError(destinationName);
+        } else {
+            OstTrace0(TRACE_NORMAL, CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME, "CpDestinationEntryItemData::saveNewDestinationName: emit destination changed");
+            emit destChanged();
+        }
     }
     OstTraceFunctionExit0(DUP1_CPDESTINATIONENTRYITEMDATA_SAVENEWDESTINATIONNAME_EXIT);
 }
@@ -730,7 +753,9 @@
     note->setAttribute(Qt::WA_DeleteOnClose);
     note->setText(info);
     note->setTimeout(HbPopup::NoTimeout);
-    HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok"));
+    HbAction *errorOk = new HbAction(
+        hbTrId("txt_common_button_ok"),
+        note);
     bool connected = connect(
         errorOk,
         SIGNAL(triggered()),
@@ -755,7 +780,9 @@
     note->setAttribute(Qt::WA_DeleteOnClose);
     note->setText(info);
     note->setTimeout(HbPopup::NoTimeout);
-    HbAction *errorOk = new HbAction(hbTrId("txt_common_button_ok"));                       
+    HbAction *errorOk = new HbAction(
+        hbTrId("txt_common_button_ok"),
+        note);
     note->addAction(errorOk);
     note->show();    
     OstTraceFunctionExit0(CPDESTINATIONENTRYITEMDATA_SHOWERRORNOTE_EXIT);
--- a/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpdestinationgroup.cpp	Mon May 24 20:51:35 2010 +0300
@@ -20,7 +20,7 @@
 #include <QDir>
 #include <QPluginLoader>
 #include <QStringList>
-#include <HbDataform>
+#include <HbDataForm>
 #include <HbDataFormModel>
 #include <HbDataFormViewItem>
 #include <HbParameterLengthLimiter>
@@ -326,8 +326,7 @@
     OstTraceFunctionEntry0(CPDESTINATIONGROUP_GETDESTINATIONADDITIONALTEXT_ENTRY);
     QString result = "";
     if (iapCount > 0) {
-        //result = hbTrId("txt_occ_dblist_internet_val_ln_access_points", iapCount);
-        result = HbParameterLengthLimiter("txt_occ_dblist_internet_val_ln_access_points").arg(iapCount);
+        result = hbTrId("txt_occ_dblist_internet_val_ln_access_points", iapCount);
     } else {
         result = hbTrId("txt_occ_dblist_internet_val_no_access_points");
     }
--- a/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Mon May 24 20:51:35 2010 +0300
@@ -77,10 +77,10 @@
     bool apProtected,
     CpBearerApPluginInterface *bearerPlugin) :
     CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
-    mItemDataHelper(&itemDataHelper),
     mIapId(iapId), 
     mIapName(iapName),
     mDestId(destId),
+    mItemDataHelper(&itemDataHelper),
     mBearerPlugin(bearerPlugin),
     mMoveOngoing(false),
     mDialog(0),
@@ -270,6 +270,14 @@
 }
 
 /*!
+    Opens Iap settings view.
+ */
+void CpIapItem::openIap()
+{
+    onLaunchView();
+}
+
+/*!
     Gets access point specific view from bearer plugin.
     
     \return Returns settings view containing access point settings.
@@ -280,12 +288,19 @@
     CpBaseSettingView *view = NULL;
     CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
     if (mBearerPlugin != NULL) {
-        CpIapItem *iap = const_cast<CpIapItem*>(this);
-        itemDataHelper->connectToForm( 
-            SIGNAL(itemShown(const QModelIndex)),
-            iap, 
-            SLOT(updateIap(const QModelIndex)));
-        view = mBearerPlugin->createSettingView(mIapId);
+        CmConnectionMethodShim *cm = mCmm->connectionMethod(mIapId);
+        bool cmConnected = cm->getBoolAttribute(CMManagerShim::CmConnected);
+        delete cm;
+        
+        // Do not open connected AP
+        if (!cmConnected) {
+            CpIapItem *iap = const_cast<CpIapItem*>(this);
+            itemDataHelper->connectToForm( 
+                SIGNAL(itemShown(const QModelIndex)),
+                iap, 
+                SLOT(updateIap(const QModelIndex)));
+            view = mBearerPlugin->createSettingView(mIapId);
+        }
     }
     delete itemDataHelper;
     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
@@ -447,9 +462,13 @@
     OstTraceFunctionEntry0(CPIAPITEM_CREATEITEMMENU_ENTRY);
     HbMenu* menu = new HbMenu();
     menu->setAttribute(Qt::WA_DeleteOnClose);
+    HbAction* openIapAction 
+            = menu->addAction(hbTrId("txt_common_menu_open"));
+    bool connected = connect(openIapAction, SIGNAL(triggered()), this, SLOT(openIap()));
+    Q_ASSERT(connected);
     HbAction* moveIapAction 
         = menu->addAction(hbTrId("txt_occ_menu_move_to_other_destination"));
-    bool connected = connect(moveIapAction, SIGNAL(triggered()), this, SLOT(moveIap()));
+    connected = connect(moveIapAction, SIGNAL(triggered()), this, SLOT(moveIap()));
     Q_ASSERT(connected);
     HbAction* deleteIapAction 
         = menu->addAction(hbTrId("txt_common_menu_delete"));
@@ -466,6 +485,7 @@
        
     if (cmConnected) {
         // Disable operations for connected APs
+        openIapAction->setDisabled(true);
         moveIapAction->setDisabled(true);
         deleteIapAction->setDisabled(true);
         shareIapAction->setDisabled(true);
--- a/cmmanager/cpipsettingsplugin/src/cpipsettingsview.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpipsettingsplugin/src/cpipsettingsview.cpp	Mon May 24 20:51:35 2010 +0300
@@ -11,7 +11,8 @@
 *
 * Contributors:
 *
-* Description:  
+* Description: 
+* Control Panel "Network Settings" view implementation.
 *
 */
 
@@ -38,6 +39,7 @@
 static const QString ipSettingsPlugins[] = {
     "cpwlansettingsplugin.qtplugin",
     "cpdestinationplugin.qtplugin",
+    "videosettingsplugin.qtplugin",
     "cpvpnmanagementplugin.qtplugin",
     "" // empty item terminates the list
 };
--- a/cmmanager/cppacketdataapplugin/inc/cppacketdataapadvancedview.h	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/inc/cppacketdataapadvancedview.h	Mon May 24 20:51:35 2010 +0300
@@ -150,6 +150,9 @@
     bool mIpv6Supported;
     //! Current network type (IPv4/IPv6)
     NetworkType mCurrentNetworkType;
+    
+    // Friend classes
+    friend class TestCpPacketDataApPlugin;
 };
 
 #endif // CPPACKETDATAAPADVANCEDVIEW_H
--- a/cmmanager/cppacketdataapplugin/tsrc/ut/hbautotest.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/tsrc/ut/hbautotest.cpp	Mon May 24 20:51:35 2010 +0300
@@ -48,8 +48,7 @@
             Qt::NoButton, 
             Qt::NoModifier);
             QSpontaneKeyEvent::setSpontaneous(&me);
-            qApp->notify((window->viewport()), &me);
-            QCoreApplication::sendPostedEvents();
+            QCoreApplication::sendEvent(window->viewport(), &me);
             QTest::qWait(1);
     } else {
             HbAutoTestMouseEvent me (
@@ -60,8 +59,7 @@
             Qt::NoButton, 
             Qt::NoModifier);
             QSpontaneKeyEvent::setSpontaneous(&me);
-            qApp->notify((window->viewport()), &me);
-            QCoreApplication::sendPostedEvents();
+            QCoreApplication::sendEvent(window->viewport(), &me);
             QTest::qWait(1);
 
     }
@@ -94,9 +92,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
     QTest::qWait(1);
 }
 
@@ -123,8 +119,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
 
     QTest::qWait(1);
     QTest::qWait(1);
@@ -152,15 +147,12 @@
     Qt::LeftButton, 
     Qt::NoModifier);
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
-    //QTime currentTime = QTime::currentTime();
-    //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button down";
-    QTest::qWait(1);
+    QCoreApplication::sendEvent(window->viewport(), &me);
 
     if (delay!=-1) {
         QTest::qWait(delay);
     }
+
     HbAutoTestMouseEvent me2 (
     QEvent::MouseButtonRelease, 
     targetPoint.toPoint(), 
@@ -170,10 +162,7 @@
     Qt::NoModifier);
 
     QSpontaneKeyEvent::setSpontaneous(&me2);
-    qApp->notify((window->viewport()), &me2);
-    QCoreApplication::sendPostedEvents();
-    //currentTime = QTime::currentTime();
-    //qDebug() << currentTime.toString("hh:mm:ss.zzz") << ": Left button up";
+    QCoreApplication::sendEvent(window->viewport(), &me2);
 
     QTest::qWait(1);
     QTest::qWait(1);
@@ -221,8 +210,8 @@
                             Qt::NoModifier);   
 
         QSpontaneKeyEvent::setSpontaneous(&me);
-        qApp->notify((window->viewport()), &me);
-        QCoreApplication::sendPostedEvents();
+        QCoreApplication::sendEvent(window->viewport(), &me);
+        QTest::qWait(1);
     }
 
     QCursor::setPos(window->mapToGlobal(targetPoint.toPoint()));
@@ -235,8 +224,7 @@
                             Qt::LeftButton, 
                             Qt::NoModifier);   
     QSpontaneKeyEvent::setSpontaneous(&me);
-    qApp->notify((window->viewport()), &me);
-    QCoreApplication::sendPostedEvents();
+    QCoreApplication::sendEvent(window->viewport(), &me);
 }
 
 
@@ -255,7 +243,7 @@
 
         HbAutoTestKeyEvent a(press ? QEvent::KeyPress : QEvent::KeyRelease, code, modifier, text, repeat);
         QSpontaneKeyEvent::setSpontaneous(&a);
-        if (!qApp->notify(widget, &a))
+        if (!QCoreApplication::sendEvent(widget, &a))
             QTest::qWarn("Keyboard event not accepted by receiving widget");
     }
 
--- a/cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.cpp	Mon May 24 20:51:35 2010 +0300
@@ -24,12 +24,17 @@
 #include <HbDataForm>
 #include <HbDataFormModel>
 #include <HbDataFormModelItem>
+#include <HbDataFormViewItem>
+#include <HbModelIterator>
+#include <HbComboBox>
 #include <QtTest/QtTest>
+#include <etelpckt.h>
 #include <cpbearerapplugininterface.h>
 #include <cmmanager_shim.h>
 #include <cmconnectionmethod_shim.h>
 
 #include "cppacketdataapview.h"
+#include "cppacketdataapadvancedview.h"
 
 #include "hbautotest.h"
 #include "testcppacketdataapplugin.h"
@@ -50,28 +55,30 @@
 static const int waitTime = 10;
 
 // UI coordinates
-static const QPoint sideTop(350, 60);
-static const QPoint scrollStart(350, 300);
-static const QPoint scrollStop(350, 240);
+static const QPoint scrollMiddle(350, 280);
+static const QPoint scrollTop(350, 30);
+static const QPoint scrollBottom(350, 540);
 
-static const QPoint messageBoxOkButton(170, 320);
-
-// These are measured when view is scrolled to top
-static const QPoint connectionNameLineEdit(330, 110);
-
-static const QPoint accessPointNameLineEdit(330, 190);
+// Use positive offset if dropdown opens under the combobox
+static const QPoint comboBoxFirstItemOffset(80, 75);
+static const QPoint comboBoxItemOffset(0, 51);
+// Use negative offset if dropdown opens above the combobox
+static const QPoint comboBoxFirstItemNegativeOffset(80, -29);
+static const QPoint comboBoxItemNegativeOffset(0, -51);
 
-static const QPoint userNameLineEdit(330, 265);
+static const QPoint exitEditorOffset(-10, -20);
 
-// These are measured when view is scrolled to bottom
-static const QPoint passwordPromptCheckbox(50, 295);
-static const QPoint passwordLineEdit(330, 380);
+static const QPoint messageBoxOkButtonOffset(160, 140);
 
-static const QPoint authenticationComboBox(175, 470);
-static const QPoint authenticationSecure(100, 420);
-static const QPoint authenticationNormal(100, 365);
+// Advanced settings groups
+static const QPoint ipGroup(160, 10);
+static const QPoint proxyGroup(160, 60);
 
-static const QPoint homepageLineEdit(330, 555);
+// Test strings
+static const QString tooLongUserName =
+    "too long name 123456789012345678901234567890123456THISISEXTRA";
+static const QString truncatedUserName =
+    "too long name 123456789012345678901234567890123456";
 
 // -----------------------------------------------------------------------------
 // FRAMEWORK FUNCTIONS
@@ -111,15 +118,20 @@
     
     // Load plugin
     QDir dir(pluginDir);
-    QPluginLoader loader(dir.absoluteFilePath(pluginName));
-    mPlugin = qobject_cast<CpBearerApPluginInterface *>(loader.instance());
+    mPluginLoader = new QPluginLoader(dir.absoluteFilePath(pluginName));
+    mPlugin = qobject_cast<CpBearerApPluginInterface *>(mPluginLoader->instance());
     QVERIFY(mPlugin != NULL);
     
     // Verify plugin bearer type
     QVERIFY(mPlugin->bearerType() == CMManagerShim::BearerTypePacketData);
     
+    // Write initial settings to CommsDat
+    subInitializeCommsDat();
+    
     // Create packet data settings view (connection method ID given)
     subCreateSettingsView(testApId);
+    
+    subGetUiWidgets();
 }
 
 /**
@@ -129,6 +141,11 @@
 {
     delete mMainWindow;
     mMainWindow = 0;
+    
+    // Force unloading of plugin
+    mPluginLoader->unload();
+    delete mPluginLoader;
+    mPluginLoader = 0;
 }
 
 /**
@@ -158,15 +175,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::CmNameLength);
+    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -184,11 +202,11 @@
     QTest::addColumn<QString>("result");
     
     QTest::newRow("maximum length")
-        << "really long name 1234567890123"
-        << "really long name 1234567890123";
+        << "really long name 123456789012345678901234567890123"
+        << "really long name 123456789012345678901234567890123";
     QTest::newRow("too long")
-        << "too long name 123456789012345678901234567890"
-        << "too long name 1234567890123456";
+        << "too long name 12345678901234567890123456789012345678901234"
+        << "too long name 123456789012345678901234567890123456";
     QTest::newRow("basic") // last one must always fit on one line in UI
         << "test packet AP"
         << "test packet AP";
@@ -202,16 +220,20 @@
     QString previous = 
         mTestView->mConnectionNameItem->contentWidgetData("text").toString();
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, connectionNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::CmNameLength);
+    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
 
     QTest::qWait(100);
     // Dismiss messagebox
-    HbAutoTest::mouseClick(mMainWindow, mTestView, messageBoxOkButton);
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestView->mMessageBox.data(),
+        messageBoxOkButtonOffset);
     
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -228,15 +250,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, accessPointNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::PacketDataAPNameLength);
+    QString text = mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -272,16 +295,20 @@
     QString previous = 
         mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, accessPointNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::PacketDataAPNameLength);
+    QString text = mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget, exitEditorOffset);
 
     QTest::qWait(100);
     // Dismiss messagebox
-    HbAutoTest::mouseClick(mMainWindow, mTestView, messageBoxOkButton);
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestView->mMessageBox.data(),
+        messageBoxOkButtonOffset);
     
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -290,6 +317,33 @@
         previous);
 }
 
+
+/**
+ * Tests handling of too long string from CommsDat (longer than UI accepts).
+ */
+void TestCpPacketDataApPlugin::tcTooLongUserNameInCommsDat()
+{
+    // Verify UI text, the widget contains the too long string, even though
+    // it is not shown completely on UI
+    QString text = mTestView->mUserNameItem->contentWidgetData("text").toString();
+    QCOMPARE(tooLongUserName, text);
+
+    QTest::qWait(1000);
+    
+    // Visit editing state, truncated string should be saved to CommsDat
+    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget);
+    
+    QTest::qWait(1000);
+    
+    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIFAuthName,
+        mTestView->mUserNameItem,
+        truncatedUserName);
+}
+
 /**
  * Tests changing of user name.
  */
@@ -298,15 +352,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, userNameLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::PacketDataIFAuthNameLength);
+    QString text = mTestView->mUserNameItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -323,13 +378,12 @@
     QTest::addColumn<QString>("string");
     QTest::addColumn<QString>("result");
 
-// Long strings don't work, Orbit bug? Screen goes blank
-//    QTest::newRow("maximum length")
-//        << "really long name 123456789012345678901234567890123"
-//        << "really long name 123456789012345678901234567890123";
-//    QTest::newRow("too long")
-//        << "too long name 1234567890123456789012345678901234567890123"
-//        << "too long name 123456789012345678901234567890123456";
+    QTest::newRow("maximum length")
+        << "really long name 123456789012345678901234567890123"
+        << "really long name 123456789012345678901234567890123";
+    QTest::newRow("too long")
+        << "too long name 1234567890123456789012345678901234567890123"
+        << "too long name 123456789012345678901234567890123456";
     QTest::newRow("basic")
         << "username"
         << "username";
@@ -343,11 +397,7 @@
  */
 void TestCpPacketDataApPlugin::tcScrollToBottom()
 {
-    // Scroll to the bottom of the view
-    HbAutoTest::mousePress(mMainWindow, mTestView, scrollStart);
-    QTest::qWait(500);
-    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollStop);
-    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollStop);
+    subScrollToBottom();
 }
 
 /**
@@ -359,25 +409,22 @@
     bool prompt = subGetBool(CMManagerShim::PacketDataIFPromptForAuth);
     if (prompt) {
         // Disable prompt for password
-        HbAutoTest::mouseClick(
-            mMainWindow,
-            mTestView,
-            passwordPromptCheckbox);
+        HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
     }
     
     // Enable prompt for password and verify
-    HbAutoTest::mouseClick(mMainWindow, mTestView, passwordPromptCheckbox);
+    HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
     subVerifyBool(
         CMManagerShim::PacketDataIFPromptForAuth,
         true);
     
     // Verify that password lineedit is disabled, following steps will
     // fail if editing is allowed
-    HbAutoTest::mouseClick(mMainWindow, mTestView, passwordLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget);
     QTest::qWait(waitTime);
 
     // Disable prompt for password and verify
-    HbAutoTest::mouseClick(mMainWindow, mTestView, passwordPromptCheckbox);
+    HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
     subVerifyBool(
         CMManagerShim::PacketDataIFPromptForAuth,
         false);
@@ -391,15 +438,16 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, passwordLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget);
     
     // Erase old string
-    subClearLineEdit(CMManagerShim::PacketDataIFAuthPassLength);
+    QString text = mTestView->mPasswordItem->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
     
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -416,13 +464,12 @@
     QTest::addColumn<QString>("string");
     QTest::addColumn<QString>("result");
 
-// Long strings don't work, Orbit bug? Screen goes blank
-//    QTest::newRow("maximum length")
-//        << "really long name 123456789012345678901234567890123"
-//        << "really long name 123456789012345678901234567890123";
-//    QTest::newRow("too long")
-//        << "too long name 1234567890123456789012345678901234567890123"
-//        << "too long name 123456789012345678901234567890123456";
+    QTest::newRow("maximum length")
+        << "really long name 123456789012345678901234567890123"
+        << "really long name 123456789012345678901234567890123";
+    QTest::newRow("too long")
+        << "too long name 1234567890123456789012345678901234567890123"
+        << "too long name 123456789012345678901234567890123456";
     QTest::newRow("basic")
         << "password"
         << "password";
@@ -436,19 +483,22 @@
  */
 void TestCpPacketDataApPlugin::tcChangeAuthenticationMode()
 {
+    QPointF normalPointOffset = comboBoxFirstItemOffset;
+    QPointF securePointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
+    
     // Set authentication mode to secure
-    HbAutoTest::mouseClick(mMainWindow, mTestView, authenticationComboBox, 100);
+    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
     QTest::qWait(100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, authenticationSecure, 100);
+    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, securePointOffset);
 
     subVerifyBool(
         CMManagerShim::PacketDataDisablePlainTextAuth,
         true);
     
     // Set authentication mode to normal
-    HbAutoTest::mouseClick(mMainWindow, mTestView, authenticationComboBox, 100);
+    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
     QTest::qWait(100);
-    HbAutoTest::mouseClick(mMainWindow, mTestView, authenticationNormal, 100);
+    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, normalPointOffset);
 
     subVerifyBool(
         CMManagerShim::PacketDataDisablePlainTextAuth,
@@ -463,7 +513,7 @@
     QFETCH(QString, string);
     QFETCH(QString, result);
     
-    HbAutoTest::mouseClick(mMainWindow, mTestView, homepageLineEdit);
+    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget);
     
     // Erase old string
     QString text = mTestView->mHomepageItem->contentWidgetData("text").toString();
@@ -472,7 +522,7 @@
     // Enter new string
     HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
 
-    HbAutoTest::mouseClick(mMainWindow, mTestView, sideTop);
+    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget, exitEditorOffset);
 
     // Verify both commsdat and UI widget
     subVerifyString(
@@ -489,10 +539,9 @@
     QTest::addColumn<QString>("string");
     QTest::addColumn<QString>("result");
   
-// Doesn't work always, view goes blank sometimes, Orbit bug?
-//    QTest::newRow("long")
-//        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
-//        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
+    QTest::newRow("long")
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
     QTest::newRow("basic") // last one should always fit on one line in UI
         << "http://www.symbian.org/"
         << "http://www.symbian.org/";
@@ -502,9 +551,9 @@
 }
 
 /**
- * Tests advanced settings view (which is currently empty).
+ * Opens advanced settings view.
  */
-void TestCpPacketDataApPlugin::tcAdvancedSettings()
+void TestCpPacketDataApPlugin::tcOpenAdvancedSettingsView()
 {
     // Launch advanced settings view
     bool status = connect(
@@ -515,8 +564,622 @@
     Q_ASSERT(status);
     emit menuActionTriggered(mTestView->mAdvancedSettingsAction);
 
-    QTest::qWait(2000);
+    QTest::qWait(1000);
+    
+    mTestViewAdvanced = static_cast<CpPacketDataApAdvancedView *>(mMainWindow->currentView());
+}
+
+/**
+ * Expands the IP settings group.
+ */
+void TestCpPacketDataApPlugin::tcExpandIpSettings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
+    
+    subGetAdvancedUiWidgets(0);
+}
+
+/**
+ * Sets the network type to IPv4 and gets UI widget pointers.
+ */
+void TestCpPacketDataApPlugin::tcSetIpv4NetworkType()
+{
+    QPointF ipv4PointOffset = comboBoxFirstItemOffset;
+    
+    // Set network type to IPv4
+    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv4PointOffset, 100);
+    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv4);
+    
+    subGetAdvancedUiWidgets(0);
+}
+
+/**
+ * Tests enabling of automatic phone IP address.
+ */
+void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4Address()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IP address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    }
+    // Enable automatic IP address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    subVerifyBool(
+        CMManagerShim::PacketDataIPAddrFromServer,
+        true);
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
+}
+
+/**
+ * Tests disabling of automatic phone IP address.
+ */
+void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4Address()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IP address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
+    }
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpAddress().
+}
+
+/**
+ * Tests changing of IP address.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4Address->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPAddr,
+        mTestViewAdvanced->mIpv4Address,
+        result);
+    subVerifyBool(
+        CMManagerShim::PacketDataIPAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IP address change test case.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Scrolls the tested view to the bottom.
+ */
+void TestCpPacketDataApPlugin::tcScrollToBottom2()
+{
+    subScrollToBottom();
+    
+    subGetAdvancedUiWidgets(0);
+}
+
+/**
+ * Tests enabling of automatic IPv4 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4DnsAddress()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IPv4 DNS address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    }
+    // Enable automatic IPv4 DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    subVerifyBool(
+        CMManagerShim::PacketDataIPDNSAddrFromServer,
+        true);
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests disabling of automatic IPv4 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4DnsAddress()
+{
+    Qt::CheckState state = static_cast<Qt::CheckState>
+        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
+    if (state == Qt::Checked) {
+        // Disable automatic IPv4 DNS address
+        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
+    }
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpv4DnsAddress().
+}
+
+/**
+ * Tests changing of IPv4 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    // Primary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPNameServer1,
+        mTestViewAdvanced->mIpv4DnsAddress1,
+        result);
+    
+    // Secondary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
+    
+    // Erase old string
+    text = mTestViewAdvanced->mIpv4DnsAddress2->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPNameServer2,
+        mTestViewAdvanced->mIpv4DnsAddress2,
+        result);
+    
+    // Verify user defined address is in use
+    subVerifyBool(
+        CMManagerShim::PacketDataIPDNSAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IPv4 DNS address change test case.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("too long")
+        << "255.255.255.2551234"
+        << "255.255.255.255";
+    QTest::newRow("normal")
+        << "192.168.0.1"
+        << "192.168.0.1";
+}
+
+/**
+ * Tests invalid IPv4 DNS address.
+ */
+void TestCpPacketDataApPlugin::tcInvalidIpv4DnsAddress()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPNameServer1,
+        mTestViewAdvanced->mIpv4DnsAddress1,
+        previous);
+}
+
+/**
+ * Scrolls the tested view to the top.
+ */
+void TestCpPacketDataApPlugin::tcScrollToTop()
+{
+    subScrollToTop();
+}
+
+/**
+ * Sets the network type to IPv6 and gets UI widget pointers.
+ */
+void TestCpPacketDataApPlugin::tcSetIpv6NetworkType()
+{
+    QPointF ipv6PointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
+    
+    // Set network type to IPv6
+    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
+    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv6PointOffset, 100);
+    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv6);
+
+    subGetAdvancedUiWidgets(0);
+}
+
+/**
+ * Tests enabling of automatic IPv6 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcEnableAutomaticIpv6DnsAddress()
+{
+    // Enable automatic IPv6 DNS address
+    QPointF automaticPointOffset = comboBoxFirstItemOffset;
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, automaticPointOffset, 100);
+    QTest::qWait(100);
+    subVerifyBool(
+        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
+        true);
     
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests enabling of well-known IPv6 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcEnableWellKnownIpv6DnsAddress()
+{
+    // Enable well-known IPv6 DNS address
+    QPointF wellKnownPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, wellKnownPointOffset, 100);
+    QTest::qWait(100);
+    subVerifyBool(
+        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
+        false);
+    subVerifyString(
+        CMManagerShim::PacketDataIPIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        "fec0:000:0000:ffff::1");
+    subVerifyString(
+        CMManagerShim::PacketDataIPIP6NameServer2,
+        mTestViewAdvanced->mIpv6DnsAddress2,
+        "fec0:000:0000:ffff::2");
+    
+    // Ensure that editing the IP address is not allowed
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+}
+
+/**
+ * Tests enabling of user defined IPv6 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv6DnsAddress()
+{
+    // Select user defined IPv6 DNS address
+    QPointF userDefinedPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset * 2;
+    //QPointF userDefinedPointOffset(0, 160);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
+    QTest::qWait(100);
+    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, userDefinedPointOffset, 100);
+    QTest::qWait(100);
+    // Can't verify the setting from CommsDat here, because CMManager will
+    // set it back to true if no valid IP address is yet defined. The flag
+    // is verified in tcChangeIpv4DnsAddress().
+}
+
+/**
+ * Tests changing of IPv6 DNS addresses.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    // Primary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        result);
+    
+    // Secondary DNS address
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
+    
+    // Erase old string
+    text = mTestViewAdvanced->mIpv6DnsAddress2->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPIP6NameServer2,
+        mTestViewAdvanced->mIpv6DnsAddress2,
+        result);
+    
+    // Verify user defined address is in use
+    subVerifyBool(
+        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
+        false);
+}
+
+/**
+ * Test data for IPv6 DNS address change test case.
+ */
+void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("normal")
+        << "2001:db8:85a3::8a2e:370:7334"
+        << "2001:db8:85a3:0:0:8a2e:370:7334";
+}
+
+/**
+ * Tests invalid IPv6 DNS address.
+ */
+void TestCpPacketDataApPlugin::tcInvalidIpv6DnsAddress()
+{
+    QString previous = 
+        mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "abcdef:fedcba", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::PacketDataIPIP6NameServer1,
+        mTestViewAdvanced->mIpv6DnsAddress1,
+        previous);
+}
+
+/**
+ * Collapses the IP settings group.
+ */
+void TestCpPacketDataApPlugin::tcCollapseIpSettings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
+}
+
+/**
+ * Expands the proxy settings group and gets UI widget pointers.
+ */
+void TestCpPacketDataApPlugin::tcExpandProxySettingsAndGetUiWidgets()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
+
+    QTest::qWait(500);
+    
+    subGetAdvancedUiWidgets(1);
+}
+
+/**
+ * Tests changing of proxy server address.
+ */
+void TestCpPacketDataApPlugin::tcChangeProxyServerAddress()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyServer->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyString(
+        CMManagerShim::CmProxyServerName,
+        mTestViewAdvanced->mProxyServer,
+        result);
+    // Verify user defined address flag is set correctly
+    if (result.isEmpty()) {
+        subVerifyBool(
+            CMManagerShim::CmProxyUsageEnabled,
+            false);
+    } else {
+        subVerifyBool(
+            CMManagerShim::CmProxyUsageEnabled,
+            true);
+    }
+}
+
+/**
+ * Test data for proxy server address change test case.
+ */
+void TestCpPacketDataApPlugin::tcChangeProxyServerAddress_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("long")
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
+        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
+    QTest::newRow("empty")
+        << ""
+        << "";
+    QTest::newRow("basic") // last one should always fit on one line in UI
+        << "http://www.symbian.org/"
+        << "http://www.symbian.org/";
+}
+
+/**
+ * Tests changing of proxy port number.
+ */
+void TestCpPacketDataApPlugin::tcChangeProxyPortNumber()
+{
+    QFETCH(QString, string);
+    QFETCH(QString, result);
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
+
+    // Verify both commsdat and UI widget
+    subVerifyUint(
+        CMManagerShim::CmProxyPortNumber,
+        result.toInt());
+    QCOMPARE(
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
+        result.toInt());
+}
+
+/**
+ * Test data for proxy port number change test case.
+ */
+void TestCpPacketDataApPlugin::tcChangeProxyPortNumber_data()
+{
+    QTest::addColumn<QString>("string");
+    QTest::addColumn<QString>("result");
+  
+    QTest::newRow("basic")
+        << "8080"
+        << "8080";
+    QTest::newRow("too long")
+        << "1234567890"
+        << "12345";
+    QTest::newRow("zero")
+        << "0"
+        << "";
+    QTest::newRow("empty")
+        << ""
+        << "";
+}
+
+/**
+ * Tests invalid proxy port number.
+ */
+void TestCpPacketDataApPlugin::tcInvalidProxyPortNumber()
+{
+    int previous = 
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt();
+    
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
+    
+    // Erase old string
+    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
+    subClearLineEdit(text.size());
+    
+    // Enter new string
+    HbAutoTest::keyClicks(mMainWindow, "65536", 0, waitTime);
+
+    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
+
+    QTest::qWait(100);
+    // Dismiss messagebox
+    HbAutoTest::mouseClick(
+        mMainWindow,
+        mTestViewAdvanced->mMessageBox.data(),
+        messageBoxOkButtonOffset);
+    
+    // Verify both commsdat and UI widget
+    subVerifyUint(
+        CMManagerShim::CmProxyPortNumber,
+        previous);
+    QCOMPARE(
+        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
+        previous);
+}
+
+/**
+ * Collapses the proxy settings group.
+ */
+void TestCpPacketDataApPlugin::tcCollapseProxySettings()
+{
+    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
+}
+
+/**
+ * Returns from advanced settings view.
+ */
+void TestCpPacketDataApPlugin::tcCloseAdvancedSettingsView()
+{
     // Return from advanced settings view
     subClickWidget("HbNavigationButton");
 }
@@ -526,6 +1189,128 @@
 // -----------------------------------------------------------------------------
 
 /**
+ * Gets UI widget pointers.
+ */
+void TestCpPacketDataApPlugin::subGetUiWidgets()
+{
+    HbModelIterator iterator(mTestView->mModel);
+    
+    // Get "Access point settings" group item
+    QModelIndex apGroupIndex = iterator.index(0);
+    
+    // Get UI widgets
+    mConnectionNameWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(0, apGroupIndex));
+    mAccessPointNameWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(1, apGroupIndex));
+    mUserNameWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(2, apGroupIndex));
+    mPasswordPromptWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(3, apGroupIndex));
+    mPasswordWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(4, apGroupIndex));
+    mAuthenticationWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(5, apGroupIndex));
+    mHomepageWidget = subGetWidgetByIndex(
+        mTestView->mForm,
+        iterator.index(6, apGroupIndex));
+}
+
+/**
+ * Gets advanced settings view UI widget pointers by group index.
+ */
+void TestCpPacketDataApPlugin::subGetAdvancedUiWidgets(
+    uint index)
+{
+    // Get the group item
+    HbModelIterator iterator(mTestViewAdvanced->mModel);
+    QModelIndex groupIndex = iterator.index(index);
+    
+    // Get UI widgets
+    if (index == 0) {
+        // IP settings group
+        mNetworkTypeWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(0, groupIndex));
+        if (qobject_cast<HbComboBox *>(mNetworkTypeWidget)->currentIndex() == 0) {
+            // IPv4
+            mIpv4AddressAutomaticWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(1, groupIndex));
+            mIpv4AddressWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(2, groupIndex));
+            mIpv4DnsAddressAutomaticWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(3, groupIndex));
+            mIpv4PrimaryDnsAddressWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(4, groupIndex));
+            mIpv4SecondaryDnsAddressWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(5, groupIndex));
+        } else {
+            // IPv6
+            mIpv6DnsAddressAutomaticWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(1, groupIndex));
+            mIpv6PrimaryDnsAddressWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(2, groupIndex));
+            mIpv6SecondaryDnsAddressWidget = subGetWidgetByIndex(
+                mTestViewAdvanced->mForm,
+                iterator.index(3, groupIndex));
+        }
+    } else {
+        // Proxy settings group
+        mProxyServerAddressWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(0, groupIndex));
+        mProxyPortNumberWidget = subGetWidgetByIndex(
+            mTestViewAdvanced->mForm,
+            iterator.index(1, groupIndex));
+    }
+}
+
+/**
+ * Gets an UI widget from HbDataForm by index. 
+ */
+HbWidget *TestCpPacketDataApPlugin::subGetWidgetByIndex(
+    HbDataForm *form,
+    const QModelIndex &index)
+{
+    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
+        (form->itemByIndex(index));
+    HbWidget *widget = viewItem->dataItemContentWidget();
+    //QString widgetClassName(widget->metaObject()->className());
+    //qDebug() << widgetClassName;
+    return widget;
+}
+
+/**
+ * Writes initial settings to CommsDat needed by some test cases.
+ */
+void TestCpPacketDataApPlugin::subInitializeCommsDat()
+{
+    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
+    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
+        cmManager->connectionMethod(testApId));
+    
+    // Initial settings
+    connectionMethod->setStringAttribute(
+        CMManagerShim::PacketDataIFAuthName,
+        tooLongUserName);
+    
+    connectionMethod->update();
+}
+
+/**
  * Creates the settings view and shows it.
  */
 void TestCpPacketDataApPlugin::subCreateSettingsView(uint connectionMethodId)
@@ -549,6 +1334,8 @@
     HbDataFormModelItem *item,
     QString expected)
 {
+    QTest::qWait(waitTime);
+
     // Read attribute value from CommsDat
     QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
     QScopedPointer<CmConnectionMethodShim> connectionMethod( 
@@ -569,17 +1356,15 @@
 void TestCpPacketDataApPlugin::subClearLineEdit(
     uint length)
 {
-    // Erase old string
-    QTest::qWait(5000); // TODO: Remove this when item specific menu doesn't pop up anymore
-
     // Move cursor to end of string
-    //HbAutoTest::keyClick(mMainWindow, Qt::Key_End, 0, waitTime); // doesn't seem to do anything? 
+    //HbAutoTest::keyClick(mMainWindow, Qt::Key_End, Qt::ControlModifier, waitTime); // doesn't seem to do anything? 
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
     for (int i=0; i<25; i++) {
         HbAutoTest::keyClick(mMainWindow, Qt::Key_Right, 0, waitTime);
     }
+    // Erase string
     for (int i=0; i<length; i++) {
         HbAutoTest::keyClick(mMainWindow, Qt::Key_Backspace, 0, waitTime);
     }
@@ -604,6 +1389,8 @@
     CMManagerShim::ConnectionMethodAttribute attribute,
     bool expected)
 {
+    QTest::qWait(waitTime);
+    
     // Read attribute value from CommsDat
     QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
     QScopedPointer<CmConnectionMethodShim> connectionMethod( 
@@ -614,6 +1401,24 @@
 }
 
 /**
+ * Verifies that given attribute contains expected integer value in CommsDat. 
+ */
+void TestCpPacketDataApPlugin::subVerifyUint(
+    CMManagerShim::ConnectionMethodAttribute attribute,
+    uint expected)
+{
+    QTest::qWait(waitTime);
+
+    // Read attribute value from CommsDat
+    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
+    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
+        cmManager->connectionMethod(testApId));
+    uint commsdat = connectionMethod->getIntAttribute(attribute);
+    
+    QCOMPARE(commsdat, expected);
+}
+
+/**
  * Clicks a widget currently on UI by class name.
  */
 void TestCpPacketDataApPlugin::subClickWidget(const QString &name)
@@ -636,3 +1441,27 @@
     Q_ASSERT(target);
     HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
 }
+
+/**
+ * Scrolls the tested view to the bottom.
+ */
+void TestCpPacketDataApPlugin::subScrollToBottom()
+{
+    // Scroll to the bottom of the view
+    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
+    QTest::qWait(1000);
+    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollTop);
+    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollTop);
+}
+
+/**
+ * Scrolls the tested view to the top.
+ */
+void TestCpPacketDataApPlugin::subScrollToTop()
+{
+    // Scroll to the top of the view
+    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
+    QTest::qWait(1000);
+    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollBottom);
+    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollBottom);
+}
--- a/cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.h	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.h	Mon May 24 20:51:35 2010 +0300
@@ -19,12 +19,16 @@
 #include <QtTest/QtTest>
 #include <cmmanagerdefines_shim.h>
 
+class HbWidget;
 class HbDialog;
 class HbMainWindow;
 class HbAutoTestMainWindow;
+class HbDataForm;
 class HbDataFormModelItem;
+class HbDataFormViewItem;
 class HbAction;
 class CpPacketDataApView;
+class CpPacketDataApAdvancedView;
 class CpBearerApPluginInterface;
 
 class TestCpPacketDataApPlugin : public QObject
@@ -50,6 +54,7 @@
         void tcChangeAccessPointName();
         void tcChangeAccessPointName_data();
         void tcAccessPointNameEmpty();
+        void tcTooLongUserNameInCommsDat();
         void tcChangeUserName();
         void tcChangeUserName_data();
         void tcScrollToBottom();
@@ -59,10 +64,45 @@
         void tcChangeAuthenticationMode();
         void tcChangeHomepage();
         void tcChangeHomepage_data();
-        void tcAdvancedSettings();
+        void tcOpenAdvancedSettingsView();
+        void tcExpandIpSettings();
+        void tcSetIpv4NetworkType();
+        void tcEnableAutomaticIpv4Address();
+        void tcEnableUserDefinedIpv4Address();
+        void tcChangeIpAddress();
+        void tcChangeIpAddress_data();
+        void tcScrollToBottom2();
+        void tcEnableAutomaticIpv4DnsAddress();
+        void tcEnableUserDefinedIpv4DnsAddress();
+        void tcChangeIpv4DnsAddress();
+        void tcChangeIpv4DnsAddress_data();
+        void tcInvalidIpv4DnsAddress();
+        void tcScrollToTop();
+        void tcSetIpv6NetworkType();
+        void tcEnableAutomaticIpv6DnsAddress();
+        void tcEnableWellKnownIpv6DnsAddress();
+        void tcEnableUserDefinedIpv6DnsAddress();
+        void tcChangeIpv6DnsAddress();
+        void tcChangeIpv6DnsAddress_data();
+        void tcInvalidIpv6DnsAddress();
+        void tcCollapseIpSettings();
+        void tcExpandProxySettingsAndGetUiWidgets();
+        void tcChangeProxyServerAddress();
+        void tcChangeProxyServerAddress_data();
+        void tcChangeProxyPortNumber();
+        void tcChangeProxyPortNumber_data();
+        void tcInvalidProxyPortNumber();
+        void tcCollapseProxySettings();
+        void tcCloseAdvancedSettingsView();
 
     private:
         // Sub test cases
+        void subGetUiWidgets();
+        void subGetAdvancedUiWidgets(uint index);
+        HbWidget *subGetWidgetByIndex(
+            HbDataForm *form,
+            const QModelIndex &index);
+        void subInitializeCommsDat();
         void subCreateSettingsView(uint connetionMethodId);
         void subVerifyString(
             CMManagerShim::ConnectionMethodAttribute attribute,
@@ -73,13 +113,42 @@
         void subVerifyBool(
             CMManagerShim::ConnectionMethodAttribute attribute,
             bool expected);
+        void subVerifyUint(
+            CMManagerShim::ConnectionMethodAttribute attribute,
+            uint expected);
         void subClickWidget(const QString &name);
+        void subScrollToBottom();
+        void subScrollToTop();
 
     private:
         // Code references
         CpPacketDataApView *mTestView;
+        CpPacketDataApAdvancedView *mTestViewAdvanced;
+        // "Access point settings" UI widgets
+        HbWidget *mConnectionNameWidget;
+        HbWidget *mAccessPointNameWidget;
+        HbWidget *mUserNameWidget;
+        HbWidget *mPasswordPromptWidget;
+        HbWidget *mPasswordWidget;
+        HbWidget *mAuthenticationWidget;
+        HbWidget *mHomepageWidget;
+        // "Advanced settings" UI widgets
+        HbDataFormViewItem *mIpGroupViewItem;
+        HbDataFormViewItem *mProxyGroupViewItem;
+        HbWidget *mNetworkTypeWidget;
+        HbWidget *mIpv4AddressAutomaticWidget;
+        HbWidget *mIpv4AddressWidget;
+        HbWidget *mIpv4DnsAddressAutomaticWidget;
+        HbWidget *mIpv4PrimaryDnsAddressWidget;
+        HbWidget *mIpv4SecondaryDnsAddressWidget;
+        HbWidget *mIpv6DnsAddressAutomaticWidget;
+        HbWidget *mIpv6PrimaryDnsAddressWidget;
+        HbWidget *mIpv6SecondaryDnsAddressWidget;
+        HbWidget *mProxyServerAddressWidget;
+        HbWidget *mProxyPortNumberWidget;
         
         // Test data
         HbAutoTestMainWindow *mMainWindow;
+        QPluginLoader *mPluginLoader;
         CpBearerApPluginInterface *mPlugin;
 };
--- a/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/cmmanager/cpwlanapplugin/tsrc/ut/testcpwlanapplugin.cpp	Mon May 24 20:51:35 2010 +0300
@@ -60,13 +60,15 @@
 
 // UI coordinates
 static const QPoint scrollMiddle(350, 280);
-static const QPoint scrollTop(350, 50);
-static const QPoint scrollBottom(350, 520);
+static const QPoint scrollTop(350, 30);
+static const QPoint scrollBottom(350, 540);
 
 // Use positive offset if dropdown opens under the combobox
-static const QPoint comboBoxItemOffset(0, 55);
+static const QPoint comboBoxFirstItemOffset(80, 75);
+static const QPoint comboBoxItemOffset(0, 51);
 // Use negative offset if dropdown opens above the combobox
-static const QPoint comboBoxItemNegativeOffset(0, -50);
+static const QPoint comboBoxFirstItemNegativeOffset(80, -29);
+static const QPoint comboBoxItemNegativeOffset(0, -51);
 
 static const QPoint exitEditorOffset(-10, -20);
 
@@ -196,11 +198,11 @@
     QTest::addColumn<QString>("result");
     
     QTest::newRow("maximum length")
-        << "really long name 1234567890123"
-        << "really long name 1234567890123";
+        << "really long name 123456789012345678901234567890123"
+        << "really long name 123456789012345678901234567890123";
     QTest::newRow("too long")
-        << "too long name 123456789012345678901234567890"
-        << "too long name 1234567890123456";
+        << "too long name 12345678901234567890123456789012345678901234"
+        << "too long name 123456789012345678901234567890123456";
     QTest::newRow("basic") // last one must always fit on one line in UI
         << "test WLAN AP"
         << "test WLAN AP";
@@ -316,8 +318,8 @@
  */
 void TestCpWlanApPlugin::tcChangeNetworkStatus()
 {
-    QPointF publicPointOffset = comboBoxItemOffset;
-    QPointF hiddenPointOffset = comboBoxItemOffset * 2;
+    QPointF publicPointOffset = comboBoxFirstItemOffset;
+    QPointF hiddenPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
     
     // Set network status to hidden
     HbAutoTest::mouseClick(mMainWindow, mNetworkStatusWidget);
@@ -335,8 +337,8 @@
  */
 void TestCpWlanApPlugin::tcChangeNetworkMode()
 {
-    QPointF infraPointOffset = comboBoxItemOffset;
-    QPointF adHocPointOffset = comboBoxItemOffset * 2;
+    QPointF infraPointOffset = comboBoxFirstItemOffset;
+    QPointF adHocPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
     
     // Set network mode to ad-hoc
     HbAutoTest::mouseClick(mMainWindow, mNetworkModeWidget);
@@ -355,12 +357,12 @@
 void TestCpWlanApPlugin::tcChangeSecurityMode()
 {
 #ifdef WLAN_SECURITY_PLUGINS_AVAILABLE
-    QPointF openPointOffset = comboBoxItemNegativeOffset * 4;
-    QPointF wepPointOffset = comboBoxItemNegativeOffset * 3;
-    QPointF wpaPointOffset = comboBoxItemNegativeOffset * 2;
-    QPointF wpa2PointOffset = comboBoxItemNegativeOffset;
+    QPointF openPointOffset = comboBoxFirstItemNegativeOffset + comboBoxItemNegativeOffset * 3;
+    QPointF wepPointOffset = comboBoxFirstItemNegativeOffset + comboBoxItemNegativeOffset * 2;
+    QPointF wpaPointOffset = comboBoxFirstItemNegativeOffset + comboBoxItemNegativeOffset;
+    QPointF wpa2PointOffset = comboBoxFirstItemNegativeOffset;
 #else
-    QPointF openPointOffset = comboBoxItemNegativeOffset;
+    QPointF openPointOffset = comboBoxFirstItemNegativeOffset;
 #endif
     
 #ifdef WLAN_SECURITY_PLUGINS_AVAILABLE
@@ -901,7 +903,7 @@
 void TestCpWlanApPlugin::tcEnableAutomaticIpv6DnsAddress()
 {
     // Enable automatic IPv6 DNS address
-    QPointF automaticPointOffset = comboBoxItemOffset;
+    QPointF automaticPointOffset = comboBoxFirstItemOffset;
     HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
     QTest::qWait(100);
     HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, automaticPointOffset, 100);
@@ -921,7 +923,7 @@
 void TestCpWlanApPlugin::tcEnableWellKnownIpv6DnsAddress()
 {
     // Enable well-known IPv6 DNS address
-    QPointF wellKnownPointOffset = comboBoxItemOffset * 2;
+    QPointF wellKnownPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
     HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
     QTest::qWait(100);
     HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, wellKnownPointOffset, 100);
@@ -949,7 +951,7 @@
 void TestCpWlanApPlugin::tcEnableUserDefinedIpv6DnsAddress()
 {
     // Select user defined IPv6 DNS address
-    QPointF userDefinedPointOffset = comboBoxItemOffset * 3;
+    QPointF userDefinedPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset * 2;
     //QPointF userDefinedPointOffset(0, 160);
     HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
     QTest::qWait(100);
--- a/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/connectionmonitoring/connmon/connectionmonitor/src/ConnMonNoti.cpp	Mon May 24 20:51:35 2010 +0300
@@ -21,6 +21,8 @@
 #include <e32base.h>
 #include <rmmcustomapi.h>
 #include <featmgr.h>
+#include <gsmerror.h>     // KErrPacketDataTsyMaxPdpContextsReached 
+#include <etelpckt.h>     // KErrUmtsMaxNumOfContextExceededByNetwork
 
 #include "ConnMonServ.h"
 #include "ConnMonSess.h"
@@ -562,10 +564,10 @@
         }
     else
         {
-        iEventInfo.Reset();
-
         if ( iInfoBuf().iStage != static_cast< TInt >( iEventInfo.iData ) )
             {
+            iEventInfo.Reset();
+            
             // Send only new stage info to clients
             iEventInfo.iEventType       = EConnMonConnectionStatusChange;
             iEventInfo.iConnectionId    = iConnectionId;
@@ -640,35 +642,15 @@
                 }
             }
 
-        if ( iInfoBuf().iError == KErrNone )
-            {
-            // New request
-            Receive();
-            }
-        else
+        // New request
+        Receive();
+            
+        if ( iInfoBuf().iError == KErrDisconnected )
             {
-            // Connection is closing.
-            CSubConnUpDownNotifier* subConnUpDownNotifier = 0;
-            TInt err = iServer->Iap()->GetSubConnUpDownNotifier(
-                    iConnectionId,
-                    &subConnUpDownNotifier );
-
-            if ( KErrNone == err )
-                {
-                // Subconn down notifier has stopped and allinterface closed event has arrived
-                if ( !subConnUpDownNotifier->IsActive() )
-                    {
-                    subConnUpDownNotifier->SendDeletedEvent();
-                    }
-                }
-
-            if ( iInfoBuf().iError == KErrDisconnected )
-                {
-                // Enable WLAN scan when IAP availability is check for the
-                // next time because current bearer has been lost (-36).
-                // MPM needs a fresh list of available iaps.
-                iServer->Iap()->EnableWlanScan();
-                }
+            // Enable WLAN scan when IAP availability is check for the
+            // next time because current bearer has been lost (-36).
+            // MPM needs a fresh list of available iaps.
+            iServer->Iap()->EnableWlanScan();
             }
         }
     //LOGEXITFN("CProgressNotifier::RunL()")
--- a/connectionmonitoring/indicatorobserver/inc/indicatorobserver.h	Mon May 17 09:55:27 2010 +0300
+++ b/connectionmonitoring/indicatorobserver/inc/indicatorobserver.h	Mon May 24 20:51:35 2010 +0300
@@ -94,6 +94,11 @@
     bool mWlanEnabled;
     
     /*!
+        Indicates whether WLAN radio is forced off
+    */
+    bool mWlanForceDisabled;
+    
+    /*!
         Indicates whether WLAN indicator plugin is activated
     */
     bool mWlanIndicatorIsActivated;
--- a/connectionmonitoring/indicatorobserver/src/indicatorobserver.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/connectionmonitoring/indicatorobserver/src/indicatorobserver.cpp	Mon May 24 20:51:35 2010 +0300
@@ -45,6 +45,7 @@
     mActiveCellularConfigurations(new QList<QNetworkConfiguration>),
     mActiveWlanConfigurations(new QList<QNetworkConfiguration>),    
     mWlanEnabled(0),
+    mWlanForceDisabled(0),
     mWlanIndicatorIsActivated(false),
     mCellularIndicatorIsActivated(false)
     
@@ -79,10 +80,18 @@
         KCRUidWlanDeviceSettingsRegistryId.iUid,
         KWlanOnOff);
     
+    // Also subscribe for KForceDisableWlan change indications
+    XQSettingsKey wlanForceKey(
+        XQSettingsKey::TargetCentralRepository,
+        KCRUidWlanDeviceSettingsRegistryId.iUid, 
+        KWlanForceDisable);
+    
     //Read current status of WLAN radio
     mWlanEnabled = mSettingsManager->readItemValue(wlanKey).toInt() ? true : false;
+    mWlanForceDisabled = mSettingsManager->readItemValue(wlanForceKey).toInt() ? true : false;
 
     mSettingsManager->startMonitoring(wlanKey);
+    mSettingsManager->startMonitoring(wlanForceKey);
 
     initializeIndicators();
     
@@ -140,13 +149,15 @@
 {
     OstTrace0(TRACE_FLOW, INDICATOROBSERVER_UPDATEWLANRADIOSTATUS_ENTRY, "-->");
     
-    // The key parameter is not used, since only WLAN ON/OFF setting is connected to this slot
-    Q_UNUSED(key);
+    // The change notification is received either for the WlanOnoff key, or the
+    // ForceDisableWlan key
+    if (KWlanOnOff == key.key()) {
+        mWlanEnabled = value.toInt() ? true : false;
+    } else {
+        mWlanForceDisabled = value.toInt() ? true : false;
+    }
     
-    // Inform about WLAN ON/OFF status change
-    mWlanEnabled = value.toInt() ? true : false;
-    
-    if (mWlanEnabled == false) {    
+    if (mWlanEnabled == false || mWlanForceDisabled == true) {    
         deactivateWlanIndicatorPlugin();
     } else {
         updateWlanIndicator();
@@ -198,7 +209,7 @@
 
     //We do not deactivate WlanIndicator plugin here as it is done in updateWlanRadioStatus method
     //as WLAN radio status determines whether to show indicator or not
-    if ( mWlanEnabled ) {
+    if ( mWlanEnabled && !mWlanForceDisabled) {
         if(count == 0) {
             list.insert(0, wlanNotConnected);
             activateWlanIndicatorPlugin(list);
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ChangeConnectionDlg.h	Mon May 17 09:55:27 2010 +0300
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/inc/ChangeConnectionDlg.h	Mon May 24 20:51:35 2010 +0300
@@ -102,15 +102,6 @@
         */
         void HandleTimedOut();
 
-    private:  // New functions
-
-        /**
-        * Sets graphic icons
-        * @param    -
-        */
-        void SetIconsL();
-
-
     private: //data
         TUint32*            iIAPId;
         TBuf<CommsDat::KMaxTextLength> iConnectionName;
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/ChangeConnectionDlg.cpp	Mon May 24 20:51:35 2010 +0300
@@ -28,7 +28,6 @@
 
 #include <data_caging_path_literals.hrh>
 #include <ConnectionUiUtilities.rsg>
-#include <apsettings.mbg>
 
 #include "ChangeConnectionDlg.h"
 #include "ActiveCChangeConnectionDlg.h"
@@ -37,18 +36,10 @@
 
 // CONSTANTS
 
-// ROM folder
-_LIT( KDriveZ, "z:" );
-
-// Name of the MBM file containing icons
-_LIT( KFileIcons, "ApSettings.mbm" );
-
 #if defined(_DEBUG)
 _LIT( KErrNullPointer, "NULL pointer" );
 #endif
 
-LOCAL_D const TInt KIconsGranularity = 4;
-
 
 // ================= MEMBER FUNCTIONS =======================
 
@@ -166,8 +157,6 @@
     SetItemTextArray( iActiveDlg->ActIAPs() );       
     SetOwnershipType( ELbmDoesNotOwnItemArray );
 
-    SetIconsL();
-    
     // Timer not in use due the unresolved crash
     //iExpiryTimer = CExpiryTimer::NewL( *this );
     //iExpiryTimer->Start();
@@ -196,67 +185,6 @@
     }
 
 
-// ---------------------------------------------------------
-// CChangeConnectionDlg::SetIconsL()
-// ---------------------------------------------------------
-//
-void CChangeConnectionDlg::SetIconsL()
-    {
-    CArrayPtr< CGulIcon >* icons = new( ELeave ) CAknIconArray( 
-                                                        KIconsGranularity );
-    CleanupStack::PushL( icons );
-
-    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
-
-    TFileName iconsFileName;
-
-    iconsFileName.Append( KDriveZ );
-
-    iconsFileName.Append( KDC_APP_BITMAP_DIR );
-
-    iconsFileName.Append( KFileIcons );
-
-    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
-                            KAknsIIDQgnPropWmlGprs,
-                            iconsFileName, 
-                            EMbmApsettingsQgn_prop_wml_gprs, 
-                            EMbmApsettingsQgn_prop_wml_gprs_mask ) );
-
-    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
-                            KAknsIIDQgnPropWmlCsd,
-                            iconsFileName, 
-                            EMbmApsettingsQgn_prop_wml_csd, 
-                            EMbmApsettingsQgn_prop_wml_csd_mask ) );
-
-    icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
-                            KAknsIIDQgnPropWmlHscsd,
-                            iconsFileName, 
-                            EMbmApsettingsQgn_prop_wml_hscsd, 
-                            EMbmApsettingsQgn_prop_wml_hscsd_mask ) );
-
-    if ( iIsWLANFeatureSupported )
-        {
-        icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
-                            KAknsIIDQgnPropWlanEasy,
-                            iconsFileName, 
-                            EMbmApsettingsQgn_prop_wlan_easy, 
-                            EMbmApsettingsQgn_prop_wlan_easy_mask ) );
-    
-        icons->AppendL( AknsUtils::CreateGulIconL( skinInstance, 
-                            KAknsIIDQgnPropWlanBearer,
-                            iconsFileName, 
-                            EMbmApsettingsQgn_prop_wlan_bearer, 
-                            EMbmApsettingsQgn_prop_wlan_bearer_mask ) );
-        }
-    
-    SetIconArrayL( icons );
-
-    CleanupStack::Pop( icons );
-    }
-
-
-
-
 // ----------------------------------------------------------------------------
 // void CChangeConnectionDlg::HandleResourceChange( TInt aType )
 // Handle resource change events. 
@@ -268,7 +196,6 @@
         {
         CAknListQueryDialog::HandleResourceChange( aType );
 
-        TRAP_IGNORE( SetIconsL() );
         SizeChanged();
         }
     else
--- a/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/connectionutilities/ConnectionDialogs/ConnectionUiUtilities/src/connectionstatuspopup.cpp	Mon May 24 20:51:35 2010 +0300
@@ -48,8 +48,8 @@
 const TInt KErrGenConnNoGPRSNetwork     = -3609;
 
 // Icons representing bearer
-_LIT( KIconCellular, "qtg_small_wlan.svg" );
-_LIT( KIconWlan,     "qtg_small_gprs.svg" );
+_LIT( KIconCellular, "qtg_small_gprs.svg" );
+_LIT( KIconWlan,     "qtg_small_wlan.svg" );
 _LIT( KIconVpn,      "qtg_small_vpn.svg" ); 
 _LIT( KIconNone,     "" );
 
@@ -526,7 +526,10 @@
         case KErrGprsNSAPIAlreadyUsed:
         case KErrGprsQoSNotAccepted:
         case KErrGprsReactivationRequested:
-            icon = EIconCellular;
+        case KErrGprsOfflineMode:
+            icon = EIconCellular;           
+        case KErrWlanOff:
+        case KErrWlanForceOff:
             textPtr.Set( Ktxt_occ_dpopinfo_connection_unavailable );
             break;
 
--- a/connectionutilities/ConnectionDialogs/group/ConnectionUiUtilities.mmp	Mon May 17 09:55:27 2010 +0300
+++ b/connectionutilities/ConnectionDialogs/group/ConnectionUiUtilities.mmp	Mon May 24 20:51:35 2010 +0300
@@ -23,6 +23,7 @@
 
 TARGET      ConnectionUiUtilities.dll
 TARGETTYPE  DLL
+UID         0x1000008d 0x2002FF74
 
 CAPABILITY CAP_GENERAL_DLL
 VENDORID VID_DEFAULT
Binary file data/cccccc00_emulator.cre has changed
--- a/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorglobal.h	Mon May 24 20:51:35 2010 +0300
@@ -62,8 +62,7 @@
                                 RPointerArray< RCmConnectionMethodExt >& aPluginArray,
                                 RPointerArray< HBufC >& aPluginNames, 
                                 RPointerArray< RCmDestinationExt >& aDestArray,
-                                RPointerArray< HBufC >& aDestNames,
-                                RPointerArray< HBufC >& aDefCon );
+                                RPointerArray< HBufC >& aDestNames );
 
         /**
         * Destructor.
@@ -81,8 +80,7 @@
                           RPointerArray< RCmConnectionMethodExt >& aPluginArray,
                           RPointerArray< HBufC >& aPluginNames, 
                           RPointerArray< RCmDestinationExt >& aDestArray,
-                          RPointerArray< HBufC >& aDestNames,
-                          RPointerArray< HBufC >& aDefCon);
+                          RPointerArray< HBufC >& aDestNames );
                           
         /**
         * Second phase constructor. Leaves on failure.
@@ -116,22 +114,7 @@
         void UpdateGlobalBearerArrayL
                             ( TDbCreatorGlobalSettings aField, TUint32 aPrio );
                 
-        /**
-        * Sets the value of default connection type parsing and converting
-        *                           the param string to the right enum. 
-        * @param aPtrTag string of the type.
-        */
-        void SetDefaultConnectionTypeL( HBufC16* aPtrTag );
-                            
-        /**
-        * Sets the id of default connection method. It founds the connection
-        *     method or destination corresponding to the given name.
-        *     Type depends on the default connection type.
-        *     If the method/destination cannot be found then no id is set.
-        * @param aPtrTag string of the connection method/destination name.
-        */
-        void SetDefaultConnectionNameL( HBufC16* aPtrTag );
-
+                         
         /**
         * Sets the WLAN Usage parameter in general connection settings.
         * @param aPtrTag string containing the parameter's value.
@@ -155,9 +138,6 @@
         // Stores the general connection settings, using CMM
         void SetGenConnSettingsL();
         
-        // Stores the default connection's values, using CMM
-        void SetDefConnRecordL( const TInt aId );
-        
         // Stores the WLAN parameters
         void SaveGlobalWlanParameterL( const TUint32 aTableType, 
         							   const TDbCreatorGlobalSettings aField, 
@@ -165,9 +145,6 @@
 
     private:
         
-        // @var Default connection's data
-        TCmDefConnType iDefaultConnectionType;
-        TBool iDefaultConnectionSet;
 
         // @var GPRS attach mode : whenneeded/whenavailable
         TBool  iAttachWhenNeeded;
@@ -175,9 +152,6 @@
         RArray< TBearerPriority > iBearerArray;
         TBool iBearerArrayChanged;
         
-        // @var Stores the default connection type / name pair
-        RPointerArray< HBufC >* iDefCon; 
-        
         // @var Stores the general connection settings
         TCmGenConnSettings* iGenConnSettings;
         
--- a/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Inc/cdcprocessorwlan.h	Mon May 24 20:51:35 2010 +0300
@@ -28,7 +28,8 @@
 #include <cmmanagerext.h>
 #include <cmconnectionmethodext.h>
 #include <metadatabase.h>
-#include <EapSettings.h>
+#include <EapGeneralSettings.h>
+#include <EapExpandedType.h>
 
 #include "cdcprocessorbase.h"
 
@@ -49,7 +50,7 @@
         ~CEapTypeElement();
 		HBufC* iName;
         EAPSettings* iEapSettings; 
-        EAPSettings::TEapType iEncapsulatingEapId;
+        TEapExpandedType iEncapsulatingEapId; 
         };
 
 
@@ -220,6 +221,13 @@
         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
@@ -260,25 +268,25 @@
         
         /*
          * Sets the values of the expanded Eap lists to the database 
-         * @param aGeneric for accessing the database records 
+         * @param aServiceId for accessing the EAP data 
          */
-        void SetExpandedEapListL( CMDBGenericRecord* aGeneric );
+        void SetExpandedEapListL( const TUint aServiceId );
         
     private:
     
         void AddSecurityDataL( TInt aField, HBufC* aPtrTag, TBool aIsWep );
 
-		void AddEAPSettingL( const TInt aField, const HBufC16* const aValue );
+		void AddEAPSettingL( const TInt aField, HBufC16* aValue );
 		
 		TBool EAPSetting( const TInt aField );
 	
 		void FillCipherSuitesL( const HBufC16* const aPtrTag, const TInt aEapIndex );
 		
-		EAPSettings::TEapType GetEapTypeIdFromSettingId( const TInt aField );
+		TEapExpandedType GetEapTypeIdFromSettingId( const TInt aField ); 
 		
-		TUint FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex );
+		TUint FindCertificateEntryL( const EapCertificateEntry::TCertType aCertType, const TInt aEapIndex );
 		
-		void ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey);
+		void ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey);
         
         // @var Indicates the WLAN security mode
         TDbCreatorSecurityMode iSecurityMode;
--- a/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Src/cdccommsdatcreator.cpp	Mon May 24 20:51:35 2010 +0300
@@ -301,8 +301,7 @@
                                                           iPluginArray,
                                                           iPluginNames,
                                                           iDestArray,
-                                                          iDestNames,
-                                                          iDefCon ); 
+                                                          iDestNames ); 
                 iFileProcessor->ParseFileL();
 
                 delete iFileProcessor;
@@ -411,8 +410,6 @@
     
     iLingerSettings.ResetAndDestroy();
 
-    iDefCon.ResetAndDestroy();
-    
     iCmInDest.Close(); 
     
     iCmManager.Close();
--- a/dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorglobal.cpp	Mon May 24 20:51:35 2010 +0300
@@ -38,7 +38,6 @@
 #include <cmmanagerext.h>
 #include <cmmanager.h>
 #include <cmdestinationext.h>
-#include <cmdefconnvalues.h>
 #include <WlanCdbCols.h>
 #include <wlancontainer.h>
 #include <featmgr.h>
@@ -106,16 +105,14 @@
                           RPointerArray< RCmConnectionMethodExt >& aPluginArray,
                           RPointerArray< HBufC >& aPluginNames, 
                           RPointerArray< RCmDestinationExt >& aDestArray,
-                          RPointerArray< HBufC >& aDestNames,
-                          RPointerArray< HBufC >& aDefCon )
+                          RPointerArray< HBufC >& aDestNames )
     {
     CProcessorGlobal* self = new ( ELeave ) CProcessorGlobal( aFileReader,
                                                               aCmManager,
                                                               aPluginArray,
                                                               aPluginNames,
                                                               aDestArray,
-                                                              aDestNames,
-                                                              aDefCon );
+                                                              aDestNames );
     CleanupStack::PushL( self );
 
     // From base class
@@ -134,12 +131,10 @@
                                     RPointerArray< RCmConnectionMethodExt >& aPluginArray,
                                     RPointerArray< HBufC >& aPluginNames, 
                                     RPointerArray< RCmDestinationExt >& aDestArray,
-                                    RPointerArray< HBufC >& aDestNames,
-                                    RPointerArray< HBufC >& aDefCon ) :
+                                    RPointerArray< HBufC >& aDestNames ) :
     CProcessorBase( aFileReader, aCmManager, aPluginArray, aPluginNames, aDestArray, aDestNames ),
     iAttachWhenNeeded ( EFalse )
     {
-    iDefCon = &aDefCon;
     }
     
     
@@ -308,20 +303,6 @@
                 break;
                 }
                 
-            case EDefaultConnectionType:
-                {
-                iDefCon->Append( ptrTag->AllocL() );
-                //SetDefaultConnectionTypeL( ptrTag )
-                break;
-                }
-                
-            case EDefaultConnectionName:
-                {
-                iDefCon->Append( ptrTag->AllocL() );
-                //SetDefaultConnectionNameL( ptrTag )
-                break;
-                }
-                
             case EGprsLastSocketActivityTimeout:
             case EGprsLastSessionClosedTimeout:
             case EGprsLastSocketClosedTimeout:		
@@ -611,87 +592,6 @@
     }
 
 // ---------------------------------------------------------
-// CProcessorGlobal::SetDefaultConnectionL
-// ---------------------------------------------------------
-//
-/*void CProcessorGlobal::SetDefaultConnectionL()
-    {
-    if( iDefCon->Count() > 0 )
-        {
-        SetDefaultConnectionTypeL( (*iDefCon)[0] );
-        }
-    if( iDefCon->Count() > 1 )
-        {
-        SetDefaultConnectionNameL( (*iDefCon)[1] );
-        }
-    }*/
-
-// ---------------------------------------------------------
-// CProcessorGlobal::SetDefaultConnectionTypeL
-// ---------------------------------------------------------
-//
-void CProcessorGlobal::SetDefaultConnectionTypeL( HBufC16* aPtrTag )
-    {
-    iDefaultConnectionSet = EFalse;
-    
-    if ( aPtrTag->CompareF( KStrAlwaysAsk ) == 0 ) 
-        {
-        iDefaultConnectionType = ECmDefConnAlwaysAsk;
-        SetDefConnRecordL( 0 );
-        }
-    else if ( aPtrTag->CompareF( KStrAskOnce ) == 0 ) 
-        {
-        iDefaultConnectionType = ECmDefConnAskOnce;
-        SetDefConnRecordL( 0 );
-        }
-    else if ( aPtrTag->CompareF( KStrDestination ) == 0 ) 
-        {
-        iDefaultConnectionType = ECmDefConnDestination;
-        }
-    else if ( aPtrTag->CompareF( KStrConnectionMethod ) == 0 ) 
-        {
-        iDefaultConnectionType = ECmDefConnConnectionMethod;
-        }
-    else
-        {
-        CLOG_WRITE(
-        "Warning: Default connection type is not valid. Always ask is set.")
-        iDefaultConnectionType = ECmDefConnAlwaysAsk;
-        SetDefConnRecordL( 0 );
-        }    
-    }
-
-// ---------------------------------------------------------
-// CProcessorGlobal::SetDefaultConnectionNameL
-// ---------------------------------------------------------
-//
-void CProcessorGlobal::SetDefaultConnectionNameL( HBufC16* aPtrTag )
-    {
-        
-    // Name is ignored if the defconn has been set. It can happen e.g.
-    // if iDefaultConnectionType is ECmDefConnAlwaysAsk or ECmDefConnAskOnce     
-    if ( iDefaultConnectionSet )
-        {
-        return;
-        }
-        
-    TInt uId = KErrNotFound;
-    if ( iDefaultConnectionType == ECmDefConnDestination )
-        {
-        uId = GetDestinationIdL( aPtrTag );
-        }
-    else if ( iDefaultConnectionType == ECmDefConnConnectionMethod )
-        {
-        uId = GetPluginIdL( aPtrTag );
-        }
-        
-    if( uId != KErrNotFound )
-        {
-        SetDefConnRecordL( uId );
-        }
-    }
-
-// ---------------------------------------------------------
 // CProcessorGlobal::SetGenConnSettingWlanUsage
 // ---------------------------------------------------------
 //
@@ -756,25 +656,6 @@
     }
 
 //-----------------------------------------------------------------------------
-//  CProcessorGlobal::SetDefConnRecordL()
-//-----------------------------------------------------------------------------
-//
-void CProcessorGlobal::SetDefConnRecordL( const TInt /*aId*/ )
-    {
-
-/*    TCmDefConnValue value;
-    value.iType = iDefaultConnectionType;
-    value.iId = aId;*/
-    
-//    iCmManager->WriteDefConnL( value );
-    
-    // It gets true if the defconn was set correctly
-    iDefaultConnectionSet = ETrue;
-
-    }
-    
-
-//-----------------------------------------------------------------------------
 //  CProcessorGlobal::SaveGlobalWlanParameterL()
 //-----------------------------------------------------------------------------
 //
--- a/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Src/cdcprocessorwlan.cpp	Mon May 24 20:51:35 2010 +0300
@@ -33,7 +33,6 @@
 #include <WlanCdbCols.h>
 #include <commsdattypesv1_1.h>
 #include <wlancontainer.h>
-#include <EapType.h>
 
 using namespace CMManager;
 
@@ -60,12 +59,6 @@
 // ratio between sizes of ascii and unicode characters
 const TUint KAsciiUnicodeRatio = 2;
 
-// Length of expanded EAP type identifier
-const TUint KExpandedEAPIdLength = 8;
-
-// Plain MSCHAPv2 EAP identifier. Needed because of special handling
-const TUint8 KMschapv2TypeId[] = {0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x63};
-
 // ================= MEMBER FUNCTIONS =======================
 
 CEapTypeElement::~CEapTypeElement()
@@ -144,6 +137,7 @@
 CProcessorWlan::~CProcessorWlan()
     {
     delete iEmptyTag;
+    REComSession::FinalClose();
     }
 
 // ---------------------------------------------------------
@@ -601,51 +595,30 @@
 	    
 	    CleanupStack::PopAndDestroy( iapRecord );	        
 	            
-		TInt err = KErrNone;
-	    TUint8 expandedEapId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-	    TBuf8<KExpandedEAPIdLength> cue;
-	    
-		// Set-up 64-bit expanded EAP id
-		if ( eap->iEapSettings->iEAPType == KMschapv2TypeId[7] )
-			{
-			// This is plain MSCHAPv2. Set vendor ID correctly
-			expandedEapId[1] = KMschapv2TypeId[1];
-			expandedEapId[2] = KMschapv2TypeId[2];
-			expandedEapId[3] = KMschapv2TypeId[3];
-			}
-		
-		expandedEapId[KExpandedEAPIdLength - 1] = static_cast<TUint8> ( eap->iEapSettings->iEAPType );	
-		cue.Copy( expandedEapId, KExpandedEAPIdLength );
-		
-		// Try loading EAP ECOM module
-		CLOG_WRITE_FORMAT( "Try to load EAP module: %d", expandedEapId[7]);
-		CEapType* eapType = 0;
-		TRAP( err, eapType = CEapType::NewL( cue, ELan, serviceId ) );
-		// The error is caused by probably missing EAP method from the device. Ignore the error
-		// because same scripts can be used for devices with and without certain methods.
-		if( err == KErrNone )
-			{
-		    CleanupStack::PushL( eapType );
-		        
-		    // Check if this type is tunneled
-		    if ( eap->iEncapsulatingEapId != EAPSettings::EEapNone )
-		    	{
-		    	// It is tunneled. Take the last byte of the expanded id.
-		    	eapType->SetTunnelingType( eap->iEncapsulatingEapId );    	
-		    	}
-		    CLOG_WRITE( "Calling eapType->SetConfiguration" );
-		    eapType->SetConfigurationL( *eap->iEapSettings );
-		    CLOG_WRITE( "eapType->SetConfiguration success!" );
-		    CleanupStack::PopAndDestroy( eapType );
-		    REComSession::FinalClose();
-			}
+        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" );
-	//iEapSettings.ResetAndDestroy();
 
     CLOG_WRITE_FORMAT( "SaveSecurityInfoL end %d", iSecurityInfo->Count() );
 }
@@ -1207,6 +1180,7 @@
 void CProcessorWlan::SaveWPAL( TUint32 aIapId )
     {
     CLOG_WRITE( "CProcessorWlan::SaveWPAL enter" );
+    
     CMDBSession* session = CMDBSession::NewL( CMDBSession::LatestVersion() );
     CleanupStack::PushL( session );
     
@@ -1251,9 +1225,9 @@
     CLOG_WRITE( "Wrote securityMode" );
 
     // Save EAP list
-    SetExpandedEapListL( generic );
-	CLOG_WRITE( "Wrote expandedEapList" );	
-	
+    SetExpandedEapListL( service );
+    CLOG_WRITE( "Wrote Expanded EAPList" );
+    
     // Save PreShared Key
     TBuf8<KMaxLengthOfKeyData> keyWPA;
     //convert to 8 bit
@@ -1291,7 +1265,7 @@
 // CProcessorWlan::SetExpandedEapListL
 // ---------------------------------------------------------
 //
-void CProcessorWlan::SetExpandedEapListL( CMDBGenericRecord* generic )
+void CProcessorWlan::SetExpandedEapListL( const TUint aServiceId )
     {
     CLOG_WRITE( "CProcessorWlan::SetExpandedEapListL" )
     // Gets the text format eap list
@@ -1299,34 +1273,95 @@
     
     if ( eapList != NULL && 0 < eapList->Length() )
         {
-
-        // Read EAP method and save it as enabled eap list.
-        // Fills expandedForm with 8 bytes: 0xFE, 6 zeros and EAP ID.
-        // That's the format expected by EAPOL.
-        TBuf8<8> expandedForm;
-        expandedForm.AppendFill( 0xFE, 1 );
-        expandedForm.AppendFill( 0x00, 6 );
-            
-        TUint8 resultByte;
-        TLex16 lex( eapList->Ptr() );
-        User::LeaveIfError( lex.Val( resultByte, EDecimal ) );
-        expandedForm.AppendFill( resultByte, 1 );
-        CLOG_WRITE_FORMAT( "CProcessorWlan::SetExpandedEapListL: EAP %d",
-                (int)resultByte)
-
-        CMDBField<TDesC8>* wlanEnabledEapsField = static_cast<CMDBField<TDesC8>*>
-                                ( generic->GetFieldByIdL( KCDTIdWlanEnabledEaps ) );
-        wlanEnabledEapsField->SetL( expandedForm );
-
-        // Save empty disabled EAP list
-        HBufC8* disabledEapList = HBufC8::NewLC(0);
-        CMDBField<TDesC8>* wlanDisabledEapsField = static_cast<CMDBField<TDesC8>*>
-                                ( generic->GetFieldByIdL( KCDTIdWlanDisabledEaps ) );
-        wlanDisabledEapsField->SetL( disabledEapList->Des() );
-        CleanupStack::PopAndDestroy( disabledEapList );
+        // 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
@@ -1340,7 +1375,6 @@
     return aFieldId - 0x2000 + iDataStart;                     
     }
     
-    
 // ---------------------------------------------------------
 // CProcessorWlan::WPAFieldData
 // ---------------------------------------------------------
@@ -1499,11 +1533,12 @@
 		return EFalse;
 		}
 	}
+
 // ---------------------------------------------------------
 // CProcessorWlan::GetEapTypeIdFromSettingId
 // ---------------------------------------------------------
 //
-EAPSettings::TEapType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField )
+TEapExpandedType CProcessorWlan::GetEapTypeIdFromSettingId( const TInt aField )
 	{
 	switch ( aField )
 		{
@@ -1511,7 +1546,7 @@
 		case EEapGtcSessionValidityTime:
 		case EEapGtcEncapsulation:
 			{
-			return EAPSettings::EEapGtc;
+			return *EapExpandedTypeGtc.GetType();
 			}
 		case EEapTlsUsername:
 		case EEapTlsRealm:
@@ -1527,13 +1562,13 @@
 		case EEapTlsCaCertSerialNumber:
 		case EEapTlsEncapsulation:
 			{
-			return EAPSettings::EEapTls;
+			return *EapExpandedTypeTls.GetType();
 			}
 		case EEapLeapUsername:
 		case EEapLeapPassword:
 		case EEapLeapSessionValidityTime:
 			{
-			return EAPSettings::EEapLeap;
+			return *EapExpandedTypeLeap.GetType();
 			}
 		case EEapSimUsername:
 		case EEapSimRealm:
@@ -1541,7 +1576,7 @@
 		case EEapSimSessionValidityTime:
 		case EEapSimEncapsulation:
 			{
-			return EAPSettings::EEapSim;
+			return *EapExpandedTypeSim.GetType();
 			}
 		case EEapTtlsUsername:
 		case EEapTtlsRealm:
@@ -1557,7 +1592,7 @@
 		case EEapTtlsCaCertIssuerName:
 		case EEapTtlsCaCertSerialNumber:
 			{
-			return EAPSettings::EEapTtls;
+			return *EapExpandedTypeTtls.GetType();
 			}
 		case EEapAkaUsername:
 		case EEapAkaRealm:
@@ -1565,7 +1600,7 @@
 		case EEapAkaSessionValidityTime:
 		case EEapAkaEncapsulation:
 			{
-			return EAPSettings::EEapAka;
+			return *EapExpandedTypeAka.GetType();
 			}
 		case EEapPeapUsername:
 		case EEapPeapRealm:
@@ -1584,14 +1619,14 @@
 		case EEapPeapCaCertIssuerName:
 		case EEapPeapCaCertSerialNumber:		
 			{
-			return EAPSettings::EEapPeap;
+			return *EapExpandedTypePeap.GetType();
 			}
 		case EEapMschapv2Username:
 		case EEapMschapv2Password:
 		case EEapMschapv2SessionValidityTime:
 		case EEapMschapv2Encapsulation:
 			{
-			return EAPSettings::EEapMschapv2;
+			return *EapExpandedTypeMsChapv2.GetType();
 			}
 		case EEapFastUsername:
 		case EEapFastRealm:
@@ -1612,7 +1647,7 @@
 		case EEapFastCaCertIssuerName:
 		case EEapFastCaCertSerialNumber:
 			{
-			return EAPSettings::EEapFast; 
+			return *EapExpandedTypeFast.GetType();
 			}
 		
 		case EMschapv2Username:
@@ -1620,23 +1655,24 @@
 		case EMschapv2SessionValidityTime:
 		case EMschapv2Encapsulation:
 			{
-			return EAPSettings::EPlainMschapv2;
+			return *EapExpandedPlainMsChapv2.GetType();
 			}
 		default:
 			{
-			return EAPSettings::EEapNone;
+			return *EapExpandedTypeNone.GetType();
 			}
 		
 		}
 	}
+	
 // ---------------------------------------------------------
 // CProcessorWlan::AddEAPSetting
 // ---------------------------------------------------------
 //
-void CProcessorWlan::AddEAPSettingL( const TInt aField, const HBufC16* const aValue  )
+void CProcessorWlan::AddEAPSettingL( const TInt aField, HBufC16* aValue  )
     {
-    EAPSettings::TEapType eapId = GetEapTypeIdFromSettingId( aField );
-    if ( eapId == EAPSettings::EEapNone )
+    TEapExpandedType eapId = GetEapTypeIdFromSettingId( aField );
+    if ( eapId == *EapExpandedTypeNone.GetType() )
     	{
     	CLOG_WRITE( "! Error : Unknown EAP method" );
     	User::Leave( KErrArgument ); 
@@ -1646,7 +1682,7 @@
 	// Search if the EAP instance already exists in the array for this
 	for ( eapIndex = 0 ; eapIndex < iEapSettings.Count() ; eapIndex++ )
 		{       				
-		if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPType == eapId )
+		if ( ( iEapSettings[eapIndex]->iEapSettings->iEAPExpandedType == eapId )
 			 && ( iEapSettings[eapIndex]->iName != NULL ) 
 			 && ( iEapSettings[eapIndex]->iName->Compare( *iName ) == 0 ))        					 	
 		 	{       				
@@ -1663,7 +1699,7 @@
 		
 		newEap->iEapSettings = new (ELeave) EAPSettings;
 		
-		newEap->iEapSettings->iEAPType = eapId;
+		newEap->iEapSettings->iEAPExpandedType = eapId;
 		
 		newEap->iName = iName->AllocL();                           
 		               	    	
@@ -1690,6 +1726,8 @@
 			{
 			iEapSettings[eapIndex]->iEapSettings->iUsernamePresent = ETrue;
 			iEapSettings[eapIndex]->iEapSettings->iUsername.Copy( *aValue );
+			iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsernamePresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse;
 			break;
 			}
 			
@@ -1698,7 +1736,9 @@
 		case EMschapv2Password:
 			{
 			iEapSettings[eapIndex]->iEapSettings->iPasswordPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue );			
+			iEapSettings[eapIndex]->iEapSettings->iPassword.Copy( *aValue );
+			iEapSettings[eapIndex]->iEapSettings->iShowPassWordPromptPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iUseAutomaticUsername = EFalse;
 			break;
 			}
 
@@ -1710,7 +1750,9 @@
 		case EEapFastRealm:
 			{
 			iEapSettings[eapIndex]->iEapSettings->iRealmPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue );			
+			iEapSettings[eapIndex]->iEapSettings->iRealm.Copy( *aValue );
+			iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealmPresent = ETrue;
+			iEapSettings[eapIndex]->iEapSettings->iUseAutomaticRealm = EFalse;
 			break;
 			}
 				
@@ -1730,7 +1772,7 @@
 			TUint value( 0 );
 			if( lex.Val( value, EDecimal) != KErrNone )
 				{				
-				CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId );
+				CLOG_WRITE_FORMAT( "! Error : Invalid session validity time value. EapId: %d", eapId.GetVendorType() );
 				User::Leave( KErrArgument );
 				}			
 
@@ -1750,11 +1792,10 @@
 			TUint eapTypeId( 0 );						
 			if( lex.Val( eapTypeId, EDecimal) != KErrNone )
 				{
-				CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId );
+				CLOG_WRITE_FORMAT( "! Error : Invalid encapsulation value. EapId: %d", eapId.GetVendorType() );
 				User::Leave( KErrArgument );
 				}			
-
-			iEapSettings[eapIndex]->iEncapsulatingEapId = static_cast< EAPSettings::TEapType >( eapTypeId );
+			iEapSettings[eapIndex]->iEncapsulatingEapId.SetValue( eapId.GetVendorId(), eapTypeId ); 
 			break;
 			}
 		
@@ -1775,7 +1816,7 @@
                 }
             else 
                 {                
-                CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId );                
+                CLOG_WRITE_FORMAT( "! Error : Invalid VerifyServerRealm. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
                 }
 
@@ -1799,7 +1840,7 @@
                 }
             else 
                 {                
-                CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId );                
+                CLOG_WRITE_FORMAT( "! Error : Invalid RequireClientAuth. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
                 }
 			
@@ -1814,7 +1855,7 @@
 			TRAPD( err, FillCipherSuitesL( aValue, eapIndex ) );
 			if( err != KErrNone )
 				{
-				CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId );
+				CLOG_WRITE_FORMAT( "! Error : Invalid CipherSuites. EapId: %d", eapId.GetVendorType() );
 				User::Leave( KErrArgument );
 				}
 			break;
@@ -1825,20 +1866,21 @@
 		case EEapPeapUserCertSubjectKeyId:
 		case EEapFastUserCertSubjectKeyId:
 			{
-			TInt certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+			TInt certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); 
 
-			TBuf<KKeyIdentifierLength> key;
+			TKeyIdentifier key;
 			
 			TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
 			if( err != KErrNone )
 				{
-				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() );
 				User::Leave( KErrArgument );
 				}
    			
    			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);
-   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = ETrue;
+   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyId( key );
+   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
 			break;
 			}
 		
@@ -1847,11 +1889,12 @@
 		case EEapPeapUserCertIssuerName:
 		case EEapFastUserCertIssuerName:
 			{
-			TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+			TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex ); 
 			
 			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
-	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );			
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSubjectKeyIdPresent();
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIssuerName( *aValue );			
 			break;
 			}
 		
@@ -1860,11 +1903,12 @@
 		case EEapPeapUserCertSerialNumber:
 		case EEapFastUserCertSerialNumber:
 			{
-			TUint certIndex = FindCertificateEntryL( CertificateEntry::EUser, eapIndex );
+			TUint certIndex = FindCertificateEntryL( EapCertificateEntry::EUser, eapIndex );
 			
 			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
-	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );			
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetIsEnabled( ETrue );
+			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumberPresent();
+	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex]->SetSerialNumber( *aValue );			
 			break;
 			}
 		
@@ -1873,20 +1917,23 @@
 		case EEapPeapCaCertSubjectKeyId:
 		case EEapFastCaCertSubjectKeyId:
 			{
-			TInt certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+			TInt certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); 
 
-			TBuf<KKeyIdentifierLength> key;
+			TKeyIdentifier key;
 			
 			TRAPD( err, ConvertSubjectKeyIdToBinaryL( aValue, key) );
 			if( err != KErrNone )
 				{
-				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId );
+				CLOG_WRITE_FORMAT( "! Error : Invalid UserCertSubjectKeyId. EapId: %d", eapId.GetVendorType() );
 				User::Leave( KErrArgument );
 				}
 
 			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyID.Copy(key);   			
-   			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSubjectKeyIDPresent = 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;
 			}
 		
@@ -1895,10 +1942,13 @@
 		case EEapPeapCaCertIssuerName:
 		case EEapFastCaCertIssuerName:
 			{
-			TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+			TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); 
 			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerNamePresent= ETrue;
-	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iIssuerName.Copy( *aValue );			
+			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;
 			}
@@ -1908,10 +1958,13 @@
 		case EEapPeapCaCertSerialNumber:
 		case EEapFastCaCertSerialNumber:
 			{
-			TUint certIndex = FindCertificateEntryL( CertificateEntry::ECA, eapIndex );
+			TUint certIndex = FindCertificateEntryL( EapCertificateEntry::ECA, eapIndex ); 
 			iEapSettings[eapIndex]->iEapSettings->iCertificatesPresent = ETrue;
-			iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumberPresent= ETrue;
-	 		iEapSettings[eapIndex]->iEapSettings->iCertificates[certIndex].iSerialNumber.Copy( *aValue );
+			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;
 			}
 		
@@ -1930,7 +1983,7 @@
 	            }
 	        else 
 	            {
-	            CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId );                
+	            CLOG_WRITE_FORMAT( "! Error : Invalid UsePseudonyms. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			break;
@@ -1940,35 +1993,8 @@
 		case EEapPeapEncapsulatedTypes:
 		case EEapFastEncapsulatedTypes:
 			{
-		    // Lenght of a 3 digit long signed number 
-		     const TInt sliceLength = 4;
-    
-		    TInt pos = 0;
-    		while ( pos + sliceLength <= aValue->Length() )
-        		{
-	        	// Getting a slice
-	        	TPtrC16 slice = aValue->Mid( pos, sliceLength );
-	        
-	        	// Checks the sign
-	        	if( slice[0] == '+' )
-	            	{
-         		   	TLex lex( slice.Ptr() + 1 );		
-					TUint encapsEapId( 0 );		
-					
-					if( lex.Val( encapsEapId, EDecimal) != KErrNone )
-						{				
-						CLOG_WRITE_FORMAT( "! Error : Invalid EncapsulatedTypes. EapId: %d", eapId );
-						User::Leave( KErrArgument );
-						}								
-					
-           			iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypes.Append( encapsEapId );
-					iEapSettings[eapIndex]->iEapSettings->iEncapsulatedEAPTypesPresent = ETrue;
-	            	}
-	                    	       
-		        // Step over one slice and "," e.g. "+023,"
-		        pos+=5;            
-        		}
-
+			iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( GetExpandedEapTypeIdL( *aValue ) );
+            iEapSettings[eapIndex]->iEapSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue;
 			break;
 			}
 		
@@ -1986,7 +2012,7 @@
 	            }
 	        else 
 	            {
-   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId );                
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV0Allowed. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2007,7 +2033,7 @@
 	            }
 	        else 
 	            {
-   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId );                
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV1Allowed. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2028,7 +2054,7 @@
 	            }
 	        else 
 	            {
-   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId );
+   	            CLOG_WRITE_FORMAT( "! Error : Invalid EapPeapV2Allowed. EapId: %d", eapId.GetVendorType() );
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2049,7 +2075,7 @@
 	            }
 	        else 
 	            {
-  	            CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId );                
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EEapFastAuthProvModeAllowed. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2071,7 +2097,7 @@
 	        else 
 	            {
 
-  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId );                
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastUnauthProvModeAllowed. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2092,7 +2118,7 @@
 	            }
 	        else 
 	            {
-  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId );                
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoPAC. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2113,7 +2139,7 @@
 	            }
 	        else 
 	            {
-  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId );                
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnADHPNoMatchingPAC. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2134,7 +2160,7 @@
 	            }
 	        else 
 	            {
-  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId );                
+  	            CLOG_WRITE_FORMAT( "! Error : Invalid EapFastWarnNotDefaultServer. EapId: %d", eapId.GetVendorType() );                
                 User::Leave( KErrArgument );
 	            }
 			
@@ -2185,12 +2211,12 @@
 // CProcessorWlan::FindCertificateEntry
 // ---------------------------------------------------------
 //
-TUint CProcessorWlan::FindCertificateEntryL( const CertificateEntry::TCertType aCertType, const TInt aEapIndex )
+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].iCertType == aCertType )
+		if( iEapSettings[aEapIndex]->iEapSettings->iCertificates[certIndex]->GetCertType() == aCertType )
 			{
 			// Found
 			break;
@@ -2199,9 +2225,9 @@
 	if( certIndex == iEapSettings[aEapIndex]->iEapSettings->iCertificates.Count() )
 		{
 		// Not found. Create
-		CertificateEntry entry;
-
-		entry.iCertType = aCertType;
+		EapCertificateEntry* entry;
+		entry = new (ELeave) EapCertificateEntry;
+		entry->SetCertType( aCertType );
 
 		iEapSettings[aEapIndex]->iEapSettings->iCertificates.AppendL( entry );
 
@@ -2214,7 +2240,7 @@
 // CProcessorWlan::ConvertSubjectKeyIdToBinary
 // ---------------------------------------------------------
 //
-void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TDes& aBinaryKey)
+void CProcessorWlan::ConvertSubjectKeyIdToBinaryL( const HBufC16* const aSubjectKeyIdString, TKeyIdentifier& aBinaryKey)
 	{
 	TInt err( KErrNone );
 	
--- a/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/Src/cdcreaderxml.cpp	Mon May 24 20:51:35 2010 +0300
@@ -473,8 +473,6 @@
 _LIT16( KUIPriorityDialIn,          "UIPriorityDialIn" );
 _LIT16( KUIPriorityVpn,             "UIPriorityVpn" );
 _LIT16( KUIPriorityMip,             "UIPriorityMip" );
-_LIT16( KDefaultConnectionType,     "DefaultConnectionType" );
-_LIT16( KDefaultConnectionName,     "DefaultConnectionName" );
 _LIT16( KUsageOfWlan,               "UsageOfWlan" );
 _LIT16( KCellularDataUsageHome,     "CellularDataUsageHome" );
 _LIT16( KCellularDataUsageVisitor,  "CellularDataUsageVisitor" );
@@ -1778,8 +1776,6 @@
     iGlobalParams.Append( EInputParams( EUIPriorityDialIn,      KUIPriorityDialIn ) );
     iGlobalParams.Append( EInputParams( EUIPriorityVpn,         KUIPriorityVpn ) );
     iGlobalParams.Append( EInputParams( EUIPriorityMip,         KUIPriorityMip ) );
-    iGlobalParams.Append( EInputParams( EDefaultConnectionType, KDefaultConnectionType ) );
-    iGlobalParams.Append( EInputParams( EDefaultConnectionName, KDefaultConnectionName ) );
     iGlobalParams.Append( EInputParams( EUsageOfWlan,           KUsageOfWlan ) );
     iGlobalParams.Append( EInputParams( ECellularDataUsageHome,         KCellularDataUsageHome ) );
     iGlobalParams.Append( EInputParams( ECellularDataUsageVisitor,      KCellularDataUsageVisitor ) );
--- a/dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/commsdatcreator/group/cdccommsdatcreator.mmp	Mon May 24 20:51:35 2010 +0300
@@ -73,3 +73,4 @@
 LIBRARY        cmmanagerdatabase.lib
 LIBRARY        flogger.lib 
 LIBRARY        centralrepository.lib
+LIBRARY        eaptools.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/conf/CI_commsdatcreator.confml	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,831 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration xmlns="http://www.s60.com/xml/confml/2" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Default CommsDat settings" version="1">
+  <feature ref="Global" name="Global Settings">
+    <desc>Global network related settings not tied to individual connection methods.</desc>
+    <setting ref="Attachmode" name="Packet Data Connection" type="selection">
+      <desc>Defines the packet data connection mode. Select When Available to register the device to the packet data network (GPRS) when users switch it on in a supported network. Select When Needed to establish a packet data connection only when applications or actions require it.</desc>
+      <option name="When Available" value="whenavailable"/>
+      <option name="When Needed" value="whenneeded"/>
+    </setting>
+    <setting ref="DefaultAP" name="Default Packet Data Access Point" type="string">
+      <desc>The default access point to use the device as a packet data modem for a computer.</desc>
+      <xs:maxLength value="100"/>
+    </setting>
+    <setting ref="UsageOfWlan" name="Usage Of Wlan" type="selection">
+      <desc>
+      This setting controls the behavior of the device regarding known (saved) and new WLAN networks.
+      When a known WLAN network is discovered, the device can automatically switch to it.
+      When one or more new unknown WLAN networks are discovered in connection request phase, those can be proposed and taken into use.
+    	</desc>
+      <option name="Known WLANs only" value="Known"/>
+      <option name="Manual" value="Manual"/>
+    </setting>
+    <setting ref="CellularDataUsageHome" name="Data usage in home network" type="selection">
+      <desc>
+      This setting controls the cellular packet data usage in home network.
+      Automatic means that cellular data connection is utilized automatically in case needed.
+      Confirm means that there is a confirmation query to confirm the usage.
+      WLAN Only means that cellular data is not tried to use. Instead, WLAN is utilized whenever possible. 
+    	</desc>
+      <option name="Automatic" value="Automatic"/>
+      <option name="Confirm" value="Confirm"/>
+      <option name="WlanOnly" value="Wlan only"/>
+    </setting>
+    <setting ref="CellularDataUsageVisitor" name="Data usage in foreign network" type="selection">
+      <desc>
+      This setting controls the cellular packet data usage in foreign network.
+      Automatic means that cellular data connection is utilized automatically in case needed.
+      Confirm means that there is a confirmation query to confirm the usage.
+      WLAN Only means that cellular data is not tried to use. Instead, WLAN is utilized whenever possible. 
+    	</desc>
+      <option name="Automatic" value="Automatic"/>
+      <option name="Confirm" value="Confirm"/>
+      <option name="WlanOnly" value="Wlan only"/>
+    </setting>
+    <setting ref="GprsLastSocketActivityTimeout" name="GPRS last socket activity timeout" type="string">
+      <desc>
+    	For GPRS the time (in seconds) to stay online when all socket activity has ceased. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="GprsLastSessionClosedTimeout" name="GPRS last session closed timeout" type="string">
+      <desc>
+    	For GPRS the time (in seconds) to stay online when session has closed. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="GprsLastSocketClosedTimeout" name="GPRS last socket closed timeout" type="string">
+      <desc>
+    	For GPRS the time (in seconds) to stay online when socket has closed. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="WlanLastSocketActivityTimeout" name="WLAN last socket activity timeout" type="string">
+      <desc>
+    	For WLAN the time (in seconds) to stay online when all socket activity has ceased. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="WlanLastSessionClosedTimeout" name="WLAN last session closed timeout" type="string">
+      <desc>
+    	For WLAN the time (in seconds) to stay online when all socket activity has ceased. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="WlanLastSocketClosedTimeout" name="WLAN last socket closed timeout" type="string">
+      <desc>
+    	For WLAN the time (in seconds) to stay online when all socket activity has ceased. -1 for unlimited time.
+    	Leave empty to use the product default value.
+    	</desc>
+    </setting>
+    <setting ref="WlanBGScanInterval" name="WLAN background scan interval" type="selection">
+      <desc>
+      How often WLAN networks are scanned when idle.
+      </desc>
+      <option name="Automatic" value="-1"/>
+      <option name="Never" value="0"/>
+      <option name="Every minute" value="60"/>
+      <option name="Every 2 minutes" value="120"/>
+      <option name="Every 5 minutes" value="300"/>
+      <option name="Every 10 minutes" value="600"/>
+    </setting>
+  </feature>
+  <feature ref="APs" name="Packet Data Access Points" relevant="">
+    <desc>Settings for packet data connections (GPRS).</desc>
+    <setting ref="AP" relevant="" mapKey="ConnectionName" mapValue="ConnectionName" name="Packet Data" constraint="" type="sequence" minOccurs="0" maxOccurs="99">
+      <desc>Access point to a packet data network.</desc>
+      <setting ref="ConnectionName" required="true" name="Connection Name" type="string">
+        <desc>The connection name that is visible to the user.</desc>
+        <xs:maxLength value="30"/>
+      </setting>
+      <setting ref="ConnectionId" name="Connection ID">
+        <desc>Specifies the connection ID. Either specify the connection ID manually or leave empty to have it allocated automatically. If you specify the ID manaually, verify that the IDs are globally unique.</desc>
+      </setting>
+      <setting ref="Protected" name="Protected" type="selection">
+        <desc>Defines whether the access point is protected or not. Users cannot edit protected access points.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Hidden" name="Hidden" type="selection">
+        <desc>Defines whether the access point is hidden or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="HiddenAgent" name="Hidden Agent" type="selection">
+        <desc>Defines whether or not to hide the access point for MMS connections.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Highlighted" name="Highlighted" type="selection">
+        <desc>Defines whether the access point is highlighted or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Seamlessness" name="Use access point" type="selection">
+        <desc>Defines whether devices can roam to an access point.</desc>
+        <option name="After confirmation" value="ConfirmFirst"/>
+        <option name="Automatically " value="ShowProgress"/>
+      </setting>
+      <setting ref="NetworkType" name="Network Type" type="selection">
+        <desc>Defines the addressing that the network uses.</desc>
+        <option name="IPv4" value="IPv4"/>
+        <option name="IPv6" value="IPv6"/>
+      </setting>
+      <setting ref="GPRS_AP_Name" required="true" name="Access Point Name" type="string">
+        <desc>The access point name for this packet data connection.</desc>
+        <xs:maxLength value="100"/>
+      </setting>
+      <setting ref="UserName" name="User Name" type="string">
+        <desc>Authenticates the user to the access point.</desc>
+        <xs:maxLength value="50"/>
+      </setting>
+      <setting ref="PromptPassword" name="Prompt Password" type="selection">
+        <desc>Prompts the user to enter a password when a connection is created.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Password" relevant="PromptPassword='Yes'" name="Password" type="string">
+        <desc>Authenticates the user to the access point.</desc>
+        <xs:maxLength value="50"/>
+      </setting>
+      <setting ref="PasswordAuthenticationType" name="Password Authentication Type" type="selection">
+        <desc>The password authentication method. Select Secure to always send the password encrypted and Normal to send it encryped when possible.</desc>
+        <option name="Normal" value="Normal"/>
+        <option name="Secure" value="Secure"/>
+      </setting>
+      <setting ref="WAPGatewayIP" name="WAP Gateway IP" type="string">
+        <desc>Wireless application protocol (WAP) gateway IP address.</desc>
+      </setting>
+      <setting ref="StartingPage" name="Starting Page" type="string">
+        <desc>The Web address (in URL format) of the page to display as the home page when users use this access point.</desc>
+        <xs:pattern value="(http(|s)://([\w-]+\.)+[\w-]+(:[0-9]{1,5})?(/[\w- ./?%&amp;=]*)?|)"/>
+        <xs:maxLength value="100"/>
+      </setting>
+      <setting ref="WTLS_Security" name="WTLS Security" type="selection">
+        <desc>Attempts a secure wireless transport layer security (WTLS) connection to the WAP gateway.</desc>
+        <option name="On" value="On"/>
+        <option name="Off" value="Off"/>
+      </setting>
+      <setting ref="WAP_ConnectionType" name="Connection type" type="selection">
+        <desc>Defines whether to use a continuous or a temporary connection.</desc>
+        <option name="Continuous" value="Continuous"/>
+        <option name="Temporary" value="Temporary"/>
+      </setting>
+      <setting ref="PhoneIP" relevant="NetworkType='IPv4'" name="IPv4 Phone IP Address" type="string">
+        <desc>IP address of the interface. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="PrimaryNameServer" relevant="NetworkType='IPv4'" name="IPv4 Primary Name Server" type="string">
+        <desc>Address of the primary DNS server that resolves host names. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="SecondaryNameServer" relevant="NetworkType='IPv4'" name="IPv4 Secondary Name Server" type="string">
+        <desc>Address of the secondary DNS server to connect if the primary DNS server is not available. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="PrimaryIP6NameServer" relevant="NetworkType='IPv6'" name="IPv6 Primary Name Server" type="string">
+        <desc>Address of the primary DNS server that resolves host names. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="SecondaryIP6NameServer" relevant="NetworkType='IPv6'" name="IPv6 Secondary Name Server" type="string">
+        <desc>Address of the secondary DNS server to connect if the primary DNS server is not available. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="ProxyServerAddress" name="Proxy Server Address" type="string">
+        <desc>Address of the HTTP/HTTPS proxy server.</desc>
+        <xs:maxLength value="1000"/>
+      </setting>
+      <setting ref="ProxyPortNumber" name="Proxy Port Number" type="string">
+        <desc>Port number of the HTTP/HTTPS proxy server.</desc>
+        <xs:maxLength value="5"/>
+      </setting>
+      <setting ref="ProxyProtocolName" name="Proxy Protocol Name" type="string">
+        <desc>Protocol name for the proxy settings. Typically HTTP or HTTPS.</desc>
+      </setting>
+      <setting ref="GprsUseEdge" name="Use EDGE" type="selection">
+        <desc>Defines whether EDGE usage is allowed or not.</desc>
+        <option name="Yes" value="Yes"/>
+        <option name="No" value="No"/>
+      </setting>
+      <setting ref="IspType" name="Service Provider Type" type="selection">
+        <desc>Specifies the service provider type. Used when filtering connection methods for certain purpose.</desc>
+        <option name="Internet" value="0"/>
+        <option name="WAP" value="1"/>
+        <option name="Both" value="2"/>
+      </setting>
+      <setting ref="Linger" name="Always Online / Linger time" type="selection">
+        <desc>Defines the time to stay online after all activity on a network link has stopped. Choose 0 or a negative value for unlimited time. Leave empty to disable.</desc>
+        <option name="Off" value=""/>
+        <option name="30 min" value="1800"/>
+        <option name="1h" value="3600"/>
+        <option name="5h" value="18000"/>
+      </setting>
+    </setting>
+  </feature>
+  <feature ref="WLAN_APs" name="WLAN Access Points" relevant="">
+    <desc>Settings for WLAN connections.</desc>
+    <setting ref="WLAN_AP" relevant="" name="WLAN" constraint="" type="sequence" minOccurs="0" maxOccurs="99">
+      <desc>Specifies the settings for WLAN access point.</desc>
+      <setting ref="ConnectionName" name="Connection Name" constraint="" type="string">
+        <desc>The connection name that is visible to the user.</desc>
+      </setting>
+      <setting ref="ConnectionId" name="Connection ID">
+        <desc>Specifies the connection ID. Either specify the connection ID manually or leave empty to have it allocated automatically. If you specify the ID manaually, verify that the IDs are globally unique.</desc>
+      </setting>
+      <setting ref="Protected" name="Protected" type="selection">
+        <desc>Defines whether the access point is protected or not. Users cannot edit protected access points.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Hidden" name="Hidden" type="selection">
+        <desc>Defines whether the access point is hidden or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="HiddenAgent" name="Hidden Agent" type="selection">
+        <desc>Defines whether or not to hide the access point for MMS connections.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Highlighted" name="Highlighted" type="selection">
+        <desc>Defines whether the access point is highlighted or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Seamlessness" name="Seamlessness" type="selection">
+        <desc>Defines whether devices can roam to an access point.</desc>
+        <option name="Confirm First" value="ConfirmFirst"/>
+        <option name="Show Progress" value="ShowProgress"/>
+      </setting>
+      <setting ref="NetworkName" name="Network Name" type="string">
+        <desc>Service set identifier (SSID) of the primary WLAN network.</desc>
+      </setting>
+      <setting ref="StartingPage" name="Starting Page" type="string">
+        <desc>The Web address (in URL format) of the page to display as the home page when users use this access point.</desc>
+      </setting>
+      <setting ref="NetworkMode" name="Network Mode" type="string">
+        <desc>Determines how devices communicate with each other. Select Infrastructure if there is a WLAN access point in the network. Select Ad Hoc if devices can send and receive data directly with each other.</desc>
+        <option name="Infrastructure" value="Infrastructure"/>
+        <option name="Ad-hoc" value="Ad-hoc"/>
+      </setting>
+      <setting ref="SecurityMode" name="Security Mode" type="selection">
+        <desc>Security mode of the WLAN network.</desc>
+        <option name="Open" value="Open"/>
+        <option name="WEP" value="WEP"/>
+        <option name="802.1x" value="802.1x"/>
+        <option name="WPA" value="WPA"/>
+        <option name="WPA2" value="WPA2"/>
+      </setting>
+      <setting ref="PrimaryNameServer" name="IPv4 Primary Name Server" type="string">
+        <desc>Address of the primary DNS server that resolves host names. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="SecondaryNameServer" name="IPv4 Secondary Name Server" type="string">
+        <desc>Address of the secondary DNS server to connect if the primary DNS server is not available. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="PrimaryIP6NameServer" name="IPv6 Primary Name Server" type="string">
+        <desc>Address of the primary DNS server that resolves host names. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="SecondaryIP6NameServer" name="IPv6 Secondary Name Server" type="string">
+        <desc>Address of the secondary DNS server to connect if the primary DNS server is not available. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="WlanIpGatewayAddress" name="WLAN IP Gateway Address" type="string">
+        <desc>The gateway IP address. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="WlanIpNetMask" name="Wlan IP Net Mask" type="string">
+        <desc>Network mask. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="ProxyServerAddress" name="Proxy Server Address" type="string">
+        <desc>Address of the HTTP/HTTPS proxy server.</desc>
+      </setting>
+      <setting ref="ProxyPortNumber" name="Proxy Port Number" type="string">
+        <desc>Port number of the HTTP/HTTPS proxy server.</desc>
+      </setting>
+      <setting ref="ProxyProtocolName" name="Proxy Protocol Name" type="string">
+        <desc>Protocol name for the proxy settings. Typically HTTP or HTTPS.</desc>
+      </setting>
+      <setting ref="WLANScanSSID" name="WLAN Scan SSID" type="selection">
+        <desc>Defines whether the SSID should be actively scanned. This is needed if the SSID is hidden (not broadcasted by the AP).</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="WlanChannelId" name="WLAN Channel ID" type="string">
+        <desc>802.11 Channel ID (1-14). Used only when connecting/setting up adhoc network.</desc>
+      </setting>
+      <setting ref="PhoneIP" name="IPv4 Phone IP address" type="string">
+        <desc>IP address of the interface. Typically allocated automatically.</desc>
+      </setting>
+      <setting ref="WEPKeyInUse" name="WEP Key In Use" type="selection">
+        <desc>Index of default WEP key. Used only when security mode is WEP.</desc>
+        <option name="key1" value="key1"/>
+        <option name="key2" value="key2"/>
+        <option name="key3" value="key3"/>
+        <option name="key4" value="key4"/>
+      </setting>
+      <setting ref="WEPAuthType" name="WEP Authentication Type" type="selection">
+        <desc>WEP authentication mode. Select Open to allow any device that knows the SSID of the access point to gain access to the network. Select Shared to allow access only to devices that have a static WEP key and pass a challenge based authentication. Only used when security mode is WEP.</desc>
+        <option name="Shared" value="Shared"/>
+        <option name="Open" value="Open"/>
+      </setting>
+      <setting ref="WEPKey1Length" name="WEP Key1 Length" type="selection">
+        <desc>WEP key length in bits.</desc>
+        <option name="64" value="64"/>
+        <option name="128" value="128"/>
+        <option name="256" value="256"/>
+      </setting>
+      <setting ref="WEPKey1Format" name="WEP Key1 Format" type="selection">
+        <desc>WEP key format.</desc>
+        <option name="ASCII" value="ASCII"/>
+        <option name="Hexadecimal" value="Hexadecimal"/>
+      </setting>
+      <setting ref="WEPKey1Data" name="WEP Key1 Data" type="string">
+        <desc>WEP key data in either ASCII or hexadecimal format. Devices use the RC4 algorithm with a key length of 64, 128, or 256 bits to define a set of WEP keys. Access to the WLAN is allowed only to mobile devices that have the required keys. If the key length is 64, enter 5 bytes in ASCII or 10 bytes in hexadecimal format. If the key length is 128, enter 13 bytes in ASCII or 26 bytes in hexadecimal format.</desc>
+      </setting>
+      <setting ref="WEPKey2Length" name="WEP Key2 Length" type="selection">
+        <desc>WEP key length in bits.</desc>
+        <option name="64" value="64"/>
+        <option name="128" value="128"/>
+        <option name="256" value="256"/>
+      </setting>
+      <setting ref="WEPKey2Format" name="WEP Key2 Format" type="selection">
+        <desc>WEP key format.</desc>
+        <option name="ASCII" value="ASCII"/>
+        <option name="Hexadecimal" value="Hexadecimal"/>
+      </setting>
+      <setting ref="WEPKey2Data" name="WEP Key2 Data" type="string">
+        <desc>WEP key data in either ASCII or hexadecimal format. Devices use the RC4 algorithm with a key length of 64, 128, or 256 bits to define a set of WEP keys. Access to the WLAN is allowed only to mobile devices that have the required keys. If the key length is 64, enter 5 bytes in ASCII or 10 bytes in hexadecimal format. If the key length is 128, enter 13 bytes in ASCII or 26 bytes in hexadecimal format.</desc>
+      </setting>
+      <setting ref="WEPKey3Length" name="WEP Key3 Length" type="selection">
+        <desc>WEP key length in bits.</desc>
+        <option name="64" value="64"/>
+        <option name="128" value="128"/>
+        <option name="256" value="256"/>
+      </setting>
+      <setting ref="WEPKey3Format" name="WEP Key3 Format" type="selection">
+        <desc>WEP key format.</desc>
+        <option name="ASCII" value="ASCII"/>
+        <option name="Hexadecimal" value="Hexadecimal"/>
+      </setting>
+      <setting ref="WEPKey3Data" name="WEP Key3 Data" type="string">
+        <desc>WEP key data in either ASCII or hexadecimal format. Devices use the RC4 algorithm with a key length of 64, 128, or 256 bits to define a set of WEP keys. Access to the WLAN is allowed only to mobile devices that have the required keys. If the key length is 64, enter 5 bytes in ASCII or 10 bytes in hexadecimal format. If the key length is 128, enter 13 bytes in ASCII or 26 bytes in hexadecimal format.</desc>
+      </setting>
+      <setting ref="WEPKey4Length" name="WEP Key4 Length" type="selection">
+        <desc>WEP key length in bits.</desc>
+        <option name="64" value="64"/>
+        <option name="128" value="128"/>
+        <option name="256" value="256"/>
+      </setting>
+      <setting ref="WEPKey4Format" name="WEP Key4 Format" type="selection">
+        <desc>WEP key format.</desc>
+        <option name="ASCII" value="ASCII"/>
+        <option name="Hexadecimal" value="Hexadecimal"/>
+      </setting>
+      <setting ref="WEPKey4Data" name="WEP Key4 Data" type="string">
+        <desc>WEP key data in either ASCII or hexadecimal format. Devices use the RC4 algorithm with a key length of 64, 128, or 256 bits to define a set of WEP keys. Access to the WLAN is allowed only to mobile devices that have the required keys. If the key length is 64, enter 5 bytes in ASCII or 10 bytes in hexadecimal format. If the key length is 128, enter 13 bytes in ASCII or 26 bytes in hexadecimal format.</desc>
+      </setting>
+      <setting ref="WPAPresharedKey" name="WPA Pre-shared Key" type="string">
+        <desc>WPA/WPA2 pre-shared key in plain text. ASCII character set values between 32-126 must be used. Minimum length is 8 characters and maximum 63. Define the WPA pre-shared key length field accordingly.</desc>
+      </setting>
+      <setting ref="WPAUseOfPresharedKey" name="WPA Use Of Pre-shared Key" type="selection">
+        <desc>Enables the Pre-shared key mode when the security mode is WPA or WPA2. If the setting is off, EAP mode is used and the list of EAPs needs to be defined.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="WPAKeyLength" name="WPA Pre-shared Key Length">
+        <desc>The length of the specified pre-shared key in WPA Pre-shared Key.</desc>
+      </setting>
+      <setting ref="WPAEapMethod" name="WPA EAP method" type="selection">
+        <desc>
+      	Extensible Authentication Protocol (EAP) method in use for this connection in case security mode is WPA or 802.1x with EAP. Please fill also the relevant EAP method specific settings.
+      	</desc>
+        <option name="EAP-SIM" value="18"/>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-AKA" value="23"/>
+        <option name="EAP-TLS" value="13"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-LEAP" value="17"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapGtcUsername" name="EAP-GTC User Name" type="string">
+        <desc>The username used with EAP-GTC.</desc>
+      </setting>
+      <setting ref="EapGtcSessionValidityTime" name="EAP-GTC Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapGtcEncapsulation" name="EAP-GTC Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with EAP-GTC.</desc>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapTlsUsername" name="EAP-TLS User Name" type="string">
+        <desc>The username used with EAP-TLS.</desc>
+      </setting>
+      <setting ref="EapTlsRealm" name="EAP-TLS Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapTlsVerifyServerRealm" name="EAP-TLS Verify Server Realm" type="selection">
+        <desc>Compares the server realm with the device realm. This provides extra security but it depends on the network infrastructure and set-up whether this will work.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapTlsRequireClientAuth" name="EAP-TLS Requires Client Authentication" type="selection">
+        <desc>Specifies whether TLS requires that the server authenticates the client.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapTlsSessionValidityTime" name="EAP-TLS Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapTlsCipherSuites" name="EAP-TLS Cipher Suites" type="string">
+        <desc>The list of allowed cipher suites. In the format +xxx,+xxx,+xxx... where xxx is the cipher suite identifier. 004: TLS_RSA_WITH_RC4_128_MD5, 005: TLS_RSA_WITH_RC4_128_SHA, 010: TLS_RSA_WITH_3DES_EDE_CBC_SHA, 019: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 022: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 047: TLS_RSA_WITH_AES_128_CBC_SHA, 050: TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 051: TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 052: TLS_DH_anon_WITH_AES_128_CBC_SHA. For example, +004 enables only RSA with RC4 and MD5.</desc>
+      </setting>
+      <setting ref="EapTlsUserCertSubjectKeyId" name="EAP-TLS User Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the user certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapTlsUserCertIssuerName" name="EAP-TLS User Certificate Issuer" type="string">
+        <desc>The issuer of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTlsUserCertSerialNumber" name="EAP-TLS User Certificate Serial Number" type="string">
+        <desc>The serial number of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTlsCaCertSubjectKeyId" name="EAP-TLS CA Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the CA certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapTlsCaCertIssuerName" name="EAP-TLS CA Certificate Issuer" type="string">
+        <desc>The issuer of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTlsCaCertSerialNumber" name="EAP-TLS CA Certificate Serial Number" type="string">
+        <desc>The serial number of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTlsEncapsulation" name="EAP-TLS Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with EAP-TLS.</desc>
+        <option name="None" value=""/>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapLeapUsername" name="EAP-LEAP User Name" type="string">
+        <desc>The username used with EAP-LEAP.</desc>
+      </setting>
+      <setting ref="EapLeapPassword" name="EAP-LEAP Password" type="string">
+        <desc>The password used with EAP-LEAP.</desc>
+      </setting>
+      <setting ref="EapLeapSessionValidityTime" name="EAP-LEAP Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, o new password queries).</desc>
+      </setting>
+      <setting ref="EapSimUsername" name="EAP-SIM User Name" type="string">
+        <desc>The username used with EAP-SIM.</desc>
+      </setting>
+      <setting ref="EapSimRealm" name="EAP-SIM Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapSimUsePseudonyms" name="EAP-SIM Pseudonyms Allowed" type="selection">
+        <desc>Specifies whether IMSI is always sent when authenticating or is pseudonym usage allowed.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapSimSessionValidityTime" name="EAP-SIM Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapSimEncapsulation" name="EAP-SIM Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with EAP-SIM.</desc>
+        <option name="None" value=""/>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapTtlsUsername" name="EAP-TTLS User Name" type="string">
+        <desc>The username used with EAP-TTLS.</desc>
+      </setting>
+      <setting ref="EapTtlsRealm" name="EAP-TTLS Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapTtlsVerifyServerRealm" name="EAP-TTLS Verify Server Realm" type="selection">
+        <desc>Compares the server realm with the device realm. This provides extra security but it depends on the network infrastructure and set-up whether this will work.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapTtlsRequireClientAuth" name="EAP-TTLS Require Client Authentication" type="selection">
+        <desc>Specifies whether TTLS requires that the server authenticates the client.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapTtlsSessionValidityTime" name="EAP-TTLS Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapTtlsCipherSuites" name="EAP-TTLS Cipher Suites" type="string">
+        <desc>The list of allowed cipher suites. In the format +xxx,+xxx,+xxx... where xxx is the cipher suite identifier. 004: TLS_RSA_WITH_RC4_128_MD5, 005: TLS_RSA_WITH_RC4_128_SHA, 010: TLS_RSA_WITH_3DES_EDE_CBC_SHA, 019: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 022: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 047: TLS_RSA_WITH_AES_128_CBC_SHA, 050: TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 051: TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 052: TLS_DH_anon_WITH_AES_128_CBC_SHA. For example, +004 enables only RSA with RC4 and MD5.</desc>
+      </setting>
+      <setting ref="EapTtlsEncapsulatedTypes" name="EAP-TTLS Tunneled Methods" type="string">
+        <desc>A list of Extensible Authentication Protocols (EAPs) in tunneled by EAP-TTLS. The format is +xxx,+xxx,+xxx where xxx indicates the enabled EAP method ID as specified in the IANA registry: http://www.iana.org/assignments/eap-numbers. For example, to enable EAP-SIM encapsulation the string needs to be &quot;+018&quot;. The list is in priority order, highest priority first. Note that the encapsulate type's encapsulation parameter needs to be configured accordingly.</desc>
+      </setting>
+      <setting ref="EapTtlsUserCertSubjectKeyId" name="EAP-TTLS User Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the user certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapTtlsUserCertIssuerName" name="EAP-TTLS User Certificate Issuer" type="string">
+        <desc>The issuer of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTtlsUserCertSerialNumber" name="EAP-TTLS User Certificate Serial Number" type="string">
+        <desc>The serial number of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTtlsCaCertSubjectKeyId" name="EAP-TTLS CA Certificate Subject Key ID" type="string">
+        <desc>The subject key id value of the CA certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapTtlsCaCertIssuerName" name="EAP-TTLS CA Certificate Issuer" type="string">
+        <desc>The issuer of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapTtlsCaCertSerialNumber" name="EAP-TTLS CA Certificate Serial Number" type="string">
+        <desc>The serial number of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapAkaUsername" name="EAP-AKA User Name" type="string">
+        <desc>The username used with EAP-AKA.</desc>
+      </setting>
+      <setting ref="EapAkaRealm" name="EAP-AKA Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapAkaUsePseudonyms" name="EAP-AKA Pseudonyms Allowed" type="selection">
+        <desc>Specifies whether IMSI is always sent when authenticating or is pseudonym usage allowed.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapAkaSessionValidityTime" name="EAP-AKA Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapAkaEncapsulation" name="EAP-AKA Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with EAP-AKA.</desc>
+        <option name="None" value=""/>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapPeapUsername" name="EAP-PEAP User Name" type="string">
+        <desc>The username used with EAP-PEAP.</desc>
+      </setting>
+      <setting ref="EapPeapRealm" name="EAP-PEAP Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapPeapVerifyServerRealm" name="EAP-PEAP Verify Server Realm" type="selection">
+        <desc>Compares the server realm with the device realm. This provides extra security but it depends on the network infrastructure and set-up whether this will work.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapPeapRequireClientAuth" name="EAP-PEAP Require Client Authentication" type="selection">
+        <desc>Specifies whether PEAP requires that the server authenticates the client.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapPeapSessionValidityTime" name="EAP-PEAP Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapPeapCipherSuites" name="EAP-PEAP Cipher Suites" type="string">
+        <desc>The list of allowed cipher suites. In the format +xxx,+xxx,+xxx... where xxx is the cipher suite identifier. 004: TLS_RSA_WITH_RC4_128_MD5, 005: TLS_RSA_WITH_RC4_128_SHA, 010: TLS_RSA_WITH_3DES_EDE_CBC_SHA, 019: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 022: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 047: TLS_RSA_WITH_AES_128_CBC_SHA, 050: TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 051: TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 052: TLS_DH_anon_WITH_AES_128_CBC_SHA. For example, +004 enables only RSA with RC4 and MD5.</desc>
+      </setting>
+      <setting ref="EapPeapV0Allowed" name="Allow EAP-PEAP Version 0" type="selection">
+        <desc>Defines whether PEAP version 0 is allowed. If in doubt enable only this one.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapPeapV1Allowed" name="Allow EAP-PEAP Version 1" type="selection">
+        <desc>Defines whether PEAP version 1 is allowed.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapPeapV2Allowed" name="Allow EAP-PEAP Version 2" type="selection">
+        <desc>Defines whether PEAP version 2 is allowed.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapPeapEncapsulatedTypes" name="EAP-PEAP Tunneled Methods" type="string">
+        <desc>A list of Extensible Authentication Protocols (EAPs) in tunneled by EAP-PEAP. The format is +xxx,+xxx,+xxx where xxx indicates the enabled EAP method ID as specified in the IANA registry: http://www.iana.org/assignments/eap-numbers. For example to enable EAP-SIM encapsulation the string needs to be &quot;+018&quot;. The list is in priority order, highest priority first. Note that the encapsulate type's encapsulation parameter needs to be configured accordingly.</desc>
+      </setting>
+      <setting ref="EapPeapUserCertSubjectKeyId" name="EAP-PEAP User Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the user certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapPeapUserCertIssuerName" name="EAP-PEAP User Certificate Issuer" type="string">
+        <desc>The issuer of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapPeapUserCertSerialNumber" name="EAP-PEAP User Certificate Serial Number" type="string">
+        <desc>The serial number of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapPeapCaCertSubjectKeyId" name="EAP-PEAP CA Certificate Subject Key ID" type="string">
+        <desc>The subject key id value of the CA certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapPeapCaCertIssuerName" name="EAP-PEAP CA Certificate Issuer" type="string">
+        <desc>The issuer of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapPeapCaCertSerialNumber" name="EAP-PEAP CA Certificate Serial Number" type="string">
+        <desc>The serial number of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapMschapv2Username" name="EAP-MSCHAPv2 User Name" type="string">
+        <desc>The username used with EAP-MSCHAPv2.</desc>
+      </setting>
+      <setting ref="EapMschapv2Password" name="EAP-MSCHAPv2 Password" type="string">
+        <desc>The password used with EAP-MSCHAPv2.</desc>
+      </setting>
+      <setting ref="EapMschapv2SessionValidityTime" name="EAP-MSCHAPv2 Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapMschapv2Encapsulation" name="EAP-MSCHAPv2 Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with EAP-MSCHAPv2.</desc>
+        <option name="EAP-PEAP" value="25"/>
+        <option name="EAP-TTLS" value="21"/>
+        <option name="EAP-FAST" value="43"/>
+      </setting>
+      <setting ref="EapFastUsername" name="EAP-FAST User Name" type="string">
+        <desc>The username used with EAP-FAST.</desc>
+      </setting>
+      <setting ref="EapFastRealm" name="EAP-FAST Realm" type="string">
+        <desc>The realm used for device identification to the server.</desc>
+      </setting>
+      <setting ref="EapFastVerifyServerRealm" name="EAP-FAST Verify Server Realm" type="selection">
+        <desc>Specifies whether the server's realm is compared with own realm. This provides extra security but it depends on the network infrastructure and set-up whether this will work.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastRequireClientAuth" name="EAP-FAST Require Client Authentication" type="selection">
+        <desc>Specifies whether TTLS requires that the server authenticates the client.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastSessionValidityTime" name="EAP-FAST Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="EapFastCipherSuites" name="EAP-FAST Cipher Suites" type="string">
+        <desc>The list of allowed cipher suites. In the format +xxx,+xxx,+xxx... where xxx is the cipher suite identifier. 004: TLS_RSA_WITH_RC4_128_MD5, 005: TLS_RSA_WITH_RC4_128_SHA, 010: TLS_RSA_WITH_3DES_EDE_CBC_SHA, 019: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 022: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, 047: TLS_RSA_WITH_AES_128_CBC_SHA, 050: TLS_DHE_DSS_WITH_AES_128_CBC_SHA, 051: TLS_DHE_RSA_WITH_AES_128_CBC_SHA, 052: TLS_DH_anon_WITH_AES_128_CBC_SHA. For example, +004 enables only RSA with RC4 and MD5.</desc>
+      </setting>
+      <setting ref="EapFastEncapsulatedTypes" name="EAP-FAST Tunneled Methods" type="string">
+        <desc>A list of Extensible Authentication Protocols (EAPs) in tunneled by EAP-FAST. The format is +xxx,+xxx,+xxx where xxx indicates the enabled EAP method ID as specified in the IANA registry: http://www.iana.org/assignments/eap-numbers. For example to enable EAP-SIM encapsulation the string needs to be &quot;+018&quot;. The list is in priority order, highest priority first. Note that the encapsulate type's encapsulation parameter needs to be configured accordingly.</desc>
+      </setting>
+      <setting ref="EapFastAuthProvModeAllowed" name="Allow EAP-FAST Authenticated Provisioning Mode" type="selection">
+        <desc>Allows the dynamic provisioning of a PAC key in signed mode, where the server is authenticated during a signed Diffie-Hellman (DH) exchange. The device must have the server public key.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastUnauthProvModeAllowed" name="Allow EAP-FAST Unauthenticated Provisioning Mode" type="selection">
+        <desc>Allows the dynamic provisioning of a PAC key in anonymous mode, without authenticating the server.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastWarnADHPNoPAC" name="EAP-FAST Warn ADHP No PAC" type="selection">
+        <desc>Defines whether the server issues a warning if the device does not send a PAC, the server cannot decrypt the PAC, or the PAC has expired.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastWarnADHPNoMatchingPAC" name="EAP-FAST Warn ADHP No Matching PAC" type="selection">
+        <desc>Defines whether the server issues a warning the server and the device cannot match a PAC.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastWarnNotDefaultServer" name="EAP-FAST Warn Not Default Server" type="selection">
+        <desc>Defines whether the server issues a warning if the server is not the default server.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="EapFastUserCertSubjectKeyId" name="EAP-FAST User Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the user certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapFastUserCertIssuerName" name="EAP-FAST User Certificate Issuer" type="string">
+        <desc>The issuer of the user certificate. Ignored by the implementation currently!</desc>
+      </setting>
+      <setting ref="EapFastUserCertSerialNumber" name="EAP-FAST User Certificate Serial Number" type="string">
+        <desc>The serial number of the user certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapFastCaCertSubjectKeyId" name="EAP-FAST CA Certificate Subject Key ID" type="string">
+        <desc>The subject key ID value of the CA certificate. Currently this field is the only one that can be used to identify the certificate.</desc>
+      </setting>
+      <setting ref="EapFastCaCertIssuerName" name="EAP-FAST CA Certificate Issuer" type="string">
+        <desc>The issuer of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="EapFastCaCertSerialNumber" name="EAP-FAST CA Certificate Serial Number" type="string">
+        <desc>The serial number of the CA certificate. Currently not used.</desc>
+      </setting>
+      <setting ref="Mschapv2Username" name="MSCHAPv2 User Name" type="string">
+        <desc>The username used with MSCHAPv2.</desc>
+      </setting>
+      <setting ref="Mschapv2Password" name="MSCHAPv2 Password" type="string">
+        <desc>The password used with MSCHAPv2.</desc>
+      </setting>
+      <setting ref="Mschapv2SessionValidityTime" name="MSCHAPv2 Session Validity Time">
+        <desc>Specifies how long single session is kept in memory (for example, no new password queries).</desc>
+      </setting>
+      <setting ref="Mschapv2Encapsulation" name="MSCHAPv2 Tunneling Method" type="selection">
+        <desc>Defines which EAP tunneling method is used with MSCHAPv2. Needs to be EAP-TTLS.</desc>
+        <option name="EAP-TTLS" value="21"/>
+      </setting>
+    </setting>
+  </feature>
+  <feature ref="DNs" name="Destination Networks">
+    <desc>Settings for Destination Networks (SNAP) that applications can use.</desc>
+    <setting ref="DN" relevant="" mapKey="Name" mapValue="Name" name="Destination Network" constraint="" type="sequence" minOccurs="0" maxOccurs="3">
+      <desc>Settings for Destination Network.</desc>
+      <setting ref="Name" name="Name" type="string">
+        <desc>Destination Network name that is visible to the user.</desc>
+      </setting>
+      <setting ref="DNId" name="Destination Network ID">
+        <desc>Specifies the connection ID. Either specify the connection ID manually or leave empty to have it allocated automatically. If you specify the ID manaually, verify that the IDs are globally unique.</desc>
+      </setting>
+      <setting ref="Metadata" name="Metadata" type="selection">
+        <desc>Metadata that specifies a few default destination networks that applications can use.</desc>
+        <option name="User Defined" value="UserDefined"/>
+        <option name="Internet" value="Internet"/>
+        <option name="Operator" value="Operator"/>
+        <option name="MMS" value="MMS"/>
+        <option name="Intranet" value="Intranet"/>
+      </setting>
+      <setting ref="Protection" name="Protection Level" type="selection">
+        <desc>Defines the protection level. Select Destination And Contents to protect the connection methods inside the destination and their priorities.</desc>
+        <option name="No protection" value="0"/>
+        <option name="Destination And Contents" value="1"/>
+        <option name="Destination" value="2"/>
+      </setting>
+      <setting ref="Hidden" name="Hidden" type="selection">
+        <desc>Defines whether the Destination Network is hidden or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="HiddenAgent" name="Hidden Agent" type="selection">
+        <desc>Defines whether or not to hide the Destination Network for MMS connections.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Highlighted" name="Highlighted" type="selection">
+        <desc>Defines whether the Destination Network is highlighted or not.</desc>
+        <option name="No" value="No"/>
+        <option name="Yes" value="Yes"/>
+      </setting>
+      <setting ref="Icon" name="Icon" type="selection">
+        <desc>Defines the icon to be assigned to Destination Network.</desc>
+        <option name="Internet" value="0"/>
+        <option name="WAP" value="1"/>
+        <option name="MMS" value="2"/>
+        <option name="Intranet" value="3"/>
+        <option name="Operator" value="4"/>
+        <option name="Icon1" value="5"/>
+        <option name="Icon2" value="6"/>
+        <option name="Icon3" value="7"/>
+        <option name="Icon4" value="8"/>
+        <option name="Icon5" value="9"/>
+        <option name="Icon6" value="10"/>
+        <option name="Default" value="11"/>
+      </setting>
+      <setting ref="EmbeddedDN" name="Embedded Destination Network" type="string">
+        <desc>Name of an embedded Destination Network that is bound to the Destination Network.</desc>
+      </setting>
+      <setting ref="IAP" name="1st Access Point" type="selection">
+        <desc>Name of the first connection method that is bound to the Destination Network.</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP2" name="2nd Access Point" type="selection">
+        <desc>Name of the second connection method that is bound to the Destination Network.   	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP3" name="3rd Access Point" type="selection">
+        <desc>Name of the third connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP4" name="4th Access Point" type="selection">
+        <desc>Name of the fourth connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP5" name="5th Access Point" type="selection">
+        <desc>Name of the fifth connection method that is bound to the Destination Network.    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP6" name="6th Access Point" type="selection">
+        <desc>Name of the sixth connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP7" name="7th Access Point" type="selection">
+        <desc>Name of the seventh connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP8" name="8th Access Point" type="selection">
+        <desc>Name of the eight connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP9" name="9th Access Point" type="selection">
+        <desc>Name of the ninth connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+      <setting ref="IAP10" name="10th Access Point" type="selection">
+        <desc>Name of the tenth connection method that is bound to the Destination Network.	    	</desc>
+        <option name=" " value=""/>
+        <option map="APs/AP"/>
+        <option map="CIA_WLAN_APs/WLAN_AP"/>
+      </setting>
+    </setting>
+  </feature>
+</configuration>
\ No newline at end of file
Binary file dbcreator/conf/commsdatcreator.confml has changed
--- a/dbcreator/conf/commsdatcreator.content	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<content xmlns="http://www.s60.com/xml/content/2">
-  <desc>Copy commsdat content</desc>
-    <output dir="content/private/10202be9" file="cccccc00.cre">
-    	<externalinput dir="${CIA_KCRUidCommsDatCreator.CommsdatInputPath}">
-    		<include files="cccccc00_empty.cre"/>
-    	</externalinput>
-    </output>
-</content>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dbcreator/conf/commsdatcreator.implml	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<container xmlns="http://www.symbianfoundation.org/xml/implml/1">
+
+	<tempVariable ref="TempCommsDatCreator.InputPath" />
+
+	<container>
+		<tag name='target' value='rofs3' />
+		<phase name='pre' />
+		<ruleml xmlns="http://www.s60.com/xml/ruleml/3">
+
+			<!-- correct cccccc00.cre to image -->
+			<rule>
+		  ${APs.AP} or
+		  ${VPN_APs.VPN_AP} or
+		  ${LAN_APs.LAN_AP} or
+		  ${WLAN_APs.WLAN_AP}
+		  configures 
+		  ${TempCommsDatCreator.InputPath} = '/epoc32/data/Z/private/10202be9'
+		 </rule>
+
+		</ruleml>
+
+	</container>
+
+	<container>
+		<tag name='target' value='rofs3' />
+		<phase name='normal' />
+		<content xmlns="http://www.s60.com/xml/content/2">
+			<desc>Copy commsdat content</desc>
+			<output dir="content/private/10202be9" file="cccccc00.cre">
+				<externalinput dir="${TempCommsDatCreator.InputPath}">
+					<include files="cccccc00_empty.cre" />
+				</externalinput>
+			</output>
+		</content>
+	</container>
+
+</container>
\ No newline at end of file
--- a/dbcreator/conf/commsdatcreator.ruleml	Mon May 17 09:55:27 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ruleml xmlns="http://www.s60.com/xml/ruleml/2">
-
-<!-- correct cccccc00.cre to image --> 
- <rule>
-  APs.AP or
-  VPN_APs.VPN_AP or
-  LAN_APs.LAN_AP or
-  WLAN_APs.WLAN_AP or 
-  configures 
-  CIA_KCRUidCommsDatCreator.CommsdatInputPath ='/epoc32/data/Z/private/10202be9'
- </rule>
- 
-</ruleml>
--- a/dbcreator/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/dbcreator/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -22,10 +22,10 @@
 DEFAULT
 
 PRJ_EXPORTS
+../conf/CI_commsdatcreator.confml				MW_LAYER_CONFML(CI_commsdatcreator.confml)
 ../conf/commsdatcreator.confml				MW_LAYER_CONFML(commsdatcreator.confml)
 ../conf/commsdatcreator_01.gcfml			MW_LAYER_GCFML(commsdatcreator_01.gcfml)
-../conf/commsdatcreator.content         MW_LAYER_CRML(commsdatcreator.content)
-../conf/commsdatcreator.ruleml          MW_LAYER_CRML(commsdatcreator.ruleml)
+../conf/commsdatcreator.implml          MW_LAYER_CRML(commsdatcreator.implml)
 ../rom/commsdatcreator.iby						CORE_MW_LAYER_IBY_EXPORT_PATH(commsdatcreator.iby)
 
 
--- a/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -32,6 +32,7 @@
 #include "../cmmanager/group/bld.inf"
 #include "../connectionmonitoring/group/bld.inf"
 #include "../connectionutilities/ConnectionDialogs/group/bld.inf"
+#include "../keepalive/group/bld.inf"
 #include "../dbcreator/group/bld.inf"
 #include "../ipcm_plat/group/bld.inf"
 #include "../ipcm_pub/group/bld.inf"
--- a/inc/meshpreface1.cfg	Mon May 17 09:55:27 2010 +0300
+++ b/inc/meshpreface1.cfg	Mon May 24 20:51:35 2010 +0300
@@ -318,6 +318,14 @@
 	FIELD_COUNT=2
 END_ADD
 
+ADD_SECTION
+# COMMDB_ID = 7
+	Name=pdpcpr
+	CprUid=0x102822E2
+	FIELD_COUNT=2
+END_ADD
+
+
 ############################################################
 ## SCprTable
 ## 
@@ -545,7 +553,7 @@
 	Name=spud-ppp
 	Tier=Link.TierTable.271064565
 	MCpr=MCprTable.10
-	Cpr=CprTable.3
+	Cpr=CprTable.7
 	SCpr=SCprTable.4
 	Protocol=ProtocolTable.3
 	FIELD_COUNT=6
@@ -556,7 +564,7 @@
 	Name=spud-rawip
 	Tier=Link.TierTable.271064565
 	MCpr=MCprTable.10
-	Cpr=CprTable.3
+	Cpr=CprTable.7
 	SCpr=SCprTable.4
 	Protocol=ProtocolTable.5
 	FIELD_COUNT=6
@@ -602,3 +610,4 @@
 	FIELD_COUNT=6
 END_ADD
 
+
--- a/ipcm_plat/connection_settings_shim_api/inc/cmmanagerdefines_shim.h	Mon May 17 09:55:27 2010 +0300
+++ b/ipcm_plat/connection_settings_shim_api/inc/cmmanagerdefines_shim.h	Mon May 24 20:51:35 2010 +0300
@@ -64,7 +64,7 @@
      *  Constants for maximum string lengths.
      */
     //! Connection name length
-    const uint CmNameLength                 = 30;
+    const uint CmNameLength                 = 50;
     //! Homepage address length
     const uint CmStartPageLength            = 1024;
     //! IPv4 IP address length
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/flextimer_api/group/bld.inf	Mon May 24 20:51:35 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:  File that exports the files belonging to 
+:               FlexTimer API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/rflextimer.h			MW_LAYER_PLATFORM_EXPORT_PATH(rflextimer.h)
+../inc/flextimer.h			MW_LAYER_PLATFORM_EXPORT_PATH(flextimer.h)
+../inc/flexperiodic.h		MW_LAYER_PLATFORM_EXPORT_PATH(flexperiodic.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/flextimer_api/inc/flexperiodic.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,415 @@
+/*
+ * 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:  CFlexPeriodic class for Flexible Timer server access.
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef CFLEXPERIODIC_H
+#define CFLEXPERIODIC_H
+
+// INCLUDE FILES
+#include "flextimer.h"
+
+// CLASS DECLARATION
+/**
+ *  Class providing access to flexible periodic timer service.
+ *  This class inherits CFlexTimer and provides user with a periodic
+ *  timer very similar to CPeriodic with the exception that both
+ *  the initial delay and the consequent intervals have flexible
+ *  windows of opportunity during which they may expire.
+ *  
+ *  The flexible window sizes are set with Configure-function. If these window
+ *  sizes are not explicitly set by the user, a default window size is used.
+ *  See RFlexTimer for details about default window. 
+ *  
+ *  Note that when CFlexPeriodic expires next expiry interval always starts 
+ *  at that moment. This means that over time, timer expiry can start to 
+ *  "slide" when comparing to CPeriodic. 
+ *  
+ *  For example: CPeriodic is started at 8 o'clock with 30 minute interval.
+ *  It will then expire at 8.30, 9.00, ... 15.30, 16.00
+ *  
+ *  If CFlexPeriodic is used as a timer it can possibly expire at
+ *  8.30, 9.00, 9.28, 9.55, ... 15.45, 16.12 etc. 
+ *
+ *  @see CFlexTimer
+ *  @see RFlexTimer
+ *  @see CPeriodic
+ *
+ *  Example:
+ *  
+ *  Class definition:
+ *  @code
+ *  // Forward declaration
+ *  class CFlexPeriodic;
+ *
+ *  // Class definition
+ *  class CMyNetworkServiceMonitor : public CBase
+ *      {
+ *      public: // Members
+ *
+ *          // Destructor
+ *          virtual ~CMyNetworkServiceMonitor();
+ *
+ *          // Two-phased constructor
+ *          static CMyNetworkServiceMonitor* NewL(
+ *              TTimeIntervalMicroSeconds aWindow,
+ *              TTimeIntervalMicroSeconds aInterval );
+ *
+ *      private: // Members
+ *
+ *          // Constructor
+ *          CMyNetworkServiceMonitor();
+ *
+ *          // 2nd phase constuctor
+ *          void ConstructL(
+ *              TTimeIntervalMicroSeconds aWindow,
+ *              TTimeIntervalMicroSeconds aInterval );
+ *
+ *          // Callback function for periodic timer. A function for TCallBack.
+ *          static TInt DoMonitoring( TAny* aArgument );
+ *
+ *          // Callback function for timer server errors. A function for 
+ *          // TCallBack.
+ *          static TInt HandleError( TAny* aArgument );
+ *
+ *          // Does the network server monitoring.
+ *          // Implementation is not provided by this example.
+ *          DoNetworkServiceMonitoring();
+ *
+ *      private: // Data
+ *
+ *          // Owns. Flexible periodic timer.
+ *          CFlexPeriodic* iTimer;
+ *      };
+ *  @endcode
+ *
+ *  Class implementation:
+ *  @code
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor::CMyNetworkServiceMonitor() : iTimer( NULL )
+ *      {
+ *      // Nothing to do
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor::~CMyNetworkServiceMonitor()
+ *      {
+ *      if ( iTimer != NULL )
+ *          {
+ *          iTimer->Cancel(); // Cancel pending timer
+ *          delete iTimer;
+ *          }
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor* CMyNetworkServiceMonitor::NewL(
+ *      TTimeIntervalMicroSeconds aWindow,
+ *      TTimeIntervalMicroSeconds aInterval )
+ *      {
+ *      CMyNetworkServiceMonitor* self =
+ *          new (ELeave) CMyNetworkServiceMonitor;
+ *      CleanupStack::PushL( self );
+ *      self->ConstructL( aWindow, aInterval );
+ *      CleanupStack::Pop( self );
+ *      return self;
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::ConstructL(
+ *      TTimeIntervalMicroSeconds aWindow,
+ *      TTimeIntervalMicroSeconds aInterval )
+ *      {
+ *      // Constants
+ *      const TTimeIntervalMicroSeconds KNoWindow( 0 );
+ *      const TTimeIntervalMicroSeconds KImmediately( 0 );
+ *
+ *      iTimer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+ *
+ *      // Push timer to cleanup stack due configuration may leave
+ *      CleanupStack::PushL( iTimer );
+ *
+ *      // Set delay window 0 minute
+ *      User::LeaveIfError( 
+ *          iTimer->Configure( KNoWindow, aWindow ) );
+ *
+ *      // Start the timer, 1st call immediately
+ *      iTimer->Start(
+ *          KImmediately,
+ *          aInterval,
+ *          TCallBack( DoMonitoring, this ),
+ *          TCallBack( HandleError, this ) );
+ *
+ *      CleanupStack::Pop( iTimer );
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  TInt CMyNetworkServiceMonitor::DoMonitoring( TAny* aArgument )
+ *      {
+ *      CMyNetworkServiceMonitor* monitor =
+ *          static_cast<CMyNetworkServiceMonitor*>( aArgument );
+ *
+ *      monitor->DoNetworkServerMonitoring();
+ *      return KErrNone;
+ *      }
+ *     
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  TInt CMyNetworkServiceMonitor::HandleError( TAny* aArgument )
+ *      {
+ *      CMyNetworkServiceMonitor* monitor =
+ *          static_cast<CMyNetworkServiceMonitor*>( aArgument );
+ *
+ *      // Handling of the timer server error (e.g. closing up the application)
+ *      // here.
+ *          .
+ *          .
+ *          .
+ *      return KErrNone;
+ *      }     
+ *  @endcode
+ */
+class CFlexPeriodic : public CFlexTimer
+    {
+public:
+
+    /**
+     * A leaving constructor for the object.
+     * 
+     * @param aPriority Priority of the active object. Type CActive::TPriority
+     * 
+     * @return A pointer to a CFlexPeriodic object on success.
+     * 
+     * @leave KErrMemory Not enough memory
+     */
+    static IMPORT_C CFlexPeriodic* NewL( TInt aPriority );
+
+    /**
+     * Destructor for the object.
+     */
+    virtual IMPORT_C ~CFlexPeriodic();
+
+    /**
+     * Starts the periodic timer. After the timer has been started, it first
+     * calls aCallBack function after the aDelay time has expired. Thereafter
+     * the aCallBack function is called periodically after anInterval from the
+     * previous expiry has elapsed. All the expirations happen within timing
+     * tolerancies indicated by the flexibility windows. The flexibility
+     * window sizes are set with a Configure-function. The Configure needs to
+     * be called before Starting the periodic timer. 32-bit delay and interval
+     * values.
+
+     * @param aDelay is the initial delay between this Start-function and the
+     * first timer expiry. This value presents the maximum delay - flexibility
+     * is applied to a time window opening prior to this.
+     * @param anInterval is the size of the intervals after the initial delay.
+     * This value presents the maximum interval - flexibility is applied to
+     * a time window opening prior to this. Interval must be at least one 
+     * microsecond.
+     * @param aCallBack is a reference to a function that is executed at each
+     * expiry of the timer. NULL call back function reference is prohibited.
+     * @param aCallBackError optional, but recommended parameter is a 
+     * reference to a function that is executed if error occurs somewhere 
+     * in FlexTimer system (e.g. memory allocation failed). 
+     * If user does not provide this argument and error occurs, client 
+     * is paniced. Recommended action in case of error is to hold back all 
+     * actions for a while and give system some time to recover and free 
+     * resources.
+     *
+     * @panic CFlexPeriodic  6 aDelay is negative
+     * @panic CFlexPeriodic  7 aInterval is zero or negative
+     * @panic CFlexPeriodic 31 aCallBack.iFunction is NULL
+     * @panic RFlexTimer    15 Start() has been called twice without 
+     * cancelling the timer first
+     *
+     * @see Configure
+     */
+    IMPORT_C void Start( TTimeIntervalMicroSeconds32 aDelay,
+                         TTimeIntervalMicroSeconds32 anInterval,
+                         TCallBack aCallBack,
+                         TCallBack aCallBackError = TCallBack() );
+    
+    /**
+     * This function overloads the Start-function with 64-bit delay and
+     * interval values.
+     *
+     * @param aDelay is the initial delay between this Start-function and the
+     * first timer expiry. This value presents the maximum delay - flexibility
+     * is applied to a time window opening prior to this.
+     * @param anInterval is the size of the intervals after the initial delay.
+     * This value presents the maximum interval - flexibility is applied to
+     * a time window opening prior to this. Interval must be at least one 
+     * microsecond.
+     * @param aCallBack is a reference to a function that is executed at each
+     * expiry of the timer. NULL call back function reference is prohibited.
+     * @param aCallBackError optional, but recommended parameter is a 
+     * reference to a function that is executed if error occurs somewhere 
+     * in FlexTimer system (e.g. memory allocation failed). 
+     * If user does not provide this argument and error occurs, client 
+     * is paniced. Recommended action in case of error is to hold back all 
+     * actions for a while and give system some time to recover and free 
+     * resources.
+     *
+     * @panic CFlexPeriodic  6 aDelay is negative
+     * @panic CFlexPeriodic  7 aInterval is zero or negative
+     * @panic CFlexPeriodic 31 aCallBack.iFunction is NULL
+     * @panic RFlexTimer    15 Start() has been called twice without 
+     * cancelling the timer first
+     * @panic RFlexTimer    24 aDelay or aInterval is too long (over 730 days)
+     *
+     * @see Configure
+     */
+    IMPORT_C void Start( TTimeIntervalMicroSeconds aDelay,
+                         TTimeIntervalMicroSeconds anInterval,
+                         TCallBack aCallBack,
+                         TCallBack aCallBackError = TCallBack() );
+
+    /**
+     * Sets the window sizes inside which the timer can expire. Must be called
+     * before timer is started. If configure is called after the timer has
+     * been Started, this function returns an error code.
+     * 
+     * The window sizes set with this function override the default window
+     * sizes. @see RFlexTimer::Configure
+     *
+     * @param aDelayWindow is the flexibility window size in 32-bit
+     * microseconds for the initial delay.
+     * @param aIntervalWindow is the flexibility window size in 32-bit
+     * microseconds for the intervals after the initial delay.
+     *
+     * @return KErrNone on success. KErrInUse, if timer has been
+     * started already. In case of error, the window sizes not established
+     * into the timer and need to be configured again.
+     *
+     * @panic CFlexPeriodic  8 aDelayWindow is negative
+     * @panic CFlexPeriodic  9 aIntervalWindow is negative
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds32 aDelayWindow,
+                             TTimeIntervalMicroSeconds32 aIntervalWindow );
+
+    /**
+     * This function overloads the Configure-function with 64-bit parameters.
+     *
+     * @param aDelayWindow is the flexibility window size in 64-bit 
+     * microseconds for the initial delay.
+     * @param aIntervalWindow is the flexibility window size in 64-bit
+     * microseconds for the intervals after the initial delay.
+     *
+     * @return KErrNone on success. KErrInUse, if timer has been
+     * started already. In case of error, the window sizes not established
+     * into the timer and need to be configured again.
+     *
+     * @panic CFlexPeriodic  8 aDelayWindow is negative
+     * @panic CFlexPeriodic  9 aIntervalWindow is negative
+     * @panic RFlexTimer    24 aDelayWindow or aIntervalWindow is too long 
+     * (over 730 days)
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds aDelayWindow,
+                             TTimeIntervalMicroSeconds aIntervalWindow );
+
+protected:
+
+    /**
+     * Inherited from CActive.
+     */
+    virtual void RunL();
+    
+private:
+
+    /**
+     * Constructs the object. The second phase of the construction.
+     */
+    void ConstructL();
+
+    /**
+     * Private constructor for the object.
+     * @param aPriority The priority of the active object. If timing is
+     * critical, it should be higher than that of all other active objects
+     * owned by the scheduler.
+     */
+    CFlexPeriodic( TInt aPriority );
+
+private:
+    
+    /**
+     * No definition. This function is not to be used through CFlexPeriodic.
+     * @see CFlexTimer
+     */
+    void After( TTimeIntervalMicroSeconds32 aInterval );
+    
+    /**
+     * No definition. This function is not to be used through CFlexPeriodic.
+     * @see CFlexTimer
+     */
+    void After( TTimeIntervalMicroSeconds aInterval );
+
+    /**
+     * No definition. This function is not to be used through CFlexPeriodic.
+     * @see CFlexTimer
+     */
+    void At( const TTime& aTime );
+
+    /**
+     * No definition. This function is not to be used through CFlexPeriodic.
+     * @see CFlexTimer
+     */
+    void AtUTC( const TTime& aTime );
+    
+    /**
+     * No definition. This function is not to be used through CFlexPeriodic.
+     * @see CFlexTimer
+     */
+    TInt Configure( TTimeIntervalMicroSeconds32 aWindowSize );
+
+    /**
+     * Interval value that is used after the initial delay.
+     */
+    TTimeIntervalMicroSeconds iInterval;
+
+    /**
+     * Flex window size that is used after the initial delay.
+     */
+    TTimeIntervalMicroSeconds iIntervalWindow;
+
+    /**
+     * The callback function which is called at the completion of
+     * flextimer server requests.
+     */
+    TCallBack iCallBack;
+    
+    /**
+     * The callback function which is called if error accurs
+     * somewhere in FlexTimerSystem. i.e. Error code is returned
+     * to RunL.
+     */
+    TCallBack iCallBackError;
+    
+    /**
+     * This member stores information, whether the interval configuration
+     * should be sent to the server or not.
+     */
+    TBool   iSendConfigure;
+
+    };
+
+#endif /* CFLEXPERIODIC_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/flextimer_api/inc/flextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,363 @@
+/*
+ * 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:  CFlexTimer class for Flexible Timer server access.
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef CFLEXTIMER_H
+#define CFLEXTIMER_H
+
+// INCLUDE FILES
+#include <e32base.h> 
+#include "rflextimer.h"
+
+// CLASS DECLARATION
+/**
+ *  Class providing access to flexible timer service.
+ *  This class uses RFlexTimer to provide user with timeout services. Each
+ *  timeout that is requested with this class has a time window during which
+ *  it may expire. The size of this window needs to be configured by the user.
+ *  If not configured, a default window size is used. See RFlexTimer for 
+ *  details about default window. 
+ *  
+ *  This class can not be instantiated; it needs to be inherited by a
+ *  user's derived class. The user also needs to implement the RunL
+ *  function.
+ *  
+ *  The timer returns one of the following values for TRequestStatus or any
+ *  other system-wide error codes:
+ *  
+ *  <table border=1 bordercolor="#84B0C7" cellspacing="0" align="center">
+ *  <tr>
+ *      <th>Return value</th>
+ *      <th>Description</th>
+ *      <th>@c At()</th>
+ *      <th>@c AtUTC()</th>
+ *      <th>@c After()</th>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrNone</td>
+ *      <td>Timer has expired normally</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>  
+ *      <td align="center">X</td>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrCancel</td>
+ *      <td>Timer has been cancelled</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrAbort</td>
+ *      <td>Timer has been aborted due time change</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *      <td align="center">&nbsp;</td>
+ *  </tr>
+ *  </table>
+ *  
+ *  Any object derived from this class needs to connect to the flextimer
+ *  server by calling CFlexTimer::ConstructL() function before calling 
+ *  configuration or timeout functions. Otherwise any timeout function will
+ *  result in panic.
+ *
+ *  @see RFlexTimer
+ *  @see CTimer
+ *
+ *  Example:
+ *  
+ *  Class definition:
+ *  @code
+ *  class CMyNetworkServiceMonitor : public CFlexTimer
+ *      {
+ *      public: // Members
+ *
+ *          // Public two-phased constructor
+ *          static CMyNetworkServiceMonitor* NewL( 
+ *              TTimeIntervalMicroSeconds aWindow,
+ *              TTimeIntervalMicroSeconds aInterval );
+ *
+ *          // Destructor
+ *          virtual ~CMyNetworkServiceMonitor();
+ *
+ *      protected: // From CActive
+ *
+ *          // Handles an active object's request completion event
+ *          virtual void RunL();
+ *
+ *      private: // Members
+ *
+ *          // Private constructor
+ *          CMyNetworkServiceMonitor( TTimeIntervalMicroSeconds aInterval );
+ *
+ *          // Second phase constructor
+ *          void ConstructL( TTimeIntervalMicroSeconds aWindow );
+ *
+ *          // Does the network server monitoring.
+ *          // Implementation is not provided by this example.
+ *          DoNetworkServiceMonitoring();
+ *
+ *      private: // Data
+ *
+ *          TTimeIntervalMicroSeconds iInterval;
+ *      };
+ *  @endcode
+ *
+ *  Class implementation:
+ *  @code
+ *  CMyNetworkServiceMonitor::CMyNetworkServiceMonitor( TTimeIntervalMicroSeconds aInterval ) :
+ *      CFlexTimer( CActive::EPriorityStandard ),
+ *      iInterval( aInterval )
+ *      {
+ *      // Nothing to do
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor::~CMyNetworkServiceMonitor()
+ *      {
+ *      Cancel(); // DoCancel() is implemented by CFlexTimer
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::ConstructL( TTimeIntervalMicroSeconds aWindow )
+ *      {
+ *      const TTimeIntervalMicroSeconds KImmediately( 0 );
+ *
+ *      CFlexTimer::ConstructL();
+ *      CActiveScheduler::Add( this );
+ *
+ *      Configure( aWindow );
+ *
+ *      After( KImmediately );  // Kick-off the timer
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor* CMyNetworkServiceMonitor::NewL(
+ *      TTimeIntervalMicroSeconds aWindow,
+ *      TTimeIntervalMicroSeconds aInterval   )
+ *      {
+ *      CMyNetworkServiceMonitor* self =
+ *          new (ELeave) CMyNetworkServiceMonitor( aInterval );
+ *      CleanupStack::PushL( self );
+ *      self->ConstructL( aWindow );
+ *      CleanupStack::Pop( self );
+ *      return self;
+ *      }
+ *
+ *  // ---------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::RunL()
+ *      {
+ *      // Note! If used RFlexTimer::At() or RFlexTimer::AtUTC()
+ *      // iStatus == KErrAbort should also be handled.
+ *    
+ *      if ( iStatus == KErrNone )
+ *          {
+ *          // Do the network server monitor actions
+ *          DoNetworkServiceMonitoring();
+ *
+ *          // Refresh the timer
+ *          After( iInterval );
+ *          }
+ *      else if ( iStatus == KErrCancel )
+ *          {
+ *          // Timer was cancelled. Do not activate it again... 
+ *          }
+ *      else
+ *          {
+ *          // Handle the error by implementing RunError()
+ *          // See also: CActive::RunError()
+ *          User::Leave( iStatus );
+ *          }
+ *      }
+ *  @endcode
+ */
+class CFlexTimer : public CActive
+    {
+public:
+
+    /**
+     * Destructs the object.
+     */
+    IMPORT_C virtual ~CFlexTimer();
+
+    /**
+     * Fire timer at latest on the given interval. 32-bit interval value.
+     * @param aInterval the interval value until which the timer must expire.
+     * 
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer  1 aInterval is negative
+     *
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds32 KInterval32( 600000000 ); // 10 min
+     *      After( KInterval32 );
+     * @endcode
+     */
+    IMPORT_C void After( TTimeIntervalMicroSeconds32 aInterval );
+    
+    /**
+     * Fire timer at latest on the given interval. 64-bit interval value.
+     *
+     * @param aInterval the interval value until which the timer must expire.
+     * 
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer  1 aInterval is negative
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aInterval is too big (over 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds KInterval64( 600000000 ); // 10 min
+     *      After( KInterval64 );
+     * @endcode
+     */
+    IMPORT_C void After( TTimeIntervalMicroSeconds aInterval );
+
+    /**
+     * Fire timer at latest by the given time value. The time value provided
+     * here is related to HomeTime. @see TTime. If the system
+     * time changes before the timer requested with At-function expires, it
+     * will cancel itself. This will result in the aStatus argument to have
+     * KErrAbort-value.
+     *
+     * @param aTime indicates the latest time when this timer should be fired.
+     *
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer 3  aTime is in the past
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aTime is too far to the future (over 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMinutes KWaitTime( 5 );
+     *
+     *      TTime now;
+     *      now.HomeTime();
+     *
+     *      At( nowUtc + KWaitTime );
+     * @endcode
+     */
+    IMPORT_C void At( const TTime& aTime );
+
+    /**
+     * Fire timer at latest by the given UTC (Coordinated Universal Time)
+     * time value. If the system
+     * time changes before the timer requested with At-function expires, it
+     * will cancel itself. This will result in the aStatus argument to have
+     * KErrAbort-value.
+     * @param aTime indicates the latest UTC time when this timer should be
+     * fired. 
+     *
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer 3  aTime is in the past
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aTime is too far to the future (over 730 days)
+     *
+     * Example:
+     * @code
+     *      const TTimeIntervalMinutes KWaitTime( 5 );
+     *
+     *      TTime nowUtc;
+     *      nowUtc.UniversalTime();
+     *
+     *      AtUTC( nowUtc + KWaitTime );
+     * @endcode
+     */
+    IMPORT_C void AtUTC( const TTime& aTime );
+
+    /**
+     * Sets the window size in which flexibility is possible for the timer.
+     * @see RFlexTimer::Configure
+     * @param aWindowSize is the window size in 32-bit microseconds in which
+     * timer flexiblity is possible.
+     * @return KErrNone on success. KErrInUse, if timer has been
+     * started already.
+     *
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer 5  aWindowSize is negative
+     * 
+     * Example:
+     * @code
+     *     const TTimeIntervalMicroSeconds32 KWindow32( 120000000 ); // 2 mins
+     *     Configure( KWindow32 );
+     * @endcode
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds32 aWindowSize );
+    
+    /**
+     * Sets the window size in which flexibility is possible for the timer.
+     * @see RFlexTimer::Configure
+     * @param aWindowSize is the window size in 64-bit microseconds in which
+     * timer flexiblity is possible.
+     * @return KErrNone on success. KErrInUse, if timer has been
+     * started already.
+     *
+     * @panic CFlexTimer 10 CFlexTimer::ConstructL() has not been called yet
+     * @panic RFlexTimer 5  aWindowSize is negative
+     * @panic RFlexTimer 24 aWindowSize is too big (max 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds KWindow64( 120000000 ); // 2 mins
+     *      Configure( KWindow64 );
+     * @endcode
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds aWindowSize );
+
+protected:
+    
+    /**
+     * 2nd phase constructor for this the object. Connects to the flextimer
+     * server and creates a session. This function needs to be called by the
+     * object that is derived from this class.
+     */
+    IMPORT_C void ConstructL();
+
+    /**
+     * Constructs the object.
+     */
+    IMPORT_C CFlexTimer( TInt aPriority );
+
+    /**
+     * Inherited from CActive.
+     */
+    IMPORT_C virtual void DoCancel();
+
+private:
+
+    /**
+     * The timer resource used by this object.
+     */
+    RFlexTimer iTimer;
+
+    };
+
+#endif // CFLEXTIMER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipcm_plat/flextimer_api/inc/rflextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,594 @@
+/*
+ * 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:  RFlexTimer class for Flexible Timer server access.
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef RFLEXTIMER_H
+#define RFLEXTIMER_H
+
+// INCLUDE FILES
+#include <e32std.h> 
+
+// CLASS DECLARATION
+/**
+ *  Resource class providing access to flexible timer server.
+ *  
+ *  This timer class is in many ways similar to RTimer in its use. The
+ *  main difference is the option to set a timer expiry window. When the timer
+ *  expiry window has been set to a value greater than zero, requested
+ *  timeouts may expire at any point of time inside this window. This timer
+ *  should be used for timed air-interface operations, such as keep-alive
+ *  messages. The use of normal timers is recommended if the timeouts are not
+ *  related to data transmission or reception activity in the device.
+ *  
+ *  The purpose for a flexible timer is to allow the system the opportunity to
+ *  align timed behaviour that uses radio resources. For example, when a
+ *  radio device is otherwise in an idle state, simple keep-alive messaging
+ *  can be grouped together so that all traffic happens in single bursts
+ *  instead of being distributed evenly along time timeline. This maximises
+ *  radio idle time and therefore also battery lifetime.
+ *  
+ *  This class defines a client interface for flexible timer server
+ *  (CFlexTimerServer). When a user requests timeout with RFlexTimer, the
+ *  server will expire the request non-deterministically within an time window
+ *  configured by the user. Timer resolution is one second.
+ *  
+ *  The timer returns one of the following values for TRequestStatus or any
+ *  other system-wide error codes:
+ *  
+ *  <table border=1 bordercolor="#84B0C7" cellspacing="0" align="center">
+ *  <tr>
+ *      <th>Return value</th>
+ *      <th>Description</th>
+ *      <th>@c At()</th>
+ *      <th>@c AtUTC()</th>
+ *      <th>@c After()</th>
+ *      <th>@c AfterTicks()</th>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrNone</td>
+ *      <td>Timer has expired normally</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>  
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrCancel</td>
+ *      <td>Timer has been cancelled by @c Cancel()</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *  </tr>
+ *  <tr>
+ *      <td>@c KErrAbort</td>
+ *      <td>Timer has been aborted due time change</td>
+ *      <td align="center">X</td>
+ *      <td align="center">X</td>
+ *      <td align="center">&nbsp;</td>
+ *      <td align="center">&nbsp;</td>
+ *  </tr>
+ *  </table>
+ *  
+ *  Example: A user uses Configure-function to set the timer window to
+ *  2,000,000 microseconds. Next the user requests a timeout with an interval
+ *  value of 3,000,000 microseconds. Now the timer may expire at any moment
+ *  after 1,000,000 microseconds and at latest after 3,000,000 microseconds
+ *  (+ possible timer inaccuracy (timer resolution) ) has passed from the 
+ *  timeout request. 
+ *
+ *  Passing a negative timer interval value or a past time instant 
+ *  to timer functions will cause a panic . Restarting a timer that is already
+ *  running will cause panic. Cancel must be used before starting timer again.
+ *
+ *  @see CFlexTimer
+ *  @see CFlexPeriodic
+ *  @see RTimer
+ *
+ *  Examples:
+ *
+ *  Synchronous usage of RFlexTimer:
+ *  @code
+ *      const TTimeIntervalMicroSeconds KInterval( 900000000 ); // 15 mins
+ *      const TTimeIntervalMicroSeconds KWindow( 300000000 ); // 5 mins
+ *
+ *      TRequestStatus status;
+ *
+ *      RFlexTimer timer;
+ *      User::LeaveIfError( timer.Connect() );
+ *
+ *      timer.Configure( KWindow );
+ *      timer.After( status, KInterval );
+ *
+ *      User::WaitForRequest( status );     // Wait till the timer expires
+ *
+ *      // Check the request's status
+ *      if ( status == KErrNone )
+ *          {
+ *          // Timer was expired ok
+ *          }
+ *      else if ( status == KErrAborted )
+ *          {
+ *          // Only for At() and AtUTC()
+ *          // Timer was aborted by time change
+ *          }
+ *      else if ( status == KErrCancel )
+ *          {
+ *          // timer.Cancel() was called while the timer was active
+ *          }
+ *      else
+ *          {
+ *          // Some other error has happened
+ *          }
+ *          .
+ *          .
+ *          .
+ *      timer.Close();
+ *  @endcode
+ *
+ *  Asynchronous usage of RFlexTimer (consider using CFlexTimer or 
+ *  CFlexPeriodic instead of own implementation):
+ *  
+ *  Class definition
+ *  @code
+ *      class CMyNetworkServiceMonitor : public CActive
+ *      {
+ *      public: // Members
+ *
+ *          // Public two-phased constructor
+ *          static CMyNetworkServiceMonitor* NewL(
+ *              TTimeIntervalMicroSeconds aWindow,
+ *              TTimeIntervalMicroSeconds aInterval );
+ *
+ *          // Destructor
+ *          virtual ~CMyNetworkServiceMonitor();
+ *
+ *      protected: // From CActive
+ *
+ *          // Cancel outstanding request. Called by CActive::Cancel().
+ *          virtual void DoCancel();
+ *
+ *          // Handle request completion event  
+ *          virtual void RunL();
+ *      
+ *      private: // Members
+ *
+ *          // Constructor
+ *          CMyNetworkServiceMonitor( TTimeIntervalMicroSeconds aInterval );
+ *
+ *          // Second phase constructor
+ *          void ConstructL( TTimeIntervalMicroSeconds aWindow );
+ *
+ *          // Does the network server monitoring.
+ *          // Implementation is not provided by this example.
+ *          void DoNetworkServiceMonitoring();
+ *      
+ *      private: // Data
+ *          RFlexTimer iTimer;
+ *          TTimeIntervalMicroSeconds iInterval;
+ *      };
+ *  @endcode
+ *
+ *  @code
+ *  CMyNetworkServiceMonitor::CMyNetworkServiceMonitor( 
+ *      TTimeIntervalMicroSeconds aInterval ):
+ *      CActive( CActive::EPriorityStandard ),
+ *      iInterval( aInterval )
+ *      {
+ *      // Nothing to do
+ *      } 
+ *
+ *  // -----------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::ConstructL( 
+ *      TTimeIntervalMicroSeconds aWindow )
+ *      {
+ *      User::LeaveIfError( iTimer.Connect() );
+ *      iTimer.Configure( aWindow );
+ *      }
+ *
+ *  // -----------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor* CMyNetworkServiceMonitor::NewL( 
+ *      TTimeIntervalMicroSeconds aWindow,
+ *      TTimeIntervalMicroSeconds aInterval )
+ *      {
+ *      CMyNetworkServerMonitor* self =
+ *          new (ELeave) CMyNetworkServerMonitor( aInterval );
+ *      CleanupStack::PushL( self );
+ *      self->ConstructL( aWindow );
+ *      CleanupStack::Pop( self );
+ *
+ *      iTimer.After( TTimeIntervalMicroSeconds( 0 ) );
+ *      SetActive();
+ *
+ *      return self;
+ *      }
+ *
+ *  // -----------------------------------------------------------------------------
+ *  //
+ *  CMyNetworkServiceMonitor::~CMyNetworkServiceMonitor()
+ *      {
+ *      Cancel();       // Calls CActive::Cancel()
+ *      iTimer.Close(); // Close the timer handle
+ *      }
+ *      
+ *  // -----------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::DoCancel()
+ *      {
+ *      iTimer.Cancel();
+ *      }
+ *
+ *  // -----------------------------------------------------------------------------
+ *  //
+ *  void CMyNetworkServiceMonitor::RunL()
+ *      {
+ *      // Note! If used RFlexTimer::At() or RFlexTimer::AtUTC()
+ *      // iStatus == KErrAbort should also be handled.
+ *      
+ *      if ( iStatus == KErrNone )
+ *          {
+ *          // Do the network server monitor actions
+ *          DoNetworkServiceMonitoring();
+ *
+ *           // Refresh the timer
+ *          iTimer.After( iInterval );
+ *          SetActive();
+ *          }
+ *      else if ( iStatus == KErrCancel )
+ *          {
+ *          // Timer was cancelled. Do not activate it again... 
+ *          }
+ *      else
+ *          {
+ *          // Handle the error by implementing RunError()
+ *          // See also: CActive::RunError()
+ *          User::Leave( iStatus );
+ *          }
+ *      }
+ *  @endcode
+ */
+class RFlexTimer : public RSessionBase
+    {
+public:
+    // Constructors and destructors
+
+    /**
+     * Constructs the object.
+     */
+    IMPORT_C RFlexTimer();
+
+    /**
+     * Destructs the object.
+     */
+    IMPORT_C ~RFlexTimer();
+
+    /**
+     * Connects to the timer server. This function needs to be called before
+     * any timeouts can be requested.
+     * 
+     * @return KErrNone on success. KErrNotSupported if client's and server's
+     * versions don't match. Otherwise returns one of the system-wide error
+     * codes.
+     * @panic RFlexTimer 33 Connected is called twice without closing the
+     * handle first
+     * 
+     * Example:
+     * @code
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *          .
+     *          . // Set timer/wait for expiration.
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C TInt Connect();
+
+    /**
+     * Cancels the timer. Active timer will be completed with status 
+     * KErrCancel. If there are no active timer, Cancel() does nothing.
+     * 
+     * @panic KERN-EXEC 0 Cancel() was called before Connect()
+     * 
+     * Example:
+     * @code
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *          .
+     *          .
+     *          .
+     *      // Oops, no need to wait the timer expiration
+     *      timer.Cancel(); // Cancel the pending timer    
+     *          .
+     *          .
+     *          .  
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C void Cancel();
+
+    /**
+     * An asynchronous timeout request to the flexible timer server.
+     * Fire timer at latest on the given 32-bit interval.
+     * 
+     * @param aStatus active object to be used for getting responses.	
+     * @param aInterval the interval value until which the timer must expire.
+     * 
+     * @panic RFlexTimer 1  aInterval is negative
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     *
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds32 KInterval32( 300000000 ); // 5 mins  
+     *      const TTimeIntervalMicroSeconds32 KWindow32( 120000000 ); // 2 mins  
+     *      
+     *      TRequestStatus status;
+     *      RFlexTimer timer;
+     *      
+     *      User:LeaveIfError( timer.Connect() );
+     *      timer.Configure( KWindow32 );
+     *      timer.After( status, KInterval32 );
+     *      
+     *      User::WaitForRequest( status ); // Wait timer to expire, synchronous
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode 
+     */
+    IMPORT_C void After( TRequestStatus& aStatus,
+                         TTimeIntervalMicroSeconds32 aInterval );
+    
+    /**
+     * An asynchronous timeout request to the flexible timer server.
+     * Fire timer at latest on the given 64-bit interval.
+     * @param aStatus active object to be used for getting responses.   
+     * @param aInterval the interval value until which the timer must expire.   
+     * @panic RFlexTimer 1  aInterval is negative
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aInterval is too big (max 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds KInterval64( 300000000 ); // 5 mins
+     *
+     *      TRequestStatus status;
+     *      RFlexTimer timer;
+     *      
+     *      User::LeaveIfError( timer.Connect() );
+     *      timer.After( status, KInterval64 );
+     *      
+     *      User::WaitForRequest( status ); // Wait timer to expire, synchronous
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C void After( TRequestStatus& aStatus,
+                         TTimeIntervalMicroSeconds aInterval );
+
+    /**
+     * An asynchronous timeout request to the flexible timer server.
+     * Fire timer at latest after the given number of system ticks.
+     * 
+     * By default the system tick is 1/64 second. The exact value for one
+     * system tick can be retrieve via Symbian OS HAL API:
+     * 
+     * @code
+     *      TInt tickInMicroSeconds;
+     *      HAL::Get( HAL::ESystemTickPeriod, tickInMicroSeconds );
+     * @endcode
+     * 
+     * @param aStatus active object to be used for getting responses.
+     * @param aTicks the interval value until which the timer must expire. 	
+     * @panic RFlexTimer 2  aTicks is negative
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * 
+     * Example:
+     * @code
+     *      const TInt KIntervalInTicks( 57600 ); // 15 mins (1 tick = 15625 microseconds)
+     *
+     *      TRequestStatus status;
+     *      RFlexTimer timer;
+     *      
+     *      User::LeaveIfError( timer.Connect() );
+     *      timer.AfterTicks( status, KIntervalInTicks );
+     *      
+     *      User::WaitForRequest( status ); // Wait timer to expire, synchronous
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C void AfterTicks( TRequestStatus& aStatus, TInt aTicks );
+
+    /**
+     * An asynchronous timeout request to the flexible timer server.
+     * Fire timer between at latest by the given time value. If the system
+     * time changes before the timer requested with At-function expires, it
+     * will cancel itself. This will result in the aStatus argument to have
+     * KErrAbort-value.
+     * @param aStatus active object to be used for getting responses.
+     * @param aTime indicates the latest system-time when this timer should
+     * be fired.
+     * @panic RFlexTimer 3  aTime is in the past
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aTime is too far in the future (max 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMinutes KWaitTime( 5 );
+     *      
+     *      TRequestStatus status;
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *      
+     *      TTime now;
+     *      now.HomeTime();
+     *
+     *      timer.At( status, now + KWaitTime );
+     *      
+     *      User::WaitForRequest( status ); // Wait timer to expire, synchronous
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C void At( TRequestStatus& aStatus, const TTime& aTime );
+
+    /**
+     * An asynchronous timeout request to the flexible timer server.
+     * Fire timer between at latest by the given UTC (Coordinated Universal
+     * Time) time value. If the system time changes before the timer requested
+     * with AtUTC-function expires, it will cancel itself. This will result in
+     * the aStatus argument to have KErrAbort-value.
+     * @param aStatus active object to be used for getting responses.
+     * @param aTime indicates the latest UTC time when this timer should be
+     * fired. 
+     * @panic RFlexTimer 4  aTime is in the past
+     * @panic RFlexTimer 15 Timer is already active. Wait it to expire or
+     * cancel it first.
+     * @panic RFlexTimer 24 aTime is too far in the future (max 730 days)
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMinutes KWaitTime( 5 );
+     *
+     *      TRequestStatus status;
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *
+     *      TTime nowUtc;
+     *      nowUtc.UniversalTime();
+     *
+     *      timer.At( status, nowUtc + KWaitTime );
+     *
+     *      User::WaitForRequest( status ); // Wait timer to expire, synchronous
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C void AtUTC( TRequestStatus& aStatus, const TTime& aTime );
+
+    /**
+     * Sets the window size in which alignment is possible for the timer.
+     * This is a synchronous command - it will return only after the server
+     * has completed the configuration message. If the timer is already
+     * running, it will return KErrInUse.
+     * 
+     * If user is not calling this function in prior to start timer, default
+     * value will be used as time window. Default value is currently 20%
+     * of total timer running time 
+     * (0.2 * (requested_expiry_time - current_time)) and this value is in 
+     * subject to change.
+     * 
+	 * If the user wishes to restore the default window size behaviour,
+     * a new timer is needed. 
+	 *
+     * Giving zero value as aWindowSize parameter, means that timer is fired
+     * precisely at requested time.
+	 *
+     * @param aWindowSize is the window size in 32-bit microseconds in which
+     * alignment is possible.
+     *
+     * @return KErrNone on success, KErrInUse if timer is set (wait it to be
+     * expired or cancel it before configuring). Otherwise returns one of the 
+     * system-wide error codes.
+     *
+     * @panic RFlexTimer 5  aWindowSize is negative
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds32 KWindow32( 120000000 ); // 2 mins
+     *
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *      
+     *      timer.Configure( KWindow32 );
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds32 aWindowSize );
+    
+    /**
+     * This function overloads the Configure-function with 64-bit parameters.
+     * 
+     * @param aWindowSize is the window size in 64-bit microseconds in which
+     * alignment is possible.
+     * 
+     * @return KErrNone on success, KErrInUse if timer is set, wait it to 
+     * expire or cancel it before configuring. Otherwise returns one of the 
+     * system-wide error codes.
+     * 
+     * @panic RFlexTimer 5  aWindowSize is negative
+     * @panic RFlexTimer 24 aWindowSize is too big (max 730 days)
+     * 
+     * @see TInt Configure( TTimeIntervalMicroSeconds32 )
+     * 
+     * Example:
+     * @code
+     *      const TTimeIntervalMicroSeconds KWindow64( 120000000 ); // 2 mins
+     *
+     *      RFlexTimer timer;
+     *      User::LeaveIfError( timer.Connect() );
+     *      
+     *      timer.Configure( KWindow64 );
+     *          .
+     *          .
+     *          .
+     *      timer.Close();  // Close the handle
+     * @endcode
+     */
+    IMPORT_C TInt Configure( TTimeIntervalMicroSeconds aWindowSize );
+
+private:
+    
+    /**
+     * Gets the version number.
+     * @return The version.
+     */
+    TVersion Version() const;
+
+    /**
+     * Connects to the server. If server does not exist, it is created.
+     * @return KErrNone on success. Otherwise returns one of the system-wide
+     * error codes.
+     */
+    TInt StartServer();
+
+    };
+
+#endif // RFLEXTIMER_H
+
+// End of File
--- a/ipcm_plat/group/bld.inf	Mon May 17 09:55:27 2010 +0300
+++ b/ipcm_plat/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -23,7 +23,7 @@
 #include "../disconnect_dialog_api/group/bld.inf"
 #include "../disconnect_dialog_disable_api/group/bld.inf"
 #include "../extended_connection_settings_api/group/bld.inf"
-#include "../mpm_default_connection_api/group/bld.inf"
 #include "../pdpcontextmanager2_reset_factory_settings_api/group/bld.inf"
 #include "../pdpcontextmanager2_settings_api/group/bld.inf"
 #include "../mpm_connect_screen_api/group/bld.inf"
+#include "../flextimer_api/group/bld.inf"
--- a/ipcm_pub/connection_settings_api/inc/cmpluginvpndef.h	Mon May 17 09:55:27 2010 +0300
+++ b/ipcm_pub/connection_settings_api/inc/cmpluginvpndef.h	Mon May 24 20:51:35 2010 +0300
@@ -55,7 +55,8 @@
                                         */
         
         EVpnServicePolicyName = 30100,  /**<
-                                        * Policy name.
+                                        * Deprecated
+                                        * Always leaves with code KErrNotSupported.
                                         * (String - default: None)
                                         */
                                         
@@ -66,13 +67,27 @@
 
 
         EVpnIapId,                      /**<
+                                        * Provided for backward compatibility. 
+                                        * Use ECmNextLayerIapId instead.
+                                        *
                                         * Home IAP Id.
+                                        * 
+                                        * Setting will reset EVpnNetworkId and
+                                        * ECmNextLayerSNAPId to zero
+                                        * 
                                         * (TUint32 - default: None)
                                         */
 
         EVpnNetworkId,                  /**<
-                                        * Network Id.
-                                        * (TUint32 - default: None - read only)
+                                        * Provided for backward compatibility. 
+                                        * Use ECmNextLayerSNAPId instead.
+                                        * 
+                                        * Network Id. 
+                                        * 
+                                        * Setting will reset EVpnIapId and 
+                                        * ECmNextLayerIapId to zero.
+                                        * 
+                                        * (TUint32 - default: None)
                                         */
                                         
         EVpnServiceEnableLLMNR,         /**<
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/bwins/flextimerclientu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,31 @@
+EXPORTS
+	?ConstructL@CFlexPeriodic@@AAEXXZ @ 1 NONAME ; void CFlexPeriodic::ConstructL(void)
+	?ConstructL@CFlexTimer@@IAEXXZ @ 2 NONAME ; void CFlexTimer::ConstructL(void)
+	?At@CFlexTimer@@QAEXABVTTime@@@Z @ 3 NONAME ; void CFlexTimer::At(class TTime const &)
+	?Configure@CFlexTimer@@QAEHVTTimeIntervalMicroSeconds@@@Z @ 4 NONAME ; int CFlexTimer::Configure(class TTimeIntervalMicroSeconds)
+	?AtUTC@RFlexTimer@@QAEXAAVTRequestStatus@@ABVTTime@@@Z @ 5 NONAME ; void RFlexTimer::AtUTC(class TRequestStatus &, class TTime const &)
+	?After@RFlexTimer@@QAEXAAVTRequestStatus@@VTTimeIntervalMicroSeconds32@@@Z @ 6 NONAME ; void RFlexTimer::After(class TRequestStatus &, class TTimeIntervalMicroSeconds32)
+	??1CFlexPeriodic@@UAE@XZ @ 7 NONAME ; CFlexPeriodic::~CFlexPeriodic(void)
+	?DoCancel@CFlexTimer@@MAEXXZ @ 8 NONAME ; void CFlexTimer::DoCancel(void)
+	?Configure@CFlexPeriodic@@QAEHVTTimeIntervalMicroSeconds@@0@Z @ 9 NONAME ; int CFlexPeriodic::Configure(class TTimeIntervalMicroSeconds, class TTimeIntervalMicroSeconds)
+	?After@CFlexTimer@@QAEXVTTimeIntervalMicroSeconds@@@Z @ 10 NONAME ; void CFlexTimer::After(class TTimeIntervalMicroSeconds)
+	?Configure@CFlexTimer@@QAEHVTTimeIntervalMicroSeconds32@@@Z @ 11 NONAME ; int CFlexTimer::Configure(class TTimeIntervalMicroSeconds32)
+	?After@CFlexTimer@@QAEXVTTimeIntervalMicroSeconds32@@@Z @ 12 NONAME ; void CFlexTimer::After(class TTimeIntervalMicroSeconds32)
+	?Configure@CFlexPeriodic@@QAEHVTTimeIntervalMicroSeconds32@@0@Z @ 13 NONAME ; int CFlexPeriodic::Configure(class TTimeIntervalMicroSeconds32, class TTimeIntervalMicroSeconds32)
+	?NewL@CFlexPeriodic@@SAPAV1@H@Z @ 14 NONAME ; class CFlexPeriodic * CFlexPeriodic::NewL(int)
+	?AtUTC@CFlexTimer@@QAEXABVTTime@@@Z @ 15 NONAME ; void CFlexTimer::AtUTC(class TTime const &)
+	??1RFlexTimer@@QAE@XZ @ 16 NONAME ; RFlexTimer::~RFlexTimer(void)
+	?After@RFlexTimer@@QAEXAAVTRequestStatus@@VTTimeIntervalMicroSeconds@@@Z @ 17 NONAME ; void RFlexTimer::After(class TRequestStatus &, class TTimeIntervalMicroSeconds)
+	?AfterTicks@RFlexTimer@@QAEXAAVTRequestStatus@@H@Z @ 18 NONAME ; void RFlexTimer::AfterTicks(class TRequestStatus &, int)
+	??0CFlexPeriodic@@AAE@H@Z @ 19 NONAME ; CFlexPeriodic::CFlexPeriodic(int)
+	?At@RFlexTimer@@QAEXAAVTRequestStatus@@ABVTTime@@@Z @ 20 NONAME ; void RFlexTimer::At(class TRequestStatus &, class TTime const &)
+	?Configure@RFlexTimer@@QAEHVTTimeIntervalMicroSeconds@@@Z @ 21 NONAME ; int RFlexTimer::Configure(class TTimeIntervalMicroSeconds)
+	?Cancel@RFlexTimer@@QAEXXZ @ 22 NONAME ; void RFlexTimer::Cancel(void)
+	?Configure@RFlexTimer@@QAEHVTTimeIntervalMicroSeconds32@@@Z @ 23 NONAME ; int RFlexTimer::Configure(class TTimeIntervalMicroSeconds32)
+	??0CFlexTimer@@IAE@H@Z @ 24 NONAME ; CFlexTimer::CFlexTimer(int)
+	?Start@CFlexPeriodic@@QAEXVTTimeIntervalMicroSeconds32@@0VTCallBack@@1@Z @ 25 NONAME ; void CFlexPeriodic::Start(class TTimeIntervalMicroSeconds32, class TTimeIntervalMicroSeconds32, class TCallBack, class TCallBack)
+	??1CFlexTimer@@UAE@XZ @ 26 NONAME ; CFlexTimer::~CFlexTimer(void)
+	?Start@CFlexPeriodic@@QAEXVTTimeIntervalMicroSeconds@@0VTCallBack@@1@Z @ 27 NONAME ; void CFlexPeriodic::Start(class TTimeIntervalMicroSeconds, class TTimeIntervalMicroSeconds, class TCallBack, class TCallBack)
+	?Connect@RFlexTimer@@QAEHXZ @ 28 NONAME ; int RFlexTimer::Connect(void)
+	??0RFlexTimer@@QAE@XZ @ 29 NONAME ; RFlexTimer::RFlexTimer(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/eabi/flextimerclientu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,42 @@
+EXPORTS
+	_ZN10CFlexTimer10ConstructLEv @ 1 NONAME
+	_ZN10CFlexTimer2AtERK5TTime @ 2 NONAME
+	_ZN10CFlexTimer5AfterE25TTimeIntervalMicroSeconds @ 3 NONAME
+	_ZN10CFlexTimer5AfterE27TTimeIntervalMicroSeconds32 @ 4 NONAME
+	_ZN10CFlexTimer5AtUTCERK5TTime @ 5 NONAME
+	_ZN10CFlexTimer8DoCancelEv @ 6 NONAME
+	_ZN10CFlexTimer9ConfigureE25TTimeIntervalMicroSeconds @ 7 NONAME
+	_ZN10CFlexTimer9ConfigureE27TTimeIntervalMicroSeconds32 @ 8 NONAME
+	_ZN10CFlexTimerC2Ei @ 9 NONAME
+	_ZN10CFlexTimerD0Ev @ 10 NONAME
+	_ZN10CFlexTimerD1Ev @ 11 NONAME
+	_ZN10CFlexTimerD2Ev @ 12 NONAME
+	_ZN10RFlexTimer10AfterTicksER14TRequestStatusi @ 13 NONAME
+	_ZN10RFlexTimer2AtER14TRequestStatusRK5TTime @ 14 NONAME
+	_ZN10RFlexTimer5AfterER14TRequestStatus25TTimeIntervalMicroSeconds @ 15 NONAME
+	_ZN10RFlexTimer5AfterER14TRequestStatus27TTimeIntervalMicroSeconds32 @ 16 NONAME
+	_ZN10RFlexTimer5AtUTCER14TRequestStatusRK5TTime @ 17 NONAME
+	_ZN10RFlexTimer6CancelEv @ 18 NONAME
+	_ZN10RFlexTimer7ConnectEv @ 19 NONAME
+	_ZN10RFlexTimer9ConfigureE25TTimeIntervalMicroSeconds @ 20 NONAME
+	_ZN10RFlexTimer9ConfigureE27TTimeIntervalMicroSeconds32 @ 21 NONAME
+	_ZN10RFlexTimerC1Ev @ 22 NONAME
+	_ZN10RFlexTimerC2Ev @ 23 NONAME
+	_ZN10RFlexTimerD1Ev @ 24 NONAME
+	_ZN10RFlexTimerD2Ev @ 25 NONAME
+	_ZN13CFlexPeriodic10ConstructLEv @ 26 NONAME
+	_ZN13CFlexPeriodic4NewLEi @ 27 NONAME
+	_ZN13CFlexPeriodic5StartE25TTimeIntervalMicroSecondsS0_9TCallBackS1_ @ 28 NONAME
+	_ZN13CFlexPeriodic5StartE27TTimeIntervalMicroSeconds32S0_9TCallBackS1_ @ 29 NONAME
+	_ZN13CFlexPeriodic9ConfigureE25TTimeIntervalMicroSecondsS0_ @ 30 NONAME
+	_ZN13CFlexPeriodic9ConfigureE27TTimeIntervalMicroSeconds32S0_ @ 31 NONAME
+	_ZN13CFlexPeriodicC1Ei @ 32 NONAME
+	_ZN13CFlexPeriodicC2Ei @ 33 NONAME
+	_ZN13CFlexPeriodicD0Ev @ 34 NONAME
+	_ZN13CFlexPeriodicD1Ev @ 35 NONAME
+	_ZN13CFlexPeriodicD2Ev @ 36 NONAME
+	_ZTI10CFlexTimer @ 37 NONAME
+	_ZTI13CFlexPeriodic @ 38 NONAME
+	_ZTV10CFlexTimer @ 39 NONAME
+	_ZTV13CFlexPeriodic @ 40 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 file for Flexible timer client
+*
+*/
+
+/*
+* %version: 2 %
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/flextimerclient.iby 	CORE_MW_LAYER_IBY_EXPORT_PATH(flextimerclient.iby)
+
+PRJ_MMPFILES
+flextimerclient.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/group/flextimerclient.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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:  Project definition file for project Flexible timer client
+*
+*/
+
+/*
+* %version: 1 %
+*/
+
+#include <platform_paths.hrh>
+
+TARGET              flextimerclient.dll
+TARGETTYPE          dll
+UID                 0x1000008D 0x2002C382
+
+CAPABILITY          CAP_GENERAL_DLL
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+
+SOURCE              rflextimer.cpp
+SOURCE              flextimer.cpp 
+SOURCE              flexperiodic.cpp
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../server/inc
+USERINCLUDE         ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/rom/flextimerclient.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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: Flexible timer client
+*
+*/
+#ifndef FLEXTIMERCLIENT_IBY
+#define FLEXTIMERCLIENT_IBY
+
+file=ABI_DIR\BUILD_DIR\flextimerclient.dll           SHARED_LIB_DIR\flextimerclient.dll
+
+#endif // FLEXTIMERCLIENT_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/src/flexperiodic.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,257 @@
+/*
+ * 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 CFlexPeriodic class
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// System include files
+// User include files go here:
+#include "flexperiodic.h"
+#include "flextimercommon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flexperiodicTraces.h"
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexPeriodic* CFlexPeriodic::NewL( TInt aPriority )
+    {
+
+    CFlexPeriodic* self = new ( ELeave ) CFlexPeriodic( aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexPeriodic::~CFlexPeriodic()
+    {
+    OstTrace1( TRACE_NORMAL, CFLEXPERIODIC_CFLEXPERIODIC,
+            "CFlexPeriodic::~CFlexPeriodic;this=%x", this );
+
+    }
+
+// ---------------------------------------------------------------------------
+// Starts the periodic timer. 32-bit delay and interval parameters.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexPeriodic::Start( TTimeIntervalMicroSeconds32 aDelay,
+                                    TTimeIntervalMicroSeconds32 anInterval,
+                                    TCallBack aCallBack,
+                                    TCallBack aCallBackError )
+    {
+    OstTraceExt4( TRACE_NORMAL, CFLEXPERIODIC_START32,
+            "CFlexPeriodic::Start32;this=%x;aDelay=%d;"
+            "anInterval=%d;aCallBack=%x", ( TUint )this,
+            aDelay.Int(), anInterval.Int(), ( TUint )&( aCallBack ) );
+
+    TTimeIntervalMicroSeconds32 zero( 0 );
+    __ASSERT_ALWAYS(aDelay >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicDelayLessThanZero));
+    __ASSERT_ALWAYS(anInterval > zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicIntervalTooSmall));
+    __ASSERT_ALWAYS( aCallBack.iFunction != NULL,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicCallbackFunctionIsNull));
+    // aCallBackError is left unasserted on purpose.
+    // if error occurs and callback is null client is paniced.
+
+    // Interval value is saved for later use, delay is sent immediately
+    // to the server.
+    iInterval = MAKE_TINT64( 0, anInterval.Int() );
+    iCallBack = aCallBack;
+    iCallBackError = aCallBackError;
+    CFlexTimer::After( aDelay );
+    }
+
+// ---------------------------------------------------------------------------
+// Starts the periodic timer. 64-bit delay and interval parameters.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexPeriodic::Start( TTimeIntervalMicroSeconds aDelay,
+                                    TTimeIntervalMicroSeconds anInterval,
+                                    TCallBack aCallBack,
+                                    TCallBack aCallBackError )
+    {
+    OstTraceExt4( TRACE_NORMAL, CFLEXPERIODIC_START64,
+            "CFlexPeriodic::Start64;this=%x;aDelay=%lld;"
+            "anInterval=%lld;aCallBack=%x", ( TUint )this,
+            aDelay.Int64(), anInterval.Int64(), ( TUint )&( aCallBack ) );
+
+    TTimeIntervalMicroSeconds zero( 0 );
+    __ASSERT_ALWAYS(aDelay >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicDelayLessThanZero));
+    __ASSERT_ALWAYS(anInterval > zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicIntervalTooSmall));
+    __ASSERT_ALWAYS( aCallBack.iFunction != NULL,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicCallbackFunctionIsNull));
+    // aCallBackError is left unasserted on purpose.
+    // if error occurs and callback is null client is paniced.
+    
+    // Interval value is saved for later use, delay is sent immediately
+    // to the server.
+    iInterval = anInterval.Int64();
+    iCallBack = aCallBack;
+    iCallBackError = aCallBackError;
+    CFlexTimer::After( aDelay );
+    }
+
+// ---------------------------------------------------------------------------
+// Configures the flex window sizes for both the initial delay and the
+// consequent intervals after that.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexPeriodic::Configure(
+                                 TTimeIntervalMicroSeconds32 aDelayWindow,
+                                 TTimeIntervalMicroSeconds32 aIntervalWindow )
+    {
+
+    OstTraceExt3( TRACE_NORMAL, CFLEXPERIODIC_CONFIGURE,
+            "CFlexPeriodic::Configure32;this=%x;"
+            "aDelayWindow=%d;aIntervalWindow=%d", ( TUint )this,
+            aDelayWindow.Int(), aIntervalWindow.Int() );
+
+    TTimeIntervalMicroSeconds32 zero( 0 );
+    __ASSERT_ALWAYS(aDelayWindow >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicDelayWindowLessThanZero));
+    __ASSERT_ALWAYS(aIntervalWindow >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicIntervalWindowLessThanZero));
+
+    // interval window is saved for later use. Delay window is sent
+    // immediately to server. 
+    TInt ret = CFlexTimer::Configure( aDelayWindow );
+    if ( ret == KErrNone )
+        {
+        // Interval window is changed only, if configuration is successful.
+        iIntervalWindow = MAKE_TINT64( 0, aIntervalWindow.Int() );
+        iSendConfigure = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Configures the flex window sizes for both the initial delay and the
+// consequent intervals after that. 64-bit version.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexPeriodic::Configure( 
+                                   TTimeIntervalMicroSeconds aDelayWindow,
+                                   TTimeIntervalMicroSeconds aIntervalWindow )
+    {
+    OstTraceExt3( TRACE_NORMAL, DUP1_CFLEXPERIODIC_CONFIGURE,
+            "CFlexPeriodic::Configure64;this=%x;"
+            "aDelayWindow=%lld;aIntervalWindow=%lld", ( TUint )this,
+            aDelayWindow.Int64(), aIntervalWindow.Int64() );
+
+    TTimeIntervalMicroSeconds zero( 0 );
+    __ASSERT_ALWAYS(aDelayWindow >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicDelayWindowLessThanZero));
+    __ASSERT_ALWAYS(aIntervalWindow >= zero,
+            User::Panic(KCFlexPeriodicPanicCat,
+                    EFlexPeriodicIntervalWindowLessThanZero));
+
+    // interval window is saved for later use. Delay window is sent
+    // immediately to server. 
+    TInt ret = CFlexTimer::Configure( aDelayWindow );
+    if ( ret == KErrNone )
+        {
+        // Interval window is changed only, if configuration is successful.
+        iIntervalWindow = aIntervalWindow;
+        
+        // This is set to true only, if the server is able to receive the
+        // delay window configuration.
+        iSendConfigure = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles the active objects request completion event.
+// ---------------------------------------------------------------------------
+//
+void CFlexPeriodic::RunL()
+    {
+    if ( KErrNone == iStatus.Int() )
+        {
+        if ( iSendConfigure )
+            {
+            OstTrace1( TRACE_NORMAL, CFLEXPERIODIC_RUNL,
+                    "CFlexPeriodic::RunL;this=%x", ( TUint )this );
+    
+            CFlexTimer::Configure( iIntervalWindow );
+            // Reset the iSendConfigure to false so that this is sent only once.
+            iSendConfigure = EFalse;
+            }
+        CFlexTimer::After( iInterval );
+        iCallBack.CallBack();
+        }
+    // Error happended in server. timer is not restarted and
+    // iCallBackError is called to inform user
+    else
+        {
+        if ( NULL != iCallBackError.iFunction )
+            {
+            iCallBackError.CallBack();
+            }
+        // User has not defined iCallBackError
+        // Panic client.
+        else
+            {
+            OstTrace1( TRACE_NORMAL, CFLEXPERIODIC_RUNL_PANIC,
+            "CFlexPeriodic::RunL;this=%x;"
+            "Error returned from FlexTimerServer and no Error CallBack"
+            " is defined. Panicing client.", ( TUint )this );
+            User::Panic( KCFlexPeriodicPanicCat,
+                        EFlexPeriodicErrorCallbackFunctionIsNull );
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// Second part of the two-phase construction.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexPeriodic::ConstructL()
+    {
+    CFlexTimer::ConstructL();
+
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Private constructor with priority.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexPeriodic::CFlexPeriodic( TInt aPriority ) :
+    CFlexTimer( aPriority ), iSendConfigure( EFalse )
+    {
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/src/flextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,171 @@
+/*
+ * 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 CFlexTimer class
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+//#include <e32panic.h>
+
+#include "flextimer.h"
+#include "flextimerpanic.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerTraces.h"
+#endif
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexTimer::~CFlexTimer()
+    {
+    OstTrace1( TRACE_NORMAL, CFLEXTIMER_CFLEXTIMER,
+               "CFlexTimer::~CFlexTimer;this=%x", this );
+    
+    Cancel();
+    iTimer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer at latest on the given interval. 32-bit interval.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::After( TTimeIntervalMicroSeconds32 aInterval )
+    {
+    OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AFTER32,
+                  "CFlexTimer::After32;this=%x;aInterval=%d",
+                  ( TUint )this, aInterval.Int() );
+    
+    __ASSERT_ALWAYS( IsAdded(),
+                     User::Panic( KCFlexTimerPanicCat, 
+                                  EFlexTimerNotAddedToActiveScheduler ) );
+    iTimer.After( iStatus, aInterval );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer at latest on the given interval. 64-bit interval.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::After( TTimeIntervalMicroSeconds aInterval )
+    {
+    OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AFTER64,
+                  "CFlexTimer::After64;this=%x;aInterval=%llu",
+                  ( TUint )this, aInterval.Int64() );
+    
+    __ASSERT_ALWAYS( IsAdded(),
+                     User::Panic(KCFlexTimerPanicCat,
+                                 EFlexTimerNotAddedToActiveScheduler ) );
+    iTimer.After( iStatus, aInterval );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer between at latest by the given time value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::At( const TTime& aTime )
+    {
+    OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_AT,
+                  "CFlexTimer::At;this=%x;aTime=%lld", ( TUint )this,
+                  aTime.Int64() );
+    
+    __ASSERT_ALWAYS( IsAdded(),
+                     User::Panic( KCFlexTimerPanicCat,
+                                  EFlexTimerNotAddedToActiveScheduler ) );
+    iTimer.At( iStatus, aTime );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer between at latest by the given time value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::AtUTC( const TTime& aTime )
+    {
+    OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_ATUTC,
+                  "CFlexTimer::AtUTC;this=%x;aTime=%lld",
+                  ( TUint )this, aTime.Int64() );
+    
+    __ASSERT_ALWAYS( IsAdded(),
+                     User::Panic(KCFlexTimerPanicCat,
+                                 EFlexTimerNotAddedToActiveScheduler ) );
+    iTimer.AtUTC( iStatus, aTime );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the window size in which alignment is possible for the timer.
+// This is a synchronous command. 32-bit function argument.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexTimer::Configure( TTimeIntervalMicroSeconds32 aWindowSize )
+    {
+    OstTraceExt2( TRACE_NORMAL, CFLEXTIMER_CONFIGURE,
+                  "CFlexTimer::Configure32;this=%x;aWindowSize=%d",
+                  ( TUint )this, aWindowSize.Int() );
+    
+    return iTimer.Configure( aWindowSize );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the window size in which alignment is possible for the timer.
+// This is a synchronous command. 64-bit function argument.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexTimer::Configure( TTimeIntervalMicroSeconds aWindowSize )
+    {
+    OstTraceExt2( TRACE_NORMAL, DUP1_CFLEXTIMER_CONFIGURE,
+                  "CFlexTimer::Configure64;this=%x;aWindowSize=%lld",
+                  ( TUint )this, aWindowSize.Int64() );
+    
+    return iTimer.Configure( aWindowSize );
+    }
+
+// ---------------------------------------------------------------------------
+// Constructs the object. Connects to the server and create a session.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::ConstructL()
+    {
+    OstTrace1( TRACE_NORMAL, CFLEXTIMER_CONSTRUCTL,
+               "CFlexTimer::ConstructL;this=%x", ( TUint )this );
+    
+    User::LeaveIfError(iTimer.Connect());
+    }
+
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexTimer::CFlexTimer( TInt aPriority ) :
+    CActive( aPriority )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Inherited from CActive. Handles the object canceling operations.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CFlexTimer::DoCancel()
+    {
+    OstTrace1( TRACE_NORMAL, CFLEXTIMER_DOCANCEL,
+               "CFlexTimer::DoCancel;this=%x", ( TUint )this );
+    
+    iTimer.Cancel();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/src/rflextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,383 @@
+/*
+ * 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 RFlexTimer class
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+#include "rflextimer.h"
+#include "flextimercommon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "rflextimerTraces.h"
+#endif
+
+
+_LIT( KFlexTimerSemaphoreName, "FlexTimerSemaphore" );
+
+// Semaphore count value initialization to 1. The 1st to call Wait() will
+// pass the semaphore. Other processes attempting entry will wait until the
+// 1st one has called Signal() on the semaphore.
+const TInt KPassFirstWaitEntry = 1;
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RFlexTimer::RFlexTimer()
+    {
+    OstTrace1( TRACE_NORMAL, RFLEXTIMER_RFLEXTIMER,
+               "RFlexTimer::RFlexTimer;this=%x", this );
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RFlexTimer::~RFlexTimer()
+    {
+    OstTrace1( TRACE_NORMAL, DUP1_RFLEXTIMER_RFLEXTIMER,
+               "RFlexTimer::~RFlexTimer;this=%x", ( TUint )this );
+    
+    Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Connects to the server and create a session.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimer::Connect()
+    {
+    OstTrace1( TRACE_NORMAL, RFLEXTIMER_CONNECT,
+               "RFlexTimer::Connect;this=%x", ( TUint )this );
+    
+    // Not opened handle-number
+    const TInt kHandleNotOpened( 0 );
+    
+    // Starts the server, if it does not already exist in the system.
+    TInt ret = StartServer();
+
+    if ( ret == KErrNone )
+        { // No session, create it
+
+        // Handle() is zero when initialized RHandleBase. Close() also zeroes 
+        // the handle. If CreateSession() fails, Handle() is still zero.
+        // If session is created ok, the Handle() contains the (non zero)
+        // handle-number. 
+        //
+        // Handle() can be used for checking is the handle opened or not.
+        //
+        if ( Handle() == kHandleNotOpened )
+            {
+            // Creates the session for this client.
+            ret = CreateSession( KFlexTimerServerName,
+                                 Version(),
+                                 KFlexTimerServerMessageSlots );
+            }
+        else
+            { // Session already exists - panic.
+
+            OstTrace1( 
+                TRACE_NORMAL, 
+                DUP1_RFLEXTIMER_CONNECT,
+                "RFlexTimer::Connect already connected - PANIC;this=%x", 
+                ( TUint )this );
+        
+            User::Panic( KRFlexTimerPanicCat, EFlexTimerAlreadyConnected );
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels any outstanding request to the server.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::Cancel()
+    {
+    OstTrace1( TRACE_NORMAL, RFLEXTIMER_CANCEL,
+               "RFlexTimer::Cancel;this=%x", ( TUint )this );
+    
+    SendReceive( EFlexTimerServCancelRequest );
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer at latest on the given interval. 32-bit interval.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::After( TRequestStatus& aStatus,
+                                 TTimeIntervalMicroSeconds32 aInterval )
+    {
+    OstTraceExt3( TRACE_NORMAL, RFLEXTIMER_AFTER32,
+                  "RFlexTimer::After32;this=%x;aStatus=%x;aInterval=%d",
+                  ( TUint )this, ( TUint )&( aStatus ), aInterval.Int() );
+    
+    const TTimeIntervalMicroSeconds32 ZERO_INTERVAL32(0);
+    __ASSERT_ALWAYS(aInterval >= ZERO_INTERVAL32,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerAfterIntervalLessThanZero));
+    
+    TIpcArgs args( aInterval.Int(), 0 );
+    //asynchronous request for timer creation and timeout request.    
+    SendReceive( EFlexTimerServAfterRequest, args, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer at latest on the given interval. 64-bit interval.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::After( TRequestStatus& aStatus,
+                                 TTimeIntervalMicroSeconds aInterval )
+    {
+    OstTraceExt3( TRACE_NORMAL, RFLEXTIMER_AFTER64,
+                  "RFlexTimer::After64;this=%x;aStatus=%x;aInterval=%lld",
+                  ( TUint )this, ( TUint )&( aStatus ), aInterval.Int64() );
+    
+    const TTimeIntervalMicroSeconds ZERO_INTERVAL(0);
+    __ASSERT_ALWAYS(aInterval >= ZERO_INTERVAL,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerAfterIntervalLessThanZero));
+    
+    TIpcArgs args( I64LOW(aInterval.Int64()), I64HIGH(aInterval.Int64()) );
+    //asynchronous request for timer creation and timeout request.    
+    SendReceive( EFlexTimerServAfterRequest, args, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer at latest after the given number of ticks.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::AfterTicks( TRequestStatus& aStatus, TInt aTicks )
+    {
+    OstTraceExt3( TRACE_NORMAL, RFLEXTIMER_AFTERTICKS,
+                  "RFlexTimer::AfterTicks;this=%x;aStatus=%d;aTicks=%d",
+                  ( TUint )this, ( TUint )&( aStatus ), aTicks );
+    
+    __ASSERT_ALWAYS(aTicks >= 0,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerAfterTicksIntervalLessThanZero));
+
+    TIpcArgs args( aTicks );
+    //asynchronous request for timer creation and timeout request.    
+    SendReceive( EFlexTimerServAfterTicksRequest, args, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer between at latest by the given time value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::At( TRequestStatus& aStatus, const TTime& aTime )
+    {
+    OstTraceExt3( TRACE_NORMAL, RFLEXTIMER_AT,
+                  "RFlexTimer::At;this=%x;aStatus=%d;aTime=%lld",
+                  ( TUint )this, ( TUint )&( aStatus ), aTime.Int64() );
+    
+    TTime nowTime;
+    nowTime.HomeTime();
+    
+    __ASSERT_ALWAYS(aTime >= nowTime,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerAtIntervalLessThanZero));
+    
+    TIpcArgs args( I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()) );
+    //asynchronous request for timer creation and timeout request.    
+    SendReceive( EFlexTimerServAtRequest, args, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Fire timer between at latest by the given time value.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RFlexTimer::AtUTC( TRequestStatus& aStatus, const TTime& aTime )
+    {
+    OstTraceExt3( TRACE_NORMAL, RFLEXTIMER_ATUTC,
+                  "RFlexTimer::AtUTC;this=%x;aStatus=%d;aTime=%lld",
+                  ( TUint )this, ( TUint )&( aStatus ), aTime.Int64() );
+    
+    TTime nowTime;
+    nowTime.UniversalTime();
+    
+    __ASSERT_ALWAYS(aTime >= nowTime,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerAtUTCIntervalLessThanZero));
+    
+    TIpcArgs args( I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()) );
+    //asynchronous request for timer creation and timeout request.    
+    SendReceive( EFlexTimerServAtUTCRequest, args, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the window size in which alignment is possible for the timer.
+// This is a synchronous command. 32-bit function version.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimer::Configure( TTimeIntervalMicroSeconds32 aWindowSize )
+    {
+    OstTraceExt2( TRACE_NORMAL, RFLEXTIMER_CONFIGURE,
+                  "RFlexTimer::Configure32;this=%x;aWindowSize=%d",
+                  ( TUint )this, aWindowSize.Int() );
+    
+    const TTimeIntervalMicroSeconds32 ZERO_INTERVAL32(0);
+    __ASSERT_ALWAYS(aWindowSize >= ZERO_INTERVAL32,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerWindowLessThanZero));
+    
+    TInt64 transfer = MAKE_TINT64( 0, aWindowSize.Int() );
+        
+    // Regardless of the user function, the window size is always transmitted
+    // as a 64-bit integer.
+    TIpcArgs args( EConfigureRequestWindowSize, 
+                   I64LOW(transfer), I64HIGH(transfer) );
+
+    return SendReceive( EFlexTimerServConfigureRequest, args );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the window size in which alignment is possible for the timer.
+// This is a synchronous command. 64-bit function version.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimer::Configure( TTimeIntervalMicroSeconds aWindowSize )
+    {
+    OstTraceExt2( TRACE_NORMAL, DUP1_RFLEXTIMER_CONFIGURE,
+                  "RFlexTimer::Configure64;this=%x;aWindowSize=%lld",
+                  ( TUint )this, aWindowSize.Int64() );
+    
+    const TTimeIntervalMicroSeconds ZERO_INTERVAL64(0);
+    __ASSERT_ALWAYS(aWindowSize >= ZERO_INTERVAL64,
+                    User::Panic(KRFlexTimerPanicCat,
+                                EFlexTimerWindowLessThanZero));
+    
+    // Regardless of the user function, the window size is always transmitted
+    // as a 64-bit integer.
+    TIpcArgs args( EConfigureRequestWindowSize,
+                   I64LOW(aWindowSize.Int64()),
+                   I64HIGH(aWindowSize.Int64()) );
+
+    return SendReceive( EFlexTimerServConfigureRequest, args  );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the version number.
+// ---------------------------------------------------------------------------
+//
+TVersion RFlexTimer::Version() const
+    {
+    return ( TVersion( KFlexTimerServMajorVersionNumber,
+                       KFlexTimerServMinorVersionNumber,
+                       KFlexTimerServBuildVersionNumber ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Connects to the server. If server does not exist, it is created.
+// ---------------------------------------------------------------------------
+//
+TInt RFlexTimer::StartServer()
+    {
+    OstTrace1( TRACE_NORMAL, RFLEXTIMER_STARTSERVER,
+               "RFlexTimer::StartServer;this=%x", ( TUint )this );
+    
+    TFindServer findServer( KFlexTimerServerName );
+    TFullName serverName;
+
+    // See if the server is already started. 
+    TInt ret = findServer.Next( serverName );
+    
+    if ( ret != KErrNone )
+        {
+        //Server was not found so create one.
+        RProcess serverProcess;
+        TBuf<1> serverParameters;
+
+        // Semaphore to guard the opening of the server process.
+        RSemaphore semaphore;
+
+        // Prevent two clients from  creating the serverProcess at the same
+        // time.
+        if ( ( ret = semaphore.CreateGlobal( 
+                KFlexTimerSemaphoreName, KPassFirstWaitEntry ) ) != KErrNone )
+            {
+            ret = semaphore.OpenGlobal( KFlexTimerSemaphoreName );
+            }
+
+        if ( ret == KErrNone )
+            {
+            semaphore.Wait();
+
+            // See again if the server is already started. This doublechecking
+            // is necessary, since two or processes may have resolved the
+            // first findserver before any server was created.
+
+            // TFindServer sets its content only when instantiated.
+            // Just using findServer.Next() does not work in here.
+            TFindServer findServerAgain( KFlexTimerServerName );
+            if ( findServerAgain.Next( serverName ) != KErrNone )
+                {
+                // Load the executable for the server.
+                ret = serverProcess.Create( KFlexTimerServerExe,
+                                            serverParameters,
+                                            EOwnerThread );
+
+                if ( ret == KErrNone )
+                    {
+                    // Server has been created successfully. It is initially 
+                    // in suspended state. Now resume the server process.
+                    serverProcess.Resume();
+
+                    // Wait until the server process has been started.
+                    TRequestStatus status;
+                    serverProcess.Rendezvous( status );
+                    User::WaitForRequest( status );
+
+                    // Check if server has panicked during initialization.
+                    ret = serverProcess.ExitType();
+                    if ( ret == EExitPanic )
+                        {
+                        OstTrace1( TRACE_NORMAL, DUP1_RFLEXTIMER_STARTSERVER,
+                                "RFlexTimer::StartServer;this=%x; "
+                                "ERROR: Server paniced",
+                                ( TUint )this );
+
+                        ret = KErrServerTerminated;
+                        }
+                    else
+                        {
+                        ret = status.Int();
+                        }
+
+                    // The server process stands on its own. This handle can
+                    // be closed. 
+                    serverProcess.Close();
+                    }
+                else
+                    {
+                    OstTrace1( TRACE_NORMAL, DUP2_RFLEXTIMER_STARTSERVER,
+                            "RFlexTimer::StartServer;this=%x; "
+                            "ERROR: Server creation failed",
+                            ( TUint )this );
+                    }
+                }
+            
+            semaphore.Signal();
+            semaphore.Close();
+            }
+        }
+
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/traces/OstTraceDefinitions.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,4 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/client/traces/fixed_id.definitions	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,33 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_NORMAL=0x3
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_CFLEXPERIODIC=0x1
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_CONFIGURE=0x4
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_RUNL=0x6
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_RUNL_PANIC=0x7
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_START32=0x2
+[TRACE]TRACE_NORMAL[0x3]_CFLEXPERIODIC_START64=0x3
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_AFTER32=0x9
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_AFTER64=0xa
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_AT=0xb
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_ATUTC=0xc
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_CFLEXTIMER=0x8
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_CONFIGURE=0xd
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_CONSTRUCTL=0xf
+[TRACE]TRACE_NORMAL[0x3]_CFLEXTIMER_DOCANCEL=0x10
+[TRACE]TRACE_NORMAL[0x3]_DUP1_CFLEXPERIODIC_CONFIGURE=0x5
+[TRACE]TRACE_NORMAL[0x3]_DUP1_CFLEXTIMER_CONFIGURE=0xe
+[TRACE]TRACE_NORMAL[0x3]_DUP1_RFLEXTIMER_CONFIGURE=0x1c
+[TRACE]TRACE_NORMAL[0x3]_DUP1_RFLEXTIMER_CONNECT=0x14
+[TRACE]TRACE_NORMAL[0x3]_DUP1_RFLEXTIMER_RFLEXTIMER=0x12
+[TRACE]TRACE_NORMAL[0x3]_DUP1_RFLEXTIMER_STARTSERVER=0x1e
+[TRACE]TRACE_NORMAL[0x3]_DUP2_RFLEXTIMER_STARTSERVER=0x1f
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_AFTER32=0x16
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_AFTER64=0x17
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_AFTERTICKS=0x18
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_AT=0x19
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_ATUTC=0x1a
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_CANCEL=0x15
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_CONFIGURE=0x1b
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_CONNECT=0x13
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_RFLEXTIMER=0x11
+[TRACE]TRACE_NORMAL[0x3]_RFLEXTIMER_STARTSERVER=0x1d
Binary file keepalive/flextimer/doc_pub/flextimer_for_clients.chm has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/classesfordox.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,51 @@
+// Dummy empty classes for Doxygen documentation (main for inheritance graphs)
+
+// Symbian Classes
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CActive : public CBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class RTimer : public RHandleBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CTimer : public CActive {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CPeriodic : public CTimer {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class RHandleBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class RSessionBase : public RHandleBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CServer2 : public CActive {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class CSession2 : public CBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class RThread : public RHandleBase {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TTime {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TTimeIntervalMicroSeconds {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TTimeIntervalMicroSeconds32 {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TCallBack {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TVersion {};
+
+/*! Symbian. http://developer.symbian.org/main/documentation/carbide/index.php */
+class TRequestStatus {};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/dox_base_settings.cfg	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,228 @@
+# Doxyfile 1.6.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NUMBER         =
+OUTPUT_DIRECTORY       =
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       =
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+QT_AUTOBRIEF           = YES
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                =
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = NO
+OPTIMIZE_OUTPUT_VHDL   = NO
+EXTENSION_MAPPING      =
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+IDL_PROPERTY_SUPPORT   = YES
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+TYPEDEF_HIDES_STRUCT   = NO
+SYMBOL_CACHE_SIZE      = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = YES
+EXTRACT_ANON_NSPACES   = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       =
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = NO
+SHOW_FILES             = YES
+SHOW_NAMESPACES        = YES
+FILE_VERSION_FILTER    =
+LAYOUT_FILE            =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.h *.cpp *.dox
+EXCLUDE                =
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXCLUDE_SYMBOLS        =
+EXAMPLE_PATH           =
+EXAMPLE_PATTERNS       =
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = . 
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            =
+HTML_FOOTER            =
+HTML_STYLESHEET        =
+HTML_ALIGN_MEMBERS     = YES
+HTML_DYNAMIC_SECTIONS  = NO
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+GENERATE_CHI           = NO
+CHM_INDEX_ENCODING     =
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+GENERATE_QHP           = NO
+QCH_FILE               =
+QHP_NAMESPACE          =
+QHP_VIRTUAL_FOLDER     = doc
+QHP_CUST_FILTER_NAME   =
+QHP_CUST_FILTER_ATTRS  =
+QHP_SECT_FILTER_ATTRS  =
+QHG_LOCATION           =
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+USE_INLINE_TREES       = NO
+TREEVIEW_WIDTH         = 250
+FORMULA_FONTSIZE       = 10
+SEARCHENGINE           = YES
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         =
+LATEX_HEADER           =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+LATEX_SOURCE_CODE      = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             =
+XML_DTD                =
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+SEARCH_INCLUDES        = YES
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+MSCGEN_PATH            =
+HIDE_UNDOC_RELATIONS   = YES
+DOT_FONTNAME           = FreeSans
+DOT_FONTSIZE           = 10
+DOT_FONTPATH           =
+DOTFILE_DIRS           =
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 3
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_clients.cfg	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,1329 @@
+# Doxyfile 1.5.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file that 
+# follow. The default is UTF-8 which is also the encoding used for all text before 
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into 
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of 
+# possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = "Flexible Timers API"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = 0.1.1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, 
+# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, 
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, 
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, 
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = 
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "panic=\par \"Panic code:\" \e" \
+                         "leave=\par \"Leave code:\" \e"
+
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to 
+# include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is 
+# documented as struct with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code where the coding convention is that all structs are 
+# typedef'ed and only the typedef is referenced never the struct's name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be extracted 
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}', 
+# where file will be replaced with the base name of the file that contains the anonymous 
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = NO
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = flextimer_for_clients.dox classesfordox.h ../client
+
+# This tag can be used to specify the character encoding of the source files that 
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default 
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. 
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = 
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = .svn html
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = */.svn/* */.svn */traces/*
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the output. 
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, 
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = CActive                        \
+                         CBase                          \
+                         CPeriodic                      \
+                         CServer2                       \
+                         CSession2                      \
+                         CTimer                         \
+                         RHandleBase                    \
+                         RSessionBase                   \
+                         RThread                        \
+                         RTimer                         \
+                         TCallBack                      \
+                         TRequestStatus                 \
+                         TTime                          \
+                         TTimeIntervalMicroSeconds      \
+                         TTimeIntervalMicroSeconds32    \
+                         TVersion
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = 
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = 
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = ./pics
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH 
+# then you must also enable this option. If you don't then doxygen will produce 
+# a warning and turn it on anyway
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER            = 
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = "C:\Program Files\HTML Help Workshop\hhc.exe"
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = IMPORT_C= \
+                         EXPORT_C= \
+                         "NONSHARABLE_CLASS(name)=class name"
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = 
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to 
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to 
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to 
+# be found in the default search path.
+
+MSCGEN_PATH            = 
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
+# generate a caller dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable caller graphs for selected 
+# functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = "C:\Program Files\Graphviz2.26.3\bin"
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the number 
+# of direct children of the root node in a graph is already larger than 
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_clients.dox	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,186 @@
+/*
+ * 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:
+ *      Flexible timer documentation's main page
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+/**
+@mainpage
+
+@section mainGeneral General
+
+Flexible timers are timers for synchronizing network access. This is achieved
+by providing a timer service that instead of generating timeout at exact moment
+of time, generates timeout within given window of time. This allows several
+timeouts to be aligned, and only one wakeup is needed instead of many. This
+improves battery life. The improvement depends on the used bearer and its 
+configuration.
+
+Flexible timers are designed to provided similar API with existing Symbian
+timers (RTimer, CTimer and CPeriodic), and (besides they extend the interfaces
+by providing 64-bit interface for After(). I.e. using At() for longer than 35
+minutes timers is not required.
+
+@subsection mainYes When you should consider using Flexible timers 
+- If your timer can handle several minutes variation in expiration times @b AND
+- If your timer is used to trigger network connectivity @b AND
+- If your timer is long enough (> 5 min)
+
+@subsection mainNo Who should NOT use Flexible timers
+- If you need accurate timing (in resolution of minutes) @b OR
+- If your timer is too rapid, i.e. less than 5 minutes @b OR
+- If you need timeout when phone is powered off @b OR
+- If you need reboot-proof timeouts
+
+@section mainTimerWindow Concept
+
+The main idea of flexible timer concept is that timers can expire @a early.
+The time how much earlier timer can expire, is called @b timer @b expiration 
+@b window (or just window).
+
+For example, a timer that is started to expire after 10 minutes timer that 
+window is configured to 2 minutes can expire at any time between 8 to 10 
+minutes. See the figure below.
+
+\image html FlexTimerWindowConcept.png
+
+There are two reasons when timer can expire:
+-# The timer has reached the time it's set to be expired
+-# Another timer is expiring within this timer's window
+
+In picture below is shown two set of periodical timers; normal timers and
+flexible timers. Each time a timer expires, it causes network access.
+
+\image html FlexTimersExample.png
+
+The picture also illustrates main differences between using normal and flexible
+timers:
+- number of network initializations decreases (12 vs. 6).
+- timers are being "drifted" (e.g. interval of Timer 2 is actually 12 minutes)
+
+@section mainArchitecture Architecture
+
+In picture below is illustrated components of flexible timers.
+
+\image html FlexTimerComponents.png
+
+When a client uses flexible timers, the actual timer request is forwarded to
+Flex Timer Server using Symbian's inter process communication (IPC). The
+biggest difference to normal timers is that flexible timers actually are run in
+different process than the client as the normal timers are run in local thread.
+
+@section mainLimitations Limitations of flexible timers
+
+@subsection mainTimerAccuracy Timer Accuracy
+
+Although the timer can be set to expire in 1 microsecond accuracy, the actual
+accuracy can vary from 1/64 second (one system tick) to 1 second. It depends
+when the timer is set; timers are "rounded" to the next full second.
+
+This implies that e.g. 1 microsecond periodic timer's period is 1 second; not
+1 microsecond.
+
+As the flexible timer's implementation relies on system ticks, it's possible 
+that the timer expires 1/64 second (one system tick) too early.
+
+I.e. the timer can expire from -1/64 second to +1 second when it is set.
+
+@note If timer accuracy at this resolution is concern for you, you should not
+use flexible timers at all. Use normal timers instead.
+
+@subsection mainMinValue Minimum timer value
+
+The minimum timer value is 0 microsecond. Only exception is CFlexPeriodic's
+interval that can be 1 microseconds. 
+
+@subsection mainMaxValue Maximum timer value
+
+Maximum value for timer is 2 years (i.e. 730 days, 63072000 seconds).
+
+@subsection mainMinWindow Minimum window value
+
+The minimum value for timer window is zero microseconds.
+
+@subsection mainMaxWindow Maximum window value
+
+The maximum value for timer window is two years (i.e. 730 days, 63072000 
+seconds). 
+
+The default value for window is 20% of the timer's value (e.g. 10 minutes timer
+has 2 minutes default window).
+
+@subsection mainTimerDrifting Timer drifting
+
+As the timer expiration can happen in timer expiration window, it usually
+causes periodic timers to "drift".
+
+For example:
+
+@c CPeriodic is started at 8 o'clock with 30 minute interval.
+It will then expire at 8.30, 9.00, ... 15.30, 16.00
+
+If @c CFlexPeriodic is used as a timer it can possibly expire at
+8.30, 9.00, 9.28, 9.55, ... 15.15, 15.42 etc. 
+
+@subsection mainReboot Reboot-proof
+
+Flexible timers are @b not reboot-proof. I.e. after reboot all timers has to
+be set again.
+
+@section mainHowTo How to start using flexible timers
+
+The flexible timer API is designed to be as similar to normal Symbian timers
+as possible. 
+
+In the table below is described Symbian OS timer and its corresponding flexible
+timer.
+
+<table border=1 bordercolor="#84B0C7" cellspacing="0" align="center">
+<tr><td><b>Symbian OS timer</b></td><td><b>Flexible timer</b></td></tr>
+<tr><td><code>CPeriodic</code></td><td><code>CFlexPeriodic</code></td></tr>
+<tr><td><code>CTimer</code></td><td><code>CFlexTimer</code></td></tr>
+<tr><td><code>RTimer</code></td><td><code>RFlexTimer</code></td></tr>
+</table>
+
+Using of flexible timer is easy and fun. There are only three following steps;
+
+-# Add following line to MMP-file
+   @code 
+   LIBRARY flextimer.lib 
+   @endcode
+-# Include flexible timer's header to your code files, e.g. for periodic timer
+   @code
+   #include <flexperiodic.h>
+   @endcode
+-# Convert the used Symbian OS timers to flexible timers, e.g.
+   @code
+   //Old: CPeriodic* myTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+   CFlexPeriodic* myTimer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+   ...
+   // By default the window is 20% of timer's values
+   myTimer->Start( myDelay, myInterval, myCallback ); // No changes
+   ...
+   myTimer->Cancel(); // No changes
+   delete myTimer; // No changes
+
+   @endcode
+
+More examples available in flexible timer's class documentation.
+
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/flextimer_for_devs.cfg	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,70 @@
+# Doxyfile 1.6.1
+
+@INCLUDE = dox_base_settings.cfg
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+PROJECT_NAME           = Flexible Timers & Timer Alignment Engine
+FULL_PATH_NAMES        = NO # YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = classesfordox.h \
+                         ..\
+
+RECURSIVE              = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+# These options affect the class and function descriptions
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO # YES
+REFERENCED_BY_RELATION = NO # YES
+REFERENCES_RELATION    = NO # YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the Windows help file generation
+#---------------------------------------------------------------------------
+
+# If this is NO, the rest of the help file generation options are not evaluated 
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = ..\FlexTimerInternal.chm
+HHC_LOCATION           = "C:\Program Files\HTML Help Workshop\hhc.exe"
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If this is NO, the rest of the preprocessor options are not evaluated 
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = YES
+PREDEFINED             = IMPORT_C= \
+                         EXPORT_C= \
+                         "NONSHARABLE_CLASS(name)=class name"
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+# These parameters govern the type and amount of graphs in the document.
+#---------------------------------------------------------------------------
+
+# If this is NO, the rest of the graph options are not evaluated 
+HAVE_DOT               = YES
+
+CLASS_DIAGRAMS         = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH           = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = "C:\Program Files\Graphviz2.26.3\bin"
Binary file keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimerComponents.png has changed
Binary file keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimerWindowConcept.png has changed
Binary file keepalive/flextimer/doc_pub/flextimer_for_clients_doxygen/pics/FlexTimersExample.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/group/bld.inf	Mon May 24 20:51:35 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 flex timer modules.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+#include "../client/group/bld.inf"
+#include "../server/group/bld.inf"
+
+PRJ_TESTMMPFILES
+#include "../test/testflextimer/group/bld.inf"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/bwins/flextimerengineu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	?NewL@CFlexTimerEngine@@SAPAV1@XZ @ 1 NONAME ; class CFlexTimerEngine * CFlexTimerEngine::NewL(void)
+	?AddTimer@CFlexTimerEngine@@UAEHABVTTimeIntervalMicroSeconds@@0HPBVMFlexTimerServiceCB@@@Z @ 2 NONAME ; int CFlexTimerEngine::AddTimer(class TTimeIntervalMicroSeconds const &, class TTimeIntervalMicroSeconds const &, int, class MFlexTimerServiceCB const *)
+	?CancelTimer@CFlexTimerEngine@@UAEHPBVMFlexTimerServiceCB@@@Z @ 3 NONAME ; int CFlexTimerEngine::CancelTimer(class MFlexTimerServiceCB const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/eabi/flextimerengineu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,15 @@
+EXPORTS
+	_ZN16CFlexTimerEngine11CancelTimerEPK19MFlexTimerServiceCB @ 1 NONAME
+	_ZN16CFlexTimerEngine4NewLEv @ 2 NONAME
+	_ZN16CFlexTimerEngine8AddTimerERK25TTimeIntervalMicroSecondsS2_iPK19MFlexTimerServiceCB @ 3 NONAME
+	_ZTI14CFlexTimerItem @ 4 NONAME
+	_ZTI16CFlexTimerEngine @ 5 NONAME
+	_ZTI19CFlexTimerContainer @ 6 NONAME
+	_ZTI21CFlexTimerWakeUpTimer @ 7 NONAME
+	_ZTV14CFlexTimerItem @ 8 NONAME
+	_ZTV16CFlexTimerEngine @ 9 NONAME
+	_ZTV19CFlexTimerContainer @ 10 NONAME
+	_ZTV21CFlexTimerWakeUpTimer @ 11 NONAME
+	_ZThn4_N16CFlexTimerEngine11CancelTimerEPK19MFlexTimerServiceCB @ 12 NONAME
+	_ZThn4_N16CFlexTimerEngine8AddTimerERK25TTimeIntervalMicroSecondsS2_iPK19MFlexTimerServiceCB @ 13 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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 file for Flexible timer engine
+*
+*/
+
+/*
+* %version: 1 %
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/flextimerengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(flextimerengine.iby)
+
+PRJ_MMPFILES
+flextimerengine.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/group/flextimerengine.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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:  Project definition file for project Flexible timer
+*
+*/
+
+/*
+* %version: 1 %
+*/
+
+#include <platform_paths.hrh>
+
+TARGET              flextimerengine.dll
+TARGETTYPE          DLL
+UID                 0x1000008D 0x2002DCE7
+
+CAPABILITY          CAP_GENERAL_DLL
+VENDORID            VID_DEFAULT
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../inc
+USERINCLUDE         ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
+LIBRARY             hal.lib
+
+SOURCEPATH ../src
+
+SOURCE flextimercontainer.cpp
+SOURCE flextimerengine.cpp
+SOURCE flextimeritem.cpp
+SOURCE flextimerwakeuptimer.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimercontainer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,217 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains definition of CFlexTimerContainer.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERCONTAINER_H
+#define FLEXTIMERCONTAINER_H
+
+// System includes
+#include <e32base.h>
+
+// Forward declarations
+class MFlexTimerServiceCB;
+class CFlexTimerItem;
+
+// Class declaration
+/**
+ *  Timer container that contains list of CFlexTimerItems, means to add and
+ *  delete them and implementation of algorithms that select which timers
+ *   should be expired.
+ */
+class CFlexTimerContainer : public CBase
+    {
+public:
+    /** Supported timer algorithms.*/
+    enum TFlexTimerAlgorithm
+        {
+        /** Simple algorithm timeouts all timers that have open timeout
+         * window when one timer expires.
+         */
+        EFlexTimerAlgorithmSimple = 1,
+        /** Latest possible algorithm tries to delay expiration of timer
+         * as long as possible.
+         */
+        EFlexTimerAlgorithmLatestPossible
+        };
+
+    /**
+     * Constructs new CFlexTimerContainer.
+     */
+    static CFlexTimerContainer* NewL();
+
+    /**
+     * Destructs timercontainer and all timers in the internal lists.
+     */
+    virtual ~CFlexTimerContainer();
+
+public:
+    /**
+     * Makes new timer item and adds it to timerlist.
+     *
+     * @param aWinStartInterval Time interval from present to left side of the
+     *  timer launch window
+     * @param aWinEndInterval Time interval from present to right side of the
+     *  timer launch window
+     * @param aCancelAtSystemTimeChange Whether system time change should
+     *  trigger abort
+     * @param aFlexTimerServiceCB Call back interface. Used to inform about
+     *  timeout, abort etc.
+     */
+    void AddTimerL(
+        const TTimeIntervalMicroSeconds& aWinStartInterval,
+        const TTimeIntervalMicroSeconds& aWinEndInterval,
+        TBool aCancelAtSystemTimeChange,
+        const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+    /**
+     * Finds correct timer according to aFlexTimerServiceCB and removes it
+     * from list and finally 
+     * deletes the corresponding CFlexTimerItem.
+     * @param aFlexTimerServiceCB Call back interface aka. session that
+     * handles timer.
+     * @return KErrNone or some system wide error code.
+     */
+    TInt RemoveTimer( const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+    /**
+     * Finds earliest moment that at least one timer must expire and after
+     * this function returns aNextTimeoutDelay contains number of microseconds
+     * from now to that moment.
+     *
+     * @param after return aNextTimeoutDelay contains time in microseconds
+     * from now till next timer expiry. If aNextTimeoutDelay is zero, it means
+     * that expiry time has already passed or is due right now
+     * @return Active timers indication
+     * - ETrue if there is at least one timer in queue
+     * - EFalse if there are no timers
+     */
+    TBool GetNextTimeout( TTimeIntervalMicroSeconds& aNextTimeoutDelay );
+
+    /**
+     * Fires all timers that can be fired according to algorithm that is
+     * supplied as parameter.
+     *
+     * @param aAlgorithmToBeUsed Algorithm that is used to fire timers.
+     * - EFlexTimerAlgorithmSimple
+     * - EFlexTimerAlgorithmLatestPossible
+     */
+    void FireTimers( TFlexTimerAlgorithm aAlgorithmToBeUsed );
+
+    /**
+     * Aborts and removes all timers that are marked with
+     * aCancelAtSystemTimeChange = ETrue during adding timer.
+     *
+     * @param aReason Timers will be aborted with this reason code. Can be
+     * e.g. KErrAbort
+     */
+    void AbortTimersDueToTimeChange( TInt aReason );
+
+private:
+    /**
+     * Private constructor.
+     */
+    CFlexTimerContainer();
+
+    /**
+     * Excecutes simple algorithm.
+     * 
+     * Moves timers (that can be fired right now) from iTimerList to
+     * candidateList.
+     * 
+     * @param aCandidateList After this function returns, this list contains
+     * all timers that can be fire right now.
+     * @param aCurrentTime Current safe UTC time.
+     */
+    void SimpleAlgorithm( TSglQue<CFlexTimerItem>& aCandidateList,
+        TTime& aCurrentTime );
+
+    /**
+     * Excecutes latest possible algorithm.
+     * 
+     * Moves timers (that don't necessarily be fired right now) from
+     * candidateList to iTimerList.
+     * 
+     * @param aCandidateList After this function returns, this list contains
+     * all timers that can be fire right now.
+     */
+    void LatestPossibleAlgorithm( TSglQue<CFlexTimerItem>& aCandidateList );
+
+    /**
+     * Fires all timers in aCandidateList. Calls Timeout() to all timers and
+     * deletes timer items.
+     * 
+     * @param aCandidateList Timers that are fired.
+     */
+    void ExpireTimers( TSglQue<CFlexTimerItem>& aCandidateList );
+
+    /**
+     * Gets current absolute time. The time in FlexTimer engine time base, not
+     * system time base. This time base is begins from the first call to
+     *  GetCurrentTime and it is base on system ticks.
+     * 
+     * @param aCurrentAbsoluteTime After this function returns this contains
+     * current flextimer timebase time.
+     */
+    void GetCurrentTime( TTime& aCurrentAbsoluteTime );
+
+    /**
+     * Converts microseconds interval to tick based reference time used by
+     * FlexTimer engine (also in microseconds). All FlexTimer timeout element
+     * time handling is based on this tick based absolute time.
+     *
+     * @param aInterval Interval to be converted.
+     */
+    inline TInt64 IntervalToAbsoluteTime(
+        const TTimeIntervalMicroSeconds& aInterval );
+
+    /**
+     * Converts ticks to microseconds.
+     *
+     * @param aTicks. Ticks to be converted to microseconds
+     */
+    inline TInt64 TicksToAbsoluteTime( TUint32 aTicks );
+
+private:
+    // Data
+    /**
+     * Linked list and iterator for all timer objects.
+     */
+    TSglQue<CFlexTimerItem> iTimerList;
+    
+    /**
+     * Length of system tick in milliseconds. The value is read once
+     * to member variable during construction of FlexTimerContainer so that
+     * it does not need be read every time the absolute time is calculated.
+     */
+    TInt iTickPeriod;
+     
+    /**
+     * Number of tics during the last time they were read. This is used to
+     * detect possible tick counter overflow and to calculate time passed
+     * since the last read.
+     */
+    TUint32 iLastTicks;
+    
+    /**
+     * Current FlexTimer engine time. This is system tick based time and
+     * it is updated every time someone request for it.
+     */
+    TInt64 iCurrentAbsoluteTime;
+    };
+
+#include "flextimercontainer.inl"
+
+#endif  //FLEXTIMERCONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimercontainer.inl	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,45 @@
+/*
+ * 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
+ *
+ * Description:
+ * This file contains inline functions of FlexTimerContainer class.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERCONTAINER_INL
+#define FLEXTIMERCONTAINER_INL
+
+// ---------------------------------------------------------------------------
+// Converts micro seconds interval to tick based absolute time (also in micro
+// seconds). All flextimer item time handling in engine is based on this tick
+// based absolute time. Note that the time is not using system time base.
+// ---------------------------------------------------------------------------
+//
+inline TInt64 CFlexTimerContainer::IntervalToAbsoluteTime(
+    const TTimeIntervalMicroSeconds& aInterval )
+    {
+    TTime tempTime;
+    GetCurrentTime( tempTime );
+
+    return tempTime.Int64() + aInterval.Int64();
+    }
+// ---------------------------------------------------------------------------
+// Converts system ticks to microseconds. 
+// ---------------------------------------------------------------------------
+//
+inline TInt64 CFlexTimerContainer::TicksToAbsoluteTime( const TUint32 aTicks )
+    {
+    return static_cast<TInt64> ( aTicks )
+        * static_cast<TInt64> ( iTickPeriod );
+    }
+
+#endif  //FLEXTIMERCONTAINER_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimerengine.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,130 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains definition of CFlexTimerEngine.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERENGINE_H
+#define FLEXTIMERENGINE_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "mflextimerservice.h"
+#include "mflextimerwakeuptimercb.h"
+
+// Forward declarations
+class MFlexTimerServiceCB;
+class CFlexTimerContainer;
+class CFlexTimerWakeUpTimer;
+
+// Class declaration
+/**
+ *  Flexible timer engine that acts as service point towards session.
+ *  Handles timer wakeups and system time changes.
+ */
+class CFlexTimerEngine : public CBase,
+        public MFlexTimerService,
+        public MFlexTimerWakeUpTimerCB
+    {
+public:
+
+    /**
+     * Constructs new timer engine.
+     */
+    IMPORT_C static CFlexTimerEngine* NewL();
+
+    /**
+     * Destructs timer item.
+     */
+    virtual ~CFlexTimerEngine();
+
+public:
+    /**
+     * Inherited from MFlexTimerService
+     */
+
+    /**
+     * Implementation of inherited pure virtual function
+     *  
+     * @see MFlexTimerService::AddTimer
+     */
+    IMPORT_C TInt AddTimer(
+        const TTimeIntervalMicroSeconds& aWinStartInterval,
+        const TTimeIntervalMicroSeconds& aWinEndInterval,
+        TBool aCancelAtSystemTimeChange,
+        const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+    /**
+     * Implementation of inherited pure virtual function
+     *  
+     * @see MFlexTimerService::CancelTimer
+     */
+    IMPORT_C TInt CancelTimer(
+        const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+    /**
+     * Inherited from MFlexTimerWakeUpTimerCB
+     */
+
+    /**
+     * Implementation of inherited pure virtual function
+     *  
+     * @see MFlexTimerWakeUpTimerCB::WakeUp
+     */
+    void WakeUp();
+
+    /**
+     * Implementation of inherited pure virtual function
+     *  
+     * @see MFlexTimerWakeUpTimerCB::SystemTimeChanged
+     */
+    void SystemTimeChanged();
+
+private:
+    /**
+     * Private constructor.
+     *  
+     */
+    CFlexTimerEngine();
+
+    /**
+     * Private 2nd pahse constructor.
+     *  
+     */
+    void ConstructL();
+
+    /**
+     * Finds out what is the next time we have to wake up to fire some
+     * FlexTimers and starts CTimer accordingly.
+     *  
+     */
+    void StartTimer();
+
+private:
+    // Data
+    /**
+     * Container for all timers. Lives and dies with engine.
+     */
+    CFlexTimerContainer* iFlexTimerContainer;
+
+    /**
+     * Wake up timer to watch flextimer firings and system time change
+     */
+    CFlexTimerWakeUpTimer* iWakeUpTimer;
+
+    };
+
+#endif  //FLEXTIMERENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimeritem.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,150 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains definition of CFlexTimerItem.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERITEM_H
+#define FLEXTIMERITEM_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+// None
+
+// Forward declarations
+class MFlexTimerServiceCB;
+
+// Class declaration
+/**
+ *  Timer item that contains expiry time, window size and other timer specific
+ *  parameters. Class implements container for one timer information in
+ *  FlexTimerServer.
+ */
+class CFlexTimerItem : public CBase
+    {
+public:
+
+    /** Constructor
+     *
+     * Constructs new timer item that contains all information needed to
+     * decide when to launch timer.
+     *
+     * @param aAbsoluteMinTime Left side of the timer launch window.
+     * @param aAbsoluteMaxTime Right side of the timer launch window.
+     * @param aCancelAtSystemTimeChange Whether system time change should
+     * trigger abort.
+     * @param aFlexTimerServiceCB Call back interface. Used to inform about
+     * timeout, abort etc.
+     * @return New CFlexTimer object.
+     */
+    static CFlexTimerItem* NewL( const TTime& aAbsoluteMinTime,
+        const TTime& aAbsoluteMaxTime,
+        TBool aCancelAtSystemTimeChange,
+        const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+    /** Destructor
+     * Destructs timer item.
+     */
+    virtual ~CFlexTimerItem();
+
+public:
+    /**
+     * Gets the earliest possible moment when this timer can expire. 
+     * Places value to reference parameter. 
+     *
+     * @param aMinAbsoluteTime After function returns this parameter contains
+     * absolute earliest moment when this timer can expire         
+     */
+    inline void GetMinAbsoluteTime( TTime& aMinAbsoluteTime );
+
+    /**
+     * Gets the latest possible moment when this timer must expire. 
+     * Places value to reference parameter. 
+     *
+     * @param aMaxAbsoluteTime After function returns this parameter contains
+     * absolute latest moment when this timer must expire       
+     */
+    inline void GetMaxAbsoluteTime( TTime& aMaxAbsoluteTime );
+
+    /**
+     * Checks whether this timer should be aborted if system time changes
+     *
+     * @return 
+     * ETrue - If timer should be aborted when system time changes
+     * EFalse - If timer should not be cancelled when system time changes        
+     */
+    inline TBool IsAbortedAtSystemTimeChange();
+
+    /**
+     * Returns timers corresponding CB session pointer.
+     *
+     * @return pointer to session that initiated this timer       
+     */
+    const MFlexTimerServiceCB* GetCB();
+
+private:
+    /**
+     * Private contructor. Constructs new timer item that contains all
+     * information needed to decide when to launch timer.
+     *
+     * @param aAbsoluteMinTime Left side of the timer launch window.
+     * @param aAbsoluteMaxTime Right side of the timer launch window.
+     * @param aCancelAtSystemTimeChange Whether system time change should
+     * trigger abort.
+     * @param aFlexTimerServiceCB Call back interface. Used to inform about
+     * timeout, abort etc.
+     *
+     * @return New CFlexTimer object.
+     * 
+     */
+    CFlexTimerItem( const TTime& aAbsoluteMinTime,
+        const TTime& aAbsoluteMaxTime,
+        TBool aCancelAtSystemTimeChange,
+        const MFlexTimerServiceCB* aFlexTimerServiceCB );
+
+public:
+    //Data
+    /**
+     * Single linked list link object for timers lists
+     */
+    TSglQueLink iLink;
+
+private:
+    // Data
+    /**
+     * Whether timer should be aborted when system time changes.
+     */
+    TBool iAbortAtSystemTimeChange;
+
+    /**
+     * Left side of the time window when timer can be fired
+     */
+    TTime iAbsoluteMinTime;
+
+    /**
+     * Right side of the time window when timer can be fired
+     */
+    TTime iAbsoluteMaxTime;
+
+    /**
+     * pointer to the session interface that is used to inform timeout
+     */
+    const MFlexTimerServiceCB* iMFlexTimerServiceCB;
+    };
+
+#include "flextimeritem.inl"
+
+#endif  //FLEXTIMERITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimeritem.inl	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,46 @@
+/*
+ * 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
+ *
+ * Description:
+ * This file contains inline functions of FlexTimerItem class.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERITEM_INL
+#define FLEXTIMERITEM_INL
+
+// ---------------------------------------------------------------------------
+// GetMinAbsoluteTime
+// ---------------------------------------------------------------------------
+//
+inline void CFlexTimerItem::GetMinAbsoluteTime( TTime& aMinAbsoluteTime )
+    {
+    aMinAbsoluteTime = iAbsoluteMinTime;
+    }
+// ---------------------------------------------------------------------------
+// GetMaxAbsoluteTime
+// ---------------------------------------------------------------------------
+//
+inline void CFlexTimerItem::GetMaxAbsoluteTime( TTime& aMaxAbsoluteTime )
+    {
+    aMaxAbsoluteTime = iAbsoluteMaxTime;
+    }
+// ---------------------------------------------------------------------------
+// IsAbortedAtSystemTimeChange
+// ---------------------------------------------------------------------------
+//
+inline TBool CFlexTimerItem::IsAbortedAtSystemTimeChange()
+    {
+    return iAbortAtSystemTimeChange;
+    }
+
+#endif  //FLEXTIMERITEM_INL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/flextimerwakeuptimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,93 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains definition of CFlexTimerWakeUpTimer.
+ *
+ */
+
+// Protection against nested includes
+#ifndef FLEXTIMERWAKEUPTIMER_H
+#define FLEXTIMERWAKEUPTIMER_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+// None
+
+// Forward declarations
+class MFlexTimerWakeUpTimerCB;
+
+// Class declaration
+/**
+ *  This class implements timer that is used to
+ *  - Inform timer engine that timeout algorithms should be excecuted
+ *  - Inform timer engine that system time has changed.
+ *
+ */
+class CFlexTimerWakeUpTimer : public CTimer
+    {
+public:
+
+    /**
+     * Contructs new wake up timer
+     * @param aObserver callback class
+     *
+     */
+    static CFlexTimerWakeUpTimer* NewL( MFlexTimerWakeUpTimerCB& aObserver );
+
+    /**
+     * Destructs wake up timer.
+     */
+    virtual ~CFlexTimerWakeUpTimer();
+
+public:
+    /**
+     * Starts timer. No need to cancel already running timer.
+     * @param aInterval time until timer should expire         
+     */
+
+    void StartTimer( TTimeIntervalMicroSeconds& aInterval );
+    
+    /**
+     * Stops timer.   
+     */
+    void StopTimer();
+
+    /**
+     * Inherited from CActive
+     * Handles timer expiration and callbacks.
+     */
+    void RunL();
+
+private:
+    // Functions
+    /**
+     * Private contructor.
+     * @param aObserver Callback class.         
+     */
+    CFlexTimerWakeUpTimer( MFlexTimerWakeUpTimerCB& aObserver );
+    /**
+     * Private 2nd phase contructor.   
+     */
+    void ConstructL();
+
+private:
+    // Data
+    /**
+     * Callback class
+     */
+    MFlexTimerWakeUpTimerCB& iObserver;
+
+    };
+
+#endif  //FLEXTIMERWAKEUPTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/inc/mflextimerwakeuptimercb.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains definition of MFlexTimerWakeUpTimerCB
+ *
+ */
+
+// Protection against nested includes
+#ifndef MFLEXTIMERWAKEUPTIMERCB_H
+#define MFLEXTIMERWAKEUPTIMERCB_H
+
+// Class declaration
+/**
+ *  Callback functions for FlexTimer engine wake up timers. If a client
+ *  wants to receive indicaitions from wake-up timer, it need to inherit
+ *  this interface and implement the callback methods.
+ */
+class MFlexTimerWakeUpTimerCB
+    {
+public:
+
+    /**
+     * This function is used to inform about timer expiry.
+     */
+    virtual void WakeUp() = 0;
+
+    /** Pure virtual functions*/
+    /**
+     * This function is used to inform about system time change.
+     */
+    virtual void SystemTimeChanged() = 0;
+    };
+
+#endif  //MFLEXTIMERWAKEUPTIMERCB_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/rom/flextimerengine.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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: Flexible timer
+*
+*/
+#ifndef FLEXTIMERENGINE_IBY
+#define FLEXTIMERENGINE_IBY
+
+file=ABI_DIR\BUILD_DIR\flextimerengine.dll           SHARED_LIB_DIR\flextimerengine.dll
+
+#endif // FLEXTIMERENGINE_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/src/flextimercontainer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,459 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains implementation of CFlexTimerContainer.
+ *
+ */
+
+// System include files
+#include <hal.h>
+
+// User include files
+#include "flextimercommon.h"
+#include "flextimercontainer.h"
+#include "flextimeritem.h"
+#include "mflextimerservicecb.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimercontainerTraces.h"
+#endif
+
+
+
+// This literal is only used by __ASSERT_DEBUG macro. Therefore, to prevent 
+// unnacessary warnings, it is not compiled into release builds.
+#ifdef _DEBUG
+static const TInt KCBNullPointer = 1;
+_LIT( KCBNullPointerDescriptor, "FlexTimerService CB is NULL." );
+#endif
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CFlexTimerContainer* CFlexTimerContainer::NewL()
+    {
+    CFlexTimerContainer* self = new (ELeave) CFlexTimerContainer();
+    
+    OstTrace1( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_NEWL,
+        "CFlexTimerContainer::NewL;this=%x",
+        ( TUint )self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// If the list is not empty when coming here something has already gone wrong.
+// Lets just delete the timers and forget Timeout() calling
+// ---------------------------------------------------------------------------
+//
+CFlexTimerContainer::~CFlexTimerContainer()
+    {
+    CFlexTimerItem* item = NULL;
+    
+    OstTrace1(
+        TRACE_INTERNAL,
+        DUP1_CFLEXTIMERCONTAINER_CFLEXTIMERCONTAINER,
+        "CFlexTimerContainer::~CFlexTimerContainer;this=%x",
+        ( TUint )this );
+
+    while ( !iTimerList.IsEmpty() )
+        {
+        item = iTimerList.First();
+        iTimerList.Remove( *item );
+        delete item;
+        }
+    }
+// ---------------------------------------------------------------------------
+// Make new timer and add it to list. On purpose do not make sanity checks. 
+// Invalid(in the past) timers are found later.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::AddTimerL(
+    const TTimeIntervalMicroSeconds& aWinStartInterval,
+    const TTimeIntervalMicroSeconds& aWinEndInterval,
+    TBool aCancelAtSystemTimeChange,
+    const MFlexTimerServiceCB* aFlexTimerServiceCB )
+    {
+    OstTraceExt5( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_ADDTIMERL,
+        "CFlexTimerContainer::AddTimerL;this=%x;"
+        "aWinStartInterval=%Ld;"
+        "aWinEndInterval=%Ld;"
+        "aCancelAtSystemTimeChange=%u;"
+        "aFlexTimerServiceCB=%x",
+        ( TUint )this,
+        aWinStartInterval.Int64(),
+        aWinEndInterval.Int64(),
+        aCancelAtSystemTimeChange,
+        ( TUint )aFlexTimerServiceCB );
+    
+    __ASSERT_DEBUG( aFlexTimerServiceCB,
+            User::Panic( KCBNullPointerDescriptor, KCBNullPointer ) );
+
+    // Before creating new flextimer timeout item, the interval times are
+    // converted to absolute tick based time used by the engine.
+    TTime winAbsStart( IntervalToAbsoluteTime( aWinStartInterval ) );
+    TTime winAbsEnd( IntervalToAbsoluteTime( aWinEndInterval ) );
+    
+    CFlexTimerItem* newItem = CFlexTimerItem::NewL( winAbsStart,
+        winAbsEnd,
+        aCancelAtSystemTimeChange,
+        aFlexTimerServiceCB );
+
+    iTimerList.AddLast( *newItem );
+    }
+// ---------------------------------------------------------------------------
+// Loop through list and if timer containing same CB that is given as a
+// parameter is found, remove timer. If no timer found just return error code.
+// ---------------------------------------------------------------------------
+//
+TInt CFlexTimerContainer::RemoveTimer(
+    const MFlexTimerServiceCB* aFlexTimerServiceCB )
+    {
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_REMOVETIMER,
+        "CFlexTimerContainer::RemoveTimer;this=%x;aFlexTimerServiceCB=%x",
+        ( TUint )this,
+        ( TUint )aFlexTimerServiceCB );
+
+    __ASSERT_DEBUG( aFlexTimerServiceCB,
+        User::Panic( KCBNullPointerDescriptor, KCBNullPointer ) );
+    
+    TSglQueIter<CFlexTimerItem> listIter( iTimerList );
+    CFlexTimerItem* item = NULL;
+
+    listIter.SetToFirst();
+    // Iter++ makes iterator to point to next element if one exists.
+    // Otherwise NULL.
+    while ( (item = listIter++) != NULL )
+        {
+        if ( item->GetCB() == aFlexTimerServiceCB )
+            {
+            iTimerList.Remove( *item );
+            delete item;
+            return KErrNone;
+            }
+        }
+    return KErrNotFound;
+    }
+// ---------------------------------------------------------------------------
+// Loop through timers and find time/timer that must expire next
+// Calculate time left to that moment and return it. 
+// ---------------------------------------------------------------------------
+//
+TBool CFlexTimerContainer::GetNextTimeout(
+    TTimeIntervalMicroSeconds& aNextTimeoutDelay )
+    {
+    TSglQueIter<CFlexTimerItem> listIter( iTimerList );
+    TTime currentAbsoluteTime( 0 );
+    CFlexTimerItem* item = NULL;
+    TTime tempTime( 0 );
+    TTime nextTimeout( 0 );
+
+    GetCurrentTime( currentAbsoluteTime );
+    // Take first item as a reference value.
+    listIter.SetToFirst();
+    item = listIter++;
+    if ( item )
+        {
+        item->GetMaxAbsoluteTime( nextTimeout );
+        }
+
+    // Find the timer that needs to expire next, and set nextTimeout to the
+    // time, when the timer needs to expire.
+    while ( (item = listIter++) != NULL )
+        {
+        item->GetMaxAbsoluteTime( tempTime );
+        if ( tempTime < nextTimeout )
+            {
+            nextTimeout = tempTime;
+            }
+        }
+    // Calculate difference between now -> min timeout time. If in past,
+    // return zero interval
+    aNextTimeoutDelay = nextTimeout.MicroSecondsFrom( currentAbsoluteTime );
+    if ( aNextTimeoutDelay < TTimeIntervalMicroSeconds( 0 ) )
+        {
+        aNextTimeoutDelay = 0;
+        }
+    
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_GETNEXTTIMEOUT,
+        "CFlexTimerContainer::GetNextTimeout;this=%x;aNextTimeoutDelay=%Ld",
+        ( TUint )this,
+        aNextTimeoutDelay.Int64() );
+    
+    return !iTimerList.IsEmpty();
+    }
+// ---------------------------------------------------------------------------
+// Excecute selected algorithms and finally fire all timers in candidate list.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::FireTimers( TFlexTimerAlgorithm aAlgorithmToBeUsed )
+    {
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_FIRETIMERS,
+        "CFlexTimerContainer::FireTimers;this=%x;aAlgorithmToBeUsed=%x",
+        ( TUint )this,
+        ( TUint )aAlgorithmToBeUsed );
+
+    TSglQue<CFlexTimerItem> candidateList( _FOFF( CFlexTimerItem, iLink ) );
+
+    TTime currentAbsoluteTime( 0 );
+
+    GetCurrentTime( currentAbsoluteTime );
+    
+    // Simple algorithm is always executed
+    SimpleAlgorithm( candidateList, currentAbsoluteTime );
+
+    if ( EFlexTimerAlgorithmLatestPossible == aAlgorithmToBeUsed )
+        {
+        LatestPossibleAlgorithm( candidateList );
+        }
+    ExpireTimers( candidateList );
+    }
+
+//
+// ---------------------------------------------------------------------------
+// Loop through timer list, call abort to timer if it is abortable.
+// Then remove timer from list and delete it.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::AbortTimersDueToTimeChange( TInt aReason )
+    {
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_ABORTTIMERSDUETOTIMECHANGE,
+        "CFlexTimerContainer::AbortTimersDueToTimeChange;this=%x;aReason=%d",
+        ( TUint )this,
+        aReason );
+
+    TSglQueIter<CFlexTimerItem> listIter( iTimerList );
+    CFlexTimerItem* item = NULL;
+    listIter.SetToFirst();
+    
+    // Go through all timers and check if the timer has 
+    // AbortAtSystemTimeChange flag set, if so, abort the timer.
+    while ( (item = listIter++) != NULL )
+        {
+        if ( item->IsAbortedAtSystemTimeChange() )
+            {
+            item->GetCB()->Abort( aReason );
+            iTimerList.Remove( *item );
+            delete item;
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// Constructor for CFlexTimerContainer
+// ---------------------------------------------------------------------------
+//
+CFlexTimerContainer::CFlexTimerContainer() :
+    iTimerList( _FOFF( CFlexTimerItem, iLink ) ),
+    iLastTicks( 0 ),
+    iCurrentAbsoluteTime( 0 )    
+    {
+    OstTrace1( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_CFLEXTIMERCONTAINER,
+        "CFlexTimerContainer::CFlexTimerContainer;this=%x",
+        ( TUint )this );
+    TInt err;
+    
+    // Get system tick length for converting tics to microseconds.
+    err = HAL::Get( HAL::ESystemTickPeriod, iTickPeriod );
+    
+    __ASSERT_ALWAYS(
+        err == KErrNone,
+        User::Panic(
+            KFlexTimerContainerPanicCat,
+            static_cast <TInt> ( EFlexTimerContainerNoTickPeriod ) ) );
+    }
+// ---------------------------------------------------------------------------
+// Loops through timer list and moves all timers that can be fired to
+// candidate list. Can be fired means that minimum time is reached. Note that
+// if we are late for some reason (very likely if someone has win size zero),
+// candidate list can now contain timers that are late (max time passed).
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::SimpleAlgorithm(
+    TSglQue<CFlexTimerItem>& aCandidateList,
+    TTime& aCurrentTime )
+    {
+    OstTraceExt3( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_SIMPLEALGORITHM,
+        "CFlexTimerContainer::SimpleAlgorithm;"
+        "this=%x;aCandidateList=%x;aCurrentTime=%Ld;",
+        ( TUint )this,
+        ( TUint )&aCandidateList,
+        aCurrentTime.Int64() );
+
+    TSglQueIter<CFlexTimerItem> listIter( iTimerList );
+    CFlexTimerItem* item = NULL;
+    TTime minTime( 0 );
+
+    listIter.SetToFirst();
+    // Iter++ makes iterator to point to next element if one exists.
+    // Otherwise NULL.
+    while ( (item = listIter++) != NULL )
+        {
+        item->GetMinAbsoluteTime( minTime );
+        if ( minTime <= aCurrentTime )
+            {
+            OstTraceExt2( TRACE_INTERNAL,
+                DUP1_CFLEXTIMERCONTAINER_SIMPLEALGORITHM,
+                "CFlexTimerContainer::SimpleAlgorithm - Adding item;"
+                "this=%x;item=%x",
+                ( TUint )this,
+                ( TUint )item );
+            // Remove from candidate list needs to be done before the
+            // item is added to back to iTimerList, because the lists
+            // use the same iLink member.
+            iTimerList.Remove( *item );
+            
+            // This timer can be timeouted, add it to timeout candidate list.
+            // The list is called candidate list, because the content of the
+            // list may be pruned by passing it to other algorithms for furher
+            // prosessing.
+            aCandidateList.AddLast( *item );
+            }
+        }
+    }
+
+//
+// ---------------------------------------------------------------------------
+// Loops through dropped list and candidate list and find timers where:
+// dropped timers right side of the window is earlier than candidate timers
+// right side of the window i.e. Candidate can be fired later with dropped
+// timer, without additional timer firings
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::LatestPossibleAlgorithm(
+    TSglQue<CFlexTimerItem>& aCandidateList )
+    {   
+    TSglQueIter<CFlexTimerItem> listIter( iTimerList );
+    TSglQueIter<CFlexTimerItem> candidateListIter( aCandidateList );
+    CFlexTimerItem* droppedItem = NULL;
+    CFlexTimerItem* candidateItem = NULL;
+    TTime droppedMaxTime( 0 );
+    TTime candidateMaxTime( 0 );
+    
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_LATESTPOSSIBLEALGORITHM,
+        "CFlexTimerContainer::LatestPossibleAlgorithm;"
+        "this=%x;aCandidateList=%x",
+        ( TUint )this,
+        ( TUint )&aCandidateList );
+    
+    listIter.SetToFirst();
+    candidateListIter.SetToFirst();
+            
+    droppedItem = listIter++;
+    
+    if ( droppedItem != NULL )
+        {
+        // Initiliaze next dropped timeout time to some value.
+        droppedItem->GetMaxAbsoluteTime( droppedMaxTime );
+
+        // Loop through dropped timers and find the dropped timer that will have
+        // shortest time to its timeout.
+        while ( (droppedItem = listIter++) != NULL )
+            {
+            droppedItem->GetMaxAbsoluteTime( candidateMaxTime );
+            if ( droppedMaxTime > candidateMaxTime )
+                {
+                droppedMaxTime = candidateMaxTime;
+                }
+            }
+
+        // Loop through candidate timers
+        while ( (candidateItem = candidateListIter++) != NULL )
+            {
+            candidateItem->GetMaxAbsoluteTime( candidateMaxTime );
+            // If candidate can be fired together with dropped timer ->
+            // don't fire candidate yet.
+            if ( droppedMaxTime <= candidateMaxTime )
+                {
+                OstTraceExt2( TRACE_INTERNAL,
+                    DUP1_CFLEXTIMERCONTAINER_LATESTPOSSIBLEALGORITHM,
+                    "CFlexTimerContainer::LatestPossibleAlgorithm -"
+                    " Removing item;this=%x;candidateItem=%x",
+                    ( TUint )this,
+                    ( TUint )candidateItem );
+
+                // Remove from candidate list needs to be done before the
+                // item is added to back to iTimerList, because the lists
+                // use the same iLink member.
+                aCandidateList.Remove( *candidateItem );
+                // Add to first so we don't handle this again.
+                iTimerList.AddFirst( *candidateItem );
+                }
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// Loops through candidate list and calls timeout to all timers.
+// Then removes timer from list and deletes it. 
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::ExpireTimers(
+    TSglQue<CFlexTimerItem>& aCandidateList )
+    {
+    OstTraceExt2( TRACE_INTERNAL,
+        CFLEXTIMERCONTAINER_EXPIRETIMERS,
+        "CFlexTimerContainer::ExpireTimers;this=%x;candidateList=%x",
+        ( TUint )this,
+        ( TUint )&aCandidateList );
+
+    TSglQueIter<CFlexTimerItem> candidateListIter( aCandidateList );
+    CFlexTimerItem* item = NULL;
+
+    candidateListIter.SetToFirst();
+    // Iter++ makes iterator to point to next element if one exists.
+    // Otherwise NULL.
+    while ( (item = candidateListIter++) != NULL )
+        {
+        item->GetCB()->Timeout();
+        aCandidateList.Remove( *item );
+        delete item;
+        }
+    }
+// ---------------------------------------------------------------------------
+// Get current time return current time in FlexTimer engine time base. This
+// time base is begins from the first call to GetCurrentTime and it is base on
+// system ticks.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerContainer::GetCurrentTime( TTime& aAbsoluteTime )
+    {
+    TUint32 currentTicks = User::TickCount();
+
+    // Accumulate current absolute time with the time passed since last
+    // update. Both currentTicks and iLastTicks are unsigned int types, thus
+    // "currentTicks - iLastTicks" will handle also the case currentTicks
+    // overflows.
+    iCurrentAbsoluteTime += TicksToAbsoluteTime( currentTicks
+            - iLastTicks );
+        
+    iLastTicks = currentTicks;
+    
+    // N.B. Even though the time is is returned as TTime, this time has own
+    // time base. (See function description)
+    aAbsoluteTime = iCurrentAbsoluteTime;
+    }
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/src/flextimerengine.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,172 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains implementation of CFlexTimerEngine.
+ *
+ */
+
+// System include files
+// None
+
+// User include files
+#include "flextimerengine.h"
+#include "flextimercontainer.h"
+#include "flextimerwakeuptimer.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerengineTraces.h"
+#endif
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CFlexTimerEngine* CFlexTimerEngine::NewL()
+    {
+    CFlexTimerEngine* self = new (ELeave) CFlexTimerEngine();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CFlexTimerEngine::~CFlexTimerEngine()
+    {
+    OstTrace0( TRACE_INTERNAL,
+        CFLEXTIMERENGINE_CFLEXTIMERENGINE,
+        "CFlexTimerEngine::~CFlexTimerEngine" );
+
+    delete iFlexTimerContainer;
+    delete iWakeUpTimer;
+    }
+// ---------------------------------------------------------------------------
+// Add new timer and trap leave. Return Leave code to session.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexTimerEngine::AddTimer(
+    const TTimeIntervalMicroSeconds& aWinStartInterval,
+    const TTimeIntervalMicroSeconds& aWinEndInterval,
+    TBool aCancelAtSystemTimeChange,
+    const MFlexTimerServiceCB* aFlexTimerServiceCB )
+    {
+    TRAPD( err,
+        iFlexTimerContainer->AddTimerL( aWinStartInterval,
+            aWinEndInterval,
+            aCancelAtSystemTimeChange,
+            aFlexTimerServiceCB ) );
+
+    if ( KErrNone == err )
+        {
+        StartTimer();
+        }
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Remove timer from container queue and start new wakeup watch timer
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CFlexTimerEngine::CancelTimer(
+    const MFlexTimerServiceCB* aFlexTimerServiceCB )
+    {
+    TInt error = iFlexTimerContainer->RemoveTimer( aFlexTimerServiceCB );
+    StartTimer();
+    
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Wakeup timer expired, Fire timers according to some algorithm set and
+// restart wakeup timer.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerEngine::WakeUp()
+    {
+    OstTrace0( TRACE_INTERNAL,
+        CFLEXTIMERENGINE_WAKEUP,
+        "CFlexTimerEngine::WakeUp" );
+    
+    iFlexTimerContainer->FireTimers(
+        CFlexTimerContainer::EFlexTimerAlgorithmLatestPossible );
+
+    StartTimer();
+    }
+// ---------------------------------------------------------------------------
+// System time is changed. Abort all timers that need to be aborted and
+// restart wakeup timer.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerEngine::SystemTimeChanged()
+    {
+    OstTrace0( TRACE_INTERNAL,
+        CFLEXTIMERENGINE_SYSTEMTIMECHANGED,
+        "CFlexTimerEngine::SystemTimeChanged" );
+    
+    iFlexTimerContainer->AbortTimersDueToTimeChange( KErrAbort );
+    StartTimer();
+    }
+// ---------------------------------------------------------------------------
+// Private constructor
+// ---------------------------------------------------------------------------
+//
+CFlexTimerEngine::CFlexTimerEngine() : iFlexTimerContainer( NULL ),
+    iWakeUpTimer( NULL )
+    {
+    OstTrace0( TRACE_INTERNAL,
+        DUP_CFLEXTIMERENGINE_CFLEXTIMERENGINE,
+        "CFlexTimerEngine::CFlexTimerEngine" );
+    //Nothing to do here
+    }
+// ---------------------------------------------------------------------------
+// Private 2nd phase construction
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerEngine::ConstructL()
+    {
+    iFlexTimerContainer = CFlexTimerContainer::NewL();
+    iWakeUpTimer = CFlexTimerWakeUpTimer::NewL( *this );
+    }
+// ---------------------------------------------------------------------------
+// Stop timer just in case it is already running (e.g. after AddTimer())
+// and Start new wakeup timer according to current situation in container
+// queues If timeout window has passed fire timers right now.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerEngine::StartTimer()
+    {
+    TTimeIntervalMicroSeconds nextTimeout;
+
+    // Stop the timer, because, if there are no more pending timeouts, the
+    // wake-up timer needs to be stopped. If timeouts are found, the timer is
+    // is restarted below.
+    iWakeUpTimer->StopTimer();
+
+    if ( iFlexTimerContainer->GetNextTimeout( nextTimeout ) )
+        {
+        // If timeout is in the future, timer is started to wake up at that
+        // moment.
+        if ( nextTimeout > TTimeIntervalMicroSeconds( 0 ) )
+            {
+            iWakeUpTimer->StartTimer( nextTimeout );
+            }
+        // If timer is due now or in the past, Lets fire those right now.
+        else
+            {
+            WakeUp();
+            }
+        }
+    // Else no timers, so no need for timeouts. Server is propably about to be
+    // deleted.
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/src/flextimeritem.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,92 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains implementation of CFlexTimerItem.
+ *
+ */
+
+// System include files
+// None
+
+// User include files go here:
+#include "flextimeritem.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimeritemTraces.h"
+#endif
+
+// ---------------------------------------------------------------------------
+// constructor
+// ---------------------------------------------------------------------------
+//
+CFlexTimerItem::CFlexTimerItem( const TTime& aAbsoluteMinTime,
+    const TTime& aAbsoluteMaxTime,
+    TBool aCancelAtSystemTimeChange,
+    const MFlexTimerServiceCB* aFlexTimerServiceCB ) :
+        iAbortAtSystemTimeChange( aCancelAtSystemTimeChange ),
+        iAbsoluteMinTime( aAbsoluteMinTime ),
+        iAbsoluteMaxTime( aAbsoluteMaxTime ),
+        iMFlexTimerServiceCB( aFlexTimerServiceCB )
+    {
+    OstTraceExt5( TRACE_INTERNAL,
+        CFLEXTIMERITEM_CFLEXTIMERITEM,
+        "CFlexTimerItem::CFlexTimerItem;this=%x;aAbsoluteMinTime=%Ld;"
+        "aAbsoluteMaxTime=%Ld;aCancelAtSystemTimeChange=%d;"
+        "aFlexTimerServiceCB=%x",
+        ( TUint )this,
+        aAbsoluteMinTime.Int64(),
+        aAbsoluteMaxTime.Int64(),
+        aCancelAtSystemTimeChange,
+        ( TUint )aFlexTimerServiceCB );
+
+    // Nothing to do - Coverity warning of uninitialize iLink.Next suppressed,
+    // because this should be initialized by TSglQueLink constructor.
+    // coverity[uninit_member]
+    }
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CFlexTimerItem* CFlexTimerItem::NewL( const TTime& aAbsoluteMinTime,
+    const TTime& aAbsoluteMaxTime,
+    TBool aCancelAtSystemTimeChange,
+    const MFlexTimerServiceCB* aFlexTimerServiceCB )
+    {
+    CFlexTimerItem* self = new (ELeave) CFlexTimerItem( aAbsoluteMinTime,
+        aAbsoluteMaxTime,
+        aCancelAtSystemTimeChange,
+        aFlexTimerServiceCB );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor, nothing to destruct
+// ---------------------------------------------------------------------------
+//
+CFlexTimerItem::~CFlexTimerItem()
+    {
+        OstTraceExt2( TRACE_INTERNAL,
+            DUP1_CFLEXTIMERITEM_CFLEXTIMERITEM,
+            "CFlexTimerItem::~CFlexTimerItem;this=%x;iMFlexTimerServiceCB=%x",
+            ( TUint )this,
+            ( TUint )iMFlexTimerServiceCB );
+    //Nothing to do here
+    }
+// ---------------------------------------------------------------------------
+// GetCB
+// ---------------------------------------------------------------------------
+//
+const MFlexTimerServiceCB* CFlexTimerItem::GetCB()
+    {
+    return iMFlexTimerServiceCB;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/src/flextimerwakeuptimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,124 @@
+/*
+ * 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
+ *
+ * Description:
+ * This class contains implementation of CFlexTimerWakeUpTimer.
+ *
+ */
+
+// System include files
+// None
+
+// User include files go here:
+#include "flextimerwakeuptimer.h"
+#include "mflextimerwakeuptimercb.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerwakeuptimerTraces.h"
+#endif
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CFlexTimerWakeUpTimer* CFlexTimerWakeUpTimer::NewL(
+    MFlexTimerWakeUpTimerCB& aObserver )
+    {
+    CFlexTimerWakeUpTimer* self = new (ELeave) CFlexTimerWakeUpTimer(
+        aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// destructor, Cancel timer just in case it is still running.
+// ---------------------------------------------------------------------------
+//
+CFlexTimerWakeUpTimer::~CFlexTimerWakeUpTimer()
+    {
+    // Super class CTimer destructor Cancels any pending requests.
+    OstTrace0( TRACE_INTERNAL,
+        DUP1_CFLEXTIMERWAKEUPTIMER_CFLEXTIMERWAKEUPTIMER,
+        "CFlexTimerWakeUpTimer::~CFlexTimerWakeUpTimer" );
+    }
+// ---------------------------------------------------------------------------
+// Start timer so that it will expire aInterval after this moment.
+// UTC is used to get indications about system time change.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerWakeUpTimer::StartTimer( TTimeIntervalMicroSeconds& aInterval )
+    {
+    CTimer::Cancel();
+    TTime utcNow( 0 );
+
+    utcNow.UniversalTime();
+    utcNow = utcNow + aInterval;
+    
+    OstTraceExt1( TRACE_INTERNAL,
+        CFLEXTIMERWAKEUPTIMER_STARTTIMER,
+        "CFlexTimerWakeUpTimer::StartTimer;aInterval=%Ld",
+        aInterval.Int64() );
+
+    AtUTC( utcNow );
+    }
+// ---------------------------------------------------------------------------
+// just call Cancel. If timer is alreay running it will be stopped.
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerWakeUpTimer::StopTimer()
+    {
+    OstTrace0( TRACE_INTERNAL,
+        CFLEXTIMERWAKEUPTIMER_STOPTIMER,
+        "CFlexTimerWakeUpTimer::StopTimer" );
+
+    Cancel();
+    }
+// ---------------------------------------------------------------------------
+// KErrAbort comes if system time has changed. It is up to client to restart
+// timer
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerWakeUpTimer::RunL()
+    {
+    if ( KErrAbort == iStatus.Int() )
+        {
+        iObserver.SystemTimeChanged();
+        }
+    else
+        {
+        iObserver.WakeUp();
+        }
+    }
+// ---------------------------------------------------------------------------
+// Private constructor
+// ---------------------------------------------------------------------------
+//
+CFlexTimerWakeUpTimer::CFlexTimerWakeUpTimer(
+    MFlexTimerWakeUpTimerCB& aObserver ) :
+        CTimer( EPriorityStandard ), iObserver( aObserver )
+    {
+    OstTrace0( TRACE_INTERNAL,
+        CFLEXTIMERWAKEUPTIMER_CFLEXTIMERWAKEUPTIMER,
+        "CFlexTimerWakeUpTimer::CFlexTimerWakeUpTimer" );
+
+    //Nothing to do here
+    }
+// ---------------------------------------------------------------------------
+// Private 2nd phase construction
+// ---------------------------------------------------------------------------
+//
+void CFlexTimerWakeUpTimer::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    CTimer::ConstructL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/traces/OstTraceDefinitions.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,4 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/engine/traces/fixed_id.definitions	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,25 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]TRACE_INTERNAL=0x40
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_ABORTTIMERSDUETOTIMECHANGE=0x7
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_ADDTIMERL=0x3
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_CFLEXTIMERCONTAINER=0x8
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_EXPIRETIMERS=0xd
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_FIRETIMERS=0x6
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_GETNEXTTIMEOUT=0x5
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_LATESTPOSSIBLEALGORITHM=0xb
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_NEWL=0x1
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_REMOVETIMER=0x4
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERCONTAINER_SIMPLEALGORITHM=0x9
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERENGINE_CFLEXTIMERENGINE=0xe
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERENGINE_SYSTEMTIMECHANGED=0x10
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERENGINE_WAKEUP=0xf
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERITEM_CFLEXTIMERITEM=0x12
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERWAKEUPTIMER_CFLEXTIMERWAKEUPTIMER=0x17
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERWAKEUPTIMER_STARTTIMER=0x15
+[TRACE]TRACE_INTERNAL[0x40]_CFLEXTIMERWAKEUPTIMER_STOPTIMER=0x16
+[TRACE]TRACE_INTERNAL[0x40]_DUP1_CFLEXTIMERCONTAINER_CFLEXTIMERCONTAINER=0x2
+[TRACE]TRACE_INTERNAL[0x40]_DUP1_CFLEXTIMERCONTAINER_LATESTPOSSIBLEALGORITHM=0xc
+[TRACE]TRACE_INTERNAL[0x40]_DUP1_CFLEXTIMERCONTAINER_SIMPLEALGORITHM=0xa
+[TRACE]TRACE_INTERNAL[0x40]_DUP1_CFLEXTIMERITEM_CFLEXTIMERITEM=0x13
+[TRACE]TRACE_INTERNAL[0x40]_DUP1_CFLEXTIMERWAKEUPTIMER_CFLEXTIMERWAKEUPTIMER=0x14
+[TRACE]TRACE_INTERNAL[0x40]_DUP_CFLEXTIMERENGINE_CFLEXTIMERENGINE=0x11
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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 file for Flexible timer server
+*
+*/
+
+/*
+* %version: 1 %
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// IBY-file
+../rom/flextimerserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(flextimerserver.iby)
+
+PRJ_MMPFILES
+#include "../engine/group/bld.inf"
+flextimerserver.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/group/flextimerserver.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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:  Project definition file for project Flexible timer
+*               server
+*/
+
+/*
+* %version: 1 %
+*/
+
+#include <platform_paths.hrh>
+
+TARGET              flextimerserver.exe
+TARGETTYPE          EXE
+UID                 0x1000008D 0x2002C383
+
+VENDORID            VID_DEFAULT
+CAPABILITY          CAP_SERVER
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../traces
+USERINCLUDE         ../engine/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
+// For system tick period
+LIBRARY             hal.lib
+LIBRARY             flextimerengine.lib
+
+SOURCEPATH          ../src
+SOURCE flextimerserver.cpp
+SOURCE flextimersession.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/flextimercommon.h	Mon May 24 20:51:35 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 the License "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: 
+ * Common header for flextimer client interface and server.
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERCOMMON_H
+#define FLEXTIMERCOMMON_H
+
+// System includes
+#include <e32base.h>
+
+#include "flextimerpanic.h"
+
+// Constants
+/**
+ * FlexTimerServer executable name used by clients when starting server
+ */
+_LIT( KFlexTimerServerExe, "FlexTimerServer.exe" );
+
+/**
+ * Identification name for the FlexTimerServer -server
+ */
+_LIT( KFlexTimerServerName,"FlexTimerServer" );
+
+/**
+ * Number of message slots reserved for each client session.
+ * There can be at most one outstanding asynchronous request at a time
+ * (pending timeout message). Second slot is needed for synchronous
+ * communication during that (e.g. for cancellation message).
+ */
+const TUint KFlexTimerServerMessageSlots = 2;
+
+/**
+ *  Version identifier. Client-server message interface compatibility
+ *  is maintained within a major version.
+ */
+const TUint KFlexTimerServMajorVersionNumber = 1;
+const TUint KFlexTimerServMinorVersionNumber = 0;
+const TUint KFlexTimerServBuildVersionNumber = 0;
+
+/**
+ * Default timeout window size. This is used, if client has not set the
+ * used timeout window. Default window is a fraction of an interval
+ * between current time and the expiration time.
+ * 
+ * @code
+ *   interval = endTime - currentTime;
+ *   defaultWindow = interval * KDefaultWindowMultiplier;
+ *   startTime = endTime - defaultWindow;
+ * @endcode
+ */
+const TReal64 KDefaultWindowMultiplier = 0.2;
+
+/**
+ *  Maximun lenght of FlexTimer  63072000000000 == 2a in microseconds.
+ */
+const TInt64 KFlexTimerMaxTimerLength = 63072000000000;
+
+// Data types
+/**
+ * Client-server interface message types (functions)
+ */
+enum TFlexTimerServRqst
+    {
+    EFlexTimerServCancelRequest = 1,
+    EFlexTimerServAtRequest,
+    EFlexTimerServAtUTCRequest,
+    EFlexTimerServAfterRequest,
+    EFlexTimerServAfterTicksRequest,
+    EFlexTimerServConfigureRequest
+    };
+
+/**
+ * Configuration message (EFlexTimerServConfigureRequest) type.
+ * This is stored as a first parameter in configuration request message,
+ * rest of the parameters and their types depend on this.
+ */
+enum TFlexTimerConfigureRequestType
+    {
+    EConfigureRequestWindowSize = 1
+    };
+
+#endif /* FLEXTIMERCOMMON_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/flextimerpanic.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,163 @@
+/*
+ * 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 the License "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: 
+ * Common header for flextimer panic codes.
+ *
+ */
+/*
+ * %version: 1 %
+ */
+#ifndef FLEXTIMERPANIC_H
+#define FLEXTIMERPANIC_H
+// System includes
+#include <e32base.h>
+
+
+/**
+ * Server and session panic category and codes
+ */
+// Panic category
+_LIT( KRFlexTimerPanicCat, "RFlexTimer");
+_LIT( KCFlexTimerPanicCat, "CFlexTimer");
+_LIT( KCFlexPeriodicPanicCat, "CFlexPeriodic");
+_LIT( KFlexTimerServerPanicCat, "FlexTimerServer" );
+_LIT( KFlexTimerSessionPanicCat, "FlexTimerSession" );
+_LIT( KFlexTimerContainerPanicCat, "FlexTimerContainer" );
+
+enum TFlexTimerPanic
+    {
+    /**
+     * Timer After-function has been provided with a negative interval value. 
+     * @see RFlexTimer
+     */
+    EFlexTimerAfterIntervalLessThanZero = 1,
+
+    /**
+     * Timer AfterTicks-function has been provided with a negative interval
+     * value. 
+     * @see RFlexTimer
+     */
+    EFlexTimerAfterTicksIntervalLessThanZero = 2,
+
+    /**
+     * Timer At-function has been provided with an expiry time prior to
+     * TTime::HomeTime. 
+     * @see RFlexTimer
+     * @see TTime
+     */
+    EFlexTimerAtIntervalLessThanZero = 3,
+
+    /**
+     * Timer AtUTC-function has been provided with an expiry time prior to
+     * TTime::UniversalTime. 
+     * @see RFlexTimer
+     * @see TTime
+     */
+    EFlexTimerAtUTCIntervalLessThanZero = 4,
+
+    /**
+     * Timer has been configured with flexible window size less than zero. 
+     * @see RFlexTimer
+     */
+    EFlexTimerWindowLessThanZero = 5,
+
+    /**
+     * Periodic timer Start-function has been called with delay value less
+     * than zero. 
+     * @see CFlexPeriodic
+     */
+    EFlexPeriodicDelayLessThanZero = 6,
+
+    /**
+     * Periodic timer Start-function has been called with interval value less
+     * than one microsecond.
+     * @see CFlexPeriodic
+     */
+    EFlexPeriodicIntervalTooSmall = 7,
+
+    /**
+     * Periodic has been configured with delay window size less than zero. 
+     * @see CFlexPeriodic
+     */
+    EFlexPeriodicDelayWindowLessThanZero = 8,
+
+    /**
+     * Periodic has been configured with interval window size less than zero. 
+     * @see CFlexPeriodic
+     */
+    EFlexPeriodicIntervalWindowLessThanZero = 9,
+
+    /**
+     * This panic is raised by the At(), After() and Lock() member functions
+     * of the CFlexTimer active object.
+     * 
+     * It is caused by an attempt to request a timer event when the CFlexTimer
+     * active object has not been added to the active scheduler.
+     * @see CFlexTimer
+     */
+    EFlexTimerNotAddedToActiveScheduler = 10,
+                
+    /**
+     * New timer has been issued while previous operation is still pending
+     * @see RFlexTimer
+     */
+    EFlexTimerServerErrorPendingTimer = 15,
+
+    /**
+     * Cleanup stack memory creation failed for FlexTimer server process
+     */
+    EFlexTimerServerCleanupStack = 20,
+
+    /**
+     * Memory allocation for active scheduler object filed in server creation
+     */
+    EFlexTimerServerActiveScheduler = 21,
+
+    /**
+     * Starting CServer2 based FlexTimer server failed
+     */
+    EFlexTimerServerStartServer = 23,
+    
+    /**
+     * User has issued a timer request with parameters that can not be
+     * fulfilled
+     */
+    EFlexTimerServerIllegalTimerValue = 24,
+
+    /**
+     * FlexTimer session failed to read tick period from HAL. This means that
+     * we are not able to map our tick time to system time.
+     */
+    EFlexTimerContainerNoTickPeriod = 30,
+
+    /**
+     * In CFlexPeriodic::Start() has been passed a NULL function pointer in
+     * TCallBack aCallBack parameter.
+     */
+    EFlexPeriodicCallbackFunctionIsNull = 31,
+    
+    /**
+     * In CFlexPeriodic::Start() has been passed a NULL function pointer in
+     * TCallBack aCallBackError parameter and error has occurred.
+     */
+    EFlexPeriodicErrorCallbackFunctionIsNull = 32,
+    
+    /**
+     * RFlexTimer::Connect() has been called twice without closing the handle
+     * first.
+     */
+    EFlexTimerAlreadyConnected = 33
+    };
+
+#endif /* FLEXTIMERPANIC_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/flextimerserver.h	Mon May 24 20:51:35 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:
+ * Class definition for Flexible timer server. Server creates session
+ * objects and manages message passing to those.
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERSERVER_H
+#define FLEXTIMERSERVER_H
+
+// System includes
+#include <e32base.h>
+
+// Forward declarations
+class CFlexTimerEngine;
+
+// Class declaration
+/**
+ *  Flexible timer server class implements the server for FlexTimers. This
+ *  class provides services for creating new sessions, and for passing
+ *  a client message to dedicated session.
+ */
+class CFlexTimerServer : public CServer2
+    {
+    
+public:
+    /**
+     * Two phased constructor 
+     * 
+     * @param aPriority Active object priority for the server 
+     * @return Pointer to created server object
+     */
+    IMPORT_C static CFlexTimerServer* NewL( CActive::TPriority aPriority );
+
+    /**
+     * Destructor 
+     */
+    virtual ~CFlexTimerServer();
+
+public:
+
+    /**
+     * From: CServer2
+     * Function for creating a new session to this server. 
+     *
+     * @param aVersion Version identifier from client
+     * @param aMessage Reference to creation message sent by client
+     * @return Pointer to created session object
+     */
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage ) const;
+
+    /**
+     * Function for creating server thread resources. Creates the server
+     * object and active scheduler. Loops in the active scheduler to serve
+     * client requests until explicitly shutdown. Function leaves if the
+     * creation of needed resources fails.
+     */
+    static void StartServerL();
+
+private:
+
+    /**
+     * Constructor
+     * 
+     * @param aPriority Active object priority 
+     */
+    CFlexTimerServer( CActive::TPriority aPriority );
+
+    /**
+     * 2nd phase constructor, creates CFlexTimerEngine
+     */
+    void ConstructL();
+
+private:
+
+    /**
+     * Pointer to FlexTimerEngine created during server start-up
+     */
+    CFlexTimerEngine* iTimerEngine;
+
+    };
+
+#endif /* FLEXTIMERSERVER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/flextimersession.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,220 @@
+/*
+ * 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:
+ * Class definition for Flexible timer server side sessions. Session
+ * instances handle the commmunication with clients and implement a 
+ * callback interface for the CFlexTimerEngine to fire timers
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERSESSION_H
+#define FLEXTIMERSESSION_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include "mflextimerservicecb.h"
+
+// Forward declarations
+class MFlexTimerService;
+
+// Class declaration
+/**
+ *  Flexible timer server side session
+ *  CFlexTimerSession implements sessions in CFlexTimerServer. A sessions
+ *  parses client messages and adds/cancels timers to CFlexTimerEngine. The
+ *  expiration of the timer completes client side message.
+ */
+class CFlexTimerSession : public CSession2, public MFlexTimerServiceCB
+    {
+
+public:
+
+    /**
+     * Constructor
+     * 
+     * @param aFlexTimerService A pointer to engine interface providing
+     *                          timeout service
+     */
+    CFlexTimerSession( MFlexTimerService* aFlexTimerService );
+
+    /**
+     * Destructor
+     */
+    virtual ~CFlexTimerSession();
+
+    /**
+     * From: CSession2
+     * Message handler servicing client requests. Interprets message type and
+     * passes it to correct function for processing.
+     * 
+     * @param aMessage Message from client
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+    /**
+     * From CSession2
+     * Called by a server when it receives a disconnect message for the 
+     * session.
+     * 
+     * @param aMessage The disconnect message
+     */
+    void Disconnect( const RMessage2 &aMessage );
+    
+    /**
+     * From: MFlexTimerServiceCB
+     * Timeout callback function called by timeout engine when a timer
+     * associated to this session expires.
+     * 
+     * @see MFlexTimerServiceCB
+     */
+    virtual void Timeout() const;
+
+    /**
+     * From: MFlexTimerServiceCB
+     * Callback function called by CFlexTimerEngine, when a timer associated
+     * to this session is aborted. Most probable cause for this is At()-timer
+     * aborting due to the system time change
+     * 
+     * @param aReason Error code to be passed for client (KErrAbort in case 
+     *                of system time change)
+     *                
+     * @see MFlexTimerServiceCB
+     */
+    virtual void Abort( TInt aReason ) const;
+
+private:
+
+    /**
+     * Handles client messages that are issued using At()-function in
+     * RFlexTimer
+     * 
+     * @param aMessage Message from client
+     *
+     * @see RFlexTimer
+     */
+    void NewAtTimer( const RMessage2& aMessage );
+
+    /**
+     * Handles client messages that are issued using AtUTC()-function in
+     * RFlexTimer
+     * 
+     * @param aMessage Message from client
+     *
+     * @see RFlexTimer
+     */
+    void NewAtUtcTimer( const RMessage2& aMessage );
+
+    /**
+     * Handles client messages that a issued using After()-function in
+     * RFlexTimer
+     * 
+     * @param aMessage Message from client
+     * 
+     * @see RFlexTimer
+     */
+    void NewAfterTimer( const RMessage2& aMessage );
+
+    /**
+     * Handles client messages that a issued using AfterTicks()-function in
+     * RFlexTimer
+     * 
+     * @param aMessage Message from client
+     * 
+     * @see RFlexTimer
+     */
+    void NewAfterTicksTimer( const RMessage2& aMessage );
+
+    /**
+     * Handles timer cancellation initiated by client via RFlexTimer::Cancel
+     * 
+     * @param aMessage Message from client
+     * 
+     * @see RFlexTimer
+     */
+    void CancelTimer( const RMessage2& aMessage );
+
+    /**
+     * Configuration message handler, stores configuration parameters for
+     * this session
+     * 
+     * @param aMessage Message from client
+     * 
+     * @see RFlexTimer
+     */
+    void ConfigureParameters( const RMessage2& aMessage );
+
+    /**
+     * Inline function for calculating the period from current time to
+     * the timestamp given in message parameters. This is used for
+     * converting the timestamp given in At()- and AtUtc() -functions
+     * to an interval given to DoAddTimer function.
+     * 
+     * @param aRefTime  Reference time used as a basis for interval
+     *                  calculation (interval = timestamp - aRefTime)
+     * @param aMessage  Message containing timestamp in Int0 and Int1
+     *                  parameters (Int0 contains LSW)
+     * @param aInterval On return, contains the interval in microseconds
+     */
+    inline void GetIntervalToMsgTime( const RMessage2& aMessage,
+                                      TTime& aRefTime,
+                                      TTimeIntervalMicroSeconds& aInterval );
+    
+    /**
+     * Function for adding timer with desired window to engine, called in
+     * AtXxx() and AfterXxx() -functions
+     * 
+     * @param aMessage      Message from client. Stored if adding a timer is
+     *                      successful, completed if adding fails
+     * @param aInterval     Microseconds until to requested end time
+     * @param aRequestAbort ETrue if timer should be cancelled on system
+     *                      time change, EFalse otherwise
+     */
+    void DoAddTimer( const RMessage2& aMessage,
+                     TTimeIntervalMicroSeconds& aInterval,
+                     TBool aRequestAbort );
+
+private:
+
+    /**
+     * Pointer to engine interface through which new timers can be added
+     * and cancelled.
+     */
+    MFlexTimerService* iService;
+
+    /**
+     * Timeout window size in microseconds (64-bit). Timeout window is
+     * calculated backwards from the absolute timestamp given in AtXxx()
+     * and AfterXxx() -functions
+     */
+    TTimeIntervalMicroSeconds iTimerWinSize;
+
+    /**
+     * ETrue if client has not set timeout window, EFalse otherwise
+     */
+    TBool iUseDefaultWin;
+
+    /**
+     * Handle to pending timeout message
+     */
+    RMessagePtr2 iPendingTimeoutMsg;
+    };
+
+#include "flextimersession.inl"
+
+#endif /* FLEXTIMERSESSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/flextimersession.inl	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,43 @@
+/*
+ * 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
+ *
+ * Description:
+ * This file contains inline functions of FlexTimerSession class.
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERSESSION_INL
+#define FLEXTIMERSESSION_INL
+
+// --------------------------------------------------------------------------
+// Function for calculating interval from current time to timestamp
+// --------------------------------------------------------------------------
+//
+inline void CFlexTimerSession::GetIntervalToMsgTime(
+        const RMessage2& aMessage,
+        TTime& aRefTime,
+        TTimeIntervalMicroSeconds& aInterval )
+    {
+    // Construct requested timestamp from the message
+    TInt timeLo( aMessage.Int0() );
+    TInt timeHi( aMessage.Int1() );
+    TInt64 timeStamp = MAKE_TINT64( timeHi, timeLo );
+    TTime reqTime( timeStamp );
+
+    // Calculate the difference between current time and requested time
+    // Reference time used by pure At()-timer is HomeTime
+    aInterval = reqTime.MicroSecondsFrom( aRefTime );
+    }
+
+#endif  /* FLEXTIMERSESSION_INL */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/mflextimerservice.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,76 @@
+/*
+ * 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:
+ * This class contains definition of MFlexTimerService
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef MFLEXTIMERSERVICE_H
+#define MFLEXTIMERSERVICE_H
+
+//Forward declarations
+class TTime;
+class MFlexTimerServiceCB;
+
+// Class declaration
+/**
+ *  Interface to flexible timer engine. This interface is used by client
+ *  sessions to start and cancel timers.
+ */
+class MFlexTimerService
+    {
+public:
+
+    /** Pure virtual functions*/
+    /**
+     * Function for adding a new timer with specified parameters. 
+     * After timer expires aFlexTimerServiceCB is used to inform a client
+     * session about that. Both parameter times should be in the future
+     * and min should be earlier than max
+     * 
+     * @param aWinStartInterval Time interval from present to left side of the
+     *  window
+     * @param aWinEndInterval Time interval from present to right side of the
+     *  window
+     * @param aCancelAtSystemTimeChange Whether timer should be aborted if
+     *  system time changes.
+     * @param aFlexTimerServiceCB Callback interface for timer
+     *  expiration (also used as an ID)
+     * 
+     * @return KErrNone or some other system wide error code.
+     *
+     */
+    virtual TInt AddTimer(
+            const TTimeIntervalMicroSeconds& aWinStartInterval,
+            const TTimeIntervalMicroSeconds& aWinEndInterval,
+            TBool aCancelAtSystemTimeChange,
+            const MFlexTimerServiceCB* aFlexTimerServiceCB ) = 0;
+
+    /**
+     * Function for cancellin a running timer. After this function returns,
+     * all references to corresponding timer are deleted and they can not be
+     * referred again.
+     * 
+     * @param aFlexTimerServiceCB ID used when timer was added
+     * @return KErrNone or some other system wide error code.
+     */
+    virtual TInt CancelTimer(
+            const MFlexTimerServiceCB* aFlexTimerServiceCB ) = 0;
+
+    };
+
+#endif  /* MFLEXTIMERSERVICE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/inc/mflextimerservicecb.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ * This class contains definition of MFlexTimerServiceCB
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef MFLEXTIMERSERVICECB_H
+#define MFLEXTIMERSERVICECB_H
+
+// Class declaration
+/**
+ *  Callback interface for Flexible timer engine to inform a session
+ *  about timeouts and aborts.
+ */
+class MFlexTimerServiceCB
+    {
+public:
+
+    /** Pure virtual functions*/
+    /**
+     * Function used for inform that a timeout has happened and client
+     * should be informed about it. After this function is called, there will
+     * no longer be indications related to this timer. After this function
+     * returns, the timer object will be deleted.
+     * 
+     */
+    virtual void Timeout() const = 0;
+
+    /**
+     * Function for informing client session that something has happended and
+     * timer should be aborted. After this function is called, there will
+     * no longer be indications related to this timer. After this function
+     * returns, the timer object will be deleted.
+     * 
+     * @param aReason Error code specifying why timer is aborted.
+     * 
+     * @see RFlexTimer
+     *
+     */
+    virtual void Abort( TInt aReason ) const = 0;
+
+    };
+
+#endif  /* MFLEXTIMERSERVICECB_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/rom/flextimerserver.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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: Flexible timer server
+*
+*/
+#ifndef FLEXTIMERSERVER_IBY
+#define FLEXTIMERSERVER_IBY
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\flextimerserver.exe PROGRAMS_DIR\flextimerserver.exe
+
+#endif // FLEXTIMERSERVER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/src/flextimerserver.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,219 @@
+/*
+ * 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 CFlexTimerServer class.
+ *
+ */
+/*
+ * %version: 2 %
+ */
+
+// System include files
+#include <e32cmn.h>
+#include <e32std.h>
+// User include files go here:
+#include "flextimercommon.h"
+#include "flextimerserver.h"
+#include "flextimersession.h"
+#include "flextimerengine.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerserverTraces.h"
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Two phased construction, 1st phase
+// --------------------------------------------------------------------------
+//
+EXPORT_C CFlexTimerServer* CFlexTimerServer::NewL(
+        CActive::TPriority aPriority )
+    {
+    CFlexTimerServer* self = new ( ELeave ) CFlexTimerServer( aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServer::~CFlexTimerServer()
+    {
+    // Free allocated resources, CServer2 shutdowns sessions
+    delete iTimerEngine;
+
+    OstTrace0( TRACE_INTERNAL,
+            CFLEXTIMERSERVER_DEL,
+            "CFlexTimerServer::~CFlexTimerServer: exiting" );
+    }
+
+// --------------------------------------------------------------------------
+// Creation of new sessions, called by server framework
+// --------------------------------------------------------------------------
+//
+CSession2* CFlexTimerServer::NewSessionL( const TVersion& aVersion,
+                                          const RMessage2& /*aMessage*/ ) const
+    {
+    // Version checking, according to two main principles
+    // 1. Newer server will always support older clients (change this if
+    //    compatibility is changed at some phase)
+    // 2. Guaranteed that newer client will be compatible with older server 
+    //    within the same major version
+    if ( aVersion.iMajor > KFlexTimerServMajorVersionNumber )
+        {
+        OstTrace1(
+                TRACE_INTERNAL,
+                CFLEXTIMERSERVER_NEWSESSIONLVER,
+                "CFlexTimerServer::NewSessionL: Invalid major version (%d)",
+                aVersion.iMajor );
+        User::Leave( KErrNotSupported );
+        }
+
+    // Create and return session
+    CSession2* session = new ( ELeave ) CFlexTimerSession( iTimerEngine );
+
+    OstTrace1( TRACE_INTERNAL,
+            CFLEXTIMERSERVER_NEWSESSIONL,
+            "CFlexTimerServer::NewSessionL: Created; session=%x",
+            ( TUint )session );
+
+    return session;
+    }
+
+// --------------------------------------------------------------------------
+// Thread start function, loops in active scheduler
+// --------------------------------------------------------------------------
+//
+void CFlexTimerServer::StartServerL()
+    {
+    // Called when thread is created, create active scheduler
+    CActiveScheduler* sched = new CActiveScheduler;
+    if ( sched == NULL )
+        {
+        // Leave error code is used as a panic code
+        User::Leave( EFlexTimerServerActiveScheduler );
+        }
+    // Add active scheduler object to cleanup stack before installing it.
+    // It will be deleted, if any of the next operations fails.
+    CleanupStack::PushL( sched );
+    CActiveScheduler::Install( sched );
+
+    // Create server object and start it
+    CFlexTimerServer* flexServer = NULL;
+    flexServer = CFlexTimerServer::NewL( EPriorityStandard );
+
+    // Push the server object to cleanup stack before starting it
+    CleanupStack::PushL( flexServer );
+    
+    TInt err = KErrNone;
+    
+    err = flexServer->Start( KFlexTimerServerName );
+    if ( err != KErrNone )
+        {
+        // Leave error code is used as a panic code
+        User::Leave( EFlexTimerServerStartServer );
+        }
+
+    // Complete open rendezvous in this process (syncs with creator)
+    RProcess::Rendezvous( KErrNone );
+
+    // Active scheduler start will not leave, thus pop added objects
+    // from the cleanup stack. They will be deleted once the execution
+    // returns from the active scheduler (application is exiting)
+    CleanupStack::Pop( flexServer );
+    CleanupStack::Pop( sched );
+
+    OstTrace0( TRACE_INTERNAL,
+            CFLEXTIMERSERVER_START,
+            "CFlexTimerServer::StartServerL: Call ActiveScheduler" );
+
+    // Start active scheduler, thread stays in active scheduler loop
+    CActiveScheduler::Start();
+
+    OstTrace0( TRACE_INTERNAL,
+            CFLEXTIMERSERVER_EXIT,
+            "CFlexTimerServer::StartServerL: ActiveScheduler exit" );
+
+    // Delete allocated resources
+    delete flexServer;
+    delete sched;
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServer::CFlexTimerServer( CActive::TPriority aPriority ) :
+    CServer2( aPriority ), iTimerEngine( NULL )
+    {
+
+    }
+
+// --------------------------------------------------------------------------
+// Two phased construction, 2nd phase
+// --------------------------------------------------------------------------
+//
+void CFlexTimerServer::ConstructL()
+    {
+    // Create engine, leaving is handled in server creation
+    iTimerEngine = CFlexTimerEngine::NewL();
+    OstTrace0( TRACE_INTERNAL,
+            CFLEXTIMERSERVER_CONSTRUCTL,
+            "CFlexTimerServer::ConstructL: Created engine" );
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Main function of the server executable.
+// --------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    // Mark memory allocation check 
+    __UHEAP_MARK;
+
+    // Create cleanup stack
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    __ASSERT_ALWAYS( cleanup, User::Panic( KFlexTimerServerPanicCat,
+                    EFlexTimerServerCleanupStack ) );
+    // Start server
+    TRAPD( panicCode, CFlexTimerServer::StartServerL() );
+    if ( panicCode != KErrNone )
+        {
+        OstTrace1( TRACE_INTERNAL,
+                CFLEXTIMERSERVER_MAINERROR,
+                "CFlexTimerServer - Main: Start server failed (%d)",
+                panicCode );
+        delete cleanup;
+        User::Panic( KFlexTimerServerPanicCat, panicCode );
+        }
+    else
+        {
+        OstTrace0( TRACE_INTERNAL,
+                CFLEXTIMERSERVER_MAINEXIT,
+                "CFlexTimerServer - Main: Application exiting" );
+
+        // Delete cleanup stack
+        delete cleanup;
+        }
+
+    // Memory allocation check, panic in UDEB case of memory leak
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/server/src/flextimersession.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,509 @@
+/*
+ * 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 CFlexTimerSession class.
+ *
+ */
+/*
+ * %version: 1 %
+ */
+
+// System include files
+#include <e32def.h>
+#include <e32cmn.h>
+#include <hal.h>
+
+// User include files go here:
+#include "flextimercommon.h"
+#include "flextimersession.h"
+#include "mflextimerservice.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimersessionTraces.h"
+#endif
+
+// Constants
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerSession::CFlexTimerSession( MFlexTimerService* aFlexTimerService )
+:   iService( aFlexTimerService ),
+    iTimerWinSize( 0 ),
+    iUseDefaultWin( ETrue )
+    {
+    OstTrace1( TRACE_INTERNAL,
+               CFLEXTIMERSESSION,
+               "CFlexTimerSession::CFlexTimerSession; this=%x",
+               ( TUint )this );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerSession::~CFlexTimerSession()
+    {
+    OstTrace1( TRACE_INTERNAL,
+               CFLEXTIMERSESSIOND,
+               "CFlexTimerSession::~CFlexTimerSession; this=%x",
+               ( TUint )this );
+    }
+
+// --------------------------------------------------------------------------
+// Function called from CFlexTimerService::RunL for messages targeted to
+// this session
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::ServiceL( const RMessage2& aMessage )
+    {
+    TInt msgType( aMessage.Function() );
+
+    OstTraceExt2( TRACE_INTERNAL,
+                  CFLEXTIMERSESSION_MSG,
+                  "CFlexTimerSession::ServiceL; this=%x; msgType=%d",
+                  ( TInt )this,
+                  msgType );
+
+    // Check message type and pass it to correct handler. Handler either 
+    // stores the message or completes it immediately.
+    switch ( msgType )
+        {
+        case EFlexTimerServCancelRequest:
+            CancelTimer( aMessage );
+            break;
+        case EFlexTimerServAtRequest:
+            NewAtTimer( aMessage );
+            break;
+        case EFlexTimerServAtUTCRequest:
+            NewAtUtcTimer( aMessage );
+            break;
+        case EFlexTimerServAfterRequest:
+            NewAfterTimer( aMessage );
+            break;
+        case EFlexTimerServAfterTicksRequest:
+            NewAfterTicksTimer( aMessage );
+            break;
+        case EFlexTimerServConfigureRequest:
+            ConfigureParameters( aMessage );
+            break;
+        default:
+            OstTrace1(
+                    TRACE_INTERNAL,
+                    CFLEXTIMERSESSION_ERROR,
+                    "CFlexTimerSession::ServiceL: Unknown message; this=%x",
+                    ( TUint )this );
+            aMessage.Complete( KErrNotSupported );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Timeout handler for triggering timers
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::Timeout() const
+    {
+    // Check for the validity of pending timeout request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_TIMEOUT,
+                      "CFlexTimerSession::Timeout; this=%x; msg=%x",
+                      ( TUint )this,
+                      ( TUint )iPendingTimeoutMsg.Handle() );
+        // Complete message, this sets message pointer to NULL
+        iPendingTimeoutMsg.Complete( KErrNone );
+        }
+    else
+        {
+        // No valid message pointer, nothing we can do here
+        OstTrace1( TRACE_INTERNAL,
+                   CFLEXTIMERSESSION_TIMEOUT_ERROR,
+                   "CFlexTimerSession::Timeout: No Pending message; this=%x",
+                   ( TUint )this );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Function for aborting At-timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::Abort( TInt aReason ) const
+    {
+    // Check for the validity of pending timeout request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_ABORT,
+                      "CFlexTimerSession::Abort; this=%x; msg=%x",
+                      ( TUint )this,
+                      ( TUint )iPendingTimeoutMsg.Handle() );
+        // Complete message, this sets message pointer to NULL
+        iPendingTimeoutMsg.Complete( aReason );
+        }
+    else
+        {
+        // No valid message pointer, nothing we can do here
+        OstTrace1(
+                TRACE_INTERNAL,
+                CFLEXTIMERSESSION_ABORT_ERROR,
+                "CFlexTimerSession::Abort: No Pending message; this=%x",
+                ( TUint )this );
+
+        }
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for starting At() -timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::NewAtTimer( const RMessage2& aMessage )
+    {
+
+    // Check that we do not have a pending timer request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_ATPANIC,
+                      "CFlexTimerSession::NewAtTimer: Already pending; "
+                      "this=%x; msg=%x",
+                      ( TUint )this,
+                      ( TUint )iPendingTimeoutMsg.Handle() );
+
+        aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerErrorPendingTimer );
+        return;
+        }
+
+    // Get interval from current time to the requested timestamp
+    TTime refTime;
+    refTime.HomeTime();
+    TTimeIntervalMicroSeconds interval;
+    GetIntervalToMsgTime( aMessage, refTime, interval );
+
+    OstTraceExt2( TRACE_INTERNAL,
+                  CFLEXTIMERSESSION_ATTIMER,
+                  "CFlexTimerSession::NewAtTimer; this=%x; interval=%lld",
+                  ( TUint )this,
+                  interval.Int64() );
+
+    // Add the timer to engine
+    DoAddTimer( aMessage, interval, ETrue );
+
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for starting AtUTC() -timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::NewAtUtcTimer( const RMessage2& aMessage )
+    {
+
+    // Check that we do not have a pending timer request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_ATUTCPANIC,
+                      "CFlexTimerSession::NewAtUtcTimer: Already pending; "
+                      "this=%x; msg=%x",
+                      ( TUint )this,
+                      ( TUint )iPendingTimeoutMsg.Handle() );
+
+        aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerErrorPendingTimer );
+        return;
+        }
+
+    TTime refTime;
+    refTime.UniversalTime();
+    TTimeIntervalMicroSeconds interval;
+    GetIntervalToMsgTime( aMessage, refTime, interval );
+    
+    OstTraceExt2( 
+            TRACE_INTERNAL,
+            CFLEXTIMERSESSION_ATUTCTIMER,
+            "CFlexTimerSession::NewAtUtcTimer; this=%x; interval=%lld",
+            ( TUint )this,
+            interval.Int64() );
+
+    // Add the timer to engine
+    DoAddTimer( aMessage, interval, ETrue );
+
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for starting After()-timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::NewAfterTimer( const RMessage2& aMessage )
+    {
+
+    // Check that we do not have a pending timer request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_AFTERPANIC,
+                      "CFlexTimerSession::NewAfterTimer: Already pending; "
+                      "this=%x; msg=%x",
+                      ( TUint )this,
+                      ( TUint )iPendingTimeoutMsg.Handle() );
+
+        aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerErrorPendingTimer );
+        return;
+        }
+
+    TInt64 timeStamp = MAKE_TINT64( aMessage.Int1(), aMessage.Int0() );
+    TTimeIntervalMicroSeconds interval( timeStamp );
+
+    OstTraceExt2(
+            TRACE_INTERNAL,
+            CFLEXTIMERSESSION_AFTERTIMER,
+            "CFlexTimerSession::NewAfterTimer; this=%x; interval=%llu",
+            ( TUint )this,
+            interval.Int64() );
+
+    // Add the timer to engine, request cancellation if the secure time
+    // is not available
+    DoAddTimer( aMessage, interval, EFalse );
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for starting AfterTicks()-timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::NewAfterTicksTimer( const RMessage2& aMessage )
+    {
+
+    // Check that we do not have a pending timer request
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTraceExt2(
+                TRACE_INTERNAL,
+                CFLEXTIMERSESSION_AFTERTICKSPANIC,
+                "CFlexTimerSession::NewAfterTicksTimer: Already pending; "
+                "this=%x; msg=%x",
+                ( TUint )this,
+                ( TUint )iPendingTimeoutMsg.Handle() );
+
+        aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerErrorPendingTimer );
+        return;
+        }
+
+    // Get the tick period from HAL and convert ticks to microseconds
+    TInt tickUs;
+    HAL::Get( HAL::ESystemTickPeriod, tickUs );
+
+    TTimeIntervalMicroSeconds interval =
+            static_cast<TInt64> ( aMessage.Int0() ) * tickUs;
+
+    OstTraceExt2(
+            TRACE_INTERNAL,
+            CFLEXTIMERSESSION_AFTERTICKSTIMER,
+            "CFlexTimerSession::NewAfterTicksTimer; this=%x; interval=%llu",
+            ( TUint )this,
+            interval.Int64() );
+
+    // Add the timer to engine
+    DoAddTimer( aMessage, interval, EFalse );
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for cancelling running timer
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::CancelTimer( const RMessage2& aMessage )
+    {
+    TInt ret;
+    // Check that we have a pending timer request
+    if ( iPendingTimeoutMsg.IsNull() )
+        {
+        OstTrace1(
+                TRACE_INTERNAL,
+                CFLEXTIMERSESSION_CANCELERROR,
+                "CFlexTimerSession::CancelTimer: no pending msg; this=%x",
+                ( TUint )this );
+        ret = KErrNotFound;
+        }
+    else
+        {
+        ret = iService->CancelTimer( this );
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_CANCEL,
+                      "CFlexTimerSession::CancelTimer; this=%x; ret=%d",
+                      ( TUint )this,
+                      ret );
+
+        // Complete pending message, this sets message pointer to NULL
+        iPendingTimeoutMsg.Complete( KErrCancel );
+        }
+
+    // Complete cancel message
+    aMessage.Complete( ret );
+    }
+
+// --------------------------------------------------------------------------
+// Handler function for configuring timer parameters
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::ConfigureParameters( const RMessage2& aMessage )
+    {
+    TInt ret( KErrNone );
+
+    // Configuration is not allowed when there is a pending message
+    if ( !iPendingTimeoutMsg.IsNull() )
+        {
+        OstTrace1( TRACE_INTERNAL,
+                   CFLEXTIMERSESSION_CONFIGERROR,
+                   "CFlexTimerSession::ConfigureParameters: Timer pending; "
+                   "this=%x",
+                   ( TUint )this );
+        ret = KErrInUse;
+        }
+    else
+        {
+        TInt paramType( aMessage.Int0() );
+        OstTraceExt2( TRACE_INTERNAL,
+                      CFLEXTIMERSESSION_CONFIG,
+                      "CFlexTimerSession::ConfigureParameters; this=%x; "
+                      "paramType=%d",
+                      ( TUint )this,
+                      paramType );
+
+        switch ( paramType )
+            {
+            case EConfigureRequestWindowSize:
+                {
+                TInt winLo = aMessage.Int1();
+                TInt winHi = aMessage.Int2();
+
+                iTimerWinSize = MAKE_TINT64( winHi, winLo );
+                iUseDefaultWin = EFalse;
+
+                OstTraceExt1( TRACE_INTERNAL,
+                              CFLEXTIMERSESSION_CONFIGWIN,
+                              "CFlexTimerSession::ConfigureParameters; "
+                              "iTimerWinSize=%lld",
+                              iTimerWinSize.Int64() );
+                
+                if ( iTimerWinSize.Int64() < 0 ||
+                    iTimerWinSize.Int64() > KFlexTimerMaxTimerLength )
+                    {
+                    aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerIllegalTimerValue );
+                    // Return after panicing the client -- completing the
+                    // message afterwards panics the server with USER 70.
+                    return;
+                    }
+                break;
+                }
+            default:
+                OstTrace0( TRACE_INTERNAL,
+                           CFLEXTIMERSESSION_CONFIGUNKNOWN,
+                           "CFlexTimerSession::ConfigureParameters: "
+                           "ERROR - Invalid parameter type" );
+                ret = KErrNotSupported;
+                break;
+            }
+        }
+    aMessage.Complete( ret );
+    }
+
+// --------------------------------------------------------------------------
+// Function for adding timer to engine and handling its return value
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::DoAddTimer( const RMessage2& aMessage,
+                                    TTimeIntervalMicroSeconds& aWinEnd,
+                                    TBool aRequestAbort )
+    {
+    OstTraceExt4( TRACE_INTERNAL,
+               CFLEXTIMERSESSION_ADDTIMER,
+               "CFlexTimerSession::DoAddTimer; this=%x; msg=%x; aWinEnd=%llu;"
+               " aRequestAbort=%d",
+               ( TUint )this,
+               ( TUint )aMessage.Handle(),
+               aWinEnd.Int64(),
+               aRequestAbort );  
+    
+    // Check that the timer has valid values.
+    if ( aWinEnd.Int64() < 0 || aWinEnd.Int64() > KFlexTimerMaxTimerLength)
+        {
+        OstTraceExt4( TRACE_INTERNAL, 
+                      CFLEXTIMERSESSION_DOADDTIMER, 
+                      "CFlexTimerSession::DoAddTimer;Invalid parameters "
+                      "- panicing client;this=%x;aMessage=%x;aWinEnd=%llu;"
+                      "aRequestAbort=%d", 
+                      ( TUint )this, 
+                      ( TUint )aMessage.Handle(), 
+                      aWinEnd.Int64(),
+                      aRequestAbort );
+        aMessage.Panic( KRFlexTimerPanicCat,
+                        EFlexTimerServerIllegalTimerValue );
+        return;
+        }
+    
+    TTimeIntervalMicroSeconds winStart;
+    TTimeIntervalMicroSeconds window = iTimerWinSize;
+    
+    if ( iUseDefaultWin )
+        {
+        window = static_cast<TInt64> ( static_cast<TReal64> ( aWinEnd.Int64() )
+            * KDefaultWindowMultiplier );
+        }
+
+    winStart = aWinEnd.Int64() - window.Int64();
+
+    // Store pending message. Not completed until timer expires.
+    // Note that in case of zero or negative timer value, message can
+    // be completed through Timeout() even before AddTimer returns. This
+    // implementation saves some checks and timer stopping/starting in engine.
+    iPendingTimeoutMsg = aMessage;
+
+    // Add timer to engine
+    TInt ret = iService->AddTimer( winStart, aWinEnd, aRequestAbort, this );
+
+    if ( KErrNone != ret )
+        {
+        // Failed, pass error code to client side
+        OstTraceExt2( TRACE_INTERNAL,
+                   CFLEXTIMERSESSION_ADDERROR,
+                   "CFlexTimerSession::DoAddTimer: Error; this=%x, ret=%d",
+                   ( TUint )this,
+                   ret );
+        // Complete pending message, this sets message pointer to NULL
+        iPendingTimeoutMsg.Complete( ret );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// From CSession2
+// Function for handling unintentional termination of the client
+// --------------------------------------------------------------------------
+//
+void CFlexTimerSession::Disconnect( const RMessage2 &aMessage )
+    {
+    // The client of this session has died.
+    
+    // Remove timer from engine.
+    iService->CancelTimer( this );
+
+    // Disconnect() must end with a call to the base class implementation, 
+    // which will delete the session object and complete the disconnect 
+    // message.
+    CSession2::Disconnect( aMessage );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/flextimer_build.bat	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,434 @@
+::---------------------------------------------------------------------------
+:: Helper for FlexTimer building and testing
+::
+:: Commands:
+::
+::  BUILD_ALL       Build component to all targets
+::  BUILD_ERROR     Inform user about failed build
+::  BUILD_OK        Inform user about passed build
+::  BUILD_TRACES    Build OST traces to targets WINSCW_UDEB and ARMV5_UDEB
+::  CHECK_EPOCROOT  Check that epocroot is set correctly
+::  CLEAN_NOLOGS    Reallyclean component, no output to screen
+::  DEL_CTC_REPORTS Delete old CTC reports
+::  GEN_CMT_REPORTS Generate CMT reports
+::  GEN_COV_REPORTS Generate and deliver Coveruty Prevent reports
+::  GEN_CS_REPORTS  Genrete CodeScanner reports
+::  GEN_CTC_REPORTS Generate CTC reports
+::  GEN_IMAGE       Make flash images
+::  GEN_SYMBOLS     Generate symbol files
+::  INSTRUMENT_CTC  Instrument CTC++ to component's WINSCW_UDEB target
+::  RUN_TESTS       Compile test component, run test application and check 
+::                  test results
+::  SCHEDULER       Execute commands from QUEUE
+::  SHOW_HELP       Show help of the script
+::  START_UP        Enable delayed environment expansion
+::  TEST_FAILED     Inform user about failed tests
+::  THE_END         Stop execution of the script
+::
+::---------------------------------------------------------------------------
+:: Change history:
+::
+:: 1.0  01-Apr-2010     First version in SVN
+::
+::---------------------------------------------------------------------------
+
+@echo off
+setlocal
+
+set VERSION=1.0 [01/04/2010 15:08:42]
+
+:: The source path is one dir up from the BAT's location
+for /f %%i in ("%0") do set SOURCE_PATH=%%~dpi..
+
+set MAKE_PATH=%SOURCE_PATH%\group\bld.inf
+set TEST_MAKE_PATH=%SOURCE_PATH%\test\testflextimer\group\bld.inf
+
+:: Commands for the component
+set CMD_BUILD_ALL=sbs -b %MAKE_PATH%
+set CMD_BUILD_CLEAN=sbs -b %MAKE_PATH% reallyclean
+set CMD_BUILD_TRACE=sbs -b %MAKE_PATH% -c winscw_udeb.tracecompiler -c armv5_udeb.tracecompiler
+
+:: Commands for test component
+set CMD_TEST_BUILD=sbs -b %TEST_MAKE_PATH% -c winscw_udeb -c armv5
+set CMD_TEST_RUN=start /wait %EPOCROOT%epoc32\release\winscw\udeb\atsinterface.exe -dtextshell -- -testmodule testflextimer
+
+:: Commands and settings for CTC++
+set CTC_OUTFILE=MON
+set CTC_OUTPATH=.
+set CMD_CTC_BUILD=ctcwrap -i m -v -2comp sbs.bat -b %MAKE_PATH% -c winscw_udeb
+set CMD_CTC_CLEAN=sbs -b %MAKE_PATH% -c winscw_udeb reallyclean
+set CMD_CTC_GEN=ctcpost %CTC_OUTPATH%\%CTC_OUTFILE%.sym %CTC_OUTPATH%\%CTC_OUTFILE%.dat ^| ctc2html
+
+:: Command for CMT
+set CMD_CMT_GEN=dir /s /b %SOURCE_PATH%\*.cpp %SOURCE_PATH%\*.inl ^| findstr /I /V "\\test\\" ^| cmt ^| cmt2html
+
+:: Commands and settings for Coverity Prevent
+set COV_OUTPATH=coverity
+set CMD_COV_BUILD=cov-build --dir %COV_OUTPATH% sbs -b %MAKE_PATH%
+set CMD_COV_ANALYZE=cov-analyze --dir %COV_OUTPATH% --all --symbian
+set CMD_COV_DELIVER=cov-commit-defects --dir %COV_OUTPATH% --remote trwsim47 --user cadsw --password cov3rity --product flextimer --cva
+set CMD_COV_SHOW_RESULTS=start http://trwsim47:5467
+
+:: Commands for iMaker
+set CMD_IMAKE_CORE=imaker vasco_ui core USE_SYMGEN=0
+set CMD_IMAKE_ROFS2=imaker vasco_ui rofs2 USE_SYMGEN=0
+set CMD_IMAKE_ROFS3=imaker vasco_ui rofs3 USE_SYMGEN=0
+set CMD_IMAKE_UDAERASE=imaker vasco_ui udaerase USE_SYMGEN=0
+set CMD_IMAKE_CORE_SYMBOLS=imaker vasco_ui romsymbol
+set CMD_IMAKE_ROFS2_SYMBOLS=imaker vasco_ui rofs2-symbol
+set CMD_IMAKE_ROFS3_SYMBOLS=imaker vasco_ui rofs3-symbol
+
+:: Commands and settings for CodeScanner
+set CODESCANNER_PATH=cs_output
+set CMD_CODESCANNER=codescanner -t off
+
+:: Python script for checking from test logs are tests passed
+set PY_ALL_TESTS_PASSED=^
+import re,sys;^
+file = open('%EPOCROOT%/epoc32/winscw/c/logs/testframework/testreport.txt');^
+txt = '\n'.join(file);^
+reg1 = re.search('^\s*(?:Passed cases\: (\d+))$', txt, re.MULTILINE);^
+reg2 = re.search('^\s*(?:Total cases\: (\d+))$', txt, re.MULTILINE);^
+sys.exit(0 if reg1.group(1)==reg2.group(1) else 1)
+
+:: Python script for parsing test result summary from test logs
+set PY_PARSE_TEST_RESULTS=^
+import re;^
+file = open('%EPOCROOT%/epoc32/winscw/c/logs/testframework/testreport.txt');^
+txt = '\n'.join(file);^
+reg = re.findall('^\s*(.*cases\: \d+)$', txt, re.MULTILINE);^
+print '\n'.join(reg);^
+file.close()
+
+::---------------------------------------------------------------------------
+:: Parse input
+::---------------------------------------------------------------------------
+
+if not "%1"=="__INITIALIZED__" (
+    goto START_UP
+
+) else (
+
+    if "%2"=="" (
+        set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS BUILD_ALL BUILD_TRACES RUN_TESTS GEN_CMT_REPORTS GEN_CS_REPORTS
+        goto SCHEDULER
+
+    ) else if /i "%2"=="build" (
+        set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS BUILD_ALL BUILD_TRACES
+        goto SCHEDULER
+
+    ) else if /i "%2"=="ctc" (
+        rem - atsinterface does not work with CTC instrumentation, use consoleui instead
+        rem - NOTE Emulator has to be closed manually
+        set CMD_TEST_RUN=start /wait %EPOCROOT%epoc32\release\winscw\udeb\consoleui.exe -dtextshell -- -testmodule testflextimer -run all
+        set QUEUE=CHECK_EPOCROOT INSTRUMENT_CTC DEL_CTC_REPORTS RUN_TESTS GEN_CTC_REPORTS
+        goto SCHEDULER
+
+    ) else if /i "%2"=="cov" (
+        set QUEUE=CHECK_EPOCROOT CLEAN_NOLOGS GEN_COV_REPORTS
+        goto SCHEDULER
+
+    ) else if /i "%2"=="image" (
+        set QUEUE=CHECK_EPOCROOT GEN_IMAGE GEN_SYMBOLS
+        goto SCHEDULER
+
+    ) else if /i "%2"=="test" (
+        set QUEUE=CHECK_EPOCROOT GEN_CMT_REPORTS GEN_CS_REPORTS
+        goto SCHEDULER
+
+    ) else if /i "%2"=="help" goto SHOW_HELP
+)
+
+echo Illegal parameter %2
+
+goto SHOW_HELP
+
+::---------------------------------------------------------------------------
+:START_UP
+::---------------------------------------------------------------------------
+:: Start a command shell with delayed environment expansion
+
+cmd.exe /V:ON /C %0 __INITIALIZED__ %1
+
+goto THE_END
+
+::---------------------------------------------------------------------------
+:SCHEDULER
+::---------------------------------------------------------------------------
+:: Run the build commands. Eat commands from QUEUE one by one
+
+for /f "tokens=1*" %%i in ( "!QUEUE!" ) do (
+    set QUEUE=%%j
+    rem echo ====================================================================
+    rem echo %%i
+    rem echo ====================================================================
+    goto %%i
+)
+
+goto BUILD_OK
+
+::---------------------------------------------------------------------------
+:BUILD_ALL
+::---------------------------------------------------------------------------
+
+call %CMD_BUILD_ALL%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:BUILD_TRACES
+::---------------------------------------------------------------------------
+
+call %CMD_BUILD_TRACE%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:CLEAN_NOLOGS
+::---------------------------------------------------------------------------
+:: Reallyclean FlexTimer component without showing compilation logs on screen
+
+call %CMD_BUILD_CLEAN% > NUL 2>&1
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:INSTRUMENT_CTC
+::---------------------------------------------------------------------------
+:: Instrument FlexTimer WINSCW UDEB with CTC++
+
+:: Remove old CTC symbols
+del %CTC_OUTPATH%\%CTC_OUTFILE%.sym > NUL 2>&1
+
+:: Clean old compilation
+call %CMD_CTC_CLEAN% > NUL 2>&1
+
+:: Instrument the code
+call %CMD_CTC_BUILD%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:DEL_CTC_REPORTS
+::---------------------------------------------------------------------------
+:: Delete CTC generated test reports. SYM-file is deleted before 
+:: instrumenting CTC.
+
+del %CTC_OUTPATH%\%CTC_OUTFILE%.dat > NUL 2>&1
+rmdir /q /s %CTC_OUTPATH%\CTCHTML > NUL 2>&1
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:RUN_TESTS
+::---------------------------------------------------------------------------
+
+:: Compile test component
+call %CMD_TEST_BUILD%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+echo Testing...
+
+:: Run test application
+%CMD_TEST_RUN%
+if not "%errorlevel%"=="0" goto TEST_FAILED
+
+:: Verify test results
+call python -c "%PY_ALL_TESTS_PASSED%"
+if not "%errorlevel%"=="0" goto TEST_FAILED
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_CTC_REPORTS
+::---------------------------------------------------------------------------
+
+:: Generate CTC++ reports
+call %CMD_CTC_GEN% 
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_CMT_REPORTS
+::---------------------------------------------------------------------------
+
+call %CMD_CMT_GEN%
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_COV_REPORTS
+::---------------------------------------------------------------------------
+
+:: Delete the old results
+rmdir /q /s %COV_OUTPATH% > NUL 2>&1
+
+:: Build with Coverity Prevent
+call %CMD_COV_BUILD%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+:: Analyze the code
+call %CMD_COV_ANALYZE%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+:: Deliver the results
+call %CMD_COV_DELIVER%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+:: Open the results
+%CMD_COV_SHOW_RESULTS%
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_CS_REPORTS
+::---------------------------------------------------------------------------
+
+set __CODESCANNER_LAST_DIR=
+set __CODESCANNER_PARAMETERS=
+
+:: Find all inc and src -directories that are not in codescanner results nor
+:: test code. Add '-i' parameter to every directory except the last one. (As
+:: codescanner -h states.)
+
+for /f "usebackq" %%i in (`dir /s /b %SOURCE_PATH%\src %SOURCE_PATH%\inc ^| findstr /V "\\test\\ \\%CODESCANNER_PATH%\\"`) do (
+    if defined __CODESCANNER_LAST_DIR set __CODESCANNER_PARAMETERS=!__CODESCANNER_PARAMETERS! -i !__CODESCANNER_LAST_DIR!
+    set __CODESCANNER_LAST_DIR=%%i
+)
+
+%CMD_CODESCANNER% %__CODESCANNER_PARAMETERS% %__CODESCANNER_LAST_DIR% %CODESCANNER_PATH%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+:: Open the results
+start %CODESCANNER_PATH%\problemIndex.html
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:CHECK_EPOCROOT
+::---------------------------------------------------------------------------
+
+:: Check that the given parameter is a root dir.
+for /f %%i in ("%EPOCROOT%") do (
+    if /i not "%EPOCROOT%"=="%%~di\" (
+        echo EPOCROOT is invalid: %EPOCROOT%
+        echo It should be a root of certain drive letter e.g. T:\
+        goto BUILD_ERROR
+    )
+)
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_IMAGE
+::---------------------------------------------------------------------------
+
+:: Go to the SDK drive
+for /f %%i in ("%EPOCROOT%") do %%~di
+
+:: Make image
+call %CMD_IMAKE_CORE%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+call %CMD_IMAKE_ROFS2%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+call %CMD_IMAKE_ROFS3%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+call %CMD_IMAKE_UDAERASE%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+echo.
+echo ======================================================================
+echo IMAGES ARE READY
+echo ======================================================================
+echo.
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:GEN_SYMBOLS
+::---------------------------------------------------------------------------
+
+:: Go to the SDK drive
+for /f %%i in ("%EPOCROOT%") do %%~di
+
+:: Generate symbols
+call %CMD_IMAKE_CORE_SYMBOLS%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+call %CMD_IMAKE_ROFS2_SYMBOLS%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+call %CMD_IMAKE_ROFS3_SYMBOLS%
+if not "%errorlevel%"=="0" goto BUILD_ERROR
+
+goto SCHEDULER
+
+::---------------------------------------------------------------------------
+:BUILD_ERROR
+::---------------------------------------------------------------------------
+
+echo.
+echo Build failed
+echo.
+
+goto THE_END
+
+::---------------------------------------------------------------------------
+:BUILD_OK
+::---------------------------------------------------------------------------
+
+echo.
+echo Build OK
+echo.
+
+goto THE_END
+
+::---------------------------------------------------------------------------
+:TEST_FAILED
+::---------------------------------------------------------------------------
+
+echo.
+echo Testing failed
+echo.
+
+call python -c "%PY_PARSE_TEST_RESULTS%"
+
+goto THE_END
+
+::---------------------------------------------------------------------------
+:SHOW_HELP
+::---------------------------------------------------------------------------
+echo.
+echo A script for building and testing FlexTimer. Version %VERSION%
+echo.
+echo Usage:
+echo    flextimer_build ^<option^>
+echo.
+echo Options:
+echo.
+echo    ^<none^>  Build component (with traces), build test component and run
+echo            tests, generate static analysis
+echo.
+echo    build   Rebuild component (with traces)
+echo.
+echo    cov     Generate and deliver Coverity Prevent report
+echo.
+echo    ctc     Instrument CTC++, build test component and run tests, 
+echo            generate test coverity reports
+echo.
+echo    image   Create CORE and ROFS1, ROFS2, ROFS3 and UDAERASE flash images
+echo.
+echo    help    Show this help
+echo.
+
+::---------------------------------------------------------------------------
+:THE_END
+::---------------------------------------------------------------------------
+endlocal
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/bmarm/testflextimeru.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	LibEntryL__Fv @ 1 NONAME R3UNUSED ; LibEntryL(void)
+	SetRequirements__FRP16CTestModuleParamRUl @ 2 NONAME R3UNUSED ; SetRequirements(CTestModuleParam *&, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/bwins/testflextimeru.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * __cdecl LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int __cdecl SetRequirements(class CTestModuleParam * &,unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/eabi/testflextimeru.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI15CTestRFlexTimer @ 3 NONAME
+	_ZTI20CInheritedCFlexTimer @ 4 NONAME
+	_ZTI21CInheritedCFlexTimer2 @ 5 NONAME
+	_ZTV15CTestRFlexTimer @ 6 NONAME
+	_ZTV20CInheritedCFlexTimer @ 7 NONAME
+	_ZTV21CInheritedCFlexTimer2 @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/bwins/flextimerservermonitorclientu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	?StartMonitoring@RFlexTimerServerMonitor@@QAEHXZ @ 1 NONAME ; int RFlexTimerServerMonitor::StartMonitoring(void)
+	?GetStatus@RFlexTimerServerMonitor@@QAEHAAH@Z @ 2 NONAME ; int RFlexTimerServerMonitor::GetStatus(int &)
+	?StopMonitoring@RFlexTimerServerMonitor@@QAEHXZ @ 3 NONAME ; int RFlexTimerServerMonitor::StopMonitoring(void)
+	?Connect@RFlexTimerServerMonitor@@QAEHXZ @ 4 NONAME ; int RFlexTimerServerMonitor::Connect(void)
+	??1RFlexTimerServerMonitor@@QAE@XZ @ 5 NONAME ; RFlexTimerServerMonitor::~RFlexTimerServerMonitor(void)
+	??0RFlexTimerServerMonitor@@QAE@XZ @ 6 NONAME ; RFlexTimerServerMonitor::RFlexTimerServerMonitor(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/eabi/flextimerservermonitorclientu.def	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,10 @@
+EXPORTS
+	_ZN23RFlexTimerServerMonitor14StopMonitoringEv @ 1 NONAME
+	_ZN23RFlexTimerServerMonitor15StartMonitoringEv @ 2 NONAME
+	_ZN23RFlexTimerServerMonitor7ConnectEv @ 3 NONAME
+	_ZN23RFlexTimerServerMonitor9GetStatusERi @ 4 NONAME
+	_ZN23RFlexTimerServerMonitorC1Ev @ 5 NONAME
+	_ZN23RFlexTimerServerMonitorC2Ev @ 6 NONAME
+	_ZN23RFlexTimerServerMonitorD1Ev @ 7 NONAME
+	_ZN23RFlexTimerServerMonitorD2Ev @ 8 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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:
+*     Server that monitors has FlexTimerServer crashed during testing.
+*/
+
+PRJ_PLATFORMS
+
+    DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+    ../rom/flextimerservermonitor.iby CORE_MW_LAYER_IBY_EXPORT_PATH(flextimerservermonitor.iby)
+
+PRJ_TESTMMPFILES
+
+PRJ_MMPFILES
+
+    flextimerservermonitorserver.mmp
+    flextimerservermonitorclient.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/flextimerservermonitorclient.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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: 
+*       MMP file for client of server that monitors has FlexTimerServer 
+*       crashed during testing.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          flextimerservermonitorclient.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x2002EA9C
+
+CAPABILITY      ALL -TCB
+VENDORID        VID_DEFAULT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          rflextimerservermonitor.cpp
+
+LIBRARY         euser.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/group/flextimerservermonitorserver.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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: 
+*       MMP file for server that monitors has FlexTimerServer crashed during 
+*       testing.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          flextimerservermonitorserver.exe
+TARGETTYPE      exe
+UID             0x1000008D 0x2002EA9B
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_SERVER
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          flextimerservermonitorserver.cpp 
+SOURCE          flextimerservermonitorsession.cpp
+
+LIBRARY         euser.lib
+LIBRARY         flextimerclient.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorcommon.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ *      Common definitions for FlexTimerServerMonitor client/server
+ *      communication.
+ */
+/*
+ * %version: 1 %
+ */
+#ifndef FLEXTIMERSERVERMONITORCOMMON_H
+#define FLEXTIMERSERVERMONITORCOMMON_H
+
+/**
+ * Function codes used in message passing between client and server.
+ */
+enum TFlexTimerServerMonitorRequests
+    {
+    EFlexTimerServerMonitorStartMonitoring = 1, ///< Start monitoring
+    EFlexTimerServerMonitorHasServerCrashed,    ///< Has monitored server crashed
+    EFlexTimerServerMonitorStopMonitoring       ///< Stop monitoring
+    };
+
+/**
+ * Panic category for FlexTimerServerMonitor server panics
+ */
+_LIT( KFlexTimerServerMonitorPanicCategory, "TestFlexTimer-Monitor" );
+
+/**
+ * Panic codes for panic category TestFlexTimer-Monitor
+ */
+enum TFlexTimerServerMonitorPanicCode
+    {
+    EActiveSchedulerCreationFailed = 1,
+    EServerCreationFailed,
+    EStartingServerFailed,
+    ECleanupStackCreationFailed
+    };
+
+
+const TUint KFlexTimerServerMonitorMajorVersionNumber = 0; ///< Major version
+const TUint KFlexTimerServerMonitorMinorVersionNumber = 1; ///< Minor version
+const TUint KFlexTimerServerMonitorBuildVersionNumber = 1; ///< Build version
+
+/**
+ * Name of the FlexTimer server monitor process
+ */
+_LIT( KFlexTimerServerMonitorServerName, "FlexTimerServerMonitorServer" );
+
+/**
+ * Name of the FlexTimer server monitor process executable
+ */
+_LIT( KFlexTimerServerMonitorServerExe, "flextimerservermonitorserver.exe" );
+
+/**
+ * Number of the message slots for FlexTimer server monitor process.
+ * 
+ * Due there are no asynchronous messaging, the number of slots can be one.
+ */
+const TInt KFlexTimerServerMonitorServerMessageSlots = 1;
+
+#endif // FLEXTIMERSERVERMONITORCOMMON_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorserver.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,125 @@
+/*
+ * 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:
+ *      Server implementation for FlexTimerServerMonitor.
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERSERVERMONITORSERVER_H
+#define FLEXTIMERSERVERMONITORSERVER_H
+
+// System includes
+#include <e32base.h>
+#include <rflextimer.h>
+
+// Class declaration
+/**
+ * A server for detecting, has FlexTimerServer crashed during the
+ * monitoring period.
+ */
+class CFlexTimerServerMonitorServer : public CServer2
+    {
+    
+public:
+    /**
+     * Two phased constructor 
+     * 
+     * @param aPriority Active object priority for the server 
+     * @return Pointer to created server object
+     */
+    IMPORT_C static CFlexTimerServerMonitorServer* NewL( 
+        CActive::TPriority aPriority );
+
+    /**
+     * Destructor 
+     */
+    virtual ~CFlexTimerServerMonitorServer();
+
+public:
+
+    /**
+     * From CServer2
+     * Function for creating a new session to this server. 
+     *
+     * @param aVersion Version identifier from client
+     * @param aMessage Reference to creation message sent by client
+     * @return Pointer to created session object
+     */
+    CSession2* NewSessionL( const TVersion& aVersion,
+                            const RMessage2& aMessage ) const;
+
+    /**
+     * Function for creating server thread resources. Creates the server
+     * object and active scheduler. Loops in the active scheduler to serve
+     * client requests until explicitly shutdown. Function leaves if the
+     * creation of needed resources fails.
+     */
+    static void StartServerL();
+
+    /**
+     * Start monitoring FlexTimer server crashing.
+     * 
+     * @return KErrNone when succeeded, KErrAlreadyExists if monitoring was
+     * already started, or any other system level error code.
+     */
+    TInt StartMonitoring();
+    
+    /**
+     * Stop monitoring FlexTimer server crashing.
+     * 
+     * @return KErrNone when succeeded, KErrNotFound if monitoring is not
+     * started.
+     */
+    TInt StopMonitoring();
+    
+    /**
+     * Get status of monitoring the server. I.e. has the server crashed or 
+     * not.
+     *
+     * @param aHasServerCrashed Return ETrue if server has crashed while
+     * monitoring, otherwise EFalse.
+     * @return KErrNone when succeeded, KErrNotFound if monitoring is not
+     * started.
+     */
+    TInt GetStatus( TBool& aHasServerCrashed );
+    
+private:
+
+    /**
+     * Constructor
+     * 
+     * @param aPriority Active object priority 
+     */
+    CFlexTimerServerMonitorServer( CActive::TPriority aPriority );
+
+private: // Data
+
+    /**
+     * Handle to FlexTimer server.
+     * This parameter needs to be in server due it is manipulated by
+     * multible sessions.
+     */
+    RFlexTimer iFlexTimer;
+    
+    /**
+     * State of monitoring. ETrue if monitoring has started, EFalse if not.
+     * This state is introduced for preventing starting/stopping the
+     * monitoring more than once in a row.
+     */
+    TBool iIsMonitoringOn;
+    };
+
+#endif /* FLEXTIMERSERVERMONITORSERVER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/flextimerservermonitorsession.h	Mon May 24 20:51:35 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:
+ *      Session implementation for FlexTimerServerMonitor server
+ */
+/*
+ * %version: 1 %
+ */
+// Protection against nested includes
+#ifndef FLEXTIMERSERVERMONITORSESSION_H
+#define FLEXTIMERSERVERMONITORSESSION_H
+
+// System includes
+#include <e32base.h>
+
+// Forward declarations
+class RFlexTimer;
+
+// Class declaration
+/**
+ * Session for FlexTimerServerMonitor server.
+ * Just receives requests from client and calls server's interface.
+ */
+class CFlexTimerServerMonitorSession : public CSession2
+    {
+
+public:
+
+    /**
+     * Two phase constructor
+     */
+    static CFlexTimerServerMonitorSession* NewL();
+
+    /**
+     * Destructor
+     */
+    virtual ~CFlexTimerServerMonitorSession();
+
+    /**
+     * From CSession2
+     * Message handler servicing client requests. Interprets message type and
+     * passes it to correct function for processing.
+     * 
+     * @param aMessage Message from client
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+private:
+
+    /**
+     * Constructor
+     */
+    CFlexTimerServerMonitorSession();
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+private: // Data
+
+    };
+
+#endif /* FLEXTIMERSERVERMONITORSESSION_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/inc/rflextimerservermonitor.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,128 @@
+/*
+ * 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:
+ *      Client implementation for FlexTimerServerMonitor
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef RFLEXTIMERSERVERMONITOR_H
+#define RFLEXTIMERSERVERMONITOR_H
+
+// INCLUDE FILES
+#include <e32std.h> 
+
+// CLASS DECLARATION
+/**
+ * Client implementation for FlexTimerServerMonitor.
+ * Forwards all requests as synchronous messages to the client.
+ * 
+ * Creates the server if it is not up'n'running when connecting to the server
+ * at the first time.
+ * 
+ * StartMonitoring() has to be called before StopMonitoring() and GetStatus()
+ * works. Note! The starting can be done by different handle. I.e.
+ * 
+ * @code
+ * 
+ *      RFlexTimerServerMonitor mon1;
+ *      mon1.Connect();
+ *      mon1.StartMonitoring();
+ *      mon1.Close();
+ *      
+ *      .
+ *      .
+ *      . 
+ *      
+ *      RFlexTimerServerMonitor mon2;
+ *      mon2.Connect();
+ *      TBool hasCrashed;
+ *      mon2.GetStatus( hasCrashed );
+ *      // Do your stuff
+ *      ...
+ *      mon2.StopMonitoring();
+ *      mon2.Close();
+ *      
+ * @endcode
+ */
+class RFlexTimerServerMonitor : public RSessionBase
+    {
+public:
+    // Constructors and destructors
+
+    /**
+     * Constructor
+     */
+    IMPORT_C RFlexTimerServerMonitor();
+
+    /**
+     * Destructor
+     */
+    IMPORT_C ~RFlexTimerServerMonitor();
+
+    /**
+     * Connect to the server.
+     * 
+     * @return KErrNone on success. Otherwise returns one of the system-wide
+     * error codes.
+     */
+    IMPORT_C TInt Connect();
+
+    /**
+     * Start detecting the crashes.
+     * 
+     * @return KErrNone if succeeded, KErrAlreadyExists if monitoring is
+     * already activated, or any other system-wide error code.
+     */
+    IMPORT_C TInt StartMonitoring();
+
+    /**
+     * Stop detecting the crashes.
+     * 
+     * @return KErrNone if succeeded, KErrNotFound if monitoring is not
+     * activated, or any other system-wide error code.
+     */
+    IMPORT_C TInt StopMonitoring();
+    
+    /**
+     * Get the current status of monitoring.
+     * 
+     * 
+     * @param aHasServerCrashed ETrue if server has crashed, EFalse otherwise
+     * @return KErrNone if succeeded, KErrNotFound if monitoring is not
+     * activated, or any other system-wide error code.
+     */
+    IMPORT_C TInt GetStatus( TBool& aHasServerCrashed );
+    
+private:
+    
+    /**
+     * Gets the version number.
+     * @return The version.
+     */
+    TVersion Version() const;
+
+    /**
+     * Connects to the server. If server does not exist, it is created.
+     * @return KErrNone on success. Otherwise returns one of the system-wide
+     * error codes.
+     */
+    TInt StartServer();
+    };
+
+#endif // RFLEXTIMERSERVERMONITOR_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/rom/flextimerservermonitor.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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:
+*
+*/
+#ifndef FLEXTIMERSERVERMONITOR_IBY
+#define FLEXTIMERSERVERMONITOR_IBY
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\flextimerservermonitorclient.dll SHARED_LIB_DIR\flextimerservermonitorclient.dll
+file=ABI_DIR\BUILD_DIR\flextimerservermonitorserver.exe SHARED_LIB_DIR\flextimerservermonitorserver.exe
+
+#endif // FLEXTIMERSERVERMONITOR_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/flextimerservermonitorserver.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,207 @@
+/*
+ * 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:
+ *      Server implementation for FlexTimerServerMonitor
+ */
+/*
+ * %version: 2 %
+ */
+
+#include "flextimerservermonitorserver.h"
+#include "flextimerservermonitorcommon.h"
+#include "flextimerservermonitorsession.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerservermonitorserverTraces.h"
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Construction
+// --------------------------------------------------------------------------
+//
+EXPORT_C CFlexTimerServerMonitorServer* CFlexTimerServerMonitorServer::NewL(
+    CActive::TPriority aPriority )
+    {
+    return new ( ELeave ) CFlexTimerServerMonitorServer( aPriority );
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServerMonitorServer::~CFlexTimerServerMonitorServer()
+    {
+    iFlexTimer.Close();
+    }
+
+// --------------------------------------------------------------------------
+// Creation of new sessions, called by server framework
+// --------------------------------------------------------------------------
+//
+CSession2* CFlexTimerServerMonitorServer::NewSessionL( 
+    const TVersion& aVersion ,
+    const RMessage2& /* aMessage */ ) const
+    {
+
+    if ( aVersion.iMajor > KFlexTimerServerMonitorMajorVersionNumber )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    // Create and return session
+    return CFlexTimerServerMonitorSession::NewL();
+    }
+
+// --------------------------------------------------------------------------
+// Connect to FlexTimer service
+// --------------------------------------------------------------------------
+//
+TInt CFlexTimerServerMonitorServer::StartMonitoring()
+    {
+    if ( iIsMonitoringOn )
+        {
+        return KErrAlreadyExists;
+        }
+    iIsMonitoringOn = ETrue;
+    return iFlexTimer.Connect();
+    }
+
+// --------------------------------------------------------------------------
+// Close connection to FlexTimer service
+// --------------------------------------------------------------------------
+//
+TInt CFlexTimerServerMonitorServer::StopMonitoring()
+    {
+    if ( !iIsMonitoringOn )
+        {
+        return KErrNotFound; 
+        }
+    iIsMonitoringOn = EFalse;
+    iFlexTimer.Close();
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Get status of the monitored process
+// --------------------------------------------------------------------------
+//
+TInt CFlexTimerServerMonitorServer::GetStatus( TBool& aHasServerCrashed )
+    {
+    if ( !iIsMonitoringOn )
+        {
+        return KErrNotFound;
+        }
+    
+    // Check has the FlexTimerServer crashed by trying to configure
+    // the timer. If the server has crashed, it fails. Usually, in case of
+    // server crash this will return KErrServerTerminated (-15).
+    TInt ret = iFlexTimer.Configure( TTimeIntervalMicroSeconds( 1000000 ) );
+
+    if ( ret == KErrNone )
+        { // No crash.
+        aHasServerCrashed = EFalse;
+        }
+    else
+        { // Crash has happened.
+        aHasServerCrashed = ETrue;
+        }
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Thread start function, loops in active scheduler
+// --------------------------------------------------------------------------
+//
+void CFlexTimerServerMonitorServer::StartServerL()
+    {
+    // Called when thread is created, create active scheduler
+    CActiveScheduler* scheduler = new CActiveScheduler;
+    User::LeaveIfNull( scheduler );
+
+    // Add active scheduler object to cleanup stack before installing it.
+    // It will be deleted, if any of the next operations fails.
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Create server object and start it
+    CFlexTimerServerMonitorServer* server( NULL );
+    server = CFlexTimerServerMonitorServer::NewL( EPriorityStandard );
+    
+    // Push the server object to cleanup stack before starting it
+    CleanupStack::PushL( server );
+
+    User::LeaveIfError( server->Start( KFlexTimerServerMonitorServerName ) );
+
+    // Complete open rendezvous in this process (syncs with creator)
+    RProcess::Rendezvous( KErrNone );
+
+    // Active scheduler start will not leave, thus pop added objects
+    // from the cleanup stack. They will be deleted once the execution
+    // returns from the active scheduler (application is exiting)
+    CleanupStack::Pop( server );
+    CleanupStack::Pop( scheduler );
+
+    // Start active scheduler, thread stays in active scheduler loop
+    CActiveScheduler::Start();
+
+    // Delete allocated resources
+    delete server;
+    delete scheduler;
+    }
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServerMonitorServer::CFlexTimerServerMonitorServer( 
+    CActive::TPriority aPriority ) :
+    CServer2( aPriority ), iIsMonitoringOn( EFalse )
+    {
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Main function of the server executable.
+// --------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    // Mark memory allocation check 
+    __UHEAP_MARK;
+
+    // Create cleanup stack
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    __ASSERT_ALWAYS(
+        cleanup != NULL, 
+        User::Panic( KFlexTimerServerMonitorPanicCategory, 
+                     ECleanupStackCreationFailed ) );
+    
+    // Start server
+    TRAPD( panicCode, CFlexTimerServerMonitorServer::StartServerL() );
+
+    delete cleanup;
+    if ( panicCode != KErrNone )
+        {
+        User::Panic( KFlexTimerServerMonitorPanicCategory, panicCode );
+        }
+
+    // Memory allocation check, panic in UDEB case of memory leak
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/flextimerservermonitorsession.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,118 @@
+/*
+ * 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:
+ *      Session implementation for FlexTimerServerMonitor server
+ *
+ */
+/*
+ * %version: 1 %
+ */
+
+// System include files
+
+// User include files go here:
+#include <rflextimer.h>
+#include "flextimerservermonitorsession.h"
+#include "flextimerservermonitorcommon.h"
+#include "flextimerservermonitorserver.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "flextimerservermonitorsessionTraces.h"
+#endif
+
+// Constants
+
+// ======== MEMBER FUNCTIONS ========
+
+// --------------------------------------------------------------------------
+// Constructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServerMonitorSession::CFlexTimerServerMonitorSession()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// Destructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServerMonitorSession::~CFlexTimerServerMonitorSession()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// 2nd phase constructor
+// --------------------------------------------------------------------------
+//
+void CFlexTimerServerMonitorSession::ConstructL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// Two-phased constructor
+// --------------------------------------------------------------------------
+//
+CFlexTimerServerMonitorSession* CFlexTimerServerMonitorSession::NewL()
+    {
+    CFlexTimerServerMonitorSession* self =
+            new (ELeave) CFlexTimerServerMonitorSession();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// Handle clients' requests. Due the request implementations are simple
+// the actions are done in ServiceL and not dispatched to separate functions.
+// --------------------------------------------------------------------------
+//
+void CFlexTimerServerMonitorSession::ServiceL( const RMessage2& aMessage )
+    {
+    // This ain't the most elegant solution but here we go.
+    //
+    // Passing the server's reference as a parameter during session creation 
+    // would be another solution.
+    CFlexTimerServerMonitorServer* server = 
+        static_cast<CFlexTimerServerMonitorServer*>( 
+            const_cast<CServer2*>( Server() ) );
+
+    // Dispatch and execute the client's request
+    switch ( aMessage.Function() )
+        {
+        case EFlexTimerServerMonitorStartMonitoring:
+            {
+            aMessage.Complete( server->StartMonitoring() );
+            break;
+            }
+        case EFlexTimerServerMonitorHasServerCrashed:
+            {
+            TBool hasCrashed;
+
+            TInt ret = server->GetStatus( hasCrashed );
+
+            TPckgBuf<TBool> pckg( hasCrashed );
+            aMessage.WriteL( 0, pckg );
+            aMessage.Complete( ret );
+            break;
+            }
+        case EFlexTimerServerMonitorStopMonitoring:
+            {
+            aMessage.Complete( server->StopMonitoring() );
+            break;
+            }
+        default:
+            aMessage.Complete( KErrNotSupported );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/src/rflextimerservermonitor.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,164 @@
+/*
+ * 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:
+ *      Client implementation for FlexTimerServerMonitor
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+#include "rflextimerservermonitor.h"
+#include "flextimerservermonitorcommon.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "rflextimerservermonitorTraces.h"
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RFlexTimerServerMonitor::RFlexTimerServerMonitor()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RFlexTimerServerMonitor::~RFlexTimerServerMonitor()
+    {
+    Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Connects to the server and create a session.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimerServerMonitor::Connect()
+    {
+    // Starts the server, if it does not already exist in the system.
+    TInt ret = StartServer();
+
+    if ( ret == KErrNone )
+        { // No session, create it
+        ret = CreateSession( 
+            KFlexTimerServerMonitorServerName,
+            Version(),
+            KFlexTimerServerMonitorServerMessageSlots );
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Start monitoring FlexTimer server crashes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimerServerMonitor::StartMonitoring()
+    {
+    return SendReceive( EFlexTimerServerMonitorStartMonitoring );
+    }
+
+// ---------------------------------------------------------------------------
+// Get the status of the monitoring; has FlexTimer server crashed while
+// monitoring or not.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimerServerMonitor::GetStatus( TBool& aHasServerCrashed )
+    {
+    TPckgBuf<TBool> pckg;
+    TIpcArgs args( &pckg );
+
+    TInt ret = SendReceive( EFlexTimerServerMonitorHasServerCrashed, args );
+
+    // Extract the value returned from the server.
+    aHasServerCrashed = pckg();
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Stop monitoring FlexTimer server crashes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RFlexTimerServerMonitor::StopMonitoring()
+    {
+    return SendReceive( EFlexTimerServerMonitorStopMonitoring );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the version number.
+// ---------------------------------------------------------------------------
+//
+TVersion RFlexTimerServerMonitor::Version() const
+    {
+    return ( TVersion( KFlexTimerServerMonitorMajorVersionNumber,
+                       KFlexTimerServerMonitorMinorVersionNumber,
+                       KFlexTimerServerMonitorBuildVersionNumber ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Connects to the server. If server does not exist, it is created.
+// ---------------------------------------------------------------------------
+//
+TInt RFlexTimerServerMonitor::StartServer()
+    {
+    TFindServer findServer( KFlexTimerServerMonitorServerName );
+    TFullName serverName;
+
+    // See if the server is already started. 
+    TInt ret = findServer.Next( serverName );
+    
+    if ( ret != KErrNone )
+        {
+        //Server was not found so create one.
+        RProcess serverProcess;
+        TBuf<1> serverParameters;
+
+        // Load the executable for the server.
+        ret = serverProcess.Create( KFlexTimerServerMonitorServerExe,
+                                    serverParameters,
+                                    EOwnerThread );
+
+        if ( ret == KErrNone )
+            {
+            // Server has been created successfully. It is initially 
+            // in suspended state. Now resume the server process.
+
+            // Wait until the server process has been started.
+            TRequestStatus status;
+            
+            serverProcess.Rendezvous( status );
+            serverProcess.Resume();
+            User::WaitForRequest( status );
+
+            // Check if server has panicked during initialization.
+            ret = serverProcess.ExitType();
+            if ( ret == EExitPanic )
+                {
+                ret = KErrServerTerminated;
+                }
+            else
+                {
+                ret = status.Int();
+                }
+
+            // The server process stands on its own. This handle can
+            // be closed. 
+            serverProcess.Close();
+            }
+        }
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/flextimerservermonitor/traces/OstTraceDefinitions.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,4 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* 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:
+*
+*/
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+	
+	DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in \epoc32\include
+// Example: 
+/*
+\agnmodel\inc\AGMCOMON.H
+*/
+../rom/testflextimer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(testflextimer.iby)
+../init/testflextimer.ini /epoc32/data/z/system/data/testframework.ini
+../init/testflextimer.ini /epoc32/wins/c/TestFramework/testframework.ini
+../init/testflextimer.ini /epoc32/winscw/c/TestFramework/testframework.ini
+
+
+PRJ_TESTMMPFILES
+	
+	TestFlexTimer.mmp
+
+PRJ_MMPFILES
+	
+//	TestFlexTimer_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+\agnmodel\group\agnmodel.mmp
+#if defined(MARM)
+\agnmodel\group\agsvexe.mmp
+#endif
+*/
+
+#include "../flextimerservermonitor/group/bld.inf"
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/group/testflextimer.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          testflextimer.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+VENDORID		VID_DEFAULT
+
+EPOCALLOWDLLDATA
+
+DEFFILE         testflextimer.def
+
+USERINCLUDE     ../inc 
+USERINCLUDE     ../flextimerservermonitor/inc
+USERINCLUDE     ../../../server/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          testflextimer.cpp 
+SOURCE          testcflextimer.cpp 
+SOURCE          inheritedcflextimer.cpp
+SOURCE			inheritedcflextimer2.cpp
+SOURCE			testflexperiodic.cpp 
+SOURCE			testrflextimer.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			flextimerclient.lib
+LIBRARY         flextimerservermonitorclient.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/group/testflextimer.pkg	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,60 @@
+;
+; 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 STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+"\epoc32\release\armv5\udeb\TestFlexTimer.dll"   -   "!:\Sys\Bin\TestFlexTimer.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/group/testflextimer_doxyfile.txt	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,239 @@
+#
+# 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 the License "Symbian Foundation License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+# 
+# Description:
+#
+#
+
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = TestFlexTimer
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = \TestFlexTimer\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = \TestFlexTimer\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/group/testflextimer_nrm.mmp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: MMP file for STIF Test Framework's Normal test module.
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          testflextimer.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY      ALL -TCB
+VENDORID     	VID_DEFAULT
+
+EPOCALLOWDLLDATA
+
+DEFFILE         testflextimer.def
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../flextimerservermonitor/inc
+USERINCLUDE     ../../../server/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+
+SOURCE          testflextimer.cpp 
+SOURCE          testcflextimer.cpp
+SOURCE          inheritedcflextimer.cpp
+SOURCE			inheritedcflextimer2.cpp
+SOURCE			testflexperiodic.cpp 
+SOURCE			testrflextimer.cpp
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			flextimerclient.lib
+LIBRARY         flextimerservermonitorclient.lib
+
+LANG            SC
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/inheritedcflextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,98 @@
+/*
+ * 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:  CInheritedCFlexTimer inherits and implements CFlexTimer for testing purposes.
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef CINHERITEDCFLEXTIMER_H
+#define CINHERITEDCFLEXTIMER_H
+
+// INCLUDE FILES
+#include "flextimer.h"
+
+// CLASS DECLARATION
+/**
+ *  desc
+ *
+ *  @see CFlexTimer
+ *  @see CPeriodic
+ *
+ */
+class CInheritedCFlexTimer : public CFlexTimer
+    {
+public:
+
+    /**
+     * A leaving constructor for the object.
+     * @param aPriority of the active object. If timing is critical, it
+     * should be higher than that of all other active objects owned by the
+     * scheduler.
+     * @return A pointer to a CInheritedCFlexTimer object on success.
+     * On error it leaves.
+     */
+    static CInheritedCFlexTimer* NewL( TInt aPriority,
+            TCallBack aCallBack );
+
+    /**
+     * Destructor for the object.
+     */
+    virtual ~CInheritedCFlexTimer();
+
+    /**
+     * desc
+     */
+    void SetCB( TCallBack aCallBack );
+
+    /**
+     * desc
+     */
+    TInt MyOwnConfigure( TTimeIntervalMicroSeconds32 aDelayWindow );
+
+protected:
+
+    /**
+     * Inherited from CActive.
+     */
+    virtual void RunL();
+
+private:
+
+    /**
+     * Constructs the object. The second phase of the construction.
+     */
+    void ConstructL();
+
+    /**
+     * Private constructor for the object.
+     * @param aPriority The priority of the active object. If timing is
+     * critical, it should be higher than that of all other active objects
+     * owned by the scheduler.
+     */
+    CInheritedCFlexTimer( TInt aPriority, TCallBack aCallBack );
+
+private:
+
+    /**
+     * The callback function which is called at the completion of
+     * flextimer server requests.
+     */
+    TCallBack iCallBack;
+
+    };
+
+#endif /* CINHERITEDCFLEXTIMER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/inheritedcflextimer2.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,100 @@
+/*
+ * 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:  CInheritedCFlexTimer inherits and implements CFlexTimer for testing purposes.
+ *
+ */
+
+/*
+ * %version: 1 %
+ */
+
+#ifndef CINHERITEDCFLEXTIMER2_H
+#define CINHERITEDCFLEXTIMER2_H
+
+// INCLUDE FILES
+#include "flextimer.h"
+
+// CLASS DECLARATION
+/**
+ *  desc
+ *
+ *  @see CFlexTimer
+ *  @see CPeriodic
+ *
+ */
+class CInheritedCFlexTimer2 : public CFlexTimer
+    {
+public:
+
+    /**
+     * A leaving constructor for the object.
+     * @param aPriority of the active object. If timing is critical, it
+     * should be higher than that of all other active objects owned by the
+     * scheduler.
+     * @return A pointer to a CInheritedCFlexTimer2 object on success.
+     * On error it leaves.
+     */
+    static CInheritedCFlexTimer2* NewL( TInt aPriority,
+            TCallBack aCallBack, TInt aId );
+
+    /**
+     * Destructor for the object.
+     */
+    virtual ~CInheritedCFlexTimer2();
+
+    /**
+     * desc
+     */
+    void SetCB( TCallBack aCallBack );
+
+    /**
+     * desc
+     */
+    TInt MyOwnConfigure( TTimeIntervalMicroSeconds32 aDelayWindow );
+
+protected:
+
+    /**
+     * Inherited from CActive.
+     */
+    virtual void RunL();
+
+private:
+
+    /**
+     * Constructs the object. The second phase of the construction.
+     */
+    void ConstructL();
+
+    /**
+     * Private constructor for the object.
+     * @param aPriority The priority of the active object. If timing is
+     * critical, it should be higher than that of all other active objects
+     * owned by the scheduler.
+     */
+    CInheritedCFlexTimer2( TInt aPriority, TCallBack aCallBack, TInt aId );
+
+private:
+
+    /**
+     * The callback function which is called at the completion of
+     * flextimer server requests.
+     */
+    TCallBack iCallBack;
+
+    TInt iId;
+
+    };
+
+#endif /* CINHERITEDCFLEXTIMER2_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/testcflextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,972 @@
+/*
+ * ============================================================================
+ *  Name        : testflexperiodic.h
+ *  Part of     : src / testflextimer
+ *  Description : STIF test cases for CFlexPeriodic timer.
+ *  Version     : %version: 1 %
+ *
+ *  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *  All rights reserved.
+ *  This component and the accompanying materials are made available
+ *  under the terms of the License "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:
+ *  Nokia Corporation
+ * ============================================================================
+ * Template version: 4.2
+ */
+
+#ifndef TESTCFLEXTIMER_H
+#define TESTCFLEXTIMER_H
+
+#include <e32base.h>
+#include "testflextimer.h"
+#include "inheritedcflextimer2.h"
+// FORWARD DECLARATIONS
+class CTestFlexTimer;
+
+class TTimerStruct
+    {
+public:
+    CInheritedCFlexTimer2 *iTimer;
+    TExtendedTestResult *iEResult;
+    TInt iTimersRunning; //For quick check that how many timers are currently running
+    TInt iCurrentlyActive; // Stupid as hell, but won't do another container
+    // This is only valid in first item and tells which item
+    // e.g CB belongs to.
+    CPeriodic *iStartTimer; // Same but this is start timer pointer.
+    TTimerStruct() :
+        iTimer(0), iEResult(0), iTimersRunning(0), iCurrentlyActive(0),
+                iStartTimer(0)
+        {
+        }
+    ;
+    };
+
+/**
+ *  STIF test cases for CFlexTimer class.
+ *  This class implements test cases for testing CFlexTimer class.
+ *
+ *  @since TB10.1
+ */
+NONSHARABLE_CLASS( CTestCFlexTimer ) : public CBase
+    {
+
+public:
+
+    /**
+     * Destructor.
+     */
+    virtual ~CTestCFlexTimer();
+
+    // Creating and firing timers - normal cases
+
+    /**
+     * @brief Create and destroy a timer - After
+     * 
+     * Test that timer can be instantiated and deleted.<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Create, start and delete timer.
+     * 
+     * @param aResult Result of the test for the FW.
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndDestroyCFlexTimerL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Create and expire a timer - After
+     * 
+     * Test that timer expires at it's max time <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - See that timeout is happening at latest possible moment.
+     * 
+     * @param aResult Result of the test for the FW.
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndExpireCFlexTimerL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Create two timers and expire those - overlapping - After 32bit
+     * 
+     * Test that two overlapping timers are fired at latest possible moment<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use overlapping time windows. (default window).<BR>
+     * - See that both timers expire when first timer expires.<BR>
+     * - Use 32bit After()
+     * 
+     * @param aResult Result of the test for the FW.
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndExpireTwoOverlappingAfterTimersL(
+            TTestResult& aResult, CTestFlexTimer *cb );
+
+    /**
+     * @brief Create two timers and expire those - overlapping - After 64bit
+     * 
+     * Test that two overlapping timers are fired at latest possible moment<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use overlapping time windows. (default window).<BR>
+     * - See that both timers expire when first timer expires.<BR>
+     * - use 64bit After().
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndExpireTwoOverlappingAfterTimers64L(
+            TTestResult& aResult, CTestFlexTimer *cb );
+
+    /**
+     * @brief Create two timers and expire those - not overlapping - After
+     * 
+     * Test that two timer that are not overlapping are fired at their own max time.<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use non-overlapping time windows. (default window).<BR>
+     * - See that both timers expire at latest possible moment.<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndExpireTwoNonOverlappingAfterTimersL(
+            TTestResult& aResult, CTestFlexTimer *cb );
+
+    /**
+     * @brief Create 2000 timers and expire those - After
+     * 
+     * Test that many timers are started and expired at rapid sequence<BR><BR>
+     * - Use class that is inherited from CFlexTimer.
+     * - Start and expire at 2000 timers. Some of having overlapping
+     * windows (default window)with each other and others not having.<BR> 
+     * - See that all timers expire within their window. Start timers so that at least 1000 timers.
+     * - are running simultaneously. <BR>
+     * - No need to check that they expire at latest possible moment
+     * - that is checked in algorithm tests.
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt HumongousAmountOfTimeridelidilidousL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Create and expire three timers - After/At/AtUTC
+     * 
+     * Test that At, After and AtUTC are handled equally<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start timers and wait for them to expire.<BR>
+     * - Start timers so that timers started with After and At
+     * overlap and timer started with AtUTC does not overlap.<BR>
+     * - See that After and At expire at the same time and that
+     * - AT UTC expires at it's max time
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CreateAndExpireThreeTimersL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    // Cancelling timers - normal cases
+
+    /**
+     * @brief Cancel a timer
+     * 
+     * See that normal cancelling works<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start timers With At, AtUTC and After.<BR>
+     * - Cancel a running timers and see that those do not expire anymore.<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt NormalCancelL( TTestResult& aResult, CTestFlexTimer *cb );
+
+    /**
+     * @brief Cancel a timer that would have triggered another timer - After
+     * 
+     * Test that canceling timer actually cancels it<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start two timers with overlapping windows.<BR>
+     * - Cancel first timer before it expires and check that
+     * second timer is fired at it's max time.
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt CancelTimerThatWouldHaveTriggeredAnotherTimerL(
+            TTestResult& aResult, CTestFlexTimer *cb );
+
+    //Configuring align window
+
+    /**
+     * @brief Configure time window - overlap 1
+     * 
+     * Test that Timers are triggered correctly after Configure<BR><BR> 
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use two timers. Set first timer having 50% window
+     * and second having 10% window.<BR>
+     * - Set timers so that first timers max window overlaps 1s with
+     * second timers window -> first timer causes second timer to be fired 
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureCTimerOverlap1L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure time window - overlap 2
+     * 
+     * Test that Timers are triggered correctly after Configure<BR><BR> 
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use 64bit IF.
+     * - Use two timers. Set first timer having 50% window
+     * and second having 10% window.<BR>
+     * - Set timers so that first timers min window overlaps 1s with
+     * second timers window -> second timer causes first timer to be fired 
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureCTimerOverlap2L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure time window - overlap 3
+     * 
+     * Test that if many Configures are used, latest is the one that remains. Also test 0 and 100% values<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use two timers. Set first timer having 0% window
+     * then overwrite that by giving 100% window to first timer.<BR>
+     * - Give second timer 0% window.<BR>
+     * - Start second timer so that it overlaps with first timer<BR>
+     * - See that first timer is fired when second is fired. 
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureCTimerOverlap3L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure time window - non-overlap
+     * 
+     * Test that Timers are triggered correctly after Configure<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use two timers. Set first timer having 0% window
+     * and second having 10% window.<BR>
+     * - Set timers so that second timers max window is 1 seconds earlier than first timers
+     * min window.<BR>
+     * - See that both timers fire at max time
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureCTimerNonOverlap1L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure time window - non-overlap 2
+     * 
+     * Test that Timers are triggered correctly after Configure<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Use two timers. Set first timer having 100% window
+     * - then overwrite that by giving first timer 50% window.<BR>
+     * - Give second timer 50% window.<BR>
+     * - Set timers so that second timers max window is 1 seconds earlier than first timers
+     * min window.<BR>
+     * - See that both timers fire at max time
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureCTimerNonOverlap2L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    //Time changes
+    /**
+     * @brief System time changes
+     * 
+     * Test that changing system time cancels AT and AtUTC timers and leaves After timers running<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start three timers. At/AtUTC/After<BR>
+     * - Change system time e.g. User::SetHomeTime()<BR>
+     * - See that At/AtUTC timers are cancelled with error code KErrAbort<BR>
+     * - See that remaining timer is fired at max time<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt SystemTimeChangesL( TTestResult& aResult, CTestFlexTimer *cb );
+
+    /**
+     * @brief Timezone changes
+     * 
+     * Test that changing time zone cancels AT and AtUTC timers and leaves After timers running<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start three timers. At/AtUTC/After<BR>
+     * - Change timezone e.g. User::SetUTCOffset()<BR>
+     * - See that At/AtUTC timers are cancelled with error code KErrAbort<BR>
+     * - See that remaining timer is fired at max time
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt TimeZoneChangesL( TTestResult& aResult, CTestFlexTimer *cb );
+
+    // Misuse of API cases
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that stupid parameters do not cause any harm<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(32bit) with interval 1. See that timer expires almost right away<BR>
+     * - Call After(32bit) with interval 0x7FFFFFFF. Cancel timer<BR>
+     * - Call After(64bit) with interval 1. See that timer expires almost right away<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimerL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that calling After(32bit) with zero interval panics client<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(32bit) with interval 0.
+     * - See that client is paniced
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimerZero32bitL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that calling After(64bit) with zero interval panics client<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(64bit) with interval 0.
+     * - See that client is paniced
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimerZero64bitL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that calling After(64bit) with 0xFFFFFFFFFFFFFFFF interval panics client<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(64bit) with interval 0xFFFFFFFFFFFFFFFF.
+     * - See that client is paniced
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimer64MaxL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that calling After(64bit) with three years interval panics client<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(64bit) with interval 93312000*1000*1000.
+     * - See that client is paniced
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimer64ThreeYearsL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After with dumbass parameters 
+     * 
+     * Test that calling After(64bit) with one year interval panics client<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(64bit) with interval 30*1000*1000*1000*1000.
+     * - Cancel timer
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt DumbAssParametersForCTimer64OneYearL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief call After with invalid parameters 
+     * 
+     * Test that negative intervals cause panic in After()<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(32bit) with negative interval See that it causes a panic.<BR>
+     * TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AfterWithNegativeValueL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call After(64bit) with invalid parameters 
+     * 
+     * Test that negative intervals cause panic in After()<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call After(64bit) with negative interval See that it causes a panic.<BR>
+     * TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AfterWithNegativeValue64L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief call At with current time 
+     * 
+     * Test that At() with current time panics<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call At with current time. See that client panics<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AtWithCurrentTimeL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief call AtUTC with current time 
+     * 
+     * Test that AtUTC() with current time panics<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call At with current time. See that client panics<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AtUTCWithCurrentTimeL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    /**
+     * @brief call At with time three years from now 
+     * 
+     * Test that At() with three years from now panics<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call At with three years from now. See that client panics<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AtWithThreeYearsL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    /**
+     * @brief call At with time one year from now 
+     * 
+     * Test that At() with one year from now panics<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call At with one year from now. 
+     * - Cancel timer<BR>
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AtWithOneYearL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief call At/AtUTC with invalid parameters 
+     * 
+     * Test that calling At() with time that is in the past causes panic<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call At with time in the past<BR>
+     * See that it causes panic TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt AtWithTimeInThePastL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Cancel an expired timer - After
+     * 
+     * Test that calling already expired timer does not cause any harm<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start timer and wait for it to expire. After it expires
+     * cancel it<BR>
+     * - Start timer again and see that it expires normally.
+     * 
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt
+            CancelExpiredTimerL( TTestResult& aResult, CTestFlexTimer *cb );
+
+    // Hilarious Configure calls
+    /**
+     * @brief Left edge of the time window lays in the past - max check
+     * 
+     * Test that no harm is done if left side of the window lays in the past<BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure with window_size x.<BR>
+     * - Call After with interval < x.<BR>
+     * - See that timer expires when max time is reached
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureLeftSideInThePastL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Left edge of the time window lays in the past - window check
+     * 
+     * Test that window works when left side of the window lays in the past <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure with window_size x.<BR>
+     * - Call After with interval < x.<BR>
+     * - Start another timer that expires before first timer.<BR>
+     * - See that both timers expire when max time of the second timer is reached.
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureLeftSideInThePastWindowCheckL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure(32bit) with negative window_size
+     * 
+     * Test that negative window panics client <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure(32bit) with negative window_size value.<BR>
+     * - See that it causes panic TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWithNegativeWindowSize32L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure(64bit) with negative window_size
+     * 
+     * Test that negative window panics client <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure(64bit) with negative window_size value.<BR>
+     * - See that it causes panic TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWithNegativeWindowSize64L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Configure(32bit) with 0xFFFFFFFF window_size
+     * 
+     * Test that 0xFFFFFFFF is valid window size <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure(32bit) with 0xFFFFFFFF window_size value.<BR>
+     * - See that it causes no harm
+     *  
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWithMaxWindow32L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief Configure(64bit) with three year window_size
+     * 
+     * Test that negative window panics client <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure(64bit) with three year window_size value.<BR>
+     * - See that it causes panic TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWithThreeYearWindow64L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+    
+    /**
+     * @brief Configure(64bit) with max window_size
+     * 
+     * Test that negative window panics client <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Call Configure(64bit) with max window_size value.<BR>
+     * - See that it causes panic TODO what panic? Shouldn't this read in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWithMaxWindow64L( TTestResult& aResult,
+            CTestFlexTimer *cb );
+        
+    /**
+     * @brief Call configure after starting timer
+     * 
+     * Test that configure is not used and returns error while timer is already running <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start timer.<BR>
+     * - Call Configure.<BR>
+     * - See that configure returns KErrInUse.<BR>
+     * - See that timer expires normally.
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt ConfigureWhileTimerIsInUseL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /**
+     * @brief Start timer twice
+     * 
+     * Test that client is paniced if timer is started twise <BR><BR>
+     * - Use class that is inherited from CFlexTimer.<BR>
+     * - Start timer with After()<BR>
+     * - Start timer again with At()<BR>
+     * - See that client panics with code EFlexTimerServerErrorPendingTimer //TODO referense in documentation
+     * 
+     * @param TBD
+     * @return The status of execution of the test. KErrNone if the test
+     *         was executed ok, any system wide errorcode otherwise.
+     */
+    static TInt TimerIsStartedTwiceL( TTestResult& aResult,
+            CTestFlexTimer *cb );
+
+    /*****************************************
+     * CB functions used by CFlexTimer tests *
+     /*****************************************/
+
+    /**
+     * @brief Check timer stop code and stop active scheduler
+     * 
+     * Simple function that stops the active scheduler. Checks that Error code is KErrNone
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackStopSchedulerKErrNone(
+            TAny* aArgument );
+
+    /**
+     * @brief Check timer stop code and stop active scheduler
+     * 
+     * Simple function that stops the active scheduler. Checks that Error code is KErrCancel
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackStopSchedulerKErrCancel(
+            TAny* aArgument );
+
+    /**
+     * @brief Check timer stop code and stop active scheduler
+     * 
+     * Simple function that stops the active scheduler. Checks that Error code is KErrAbort
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackStopSchedulerKErrAbort(
+            TAny* aArgument );
+
+    /**
+     * @brief Check timer stop code
+     * 
+     * Simple function that checks that Error code is KErrNone
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackKErrNone( TAny* aArgument );
+
+    /**
+     * @brief Check timer stop code
+     * 
+     * Simple function that checks that Error code is KErrAbort
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackKErrAbort( TAny* aArgument );
+
+    /**
+     * @brief Check error code and mark timestamps
+     * 
+     * Function that checks that Error code is KErrNone. ans saves timestamps
+     * @see CreateAndExpireTwoOverlappingAfterTimersL
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackKErrNoneMarkTimestamp(
+            TAny* aArgument );
+
+    /**
+     * @brief Check error code and mark timestamps
+     * 
+     * Function that checks that Error code is KErrNone. ans saves timestamps
+     * @see CreateAndExpireTwoOverlappingAfterTimersL
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt InheritedFlexTimerCallbackKErrNoneMarkTimestampStopScheduler(
+            TAny* aArgument );
+
+    /**
+     * @brief Stop active scheduler
+     * 
+     * Function that stops the active scheduler
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StopActiveScheduler( TAny* aArgument );
+
+    /**
+     * @brief Changes system time and cancels CPeriodic given as parameter
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt ChangeSystemTime1sAndCancel( TAny* aArgument );
+
+    /**
+     * @brief Changes system time and cancels CPeriodic given as parameter
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt ChangeTimeZoneAndCancel( TAny* aArgument );
+
+    /**
+     * @brief Changes system time and cancels CPeriodic given as parameter
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt ChangeSecureTimeAndCancel( TAny* aArgument );
+
+    /**
+     * @brief cancel CFlexTimer given as parameter
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CancelCFlexTimer( TAny* aArgument );
+
+    /**
+     * @brief See that expiry reason is correct. Array versio
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StopSchedulerKErrNoneArray( TAny* aArgument );
+
+    /**
+     * @brief cancel CFlexTimer given as parameter also cancel CPeriodic
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CancelCFlexTimerCancelPeriodic( TAny* aArgument );
+    /**
+     * @brief cancel CFlexTimer given as parameter
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CancelCFlexTimerArray( TAny* aArgument );
+    /**
+     * @brief cancel CFlexTimer given as parameter and stops active scheduler
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CancelCFlexTimerAndStopActiveScheduler( TAny* aArgument );
+
+    /**
+     * @brief stops activescheduler and cancels it self
+     * 
+     * N/A
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StopSchedulerAndCancel( TAny* aArgument );
+
+    /**
+     * @brief Not called CB
+     * 
+     * Fails if gets called
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt NotCalledCB( TAny* aArgument );
+    
+    /**
+     * @brief Callback function, that calls StartTimerAndAddToList
+     * 
+     * -
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CTestCFlexTimer::StartTimerAndAddToListCB( TAny* aArgument );
+    /**
+     * @brief Start random timer and add it to list given as parameter
+     * 
+     * -
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StartTimerAndAddToList(
+        RArray<TTimerStruct>* aArgument, TInt aTimers );
+
+    /**
+     * @brief Stop timer and mark time to list given as parameter
+     * 
+     * -
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StopTimer( TAny* aArgument );
+    /**
+     * @brief Try to configure timer and see that KErrInUse is returned
+     * 
+     * -
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt ConfigureKErrInUseArray( TAny* aArgument );
+
+    /**
+     * @brief start timer again
+     * 
+     * -
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt StartTimerAgainArray( TAny* aArgument );
+    
+    /**
+     * @brief Create two overlapping timers and start, run and expire them
+     * during high CPU load.
+     * 
+     * Test steps:<BR>
+     * 1. Create CFlexTimer_1, (inteval = 10s, window=0.2*10s (default))<BR>
+     * 2. Create CFlexTimer_2, (inteval = 8s, window=0.2*8s (default))<BR>
+     * 3. Start 99% CPU Load<BR>
+     * 4. Start timers<BR>
+     * 5. Wait timers to expire<BR>
+     * 6. Stop CPU load<BR>
+     * 5. Check that timers expired within ~8sec<BR>
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CTestCFlexTimer::CpuLoadCreateAndExpireTwoOverlappingAfterTimersL(
+            TTestResult& aResult, CTestFlexTimer *cb );
+    
+    /**
+     * @brief Create 100  timers and start, run and expire them during high
+     *  CPU load.
+     * 
+     * Test steps:<BR>
+     * 1. Create 100 random timers with random interval and window.<BR>
+     * 3. Start 98% CPU Load<BR>
+     * 4. Start timers<BR>
+     * 5. Wait timers to expire<BR>
+     * 6. Stop CPU load<BR>
+     * 5. Check that timers expired within expected limits.<BR>
+     * 
+     * @param N/A
+     * @return N/A
+     */
+    static TInt CTestCFlexTimer::CpuLoadManyTimersL(
+            TTestResult& aResult, CTestFlexTimer *cb );
+private:
+
+    /**
+     * Constructor is private to prevent instantiation of the class. 
+     */
+    CTestCFlexTimer();
+
+    };
+
+#endif // TESTCFLEXTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/testflexperiodic.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,775 @@
+/*
+* ============================================================================
+*  Name        : testflexperiodic.h
+*  Part of     : src / testflextimer
+*  Description : STIF test cases for CFlexPeriodic timer.
+*  Version     : %version: 1 %
+*
+*  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+*  All rights reserved.
+*  This component and the accompanying materials are made available
+*  under the terms of the License "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:
+*  Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef TESTFLEXPERIODIC_H
+#define TESTFLEXPERIODIC_H
+
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CFlexPeriodic;
+
+/**
+ *  STIF test cases for CFlexPeriodic class.
+ *  This class is only a container for STIF test cases - it should NOT be
+ *  instantiated, just call the static functions.
+ *
+ *  @lib testflextimer.lib
+ *  @since TB10.1
+ */
+NONSHARABLE_CLASS( CTestFlexPeriodic ) : public CBase
+    {
+
+/**
+ * Data for restarting timer in callback function.
+ */
+struct TRestartInfo
+    {
+    CFlexPeriodic* iTimer;                      ///< Pointer to the timer
+    TInt iFirstTicksLeft;                       ///< Number of times the 1st timer settings are run
+    RArray<TTime>* iFirstTimestamps;            ///< Timestamps for the 1st timer settings
+    RArray<TTime>* iSecondTimestamps;           ///< Timestamps for the 2nd timer settings
+    TTimeIntervalMicroSeconds iSecondInterval;  ///< Interval for the 2nd timer settings
+    };
+
+/**
+ * Data for CFlexPeriodic::Configure() tests
+ */
+struct TConfigureInfo
+    {
+    CFlexPeriodic* iTimer;   ///< Pointer to the timer under testing
+    TInt iDelayWindow;       ///< value for delay window to be set
+    TInt iIntervalWindow;    ///< value for interval window to be set
+    TInt iConfigResult32;    ///< Result of configure(32 bit)
+    TInt iConfigResult64;    ///< Result of configure(64 bit)
+    };
+
+/**
+ * Data for running a test case in own thread
+ */
+struct TTestCaseArguments
+    {
+    TInt (*iTestFunction)( TTestResult&, CTestFlexTimer* ); ///< Function pointer to the test case to be run
+    TTestResult& iResult;                                   ///< The result of the test (argument for the test case)
+    CTestFlexTimer* iCallback;                              ///< Pointer to the STIF test class (argument for the test case)
+    };
+
+public:
+
+    /**
+    * Destructor.
+    */
+    virtual ~CTestFlexPeriodic();
+
+    /**
+    * @brief Create and expire CFlexPeriodic timer.
+    * 
+    * Create and start one CFlexPeriodic timer with 1 sec delay and interval 
+    * wait for 5 secs. Check that the timer has been expired at correct times.
+    * 
+    * Timer expiration times (sec):
+    * 1, 2, 3, 4, ...
+    * 
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Start() 32-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartOneTimerL( TTestResult& aResult, 
+                                CTestFlexTimer* aCallback );
+    
+    /**
+    * @brief Create and expire CFlexPeriodic timer with Error CB.
+    * 
+    * Create and start one CFlexPeriodic timer with 1 sec delay and interval 
+    * wait for 5 secs. Give timer also Error CB argument.
+    * Check that the timer has been expired at correct times.
+    * If callback gets called case panics.
+    * 
+    * Timer expiration times (sec):
+    * 1, 2, 3, 4, ...
+    * 
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Start() 32-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartOneTimerWithErrorCbL( TTestResult& aResult, 
+                                CTestFlexTimer* aCallback );
+    
+    /**
+    * @brief Restart CFlexPeriodic in callback function. 
+    *
+    * Start a periodic timer with 1 sec delay and interval.
+    *
+    * After 2 expiration cancel and start the timer in its callback function
+    * with 2 secs delay and interval.
+    * 
+    * Timer expiration times (sec):
+    * 1, 2, 4, 6, 8, ...
+    * 
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Start() 64-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    * - Cancelling and starting timer in callback function
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallbackRestartL( TTestResult& aResult, 
+                                  CTestFlexTimer* aCallback ); 
+
+    /**
+    * @brief Configure window sizes, 32 bit
+    * 
+    * Start 2 timers:
+    * T1:
+    * - delay       3.0 sec, window 0.0 sec
+    * - interval    2.0 sec, window 1.5 sec
+    * T2:
+    * - delay       3.5 sec, window 1.5 sec
+    * - interval    1.0 sec, window 0.0 sec
+    *
+    * Both timers shoud expire at (sec)
+    * 3.0, 4.0, 5.0, 6.0, ...
+    * 
+    * Functionality of delay window is tested in sec 3.0 expiration and
+    * functionality of interval window is tested in other expirations.
+    *
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Configure() 32-bit
+    * - CFlexPeriodic::Start() 32-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    * - Delay
+    * - Interval
+    * - Delay window
+    * - Interval window  
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWindow32L( TTestResult& aResult,
+                                    CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Configure window sizes, 64 bit
+    * 
+    * @see ConfigureWindow32L for test setup.
+    * 
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Configure() 64-bit
+    * - CFlexPeriodic::Start() 64-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    * - Delay
+    * - Interval
+    * - Delay window
+    * - Interval window  
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWindow64L( TTestResult& aResult,
+                                    CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Configure window sizes, 32 bit and 64 bit
+    * 
+    * @see ConfigureWindow32L for test setup.
+    * 
+    * Tests:
+    * - CFlexPeriodic::NewL()
+    * - CFlexPeriodic::Configure() 32-bit
+    * - CFlexPeriodic::Configure() 64-bit
+    * - CFlexPeriodic::Start() 32-bit
+    * - CFlexPeriodic::Start() 64-bit
+    * - CFlexPeriodic::Cancel()
+    * - CFlexPeriodic::~CFlexPeriodic()
+    * - Expiration of CFlexPeriodic timers
+    * - Delay
+    * - Interval
+    * - Delay window
+    * - Interval window  
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWindowMixL( TTestResult& aResult,
+                                     CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Configure timer after it has been started.
+    * 
+    * Start two timers:
+    * T1:
+    * - delay 1 microsecond, window 0
+    * - interval 1 sec, window 0
+    * 
+    * T2:
+    * - delay 2 sec, default window
+    * - interval 2 sec, default window
+    * 
+    * Try to configure T2 with 1.5 sec delay and interval windows by both
+    * 32 bit and 64 bit Configure(). Check that configure returns KErrInUse
+    * and it has not changed the window sizes. The timer expirations should be
+    * T1: 1, 2, 3, 4, 5, 6, 7, 8, ...
+    * T2:    2,    4,    6,    8, ...  
+    * 
+    * Cancel the timer T2 and set its callback function to call Configure() 
+    * (32 bit and 64 bit versions) while the timer is running. Check that both
+    * configurations return KErrInUse
+    *
+    * Cancel timer T2 and configure its delay and interval windows to 1.5 sec.
+    * Let the timer(s) run a while and check that the timer expirations are:
+    * T1: ..., 10, 11, 12, 13, ...
+    * T2: ..., 10, 11, 12, 13, ...
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureAfterStartL( TTestResult& aResult,
+                                      CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start a running timer.
+    * 
+    * Test should panic with E32USER-CBase 42 (attempt to active CActive when 
+    * a request is still outstanding).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartAfterStartL( TTestResult& aResult,
+                                  CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start a running timer in its callback function.
+    * 
+    * Test should panic with E32USER-CBase 42 (attempt to active CActive when 
+    * a request is still outstanding).
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartInCallbackL( TTestResult& aResult,
+                                  CTestFlexTimer* aCallback );
+
+    /**
+    * Start timer with negative delay (32 bit).
+    * 
+    * Start should panic with CFlexPeriodic 6 (EFlexPeriodicDelayLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNegativeDelay32L( TTestResult& aResult, 
+                                           CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with zero interval (32 bit).
+    * 
+    * Start should panic with CFlexPeriodic 7 (EFlexPeriodicIntervalTooSmall)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithZeroInterval32L( TTestResult& aResult, 
+                                          CTestFlexTimer*  aCallback  );
+    
+    /**
+    * @brief Start timer with negative interval (32 bit).
+    * 
+    * Start should panic with CFlexPeriodic 7 (EFlexPeriodicIntervalTooSmall)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNegativeInterval32L( TTestResult& aResult, 
+                                              CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with negative delay (64 bit).
+    * 
+    * Start should panic with CFlexPeriodic 6 (EFlexPeriodicDelayLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNegativeDelay64L( TTestResult& aResult, 
+                                          CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with zero interval (64 bit).
+    * 
+    * Start should panic with CFlexPeriodic 7 (EFlexPeriodicIntervalTooSmall)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithZeroInterval64L( TTestResult& aResult, 
+                                          CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with negative interval (64 bit).
+    * 
+    * Start should panic with CFlexPeriodic 7 (EFlexPeriodicIntervalTooSmall)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNegativeInterval64L( TTestResult& aResult, 
+                                              CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Configure timer with negative delay window (32 bit).
+    * 
+    * Configure should panic with CFlexPeriodic 9 
+    * (EFlexPeriodicIntervalWindowLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWithNegativeDelayWindow32L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Configure timer with negative interval window (32 bit).
+    * 
+    * Configure should panic with CFlexPeriodic 8 
+    * (EFlexPeriodicDelayWindowLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWithNegativeIntervalWindow32L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Configure timer with negative delay window (64 bit).
+    * 
+    * Configure should panic with CFlexPeriodic 9 
+    * (EFlexPeriodicIntervalWindowLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWithNegativeDelayWindow64L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Configure timer with negative interval window (64 bit).
+    * 
+    * Configure should panic with CFlexPeriodic 8 
+    * (EFlexPeriodicDelayWindowLessThanZero)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ConfigureWithNegativeIntervalWindow64L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    
+    /**
+    * @brief Test timer start allowed value range.
+    * 
+    * Start timers with following parameters:
+    * 
+    * T1:
+    * - Configure (32 bit): delay window 1 sec, interval window 1 sec
+    * - Start (32 bit): delay 0 microseconds, interval 1 sec
+    * 
+    * T2:
+    * - Configure (32 bit): delay window 1 sec, interval window 1 sec
+    * - Start (32 bit): delay 0x7FFFFF microseconds, interval 1 sec
+    * 
+    * T3:
+    * - Configure (32 bit): delay window 1 sec, interval window 1 sec
+    * - Start (32 bit): delay 1 sec, interval 0 microseconds
+    * 
+    * T4:
+    * - Configure (32 bit): delay window 1 sec, interval window 1 sec
+    * - Start (32 bit): delay 1 sec, interval 0x7FFFFF microseconds
+    *
+    * T5:
+    * - Configure (64 bit): delay window 1 sec, interval window 1 sec
+    * - Start (64 bit): delay 0 microseconds, interval 1 sec
+    * 
+    * T6:
+    * - Configure (64 bit): delay window 1 sec, interval window 1 sec
+    * - Start (64 bit): delay 1 year, interval 1 sec
+    * 
+    * T7:
+    * - Configure (64 bit): delay window 1 sec, interval window 1 sec
+    * - Start (64 bit): delay 1 sec, interval 0 microseconds
+    * 
+    * T8:
+    * - Configure (64 bit): delay window 1 sec, interval window 1 sec
+    * - Start (64 bit): delay 1 sec, interval 1 year
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithMinAndMaxL( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    
+    /**
+    * @brief Start timer with maximum delay (64 bit), 0x7FFFFFFFFFFFFFFF.
+    * 
+    * Start should panic with  CFlexPeriodic 24 
+    * (EFlexTimerServerIllegalTimerValue)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithMaximumDelay64L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with maximum interval (64 bit), 0x7FFFFFFFFFFFFFFF.
+    * 
+    * Start should panic with  CFlexPeriodic 24 
+    * (EFlexTimerServerIllegalTimerValue)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithMaximumInterval64L( 
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+    
+    /**
+    * @brief Start timer with NULL callback function (32 bit)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNullCallBack32L(
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    /**
+    * @brief Start timer with NULL callback function (64 bit)
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt StartWithNullCallBack64L(
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+    
+    /**
+    * @brief Crash client with active periodic flexible timer.
+    * 
+    * Start two timers in separate threads:
+    * T1: delay 1 sec, interval 1 sec with default windows
+    * T2: delay 1 sec, interval 1 sec with default windows
+    * 
+    * Panic timer T1's thread after 3 sec.
+    * 
+    * Cancel T2 after 5 sec and check that it had worked correctly.
+    * Implementation of T2 uses test case StartOneTimerL().
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ClientCrashL(
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+
+private:
+
+    /**
+    * Constructor is private to prevent instantiation of the class. 
+    */
+    CTestFlexPeriodic();
+
+    /**
+     * Run active scheduler for given time.
+     * @param aPeriod Time to run active scheduler.
+     */
+    static void WaitL( TTimeIntervalMicroSeconds32 aPeriod );
+
+    /**
+     * Stop the active scheduler. A function for TCallBack.
+     * @param aArgument Not used.
+     * @return KErrNone. Always.
+     */
+    static TInt StopScheduler( TAny* aArgument );
+
+
+    /**
+     * Do nothing. A function for TCallBack.
+     * @param aArgument Not used.
+     * @return KErrNone.
+     */
+    static TInt DoNothing( TAny* aArgument );
+    
+    /**
+     * Panics testcase if get called. A function for TCallBack.
+     * @param aArgument Not used.
+     * @return KErrNone.
+     */
+    static TInt PanicClient( TAny* aArgument );
+    
+    /**
+     * Add current time to given array. A function for TCallBack.
+     * @param aArgument Timestamp storage, type: RArray<TTime>*
+     * @return KErrNone.
+     */
+    static TInt AddTimestamp( TAny* aArgument );
+
+    /**
+     * Restart the given timer. A function for TCallBack.
+     * @param aArgument The restart data, type: TRestartInfo*
+     * @return KErrNone.
+     */
+    static TInt RestartTimer( TAny* aArgument );
+
+    /**
+     * Configure timer without cancellation in callback. A function for 
+     * TCallBack.
+     * @param aArgument The conficure data, type: TConfigureInfo*
+     * @return KErrNone.
+     */
+    static TInt ConfigureTimer( TAny* aArgument );
+
+    /**
+     * Start timer without cancellation in callback. A function for TCallBack.
+     * @param aArgument The timer, type: CFlexPeriodic*
+     * @return KErrNone.
+     */
+    static TInt StartTimer( TAny* aArgument );
+
+    /**
+     * Verify that the timestamps are expired at maximum window
+     * @param aTimestamps An array of times
+     * @param aDelay Requested delay of the 1st time
+     * @param aInterval Requested delay from the 2nd time
+     * @param aDelayWindow Time how much 1st time can be early
+     * @param aIntervalWindow Time how much times can be early from the 2nd time 
+     * @return ETrue if all timestamps are in given delay
+     */
+    static TBool AreTimestampsAtWindow( 
+        const RArray<TTime>& aTimestamps,
+        const TTimeIntervalMicroSeconds32& aDelay,
+        const TTimeIntervalMicroSeconds32& aInterval,
+        const TTimeIntervalMicroSeconds32& aDelayWindow,
+        const TTimeIntervalMicroSeconds32& aIntervalWindow );
+
+    /**
+     * Verify that the timestamps are expired at maximum window
+     * @param aTimestamps An array of times
+     * @param aDelay Requested delay of the 1st time
+     * @param aInterval Requested delay from the 2nd time
+     * @param aDelayWindow Time how much 1st time can be early
+     * @param aIntervalWindow Time how much times can be early from the 2nd time 
+     * @return ETrue if all timestamps are in given delay
+     */
+    static TBool AreTimestampsAtWindow( 
+        const RArray<TTime>& aTimestamps,
+        const TTimeIntervalMicroSeconds& aDelay,
+        const TTimeIntervalMicroSeconds& aInterval,
+        const TTimeIntervalMicroSeconds& aDelayWindow,
+        const TTimeIntervalMicroSeconds& aIntervalWindow );
+
+    /**
+     * Compare two arrays of timestamps.
+     * @param aLeft Array of timestamps to be compared
+     * @param aRight Array of timestamps to be compared
+     * @return ETrue if the arrays has the same timestamps, EFalse otherwise
+     */
+    static TBool AreTimestampsSame( 
+        const RArray<TTime>& aLeft, 
+        const RArray<TTime>& aRight );
+
+    /**
+     * Parameter types of two timers are templated, so, 32 bit and 64 bit
+     * interfaces can be tested without duplicated source code.
+     * 
+     * Possible values for template are:
+     * - TTimeIntervalMicroSeconds
+     * - TTimeIntervalMicroSeconds32
+     */
+    template <class firstType, class secondType> 
+    static TInt ConfigureWindowL( TTestResult& aResult );
+
+    /**
+     * Template function for NOK API test cases.
+     * 
+     * Types for CFlexPeriodic::Start() and CFlexPeriodic::Configure() are
+     * templated, so, 32 bit and 64 bin interfaces can be tested without
+     * duplicated code.
+     * 
+     * Function creates a flexible periodic timer, configures is, starts it.
+     * After one second the timer will be cancelled and destroyed.
+     * 
+     * Possible values for configureType and startType are:
+     * - TTimeIntervalMicroSeconds
+     * - TTimeIntervalMicroSeconds32
+     *
+     * @param aDelay Value for timer's delay in start
+     * @param aInterval Value for timer's interval in start
+     * @param aDelayWindow Value for timer's delay window in configure
+     * @param aIntervalWindow Value for timer's interval window in configure
+     */
+    template <class configureType, class startType>
+    static void ConfigureAndStartTimerL( 
+        RArray<TTime>& aTimestamps,
+        TInt64 aDelay,
+        TInt64 aInterval,
+        TInt64 aDelayWindow,
+        TInt64 aIntervalWindow );
+
+    /**
+    * Start timer with NULL callback function
+    * 
+    * Possible values for startType are:
+    * - TTimeIntervalMicroSeconds
+    * - TTimeIntervalMicroSeconds32
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    template <class startType>
+    static TInt StartWithNullCallBackL(
+        TTestResult& aResult, 
+        CTestFlexTimer*  aCallback  );
+    
+    /**
+    * Run test case in own thread
+    * 
+    * @param aThread The thread in which the test case is run
+    * @param aArguments Arguments for running a test case
+    * @return The status of execution of the test
+    */
+    static TInt RunInThread( 
+        RThread& aThread,
+        TTestCaseArguments& aArguments );
+
+    /**
+    * Start running a thread. A function of format TThreadFunction.
+    * Create trap harness for the thread and call RunTestCaseL()
+    * 
+    * @param aArgument Test case data, type: TTestCaseArguments
+    * @return The status of running the thread
+    */
+    static TInt RunTestCase( TAny* aArgument );
+
+    /**
+    * The second phase of start running a thread.
+    * Initialize scheduler and start the test case.
+    * 
+    * @param aArgument Test case data, type: TTestCaseArguments
+    */
+    static void RunTestCaseL( TAny* aArgument );
+
+    /**
+    * Panic thread after a while. 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt DoPanicL( TTestResult& aResult, CTestFlexTimer*  aCallback  );
+
+    };
+
+#endif // TESTFLEXPERIODIC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/testflextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,373 @@
+/*
+* 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: STIF normal test module declaration
+*
+*/
+
+#ifndef TESTFLEXTIMER_H
+#define TESTFLEXTIMER_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include <NormalHardcodedAssert.h>
+
+// MACROS
+#define TEST_MODULE_VERSION_MAJOR 0
+#define TEST_MODULE_VERSION_MINOR 0
+#define TEST_MODULE_VERSION_BUILD 0
+
+// Logging path
+_LIT( KTestFlexTimerLogPath, "\\logs\\testframework\\TestFlexTimer\\" ); 
+// Log file
+_LIT( KTestFlexTimerLogFile, "TestFlexTimer.txt" ); 
+_LIT( KTestFlexTimerLogFileWithTitle, "TestFlexTimer_[%S].txt" );
+
+_LIT( KTestFlexTimerPanicCategory, "FLEX-TEST" );
+
+// Function pointer related internal definitions
+#define GETPTR &  
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+
+// Forward declaration
+class CTestFlexTimer;
+
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CDemoModule::<NameOfFunction> ( TTestResult& aResult, CTestFlexTimer *cb )
+typedef TInt (*TestFunction)(TTestResult&, CTestFlexTimer*);    
+
+const TInt KTimerAccuracyMicroSeconds = 1000 * 1000; //1s - accuracy of symbian At timer.
+const double KDefaultWindowMultiplier = 0.2; //default window. defined in flextimersession.cpp 
+const TUint KTickInMicroSeconds( 1000000 / 64 ); // One tick = 1/64 sec
+
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC           iCaseName;    
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+    };
+
+//Exteded result that can "return" also status code to CB function 
+class TExtendedTestResult
+    {
+    public:
+        TTestResult *iTestResult; //the real test result
+        TInt iStatusCode; //Return code from timer
+        TBool iCaseAlreadyFailed;
+        TInt iTimerID;
+        TInt64 iTimerStartedTime;
+        TInt64 iTimerStoppedTime;
+        TInt64 iTimerExpiryTime;
+
+    TExtendedTestResult(TTestResult *aResult) : iTestResult( aResult ), iStatusCode(0), iCaseAlreadyFailed(EFalse), 
+            iTimerID(0), iTimerStartedTime(0), iTimerStoppedTime(0) {};
+    };
+// CLASS DECLARATION
+
+/**
+*  This a TestFlexTimer class.
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CTestFlexTimer) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CTestFlexTimer* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CTestFlexTimer();
+  
+    public: // Functions from base classes
+
+        
+        /**
+        * From CTestModuleBase InitL is used to initialize the TestFlexTimer. 
+        *       It is called once for every instance of TestFlexTimer after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of TestFlexTimer.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from TestFlexTimer. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+        /**
+         * Method used to log version of test module
+         */
+        void SendTestModuleVersion();
+
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestFlexTimer();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Check for settings and create logger with test case title in file name.
+        */
+        void CreateTitleLoggerL(void);
+
+        /**
+        * Check for logger settings and delete title logger.
+        */
+        void DeleteTitleLogger(void);
+
+        /**
+         * Function returning test case name and pointer to test case function.
+         * @since ?Series60_version
+         * @param aCaseNumber test case number
+         * @return TCaseInfo 
+         */
+        const TCaseInfo Case( const TInt aCaseNumber ) const;
+
+        /**
+        * Start monitoring FlexTimer server crashes
+        * 
+        * @param aResult The result of the test.
+        * @param aCallback Pointer to the STIF test class
+        * @return The status of execution of the test. KErrNone if the test
+        *         was executed ok, any system wide errorcode otherwise.
+        */
+        static TInt StartServerMonitoringL(
+            TTestResult& aResult, 
+            CTestFlexTimer* aCallback );
+
+        /**
+        * Stop monitoring FlexTimer server crashes and fail the test case if
+        * a crash has happened.
+        * 
+        * @param aResult The result of the test.
+        * @param aCallback Pointer to the STIF test class
+        * @return The status of execution of the test. KErrNone if the test
+        *         was executed ok, any system wide errorcode otherwise.
+        */
+        static TInt StopServerMonitoringL(
+            TTestResult& aResult, 
+            CTestFlexTimer* aCallback );
+        
+        /**
+        * Start second FlexTimerServer. 
+        * 
+        * Increase test coverage by testing server side destructors.
+        * 
+        * Starting of the server fails with panic "FlexTimerServer" 23 
+        * (EFlexTimerServerStartServer).
+        * 
+        * @param aResult The result of the test.
+        * @param aCallback Pointer to the STIF test class
+        * @return The status of execution of the test. KErrNone if the test
+        *         was executed ok, any system wide errorcode otherwise.
+        */
+        static TInt StartSecondServerL(
+            TTestResult& aResult, 
+            CTestFlexTimer* aCallback );
+        
+        /**
+        * Changes Test client thread priority to EPriorityMuchMore
+        * 
+        * @param aResult The result of the test, always Passed.
+        * @param aCallback Pointer to the STIF test class
+        * @return The status of execution of the test. KErrNone always
+        */
+        static TInt SetThreadPriorityMuchMore(
+            TTestResult& aResult, 
+            CTestFlexTimer* aCallback );
+        
+        /**
+        * Changes Test client thread priority to EPriorityNormal
+        * 
+        * @param aResult The result of the test, always Passed.
+        * @param aCallback Pointer to the STIF test class
+        * @return The status of execution of the test. KErrNone always
+        */
+        static TInt SetThreadPriorityNormal(
+            TTestResult& aResult, 
+            CTestFlexTimer* aCallback );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        CStifLogger * iLog;
+
+        // Standard logger
+        CStifLogger *iStdLog;
+
+        // Logger for currently running test case
+        CStifLogger *iTCLog;
+        
+        // Flag saying if test case title should be added to log file name
+        TBool iAddTestCaseTitleToLogName;
+        
+        // Flag saying if test module version was already sent
+        TBool iVersionLogged;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+        
+        //CTimer CB failed case
+        TBool iCTimerCBFailedCase;
+        
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // TESTFLEXTIMER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/inc/testrflextimer.h	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,520 @@
+/*
+* ============================================================================
+*  Name        : testrflextimer.h
+*  Part of     : src / testflextimer
+*  Description : STIF test cases for RFlexTimer
+*  Version     : %version: 1 %
+*
+*  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+*  All rights reserved.
+*  This component and the accompanying materials are made available
+*  under the terms of the License "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:
+*  Nokia Corporation
+* ============================================================================
+* Template version: 4.2
+*/
+
+#ifndef TESTRFLEXTIMER_H
+#define TESTRFLEXTIMER_H
+
+
+#include <e32base.h>
+
+/**
+ *  STIF test cases for RFlexTimer class.
+ *  This class is only a container for STIF test cases - it should NOT be
+ *  instantiated, just call the static functions.
+ *
+ *  @lib testflextimer.lib
+ *  @since TB10.1
+ */
+class CTestRFlexTimer : public CBase
+    {
+
+public:
+
+    /**
+    * Destructor.
+    */
+    virtual ~CTestRFlexTimer();
+
+    /**
+    * @brief Start a timer using After (32 bit) and wait it to expire
+    * 
+    * Open RFlexTimer handle and connect to the server. Set timer to expire
+    * after 3 secs. Close the handle and check that the expiration is done
+    * at correct time.
+    * 
+    * Tests:
+    * - RFlexTimer::RFlexTimer()
+    * - RFlexTimer::Connect()
+    * - RFlexTimer::After() 32 bit
+    * - RFlexTimer::Close()
+    * - RFlexTimer::~RFlexTimer()
+    * - Expiration of timer
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ExpireAfter32L( TTestResult& aResult,
+                                CTestFlexTimer* aCallback );
+
+
+    /**
+    * @brief Start a timer using After (64 bit) and wait it to expire
+    * 
+    * Open RFlexTimer handle and connect to the server. Set timer to expire
+    * after 3 secs. Close the handle and check that the expiration is done
+    * at correct time.
+    * 
+    * Tests:
+    * - RFlexTimer::RFlexTimer()
+    * - RFlexTimer::Connect()
+    * - RFlexTimer::After() 64 bit
+    * - RFlexTimer::Close()
+    * - RFlexTimer::~RFlexTimer()
+    * - Expiration of timer
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ExpireAfter64L( TTestResult& aResult,
+                                CTestFlexTimer* aCallback );
+
+
+    /**
+    * @brief Start a timer using AfterTicks and wait it to expire
+    *
+    * Open RFlexTimer handle and connect to the server. Set timer to expire
+    * after 192 ticks (3 secs). Close the handle and check that the 
+    * expiration is done at correct time.
+    * 
+    * Tests:
+    * - RFlexTimer::RFlexTimer()
+    * - RFlexTimer::Connect()
+    * - RFlexTimer::AfterTicks()
+    * - RFlexTimer::Close()
+    * - RFlexTimer::~RFlexTimer()
+    * - Expiration of timer
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ExpireAfterTicksL( TTestResult& aResult,
+                                   CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start a timer using At and wait it to expire
+    *
+    * Open RFlexTimer handle and connect to the server. Set timer to expire
+    * after 3 secs from now. Close the handle and check that the expiration is
+    * done at correct time.
+    * 
+    * Tests:
+    * - RFlexTimer::RFlexTimer()
+    * - RFlexTimer::Connect()
+    * - RFlexTimer::At()
+    * - RFlexTimer::Close()
+    * - RFlexTimer::~RFlexTimer()
+    * - Expiration of timer
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ExpireAtL( TTestResult& aResult,
+                           CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start a timer using AtUTC and wait it to expire
+    *
+    * Open RFlexTimer handle and connect to the server. Set timer to expire
+    * after 3 secs from now. Close the handle and check that the expiration is
+    * done at correct time.
+    * 
+    * Tests:
+    * - RFlexTimer::RFlexTimer()
+    * - RFlexTimer::Connect()
+    * - RFlexTimer::AtUTC()
+    * - RFlexTimer::Close()
+    * - RFlexTimer::~RFlexTimer()
+    * - Expiration of timer
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ExpireAtUtcL( TTestResult& aResult,
+                              CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start timer using After (32 bit) without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt After32WithoutConnect( TTestResult& aResult,
+                                       CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start timer using After (64 bit) without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt After64WithoutConnect( TTestResult& aResult,
+                                       CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start timer using AfterTicks without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt AfterTicksWithoutConnect( TTestResult& aResult,
+                                          CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start timer using At without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt AtWithoutConnect( TTestResult& aResult,
+                                  CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Start timer using AtUtc without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt AtUtcWithoutConnect( TTestResult& aResult,
+                                     CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Configure (32 bit) timer without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt Configure32WithoutConnect( TTestResult& aResult,
+                                           CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Configure (64 bit) timer without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt Configure64WithoutConnect( TTestResult& aResult,
+                                           CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Cancel timer using RFlexTimer without connecting to the server first.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * KERN-EXEC 0.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CancelWithoutConnect( TTestResult& aResult,
+                                      CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Set timer twice by After.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * RFlexTimer 15 (EFlexTimerServerErrorPendingTimer).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallAfterTwiceL( TTestResult& aResult,
+                                 CTestFlexTimer* aCallback );
+    
+
+    /**
+    * @brief Set timer twice by AfterTicks.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * RFlexTimer 15 (EFlexTimerServerErrorPendingTimer).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallAfterTicksTwiceL( TTestResult& aResult,
+                                      CTestFlexTimer* aCallback );
+    
+    /**
+    * @brief Set timer twice by At.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * RFlexTimer 15 (EFlexTimerServerErrorPendingTimer).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallAtTwiceL( TTestResult& aResult,
+                              CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Set timer twice by AtUTC.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * RFlexTimer 15 (EFlexTimerServerErrorPendingTimer).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallAtUtcTwiceL( TTestResult& aResult,
+                                 CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Connect to timer server twice.
+    *
+    * This tests illeagal usage of the interface and it'll panic with 
+    * RFlexTimer 32 (EFlexTimerAlreadyConnected).
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CallConnectTwiceL( TTestResult& aResult,
+                                   CTestFlexTimer* aCallback );
+
+    
+    /**
+    * @brief Reconnect to timer server.
+    *
+    * Connect, close and connect again the handle.
+    * 
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ReconnectL( TTestResult& aResult,
+                            CTestFlexTimer* aCallback );
+
+    
+    /**
+    * @brief Cancel timer using RFlexTimer without starting it first.
+    *
+    * This tests a leagal uage of the interface. Timer can be cancelled 
+    * without setting it first.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt CancelWithoutStart( TTestResult& aResult,
+                                    CTestFlexTimer* aCallback );
+    
+    /**
+    * @brief Call AfterTicks() with negative value.
+    *
+    * This test illegal usage of the interface. There has to be zero or more 
+    * ticks.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt NegativeTicksInAfterTicksL(
+        TTestResult& aResult, 
+        CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Call AfterTicks() with zero.
+    *
+    * This tests leagal usage of the interface.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ZeroTicksInAfterTicksL(
+        TTestResult& aResult, 
+        CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Change system time during AfterTicks timer is running.
+    * 
+    * Set timer to be expired after 640 ticks (10 sec). After 1 sec from
+    * starting the timer, add system time 3 seconds. Check that the timer
+    * expires after 10 seconds from starting (13 secs by system time).
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt ChangeTimeWhileAfterTicksL(
+        TTestResult& aResult, 
+        CTestFlexTimer* aCallback );
+
+    /**
+    * @brief Test that timer window works correctly.
+    * 
+    * Create three timers:
+    * T1: expire after 4-8 secs
+    * T2: expire after 7-8 secs
+    * T3: expire after 5 secs
+    *
+    * T1 and T2 are AfterTicks -timers T3 is After timer.
+    * 
+    * Check that T1 has expired after 5 secs and T2 after 8 secs of setting.
+    *
+    * @param aResult The result of the test.
+    * @param aCallback Pointer to the STIF test class
+    * @return The status of execution of the test. KErrNone if the test
+    *         was executed ok, any system wide errorcode otherwise.
+    */
+    static TInt TestAfterTicksWindowL(
+        TTestResult& aResult, 
+        CTestFlexTimer* aCallback );
+
+private:
+
+    /**
+    * Constructor.
+    * Keep it private to prevent instantiation of the class.
+    */
+    CTestRFlexTimer();
+
+    /**
+    * Check is the delay in the window.
+    * @param aDelay Interval to be checked.
+    * @param aInterval Interval of the timer.
+    * @param aWindow Allowed window of the timer. 
+    * @return ETrue if the delay is correc, EFalse otherwise.
+    */
+    static TBool IsDelayOk( 
+        const TTimeIntervalMicroSeconds aDelay,
+        const TTimeIntervalMicroSeconds32 aInterval,
+        const TTimeIntervalMicroSeconds32 aWindow );
+
+    /**
+    * Check is the delay in the window.
+    * @param aDelay Interval to be checked.
+    * @param aInterval Interval of the timer.
+    * @param aWindow Allowed window of the timer. 
+    * @return ETrue if the delay is correc, EFalse otherwise.
+    */
+    static TBool IsDelayOk( 
+        const TTimeIntervalMicroSeconds aDelay,
+        const TTimeIntervalMicroSeconds32 aInterval,
+        const TTimeIntervalMicroSeconds aWindow );
+
+    /**
+    * Check is the delay in the window.
+    * @param aDelay Interval to be checked.
+    * @param aInterval Interval of the timer.
+    * @param aWindow Allowed window of the timer. 
+    * @return ETrue if the delay is correc, EFalse otherwise.
+    */
+    static TBool IsDelayOk( 
+        const TTimeIntervalMicroSeconds aDelay,
+        const TTimeIntervalMicroSeconds aInterval,
+        const TTimeIntervalMicroSeconds32 aWindow );
+
+    /**
+    * Check is the delay in the window.
+    * @param aDelay Interval to be checked.
+    * @param aInterval Interval of the timer.
+    * @param aWindow Allowed window of the timer. 
+    * @return ETrue if the delay is correc, EFalse otherwise.
+    */
+    static TBool IsDelayOk( 
+        const TTimeIntervalMicroSeconds aDelay,
+        const TTimeIntervalMicroSeconds aInterval,
+        const TTimeIntervalMicroSeconds aWindow );
+    
+    /**
+    * A helper function for AfterTicks() testing.
+    * -# Creates RFlexTimer handle, 
+    * -# connects it to the server, 
+    * -# configures timer's window (default 0 microseconds),
+    * -# set the timer to expire after given ticks,
+    * -# wait timer to be expired
+    * -# return the delay of the timer
+    * 
+    * @param aTicks Timer's interval in number of ticks
+    * @param aWindowSize Timer's window (default 0 microseconds)
+    * @return The delay of the timer in microseconds
+    */
+    static TTimeIntervalMicroSeconds ExecuteAfterTicksL(
+        TInt aTicks,
+        TTimeIntervalMicroSeconds aWindowSize = 0 );
+    
+private: // data
+
+    };
+
+#endif // TESTRFLEXTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/init/testflextimer.ini	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,217 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                              #                      'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testflextimer
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set filters to be used by ConsoleUI.
+# 	If you want to use filter with ConsoleUI, simply remove comments
+# 	from section below and provide valid filter entries.
+#   Each filter line has to start with "filter= " keyword.
+#   Filter can contain special wildcard characters:
+#     *  which stands for none or any literal;
+#     ?  which stands for single character.
+#   Filters are not case-sensitive.
+
+#[Filters]
+#filter= *math*
+#filter= *radio*
+#[End_Filters]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/rom/testflextimer.iby	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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: Flexible timer tests
+*
+*/
+#ifndef TESTFLEXTIMER_IBY
+#define TESTFLEXTIMER_IBY
+
+#include <bldvariant.hrh>
+
+file=ABI_DIR\BUILD_DIR\testflextimer.dll SHARED_LIB_DIR\testflextimer.dll
+
+#endif // TESTFLEXTIMER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/inheritedcflextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,111 @@
+/*
+ * 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 CFlexPeriodic class
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// System include files
+// User include files go here:
+#include "inheritedcflextimer.h"
+//For exteded test result
+#include "testflextimer.h"
+// External function prototypes
+// Local constants go here
+// Panic category
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer* CInheritedCFlexTimer::NewL( TInt aPriority,
+        TCallBack aCallBack )
+    {
+
+    CInheritedCFlexTimer* self = new (ELeave) CInheritedCFlexTimer(aPriority,
+            aCallBack);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer::~CInheritedCFlexTimer()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// Desc
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer::SetCB( TCallBack aCallBack )
+    {
+    iCallBack = aCallBack;
+    }
+
+// ---------------------------------------------------------------------------
+// Desc
+// ---------------------------------------------------------------------------
+//
+TInt CInheritedCFlexTimer::MyOwnConfigure(
+        TTimeIntervalMicroSeconds32 aDelayWindow )
+    {
+    TInt ret = CFlexTimer::Configure(aDelayWindow);
+    if (ret == KErrNone)
+        {
+        //
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles the active objects request completion event.
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer::RunL()
+    {
+    //Give code to test case
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (iCallBack.iPtr);
+    eRes->iStatusCode = iStatus.Int();
+    iCallBack.CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// Second part of the two-phase construction.
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer::ConstructL()
+    {
+    CActiveScheduler::Add(this);
+    CFlexTimer::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// Private constructor with priority.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer::CInheritedCFlexTimer( TInt aPriority,
+        TCallBack aCallBack ) :
+    CFlexTimer(aPriority), iCallBack(aCallBack)
+    {
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/inheritedcflextimer2.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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 CFlexPeriodic class
+ *
+ */
+/*
+ * %version: 1 %
+ */
+// System include files
+// User include files go here:
+#include "inheritedcflextimer2.h"
+//For exteded test result
+#include "testcflextimer.h"
+#include <e32debug.h>
+// External function prototypes
+// Local constants go here
+// Panic category
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// Constructs the object.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer2* CInheritedCFlexTimer2::NewL( TInt aPriority,
+        TCallBack aCallBack, TInt aId )
+    {
+    RDebug::Printf("CInheritedCFlexTimer2::NewL");
+    CInheritedCFlexTimer2* self = new (ELeave) CInheritedCFlexTimer2(
+            aPriority, aCallBack, aId);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructs the object.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer2::~CInheritedCFlexTimer2()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// Desc
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer2::SetCB( TCallBack aCallBack )
+    {
+    iCallBack = aCallBack;
+    }
+
+// ---------------------------------------------------------------------------
+// Desc
+// ---------------------------------------------------------------------------
+//
+TInt CInheritedCFlexTimer2::MyOwnConfigure(
+        TTimeIntervalMicroSeconds32 aDelayWindow )
+    {
+    TInt ret = CFlexTimer::Configure(aDelayWindow);
+    if (ret == KErrNone)
+        {
+        //
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles the active objects request completion event.
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer2::RunL()
+    {
+    RDebug::Printf("CInheritedCFlexTimer2::RunL");
+    //Give code to test case
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (iCallBack.iPtr);
+    (*list)[0].iCurrentlyActive = iId;
+    (*list)[iId].iEResult->iStatusCode = iStatus.Int();
+    iCallBack.CallBack();
+    }
+
+// ---------------------------------------------------------------------------
+// Second part of the two-phase construction.
+// ---------------------------------------------------------------------------
+//
+void CInheritedCFlexTimer2::ConstructL()
+    {
+    CActiveScheduler::Add(this);
+    CFlexTimer::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// Private constructor with priority.
+// ---------------------------------------------------------------------------
+//
+CInheritedCFlexTimer2::CInheritedCFlexTimer2( TInt aPriority,
+        TCallBack aCallBack, TInt aId ) :
+    CFlexTimer(aPriority), iCallBack(aCallBack), iId(aId)
+    {
+    RDebug::Printf("CInheritedCFlexTimer2::CInheritedCFlexTimer2");
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/testcflextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,3236 @@
+/*
+ * ============================================================================
+ *  Name        : testflexperiodic.cpp
+ *  Part of     : src / testflextimer
+ *  Description : STIF test cases for CFlexPeriodic timer.
+ *  Version     : %version: 1 %
+ *
+ *  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *  All rights reserved.
+ *  This component and the accompanying materials are made available
+ *  under the terms of the License "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:
+ *  Nokia Corporation
+ * ============================================================================
+ * Template version: 4.1
+ */
+
+#include <e32debug.h>           // for RDebug
+#include <e32math.h>             // for Math::Rand()
+#include <StifTestInterference.h>
+#include "testflextimer.h"      // for global constants & CB
+#include "testcflextimer.h"
+#include "flextimerpanic.h"     // for panic constants
+#include "inheritedcflextimer.h"// CFlexTimer implementation (CB is always TExtendedTestResult*)
+#include "inheritedcflextimer2.h"// another CFlexTimer implementation (CB is always RArray<TTimerStruct> *list)
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+const TInt64 KTickResolution( 1000000 / 64 );
+const TInt KExtraSlack = 500 * 1000;
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CTestCFlexTimer::CTestCFlexTimer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CTestCFlexTimer::~CTestCFlexTimer()
+    {
+    }
+// --------------------------------------------------------------------------
+// Start timer and delete it.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndDestroyCFlexTimerL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TExtendedTestResult *eResult = new TExtendedTestResult(&aResult);
+    CInheritedCFlexTimer
+            * timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard,
+                    TCallBack(
+                            InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                            eResult));
+
+    TTimeIntervalMicroSeconds32 expireTime(5 * 1000 * 1000); //5s
+    timer->After(expireTime);
+    CActiveScheduler::Start();
+
+    delete timer;
+    timer = NULL;
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult(KErrNone, KDescription);
+    delete eResult;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start timer and see that it expires at max time
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndExpireCFlexTimerL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TExtendedTestResult *eResult = new TExtendedTestResult(&aResult);
+    CInheritedCFlexTimer
+            * timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard,
+                    TCallBack(
+                            InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                            eResult));
+
+    // Expire in 5 seconds
+    TTimeIntervalMicroSeconds32 expireTime(5 * 1000 * 1000);
+
+    // Save current time.
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer->After(expireTime);
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        delete timer;
+        delete eResult;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timer expiry happened within maxtime to maxtime+accuracy
+    if ((utcNow + expireTime) <= utcNow2 && (utcNow + expireTime
+            + TTimeIntervalMicroSeconds32(KTimerAccuracyMicroSeconds))
+            > utcNow2)
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer;
+    delete eResult;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndExpireTwoOverlappingAfterTimersL(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds32 expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)));
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(15 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds32(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime2 + TTimeIntervalMicroSeconds32(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        RDebug::Printf("utcNow = %lld\n", utcNow.Int64());
+        RDebug::Printf("eResult1->iTimerStoppedTime = %lld\n",
+                eResult1->iTimerStoppedTime);
+        RDebug::Printf("eResult2->iTimerStoppedTime = %lld\n",
+                eResult2->iTimerStoppedTime);
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time. 64bit version
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndExpireTwoOverlappingAfterTimers64L(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)));
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(15 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime2 + TTimeIntervalMicroSeconds(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at their own max time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndExpireTwoNonOverlappingAfterTimersL(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    //Expire one second before first timers window starts
+    TTimeIntervalMicroSeconds32 expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)) - 1 * 1000 * 1000);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(15 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within at their own max time edge.
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds32(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime1) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime1 + TTimeIntervalMicroSeconds32(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start many timers and see that nothing goes wrong when they are expired at rapid sequence
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::HumongousAmountOfTimeridelidilidousL(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    RDebug::Printf("HugemongousAmountOfTimeridelidilidousL");
+    // This list will contain all the timer structs, expiry times etc.
+    // First cell will always tell which timer is currently active
+    // active info is transferred from e.g. InheritedCFlexTimer2::RunL to CB function
+    RArray<TTimerStruct> timers;
+    // This CB contains all the logic about timer addition
+    StartTimerAndAddToList( &timers, 2000 );
+    // CBs stop this after all timers are expired 
+    CActiveScheduler::Start();
+    // Delete CPeriodic that was used to launch new FlexTimers
+    delete timers[0].iStartTimer;
+    _LIT( KDescriptionP , "Passed");
+    aResult.SetResult(KErrNone, KDescriptionP);
+    // Loop throug list and see if timers fired within limits.
+    // also delete all stuff reserved earlier by StartTimerAndAddToList
+    while (timers.Count())
+        {
+        // Have fun with reading this. It is not as bad as it looks
+        // Just checks if CB already failed the case
+        // and if timer was launched within its window(default) and timer accuracy
+        if (!(!timers[0].iEResult->iCaseAlreadyFailed
+                && (timers[0].iEResult->iTimerStartedTime
+                        + timers[0].iEResult->iTimerExpiryTime
+                        - (static_cast<float> (timers[0].iEResult->iTimerExpiryTime)
+                                * KDefaultWindowMultiplier)
+                        <= timers[0].iEResult->iTimerStoppedTime+KTickResolution)
+                && (timers[0].iEResult->iTimerStartedTime
+                        + timers[0].iEResult->iTimerExpiryTime
+                        + KTimerAccuracyMicroSeconds)
+                        > timers[0].iEResult->iTimerStoppedTime))
+            {
+            _LIT( KDescription , "Some timer was not fired within its window.\n");
+            aResult.SetResult(KErrGeneral, KDescription);
+
+            }
+        delete timers[0].iEResult->iTestResult;
+        delete timers[0].iEResult;
+        delete timers[0].iTimer;
+        timers.Remove(0);
+        }
+    // Case was executed
+    timers.Close();
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start three timers At, AtUTC and After and see that they are treated equally.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CreateAndExpireThreeTimersL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TTestResult *res3 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    TExtendedTestResult *eResult3 = new TExtendedTestResult(res3);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    eResult2->iTimerID = 3;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    CInheritedCFlexTimer* timer3 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult3));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(9 * 1000 * 1000);
+    TTimeIntervalMicroSeconds expireTime3(3 * 1000 * 1000); // Expire far enough from others
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    TTime homeNow(0);
+    homeNow.HomeTime();
+
+    timer1->After(expireTime1);
+    timer2->At(homeNow + expireTime2);
+    timer3->AtUTC(utcNow + expireTime3);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(15 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(
+            eResult1->iTestResult->iResult,
+            eResult1->iTestResult->iResultDes );
+        }
+    else if (eResult2->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(
+            eResult2->iTestResult->iResult,
+            eResult2->iTestResult->iResultDes );
+        }
+    else if (eResult3->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(
+            eResult3->iTestResult->iResult,
+            eResult3->iTestResult->iResultDes );
+        }
+
+    // Check if timers expiry happened within limits.
+    // First and second timer at seconds timers max time and third at its own max time.
+    //
+    // Compare results against utcNow due timer's stopped time is UTC.
+    else if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution) && 
+        (utcNow + expireTime2 + TTimeIntervalMicroSeconds( KTimerAccuracyMicroSeconds)) > TTime( eResult2->iTimerStoppedTime) &&
+
+        (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && 
+        (utcNow + expireTime2 + TTimeIntervalMicroSeconds( KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime) &&
+
+        (utcNow + expireTime3) <= TTime(eResult3->iTimerStoppedTime+KTickResolution) && 
+        (utcNow + expireTime3 + TTimeIntervalMicroSeconds( KTimerAccuracyMicroSeconds)) > TTime( eResult3->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete timer3;
+    delete eResult1;
+    delete eResult2;
+    delete eResult3;
+    delete res1;
+    delete res2;
+    delete res3;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start three timers At, AtUTC and After and see that they can be cancelled.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::NormalCancelL( TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TTestResult *res3 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    TExtendedTestResult *eResult3 = new TExtendedTestResult(res3);
+    eResult1->iTimerID = 0;
+    eResult2->iTimerID = 1;
+    eResult3->iTimerID = 2;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult1), 0);
+    CInheritedCFlexTimer2* timer2 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult2), 1);
+    CInheritedCFlexTimer2* timer3 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult3), 2);
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(10 * 1000 * 1000);
+    //just something
+    TTimeIntervalMicroSeconds expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)));
+    TTimeIntervalMicroSeconds expireTime3(7 * 1000 * 1000); // just something
+    RArray<TTimerStruct> timers;
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+    TTimerStruct *s2 = new TTimerStruct();
+    s2->iEResult = eResult2;
+    s2->iTimer = timer2;
+    timers.Append(*s2);
+    TTimerStruct *s3 = new TTimerStruct();
+    s3->iEResult = eResult3;
+    s3->iTimer = timer3;
+    timers.Append(*s3);
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    TTime homeNow(0);
+    homeNow.HomeTime();
+
+    timer1->After(expireTime1);
+    timer2->At(homeNow + expireTime2);
+    timer3->AtUTC(utcNow + expireTime3);
+
+    timers[0].iCurrentlyActive = 0; //CB uses this to decide which timer to cancel;
+
+    //Timer to cancel timers under test and cancel active scheduler
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(15 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CPeriodic *pp = CPeriodic::NewL(EPriorityNormal);
+    s1->iStartTimer = pp;
+    pp->Start(3 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+    CPeriodic *ppp = CPeriodic::NewL(EPriorityNormal);
+    s2->iStartTimer = ppp;
+    ppp->Start(4 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+    CPeriodic *pppp = CPeriodic::NewL(EPriorityNormal);
+    s3->iStartTimer = pppp;
+    pppp->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    delete pp;
+    delete ppp;
+    delete pppp;
+    delete s1;
+    delete s2;
+    delete s3;
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed
+            || eResult3->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        if (eResult2->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult3->iTestResult->iResult,
+                    eResult3->iTestResult->iResultDes);
+            }
+        }
+    delete timer1;
+    delete timer2;
+    delete timer3;
+    delete eResult1;
+    delete eResult2;
+    delete eResult3;
+    delete res1;
+    delete res2;
+    delete res3;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelTimerThatWouldHaveTriggeredAnotherTimerL(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult1));
+    CInheritedCFlexTimer
+            * timer2 =
+                    CInheritedCFlexTimer::NewL(
+                            CActive::EPriorityStandard,
+                            TCallBack(
+                                    InheritedFlexTimerCallbackKErrNoneMarkTimestampStopScheduler,
+                                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds32 expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)));
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to cancel Timer 1
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(3 * 1000 * 1000, 1000, TCallBack(CancelCFlexTimer, timer1));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds32(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureCTimerOverlap1L( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 window1(8 * 1000 * 1000);
+    timer1->Configure(window1);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds32 expireTime2(9 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 window2(1 * 1000 * 1000);
+    timer2->Configure(window2);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(17 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds32(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime2 + TTimeIntervalMicroSeconds32(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureCTimerOverlap2L( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window1(8 * 1000 * 1000);
+    timer1->Configure(window1);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(17 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window2(1 * 1000 * 1000);
+    timer2->Configure(window2);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(18 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer1 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime1) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime1 + TTimeIntervalMicroSeconds(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime1) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime1 + TTimeIntervalMicroSeconds(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureCTimerOverlap3L( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 zeroWindow(0);
+    timer1->Configure(zeroWindow);
+    timer1->Configure(window1);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(8 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window2(0);
+    timer2->Configure(window2);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(18 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime2 + TTimeIntervalMicroSeconds(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at their own max time
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureCTimerNonOverlap1L( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window1(0);
+    timer1->Configure(window1);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(15 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window2(1 * 1000 * 1000);
+    timer2->Configure(window2);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(18 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timer expired within their own  maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime1) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime1 + TTimeIntervalMicroSeconds(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at their own max time
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureCTimerNonOverlap2L( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(16 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window1(16 * 1000 * 1000);
+    timer1->Configure(window1);
+    window1 = 8 * 1000 * 1000;
+    timer1->Configure(window1);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds expireTime2(7 * 1000 * 1000);
+    TTimeIntervalMicroSeconds window2(4 * 1000 * 1000);
+    timer2->Configure(window2);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(18 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timer expired within their own  maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime1) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime1 + TTimeIntervalMicroSeconds(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start three timers and see that system time change aborts At & AtUtc timers
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::SystemTimeChangesL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TTestResult *res3 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    TExtendedTestResult *eResult3 = new TExtendedTestResult(res3);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    eResult3->iTimerID = 3;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(
+                    InheritedFlexTimerCallbackKErrAbort, eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(
+                    InheritedFlexTimerCallbackKErrAbort, eResult2));
+    CInheritedCFlexTimer* timer3 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                    eResult3));
+    // Expire in 10, 11 and 12 seconds. One and two are to be aborted
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 expireTime2(11 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 expireTime3(12 * 1000 * 1000);
+
+    
+    // Save current time as ticks. This use case will change system time
+    // and timestamps will not be exact -- ticks are.
+    TUint startTicks( User::TickCount() );
+    
+    TTime now, nowUtc;
+    now.HomeTime();
+    nowUtc.UniversalTime();
+
+    timer1->At(now + expireTime1);
+    timer2->AtUTC(nowUtc + expireTime2);
+    timer3->After(expireTime3);
+
+    //Timer to change system time after timers have been running for a while
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(5 * 1000 * 1000, 1000, TCallBack(ChangeSystemTime1sAndCancel, p));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed
+            || eResult3->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else if (eResult2->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult3->iTestResult->iResult,
+                    eResult3->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete timer3;
+        delete eResult1;
+        delete eResult2;
+        delete eResult3;
+        delete res1;
+        delete res2;
+        delete res3;
+        return KErrNone;
+        }
+    // Get new current time
+    TUint endTicks( User::TickCount() );
+    TInt delay( ( endTicks - startTicks ) * KTickInMicroSeconds );
+    
+    //Check if timers expiry happened within timer3 maxtime to maxtime+accuracy
+    if ( delay+KTickResolution >= expireTime3.Int() && 
+         delay < expireTime3.Int() + KTimerAccuracyMicroSeconds )
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete timer3;
+    delete eResult1;
+    delete eResult2;
+    delete eResult3;
+    delete res1;
+    delete res2;
+    delete res3;
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start three timers and see that time zone change aborts At & AtUtc timers
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::TimeZoneChangesL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TTestResult *res3 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    TExtendedTestResult *eResult3 = new TExtendedTestResult(res3);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    eResult3->iTimerID = 3;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(
+                    InheritedFlexTimerCallbackKErrAbort, eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(
+                    InheritedFlexTimerCallbackKErrAbort, eResult2));
+    CInheritedCFlexTimer* timer3 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                    eResult3));
+    // Expire in 10, 11 and 12 seconds. One and two are to be aborted
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 expireTime2(11 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 expireTime3(12 * 1000 * 1000);
+
+    // Save current time as ticks. This use case will change system time
+    // and timestamps will not be exact -- ticks are.
+    TUint startTicks( User::TickCount() );
+    
+    TTime now, nowUtc;
+    now.HomeTime();
+    nowUtc.UniversalTime();
+    
+    timer1->At(now + expireTime1);
+    timer2->AtUTC(nowUtc + expireTime2);
+    timer3->After(expireTime3);
+
+    //Timer to change system time after timers have been running for a while
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(5 * 1000 * 1000, 1000, TCallBack(ChangeTimeZoneAndCancel, p));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed
+            || eResult3->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else if (eResult2->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult3->iTestResult->iResult,
+                    eResult3->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete timer3;
+        delete eResult1;
+        delete eResult2;
+        delete eResult3;
+        delete res1;
+        delete res2;
+        delete res3;
+        return KErrNone;
+        }
+
+    // Get new current time
+    TUint endTicks( User::TickCount() );
+    TInt delay( ( endTicks - startTicks ) * KTickInMicroSeconds );
+    
+    //Check if timers expiry happened within timer3 maxtime to maxtime+accuracy
+    if ( delay+KTickResolution >= expireTime3.Int() && 
+         delay < expireTime3.Int() + KTimerAccuracyMicroSeconds )
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete timer3;
+    delete eResult1;
+    delete eResult2;
+    delete eResult3;
+    delete res1;
+    delete res2;
+    delete res3;
+
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimerL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+    CInheritedCFlexTimer
+            * timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard,
+                    TCallBack(
+                            InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                            eResult));
+
+    /*32 bit IF called with 1 parameter*/
+    /***********************************/
+    // Expire in 3 seconds. 
+    TTimeIntervalMicroSeconds32 expireTime(1);
+    // Save current time
+    TTime now(0);
+    now.HomeTime();
+    timer->After(expireTime);
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult->iTestResult->iResult,
+                eResult->iTestResult->iResultDes);
+        delete timer;
+        delete eResult;
+        delete res;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime now2(0);
+    now2.HomeTime();
+    //Check if timers expiry happened immediately.
+    if (!((now + expireTime) <= now2 && (now + expireTime
+            + TTimeIntervalMicroSeconds32(KTimerAccuracyMicroSeconds)) > now2))
+        {
+        _LIT( KDescription , "32 bit After(1) failed.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        delete timer;
+        delete eResult;
+        delete res;
+        return KErrNone;
+        }
+
+    /*32 bit IF called with max parameter*/
+    /***********************************/
+    expireTime = 0x7FFFFFFF;
+    now.HomeTime();
+    delete timer;
+    timer = NULL;
+    timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard, TCallBack(
+            NotCalledCB, eResult));
+    timer->After(expireTime);
+    //Timer to change system time after timers have been running for a while
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(5 * 1000 * 1000, 1000, TCallBack(
+            CancelCFlexTimerAndStopActiveScheduler, timer));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    p->Cancel();
+    delete p;
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult->iTestResult->iResult,
+                eResult->iTestResult->iResultDes);
+        delete timer;
+        delete eResult;
+        delete res;
+        return KErrNone;
+        }
+
+    /*64 bit IF called with 1 parameter*/
+    /***********************************/
+    // Expire in 3 seconds. 
+    TTimeIntervalMicroSeconds expireTime64(1);
+    // Save current time
+    now.HomeTime();
+    delete timer;
+    timer = NULL;
+    timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard, TCallBack(
+            InheritedFlexTimerCallbackStopSchedulerKErrNone, eResult));
+    timer->After(expireTime64);
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult->iTestResult->iResult,
+                eResult->iTestResult->iResultDes);
+        delete timer;
+        delete eResult;
+        delete res;
+        return KErrNone;
+        }
+    // Get new current time
+    now2.HomeTime();
+    //Check if timers expiry happened immediately
+    if (!((now + expireTime64) <= now2 && (now + expireTime64
+            + TTimeIntervalMicroSeconds(KTimerAccuracyMicroSeconds)) > now2))
+        {
+        _LIT( KDescription , "64 bit After(1) failed.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        delete timer;
+        delete eResult;
+        delete res;
+        return KErrNone;
+        }
+    // Finally if we are here set whole case to passed.
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimerZero32bitL( TTestResult& aResult,
+        CTestFlexTimer* /* cb */ )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    /*32 bit IF called with 0 parameter*/
+    /***********************************/
+    const TTimeIntervalMicroSeconds32 kExpireTime32(0);
+
+    // Save current time
+    TTime startTime;
+    startTime.HomeTime();
+
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+        CActive::EPriorityStandard, 
+        TCallBack( InheritedFlexTimerCallbackStopSchedulerKErrNone, eResult ) );
+
+    timer->After( kExpireTime32 );
+
+    CActiveScheduler::Start();  // WAIT timer to expire
+
+    TTime endTime;
+    endTime.HomeTime();
+    
+    TTimeIntervalMicroSeconds delay = endTime.MicroSecondsFrom( startTime );
+    
+    if ( delay.Int64() < kExpireTime32.Int() || 
+         delay.Int64() > kExpireTime32.Int() + KTimerAccuracyMicroSeconds )
+        {
+        aResult.SetResult( KErrGeneral, _L("Wrong expiration") );
+        }
+    else
+        {
+        aResult.SetResult( KErrNone, _L("Test case passed") );
+        }
+    
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimerZero64bitL( TTestResult& aResult,
+        CTestFlexTimer* /* cb */ )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    /*64 bit IF called with 0 parameter*/
+    /***********************************/
+    const TTimeIntervalMicroSeconds kExpireTime64(0);
+
+    // Save current time
+    TTime startTime;
+    startTime.HomeTime();
+
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(InheritedFlexTimerCallbackStopSchedulerKErrNone, eResult));
+
+    timer->After(kExpireTime64);
+    CActiveScheduler::Start();  // WAIT timer to expire
+
+    TTime endTime;
+    endTime.HomeTime();
+    
+    TTimeIntervalMicroSeconds delay = endTime.MicroSecondsFrom( startTime );
+    
+    if ( delay.Int64()+KTickResolution < kExpireTime64.Int64() || 
+         delay.Int64() > kExpireTime64.Int64() + KTimerAccuracyMicroSeconds )
+        {
+        aResult.SetResult( KErrGeneral, _L("Wrong expiration") );
+        }
+    else
+        {
+        aResult.SetResult( KErrNone, _L("Test case passed") );
+        }
+    
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimer64MaxL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    /*64 bit IF called with 0x7FFFFFFFFFFFFFFF parameter*/
+    /***********************************/
+    // This will cause panic 
+    TTimeIntervalMicroSeconds expireTime64(0x7FFFFFFFFFFFFFFF);
+    // Save current time
+    TTime now(0);
+    now.HomeTime();
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerServerIllegalTimerValue);
+    timer->After(expireTime64);
+    // Start timer that stops active scheduler just in case.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(3 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CActiveScheduler::Start();
+    delete p;
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "64 bit After(0x7FFFFFFFFFFFFFFF) failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimer64ThreeYearsL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    /*64 bit IF called with 93312000000000 (about three years) parameter*/
+    /***********************************/
+    // This will cause panic since only two years ahead timers are supported 
+    TTimeIntervalMicroSeconds expireTime64(93312000000000);
+    // Save current time
+    TTime now(0);
+    now.HomeTime();
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerServerIllegalTimerValue);
+    timer->After(expireTime64);
+    // Start timer that stops active scheduler just in case.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(3 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CActiveScheduler::Start();
+    delete p;
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "64 bit After(93312000000000) failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start one year timer and cancel it.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::DumbAssParametersForCTimer64OneYearL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    RDebug::Printf("DumbAssParametersForCTimer64OneYearL");
+    TTestResult *res1 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    eResult1->iTimerID = 0;
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1( 33312000000000 ); // About on year
+    //just something
+    RArray<TTimerStruct> timers;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB,
+                    &timers), 0);
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+
+    timer1->After(expireTime1);
+
+    timers[0].iCurrentlyActive = 0;
+
+    //Timers to cancel timer and stop scheduler.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(7 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CPeriodic *pp = CPeriodic::NewL(EPriorityNormal);
+    s1->iStartTimer = pp;
+    pp->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p; delete pp;
+    delete s1;
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult1->iTestResult->iResult,
+                eResult1->iTestResult->iResultDes);
+        }
+    
+    delete timer1;
+    delete eResult1;
+    delete res1;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with negative value
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AfterWithNegativeValueL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    // This will cause panic
+    TTimeIntervalMicroSeconds32 expireTime(-1);
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerAfterIntervalLessThanZero);
+    timer->After(expireTime);
+    CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "32 bit After(-1) failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with negative value
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AfterWithNegativeValue64L( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    // This will cause panic
+    TTimeIntervalMicroSeconds expireTime(-1);
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerAfterIntervalLessThanZero);
+    timer->After(expireTime);
+    CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "64 bit After(-1) failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AtWithCurrentTimeL( TTestResult& aResult,
+        CTestFlexTimer* /* cb */ )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    TTimeIntervalMicroSeconds expireTime64(0);
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+        CActive::EPriorityStandard, 
+        TCallBack(InheritedFlexTimerCallbackStopSchedulerKErrNone, eResult));
+
+    // Save current time
+    TTime now(0);
+    now.HomeTime();
+    timer->At(now + expireTime64);
+    CActiveScheduler::Start(); // WAIT timer to expire
+
+    // Analyze results
+    TTime endTime;
+    endTime.HomeTime();
+    
+    TTimeIntervalMicroSeconds delay = endTime.MicroSecondsFrom( now );
+
+    if ( delay.Int64()+KTickResolution < expireTime64.Int64() || 
+         delay.Int64() > expireTime64.Int64() + KTimerAccuracyMicroSeconds )
+        {
+        aResult.SetResult(KErrGeneral, _L("Wrong expiration"));
+        }
+    else
+        {
+        aResult.SetResult( KErrNone, _L("Test case passed") );
+        }
+
+    // Clean up
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AtUTCWithCurrentTimeL( TTestResult& aResult,
+        CTestFlexTimer* /* cb */ )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    TTimeIntervalMicroSeconds expireTime64(0);
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+        CActive::EPriorityStandard, 
+        TCallBack(InheritedFlexTimerCallbackStopSchedulerKErrNone, eResult));
+
+    // Save current time
+    TTime now(0);
+    now.UniversalTime();
+    timer->AtUTC(now + expireTime64);
+    CActiveScheduler::Start(); // WAIT timer to expire
+
+    // Analyze results
+    TTime endTime;
+    endTime.UniversalTime();
+    
+    TTimeIntervalMicroSeconds delay = endTime.MicroSecondsFrom( now );
+
+    if ( delay.Int64()+KTickResolution < expireTime64.Int64() || 
+         delay.Int64() > expireTime64.Int64() + KTimerAccuracyMicroSeconds )
+        {
+        aResult.SetResult(KErrGeneral, _L("Wrong expiration"));
+        }
+    else
+        {
+        aResult.SetResult( KErrNone, _L("Test case passed") );
+        }
+
+    // Clean up
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timers with dumbass parameters
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AtWithThreeYearsL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = 1;
+
+    // This will cause panic 
+    TTimeIntervalMicroSeconds expireTime64(93312000000000);
+    CInheritedCFlexTimer *timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerServerIllegalTimerValue);
+    // Save current time
+    TTime now(0);
+    now.HomeTime();
+    timer->At(now + expireTime64);
+    // Start timer that stops active scheduler just in case.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(3 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CActiveScheduler::Start();
+    delete p;
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "At(93312000000000) failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start one year timer and cancel it.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AtWithOneYearL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    RDebug::Printf("AtWithOneYearL");
+    TTestResult *res1 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    eResult1->iTimerID = 0;
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1( 33312000000000 ); // About on year
+    //just something
+    RArray<TTimerStruct> timers;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB,
+                    &timers), 0);
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+    TTime now(0);
+    now.HomeTime();
+    timer1->At(now + expireTime1);
+
+    timers[0].iCurrentlyActive = 0;
+
+    //Timers to cancel timer and stop scheduler.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(7 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CPeriodic *pp = CPeriodic::NewL(EPriorityNormal);
+    s1->iStartTimer = pp;
+    pp->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p; delete pp;
+    delete s1;
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult1->iTestResult->iResult,
+                eResult1->iTestResult->iResultDes);
+        }
+    delete timer1;
+    delete eResult1;
+    delete res1;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Call At and AtUTC with time in the past
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::AtWithTimeInThePastL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    RDebug::Printf("AtWithTimeInThePastL");
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+
+    // Expire in the past
+    TTimeIntervalMicroSeconds expireTime(-1);
+    CInheritedCFlexTimer* timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    // Save current time
+    TTime homeNow(0);
+    homeNow.HomeTime();
+    TTime homeExpireTime(homeNow + expireTime);
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerAtIntervalLessThanZero);
+    timer->At(homeExpireTime);
+    CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "At in the past failed to panic.\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timer, expire, cancel, start again and expire
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelExpiredTimerL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TExtendedTestResult *eResult = new TExtendedTestResult(&aResult);
+    CInheritedCFlexTimer
+            * timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard,
+                    TCallBack(
+                            InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                            eResult));
+
+    // Expire in 5 seconds
+    TTimeIntervalMicroSeconds32 expireTime(5 * 1000 * 1000);
+
+    // Save current time.
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer->After(expireTime);
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    // Ignore time and cb stuff
+    // Cancel timer that just expired
+    timer->Cancel();
+
+    // Start timer again
+    // Save current time.
+    utcNow.UniversalTime();
+
+    timer->After(expireTime);
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        delete timer;
+        delete eResult;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timer expiry happened within maxtime to maxtime+accuracy
+    if ((utcNow + expireTime) <= utcNow2+TTimeIntervalMicroSeconds32(KTickResolution) && (utcNow + expireTime
+            + TTimeIntervalMicroSeconds32(KTimerAccuracyMicroSeconds))
+            > utcNow2)
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer;
+    delete eResult;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start timer that has left side of the window in the past.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureLeftSideInThePastL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    TExtendedTestResult *eResult = new TExtendedTestResult(&aResult);
+    CInheritedCFlexTimer
+            * timer = CInheritedCFlexTimer::NewL(CActive::EPriorityStandard,
+                    TCallBack(
+                            InheritedFlexTimerCallbackStopSchedulerKErrNone,
+                            eResult));
+
+    // Expire in 5 seconds
+    TTimeIntervalMicroSeconds32 winTime(10 * 1000 * 1000);
+    TTimeIntervalMicroSeconds32 expireTime(5 * 1000 * 1000);
+
+    // Save current time.
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    timer->Configure(winTime);
+    timer->After(expireTime);
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    //See if CB has failed the case
+    if (eResult->iCaseAlreadyFailed)
+        {
+        delete timer;
+        delete eResult;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timer expiry happened within maxtime to maxtime+accuracy
+    if ((utcNow + expireTime) <= utcNow2+TTimeIntervalMicroSeconds32(KTickResolution) && (utcNow + expireTime
+            + TTimeIntervalMicroSeconds32(KTimerAccuracyMicroSeconds))
+            > utcNow2)
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer;
+    delete eResult;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Start two timers and see that window works if another is started with left 
+// side of the window in the past.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureLeftSideInThePastWindowCheckL(
+        TTestResult& aResult, CTestFlexTimer */*cb*/)
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds32 expireTime2(9 * 1000 * 1000);
+
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+
+    timer1->Configure(TTimeIntervalMicroSeconds(15 * 1000 * 1000));
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(17 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed || eResult2->iCaseAlreadyFailed)
+        {
+        if (eResult1->iCaseAlreadyFailed)
+            {
+            aResult.SetResult(eResult1->iTestResult->iResult,
+                    eResult1->iTestResult->iResultDes);
+            }
+        else
+            {
+            aResult.SetResult(eResult2->iTestResult->iResult,
+                    eResult2->iTestResult->iResultDes);
+            }
+        delete timer1;
+        delete timer2;
+        delete eResult1;
+        delete eResult2;
+        delete res1;
+        delete res2;
+        return KErrNone;
+        }
+    // Get new current time
+    TTime utcNow2(0);
+    utcNow2.UniversalTime();
+
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if ((utcNow + expireTime2) <= TTime(eResult2->iTimerStoppedTime+KTickResolution)
+            && (utcNow + expireTime2 + TTimeIntervalMicroSeconds32(
+                    KTimerAccuracyMicroSeconds)) > TTime(
+                    eResult2->iTimerStoppedTime) &&
+
+    (utcNow + expireTime2) <= TTime(eResult1->iTimerStoppedTime+KTickResolution) && (utcNow
+            + expireTime2 + TTimeIntervalMicroSeconds32(
+            KTimerAccuracyMicroSeconds)) > TTime(eResult1->iTimerStoppedTime))
+        {
+        _LIT( KDescription , "Passed");
+        aResult.SetResult(KErrNone, KDescription);
+        }
+    else
+        {
+        _LIT( KDescription , "Some timer was fired either too early or too late.\n");
+        aResult.SetResult(KErrGeneral, KDescription);
+        }
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    return KErrNone;
+
+    }
+
+// --------------------------------------------------------------------------
+// Call Configure 32 bit with Negative window size
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWithNegativeWindowSize32L(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    RDebug::Printf("ConfigureWithNegativeWindowSize32L");
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+
+    // negative time
+    TTimeIntervalMicroSeconds32 confTime(-1);
+    CInheritedCFlexTimer* timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerWindowLessThanZero);
+    timer->Configure(confTime);
+    //CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "Configure(32) with negative interval failed to panic\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// Call Configure 64 bit with Negative window size
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWithNegativeWindowSize64L(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    RDebug::Printf("ConfigureWithNegativeWindowSize64L");
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+
+    // negative time
+    TTimeIntervalMicroSeconds confTime(-1);
+    CInheritedCFlexTimer* timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerWindowLessThanZero);
+    timer->Configure(confTime);
+    //CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "Configure(64) with negative interval failed to panic\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// -
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWithMaxWindow32L(
+        TTestResult& aResult, CTestFlexTimer* /* cb */ )
+    {
+    RDebug::Printf("ConfigureWithMaxWindow32L");
+    TTestResult *res1 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    eResult1->iTimerID = 0;
+    TTimeIntervalMicroSeconds32 expireTime1( 0x7FFFFFFF );
+    //just something
+    RArray<TTimerStruct> timers;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB,
+                    &timers), 0);
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+    timer1->Configure(expireTime1);
+    timer1->After(expireTime1);
+
+    timers[0].iCurrentlyActive = 0;
+
+    //Timers to cancel timer and stop scheduler.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(7 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StopActiveScheduler));
+    CPeriodic *pp = CPeriodic::NewL(EPriorityNormal);
+    s1->iStartTimer = pp;
+    pp->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            CancelCFlexTimerArray, &timers));
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p; delete pp;
+    delete s1;
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult1->iTestResult->iResult,
+                eResult1->iTestResult->iResultDes);
+        }
+    delete timer1;
+    delete eResult1;
+    delete res1;
+    return KErrNone;
+    }
+// --------------------------------------------------------------------------
+// -
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWithThreeYearWindow64L(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    RDebug::Printf("ConfigureWithThreeYearWindow64L");
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+
+    // negative time
+    TTimeIntervalMicroSeconds confTime(93312000000000);
+    CInheritedCFlexTimer* timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerServerIllegalTimerValue);
+    timer->Configure(confTime);
+    //CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "Configure(93312000000000 failed to panic\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// -
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWithMaxWindow64L(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    RDebug::Printf("ConfigureWithMaxWindow64L");
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+
+    // negative time
+    TTimeIntervalMicroSeconds confTime(0x7FFFFFFFFFFFFFFF);
+    CInheritedCFlexTimer* timer = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult));
+    //Accept panic as passed case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic,
+            EFlexTimerServerIllegalTimerValue);
+    timer->Configure(confTime);
+    //CActiveScheduler::Start();
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    _LIT( KDescription , "Configure(0x7FFFFFFFFFFFFFFF) failed to panic\n");
+    aResult.SetResult(KErrGeneral, KDescription);
+    delete timer;
+    delete eResult;
+    delete res;
+    return KErrNone;
+    }
+// --------------------------------------------------------------------------
+// Start timer and call configure while it is running
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureWhileTimerIsInUseL( TTestResult& aResult,
+        CTestFlexTimer */*cb*/)
+    {
+    RDebug::Printf("ConfigureWhileTimerIsInUseL");
+    TTestResult *res1 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    eResult1->iTimerID = 0;
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(10 * 1000 * 1000);
+    //just something
+    RArray<TTimerStruct> timers;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(StopSchedulerKErrNoneArray,
+                    &timers), 0);
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+
+    TTime homeNow(0);
+    homeNow.HomeTime();
+
+    timer1->After(expireTime1);
+
+    timers[0].iCurrentlyActive = 0;
+
+    //Timer to call configure while timer is running
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            ConfigureKErrInUseArray, &timers));
+
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    delete p;
+    delete s1;
+    _LIT( KDescription , "Passed");
+    aResult.SetResult(KErrNone, KDescription);
+    //See if CB has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        aResult.SetResult(eResult1->iTestResult->iResult,
+                eResult1->iTestResult->iResultDes);
+        delete timer1;
+        delete eResult1;
+        delete res1;
+        return KErrNone;
+        }
+    TTime homeNow2(0);
+    homeNow2.HomeTime();
+    //Check if timers expiry happened within timer2 maxtime to maxtime+accuracy
+    if (!((homeNow + expireTime1) <= homeNow2+TTimeIntervalMicroSeconds32(KTickResolution) && (homeNow + expireTime1
+            + TTimeIntervalMicroSeconds32(KTimerAccuracyMicroSeconds))
+            > homeNow2))
+        {
+        _LIT( KEDescription , "Timer was not fired within limits");
+        aResult.SetResult(KErrGeneral, KEDescription);
+        }
+    delete timer1;
+    delete eResult1;
+    delete res1;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// timer is started twice
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::TimerIsStartedTwiceL( TTestResult& aResult,
+        CTestFlexTimer *cb )
+    {
+    TTestResult *res1 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    eResult1->iTimerID = 0;
+    CInheritedCFlexTimer2* timer1 = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard, TCallBack(NotCalledCB, eResult1), 0);
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds expireTime1(10 * 1000 * 1000);
+    RArray<TTimerStruct> timers;
+    TTimerStruct *s1 = new TTimerStruct();
+    s1->iEResult = eResult1;
+    s1->iTimer = timer1;
+    timers.Append(*s1);
+
+    timer1->After(expireTime1);
+    timers[0].iCurrentlyActive = 0; //CB uses this to decide which timer to start again;
+
+    //Timer to start timer again
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+    p->Start(5 * 1000 * 1000, 30 * 1000 * 1000, TCallBack(
+            StartTimerAgainArray, &timers));
+    // Panic category: "E32USER-CBase"
+    // Panic reason:   42 (attempt to active CActive when a request is still 
+    // outstanding.
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::EPanic, 42);
+    // Start scheduler and wait for callback to panic it
+    CActiveScheduler::Start();
+    // We should never get here -> fail the case
+    cb->TestModuleIf().SetExitReason(CTestModuleIf::ENormal, KErrNone);
+    delete p;
+    delete s1;
+    _LIT( KDescription , "double start failed to panic.");
+    aResult.SetResult(KErrGeneral, KDescription);
+
+    delete timer1;
+    delete eResult1;
+    delete res1;
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason and stop scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackStopSchedulerKErrNone(
+        TAny* aArgument )
+    {
+    RDebug::Printf("InheritedFlexTimerCallbackStopSchedulerKErrNone");
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrNone)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason\n");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason and stop scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackStopSchedulerKErrAbort(
+        TAny* aArgument )
+    {
+    RDebug::Printf("InheritedFlexTimerCallbackStopSchedulerKErrAbort");
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrAbort)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason and stop scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackStopSchedulerKErrCancel(
+        TAny* aArgument )
+    {
+    RDebug::Printf("InheritedFlexTimerCallbackStopSchedulerKErrCancel");
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrCancel)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackKErrNone( TAny* aArgument )
+    {
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrNone)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackKErrAbort( TAny* aArgument )
+    {
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrAbort)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that both timers are stoppped with valid reason and save expiry time
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackKErrNoneMarkTimestamp(
+        TAny* aArgument )
+    {
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrNone)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    eRes->iTimerStoppedTime = utcNow.Int64();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// See that both timers are stoppped with valid reason and save expiry time
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::InheritedFlexTimerCallbackKErrNoneMarkTimestampStopScheduler(
+        TAny* aArgument )
+    {
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    if (eRes->iStatusCode != KErrNone)
+        {
+        eRes->iCaseAlreadyFailed = ETrue;
+        _LIT(KError,"Error: Wrong timer expiry reason");
+        eRes->iTestResult->SetResult(KErrGeneral, KError);
+        }
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    eRes->iTimerStoppedTime = utcNow.Int64();
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Stop active scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StopActiveScheduler( TAny*/*aArgument*/)
+    {
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Change system time + 1s and cancel Periodic timer given as parameter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ChangeSystemTime1sAndCancel( TAny* aArgument )
+    {
+    RDebug::Printf("ChangeSystemTime1sAndCancel");
+    TTime now(0);
+    now.HomeTime();
+    User::SetHomeTime(now + TTimeIntervalMicroSeconds32(1000 * 1000));
+    CPeriodic *p = reinterpret_cast<CPeriodic*> (aArgument);
+    p->Cancel();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Change time zone and cancel Periodic timer given as parameter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ChangeTimeZoneAndCancel( TAny* aArgument )
+    {
+    RDebug::Printf("ChangeTimeZoneAndCancel");
+    TTimeIntervalSeconds currentUtcOffset( User::UTCOffset() );
+    User::SetUTCOffset( currentUtcOffset.Int() + 3000 );
+    CPeriodic *p = reinterpret_cast<CPeriodic*> (aArgument);
+    p->Cancel();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Change secure time + 1s and cancel Periodic timer given as parameter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ChangeSecureTimeAndCancel( TAny* aArgument )
+    {
+    RDebug::Printf("ChangeSecureTimeAndCancel");
+    TTime now(0);
+    now.UniversalTime();
+    User::SetUTCTimeSecure(now + TTimeIntervalMicroSeconds32(1000 * 1000));
+    CPeriodic *p = reinterpret_cast<CPeriodic*> (aArgument);
+    p->Cancel();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Fail result if this is called
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::NotCalledCB( TAny* aArgument )
+    {
+    TExtendedTestResult *eRes =
+            reinterpret_cast<TExtendedTestResult*> (aArgument);
+    eRes->iCaseAlreadyFailed = ETrue;
+    _LIT(KError,"Error: invalid CB called");
+    eRes->iTestResult->SetResult(KErrGeneral, KError);
+    return 1; //nada
+    }
+
+// --------------------------------------------------------------------------
+// Stop active schduler and cancel Periodic timer given as paramter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StopSchedulerAndCancel( TAny* aArgument )
+    {
+    CPeriodic *p = reinterpret_cast<CPeriodic*> (aArgument);
+    p->Cancel();
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Cancels CFlexTimer given a parameter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelCFlexTimer( TAny* aArgument )
+    {
+    CFlexTimer *p = reinterpret_cast<CFlexTimer*> (aArgument);
+    p->Cancel();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Cancels CFlexTimer
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelCFlexTimerArray( TAny* aArgument )
+    {
+    RDebug::Printf("CancelCFlexTimerCancelPeriodic");
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    (*list)[(*list)[0].iCurrentlyActive].iTimer->Cancel();
+    (*list)[0].iCurrentlyActive += 1;
+    return 1; // nada
+    }
+// --------------------------------------------------------------------------
+// Cancels CFlexTimer and CPeriodic given a parameter
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelCFlexTimerCancelPeriodic( TAny* aArgument )
+    {
+    RDebug::Printf("CancelCFlexTimerCancelPeriodic");
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    (*list)[(*list)[0].iCurrentlyActive].iTimer->Cancel();
+    (*list)[0].iCurrentlyActive += 1;
+    (*list)[0].iStartTimer->Cancel();
+    return 1; // nada
+    }
+// --------------------------------------------------------------------------
+// See that timer is stoppped with valid reason and stop scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StopSchedulerKErrNoneArray( TAny* aArgument )
+    {
+    RDebug::Printf("StopSchedulerKErrNoneArray");
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    if ((*list)[(*list)[0].iCurrentlyActive].iEResult->iStatusCode
+            != KErrNone)
+        {
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iCaseAlreadyFailed
+                = ETrue;
+        _LIT(KErrorDes,"Error: Wrong timer expiry reason");
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iTestResult->SetResult(
+                KErrGeneral, KErrorDes);
+        }
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Cancels CFlexTimer given a parameter and stops active scheduler
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CancelCFlexTimerAndStopActiveScheduler( TAny* aArgument )
+    {
+    CFlexTimer *p = reinterpret_cast<CFlexTimer*> (aArgument);
+    p->Cancel();
+    CActiveScheduler::Stop();
+    return 1; // nada
+    }
+    
+// --------------------------------------------------------------------------
+// Callback for StartTimerAndAddToList method. This is hack to enable aTimers
+// parameter in StartTimerAndAddToList method.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StartTimerAndAddToListCB( TAny* aArgument )
+    {
+    return StartTimerAndAddToList(
+        reinterpret_cast<RArray<TTimerStruct>*> (aArgument), -1 );
+    }
+
+// --------------------------------------------------------------------------
+// Starts timer and adds it to list given as param
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StartTimerAndAddToList(
+    RArray<TTimerStruct>* aList, TInt aTimers )
+    {
+    const TInt KTimerStartInterval = 5 * 1000; //Start new timer every 5ms
+    const TInt KTimerMaxDelay = 15 * 1000 * 1000; //Timer delay is between 0 and 15 seconds
+    static TInt numberOfTimers = 0; // How many timers to start
+    
+    if (aTimers > 0)
+        {
+        numberOfTimers = aTimers;
+        }
+
+    TTestResult *res = new TTestResult();
+    TExtendedTestResult *eResult = new TExtendedTestResult(res);
+    eResult->iTimerID = aList->Count();
+    CInheritedCFlexTimer2* timer = CInheritedCFlexTimer2::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(StopTimer, reinterpret_cast<TAny*> (aList)),
+            eResult->iTimerID);
+
+    // Expire in 0-15s seconds
+    TInt random = Math::Random() % (KTimerMaxDelay);
+    TTimeIntervalMicroSeconds expireTime(random);
+    TTimerStruct *s = new TTimerStruct();
+    s->iEResult = eResult;
+    s->iTimer = timer;
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    s->iEResult->iTimerStartedTime = utcNow.Int64();
+    s->iEResult->iTimerExpiryTime = expireTime.Int64();
+    TInt listerr = aList->Append(*s);
+    if (KErrNone != listerr)
+        {
+        RDebug::Printf("Error: Adding to list failed %d", listerr);
+        }
+    (*aList)[0].iTimersRunning += 1;
+    timer->After(expireTime);
+    //First time here. Lets start timer to make many timers.
+    if (aList->Count() == 1)
+        {
+        CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+        p->Start(KTimerStartInterval, KTimerStartInterval, TCallBack(
+                StartTimerAndAddToListCB, reinterpret_cast<TAny*> (aList) ));
+        (*aList)[0].iStartTimer = p;
+        }
+    RDebug::Printf("StartTimerAndAddToList: timers running %d",
+            (*aList)[0].iTimersRunning);
+    RDebug::Printf("StartTimerAndAddToList: list->Count() %d", aList->Count());
+    if (aList->Count() == numberOfTimers)
+        {
+        ((*aList)[0].iStartTimer->Cancel());
+        }
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// Starts timer and adds it to list given as param
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StopTimer( TAny* aArgument )
+    {
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    RDebug::Printf("StopTimer: timers running %d", (*list)[0].iTimersRunning);
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    (*list)[0].iTimersRunning -= 1;
+    (*list)[(*list)[0].iCurrentlyActive].iEResult->iTimerStoppedTime
+            = utcNow.Int64();
+    if ((*list)[0].iTimersRunning == 0)
+        {
+        (*list)[0].iStartTimer->Cancel();
+        CActiveScheduler::Stop();
+        }
+    return 1; // nada
+    }
+// --------------------------------------------------------------------------
+// Try to configure timer ans see that correct error code is returned
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::ConfigureKErrInUseArray( TAny* aArgument )
+    {
+    RDebug::Printf("ConfigureKErrInUseArray");
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    TInt error = (*list)[(*list)[0].iCurrentlyActive].iTimer->Configure(
+            TTimeIntervalMicroSeconds(12 * 1000 * 1000));
+    if (KErrInUse != error)
+        {
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iCaseAlreadyFailed
+                = ETrue;
+        _LIT(KError,"Error: Wrong return code 64bit if\n");
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iTestResult->SetResult(
+                KErrGeneral, KError);
+        return 1;
+        }
+    //Try same with 32 bit if
+    error = (*list)[(*list)[0].iCurrentlyActive].iTimer->Configure(
+            TTimeIntervalMicroSeconds32(12 * 1000 * 1000));
+    if (KErrInUse != error)
+        {
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iCaseAlreadyFailed
+                = ETrue;
+        _LIT(KError,"Error: Wrong return code 32bit if\n");
+        (*list)[(*list)[0].iCurrentlyActive].iEResult->iTestResult->SetResult(
+                KErrGeneral, KError);
+        }
+    return 1; // nada
+    }
+
+// --------------------------------------------------------------------------
+// start timer again
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::StartTimerAgainArray( TAny* aArgument )
+    {
+    RDebug::Printf("StartTimerAgainArray");
+    RArray<TTimerStruct> *list =
+            reinterpret_cast<RArray<TTimerStruct>*> (aArgument);
+    (*list)[(*list)[0].iCurrentlyActive].iTimer->After(
+            TTimeIntervalMicroSeconds(12 * 1000 * 1000));
+    return 1; // nada
+    }
+// --------------------------------------------------------------------------
+// Start two timers and see that they expire at the same time.
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CpuLoadCreateAndExpireTwoOverlappingAfterTimersL(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    TTestResult *res1 = new TTestResult();
+    TTestResult *res2 = new TTestResult();
+    TExtendedTestResult *eResult1 = new TExtendedTestResult(res1);
+    TExtendedTestResult *eResult2 = new TExtendedTestResult(res2);
+    
+
+    eResult1->iTimerID = 1;
+    eResult2->iTimerID = 2;
+    
+    CInheritedCFlexTimer* timer1 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult1));
+    CInheritedCFlexTimer* timer2 = CInheritedCFlexTimer::NewL(
+            CActive::EPriorityStandard,
+            TCallBack(InheritedFlexTimerCallbackKErrNoneMarkTimestamp,
+                    eResult2));
+    
+    // Expire in 10 seconds
+    TTimeIntervalMicroSeconds32 expireTime1(10 * 1000 * 1000);
+    //Expire within first timers default window
+    TTimeIntervalMicroSeconds32 expireTime2(static_cast<TInt64> ((10 * 1000
+            * 1000 - static_cast<float> (10 * 1000 * 1000)
+            * KDefaultWindowMultiplier)));
+    
+    // Save current time
+    TTime utcNow(0);
+    utcNow.UniversalTime();
+    
+    timer1->After(expireTime1);
+    timer2->After(expireTime2);
+    
+    //Timer to stop active scheduler after timers under test are completed.
+    CPeriodic *p = CPeriodic::NewL(EPriorityNormal);
+
+    p->Start(15 * 1000 * 1000, 1000, TCallBack(StopActiveScheduler));
+
+    MSTIFTestInterference* interference =  MSTIFTestInterference::NewL(
+        cb, MSTIFTestInterference::EThread );
+
+    // Start interference to generate 99% CPU load (100 ms load, 1% idle)
+    interference->StartL( MSTIFTestInterference::ECpuLoad, 1, 100 );
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    interference->Stop();
+    delete interference;
+    
+    delete p;
+
+    // Check results
+    TInt64 timer1RightWin =
+        utcNow.Int64() + static_cast<TInt64>(expireTime1.Int());
+    TInt64 timer2RightWin =
+        utcNow.Int64() + static_cast<TInt64>(expireTime2.Int());
+    TInt64 timer1LeftWin = timer2RightWin - static_cast<TInt64>(
+        (static_cast<TReal64>(expireTime1.Int()) * KDefaultWindowMultiplier));
+    TInt64 timer2LeftWin = timer2RightWin - static_cast<TInt64>(
+        (static_cast<TReal64>(expireTime2.Int()) * KDefaultWindowMultiplier));
+    TInt64 timer1StopedTime = eResult1->iTimerStoppedTime;
+    TInt64 timer2StopedTime = eResult2->iTimerStoppedTime;
+    
+    //See if Timer 1 Callback has failed the case
+    if (eResult1->iCaseAlreadyFailed)
+        {
+        _LIT( KDescription ,"Timer 1 has failed" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    //See if Timer 2 Callback has failed the case
+    else if (eResult2->iCaseAlreadyFailed)
+        {
+        _LIT( KDescription,"Timer 2 has failed" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Check if timer 1 has timed out too early
+    else if ((timer1StopedTime + KTickResolution) < timer1LeftWin)
+        {
+        _LIT( KDescription, "Timer 1 timed out too early" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Check if timer 1 has timed out too Late
+    else if ((timer1StopedTime - KTimerAccuracyMicroSeconds) > timer1RightWin)
+        {
+        _LIT( KDescription, "Timer 1 timed out too late" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Check if timer 2 has timed out too early
+    else if ((timer2StopedTime + KTickResolution) < timer2LeftWin)
+        {
+        _LIT( KDescription, "Timer 2 timed out too early" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Check if timer 2 has timed out too Late
+    else if ((timer2StopedTime - KTimerAccuracyMicroSeconds - KExtraSlack) > timer2RightWin)
+        {
+        _LIT( KDescription, "Timer 2 timed out too late" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Check that the timers 1 and 2 timed out at the same time
+    else if (((timer1StopedTime + KTimerAccuracyMicroSeconds) < timer2StopedTime) ||
+        ((timer1StopedTime - KTimerAccuracyMicroSeconds) > timer2StopedTime))
+        {
+        _LIT( KDescription, "Timers 1 and 2 did not timeout at the same time" );
+        aResult.SetResult( KErrGeneral, KDescription );
+        }
+    // Everything was successful
+    else
+        {
+        _LIT( KDescription, "Passed" );
+        aResult.SetResult( KErrNone, KDescription );
+        }
+    
+    // Case was executed
+    delete timer1;
+    delete timer2;
+    delete eResult1;
+    delete eResult2;
+    delete res1;
+    delete res2;
+    
+    return KErrNone;
+    }
+// --------------------------------------------------------------------------
+// Start many timers and see that nothing goes wrong when they are expired at rapid sequence
+// --------------------------------------------------------------------------
+//
+TInt CTestCFlexTimer::CpuLoadManyTimersL(
+        TTestResult& aResult, CTestFlexTimer *cb )
+    {
+    RDebug::Printf("CpuLoadManyTimersL");
+    // This list will contain all the timer structs, expiry times etc.
+    // First cell will always tell which timer is currently active
+    // active info is transferred from e.g. InheritedCFlexTimer2::RunL to CB function
+    RArray<TTimerStruct> timers;
+    // This CB contains all the logic about timer addition
+    StartTimerAndAddToList( &timers, 100 );
+    
+    MSTIFTestInterference* interference =  MSTIFTestInterference::NewL(
+        cb, MSTIFTestInterference::EThread );
+    // Start interference to generate 99% CPU load (100 ms load, 1% idle)
+    interference->StartL( MSTIFTestInterference::ECpuLoad, 1, 50 );
+    // Start scheduler and wait for callback to stop it
+    CActiveScheduler::Start();
+    interference->Stop();
+    delete interference;
+    
+    // Delete CPeriodic that was used to launch new FlexTimers
+    delete timers[0].iStartTimer;
+    _LIT( KDescriptionP , "Passed");
+    aResult.SetResult(KErrNone, KDescriptionP);
+    // Loop throug list and see if timers fired within limits.
+    // also delete all stuff reserved earlier by StartTimerAndAddToList
+    while (timers.Count())
+        {
+        TInt64 rightWin = timers[0].iEResult->iTimerStartedTime +
+            timers[0].iEResult->iTimerExpiryTime;
+        TInt64 leftWin = rightWin -
+            (static_cast<float> (timers[0].iEResult->iTimerExpiryTime) *
+                KDefaultWindowMultiplier);
+        TInt64 stopTime = timers[0].iEResult->iTimerStoppedTime;
+        
+        // Have fun with reading this. It is not as bad as it looks
+        // Just checks if CB already failed the case
+        // and if timer was launched within its window(default) and timer accuracy
+        if (timers[0].iEResult->iCaseAlreadyFailed)
+            {
+            _LIT( KDescription , "Case was failed earlier for unknown reason.");
+            aResult.SetResult(KErrGeneral, KDescription);
+            }
+        // Check if timer has expired before the window has started.
+        else if((stopTime + KTickResolution)  < leftWin)
+            {
+            _LIT( KDescription , "Some timer has expired too soon");
+            aResult.SetResult(KErrGeneral, KDescription);
+            }
+        // Check if timeout has happened too long time after window end.
+        else if (stopTime > (rightWin + KTimerAccuracyMicroSeconds + KExtraSlack))
+            {
+            _LIT( KDescription , "Some timer has expired too late");
+            aResult.SetResult(KErrGeneral, KDescription);
+            }
+        delete timers[0].iEResult->iTestResult;
+        delete timers[0].iEResult;
+        delete timers[0].iTimer;
+        timers.Remove(0);
+        }
+    // Case was executed
+    timers.Close();
+    return KErrNone;
+    }
+
+// ======== GLOBAL FUNCTIONS ========
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/testflexperiodic.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,2091 @@
+/*
+* ============================================================================
+*  Name        : testflexperiodic.cpp
+*  Part of     : src / testflextimer
+*  Description : STIF test cases for CFlexPeriodic timer.
+*  Version     : %version: 1 %
+*
+*  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+*  All rights reserved.
+*  This component and the accompanying materials are made available
+*  under the terms of the License "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:
+*  Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <e32debug.h>               // for RDebug
+#include <flexperiodic.h>           // for CFlexPeriodic
+#include <stiftesteventinterface.h> // for TEventIf 
+#include "testflextimer.h"          // for global constants
+#include "testflexperiodic.h"
+
+/**
+ *  Timer can be expired 1 sec late
+ *  
+ *  Note! Definition
+ *  
+ *      const TTimeIntervalMicroSeconds32 KTimerResolution( 1000000 );
+ * 
+ * will cause writable static data due non-trivial constructor of 
+ * TTimeIntervalMicroSeconds32.
+ *  
+ */
+const TInt KTimerResolution( 1000000 );
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CTestFlexPeriodic::CTestFlexPeriodic()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CTestFlexPeriodic::~CTestFlexPeriodic()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// _ _ _ ____ _ ___    _    ____ ____ ___  
+// | | | |__| |  |     |    |  | |  | |__] 
+// |_|_| |  | |  |     |___ |__| |__| |    
+//                                         
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// Start scheduler for given time.
+// ---------------------------------------------------------------------------
+//
+void CTestFlexPeriodic::WaitL( TTimeIntervalMicroSeconds32 aPeriod )
+    {
+    CPeriodic* watchdog = CPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( watchdog );
+    watchdog->Start( aPeriod, aPeriod, TCallBack( StopScheduler, NULL ) );
+    
+    // Start scheduler. Wait here until the timer expires and stops the
+    // scheduler.
+    CActiveScheduler::Start();
+    
+    // Clean-up
+    watchdog->Cancel();
+    CleanupStack::PopAndDestroy( watchdog );
+    }
+
+// ---------------------------------------------------------------------------
+// TCallBack function to stop the scheduler.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StopScheduler( TAny* /* aArgument */ )
+    {
+    CActiveScheduler::Stop();
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ____ ____ _    _    ___  ____ ____ _  _ ____ 
+// |    |__| |    |    |__] |__| |    |_/  [__  
+// |___ |  | |___ |___ |__] |  | |___ | \_ ___] 
+//                                              
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// TCallBack function that does nothing. Not ment to be called - just to 
+// fulfill the interface.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::DoNothing( TAny* /* aArgument */ )
+    {
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TCallBack function that panics testcase if it get called.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::PanicClient( TAny* /* aArgument */ )
+    {
+    User::Panic(_L("NotCalled CB got called"), 0xDEAD);
+    return KErrNone;
+    }
+// ---------------------------------------------------------------------------
+// TCallBack function for adding time stamp to an RArray of TTimes.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::AddTimestamp( TAny* aArgument )
+    {
+    __ASSERT_ALWAYS(
+        aArgument != NULL,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    //RDebug::Print( _L("CTestFlexPeriodic::AddTimestamp()") );
+    
+    RArray<TTime>* times =  reinterpret_cast<RArray<TTime>*>( aArgument );
+
+    TTime now;
+    now.UniversalTime();
+
+    TInt err = times->Append( now ); // Data is copied by RArray
+    __ASSERT_ALWAYS(
+        err == KErrNone,
+        User::Panic( KTestFlexTimerPanicCategory, err ) );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TCallBack function for restarting CFlexPeriodic timer.
+// Action depends the value of iFirstTicksLeft;
+// >0 -- Add timestamp to iFirstTimestamps 
+// <0 -- Add timestamp to iSecondTimestamps
+// =0 -- Add timestamp to iFirstTimestamps AND iSecondTimestamps AND restart
+//       the timer with iSecondInterval
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::RestartTimer( TAny* aArgument )
+    {
+    __ASSERT_ALWAYS(
+        aArgument != NULL,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    TRestartInfo* info =  reinterpret_cast<TRestartInfo*>( aArgument );
+
+    __ASSERT_ALWAYS(
+        info->iTimer != NULL && 
+        info->iFirstTimestamps != NULL && 
+        info->iSecondTimestamps != NULL,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+    
+    // Add current time to timestamps
+    // Data is copied by RArray - no need to use heap
+    TTime now;
+    now.UniversalTime();
+    
+    TInt ticks( info->iFirstTicksLeft-- ); // Update the ticks
+    TInt err( KErrNone );
+    if ( ticks > 0 )
+        {
+        err = info->iFirstTimestamps->Append( now );
+        }
+    else if ( ticks < 0 )
+        {
+        err = info->iSecondTimestamps->Append( now );
+        }
+    else // ticks == 0
+        {
+        // Set the timestamps.
+        // 1st timer settings expiration time is the starting time of the
+        // second timer settings. Add timestamp to both arrays.
+        err = info->iFirstTimestamps->Append( now );
+        __ASSERT_ALWAYS(
+            err == KErrNone,
+            User::Panic( KTestFlexTimerPanicCategory, err ) );
+        err = info->iSecondTimestamps->Append( now );
+
+        // Restart the timer
+        info->iTimer->Cancel();
+        info->iTimer->Start(
+            info->iSecondInterval,
+            info->iSecondInterval, 
+            TCallBack( RestartTimer, info ) );
+        }
+    __ASSERT_ALWAYS(
+        err == KErrNone,
+        User::Panic( KTestFlexTimerPanicCategory, err ) );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TCallBack function for trying to configure timer in callback.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureTimer( TAny* aArgument )
+    {
+    __ASSERT_ALWAYS(
+        aArgument != NULL,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    TConfigureInfo* info =  reinterpret_cast<TConfigureInfo*>( aArgument );
+
+    const TTimeIntervalMicroSeconds32 delayWindow32( info->iDelayWindow );
+    const TTimeIntervalMicroSeconds32 intervalWindow32( info->iIntervalWindow );
+
+    const TTimeIntervalMicroSeconds delayWindow64( info->iDelayWindow );
+    const TTimeIntervalMicroSeconds intervalWindow64( info->iIntervalWindow );
+
+    info->iConfigResult32 = info->iTimer->Configure( delayWindow32,
+                                                     intervalWindow32);
+
+    info->iConfigResult64 = info->iTimer->Configure( delayWindow64,
+                                                     intervalWindow64);
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TCallBack function for starting a flexible periodic timer.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartTimer( TAny* aArgument )
+    {
+    __ASSERT_ALWAYS(
+        aArgument != NULL,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    const TTimeIntervalMicroSeconds32 KTimerDelay( 2000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 2000000 );
+
+    CFlexPeriodic* timer =  reinterpret_cast<CFlexPeriodic*>( aArgument );
+
+    timer->Start(
+        KTimerDelay,
+        KTimerInterval,
+        TCallBack( StartTimer, timer )
+        );
+
+    return KErrNone;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// ___ _ _  _ ____ ____ ___ ____ _  _ ___     ____ _  _ _  _ ____ . ____ 
+//  |  | |\/| |___ [__   |  |__| |\/| |__]    |___ |  | |\ | |    ' [__  
+//  |  | |  | |___ ___]  |  |  | |  | |       |    |__| | \| |___   ___] 
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// Verify that the timestamps are expired at window.
+//
+// Note that the timer resolution is 1 sec, so, the actual expiration time can
+// be later than set.
+// ---------------------------------------------------------------------------
+//
+TBool CTestFlexPeriodic::AreTimestampsAtWindow( 
+    const RArray<TTime>& aTimestamps,
+    const TTimeIntervalMicroSeconds32& aDelay,
+    const TTimeIntervalMicroSeconds32& aInterval,
+    const TTimeIntervalMicroSeconds32& aDelayWindow,
+    const TTimeIntervalMicroSeconds32& aIntervalWindow )
+    {
+    __ASSERT_ALWAYS(
+        aTimestamps.Count() >= 2 && 
+        aDelay.Int() >= 0 &&
+        aInterval.Int() >= 0 &&
+        aDelayWindow.Int() >= 0 &&
+        aIntervalWindow.Int() >= 0,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    // Timestamps are correct unless proved otherwise 
+    TBool ret = ETrue;
+
+    // For the 1st expiration is delay
+    TTimeIntervalMicroSeconds delay;
+    delay = aTimestamps[1].MicroSecondsFrom( aTimestamps[0] );
+    RDebug::Print( _L("Timer delay %Ld"), delay.Int64() );
+
+    if ( delay < aDelay.Int() - aDelayWindow.Int() || 
+         delay > aDelay.Int() + KTimerResolution )
+        {
+        ret = EFalse;
+        }
+
+    // The rest of the expirations are intervals
+    for ( TInt i( 2 ); i < aTimestamps.Count(); ++i )
+        {
+        TTimeIntervalMicroSeconds interval;
+        interval = aTimestamps[i].MicroSecondsFrom( aTimestamps[i-1] );
+        RDebug::Print( _L("Timer interval %Ld"), interval.Int64() );
+
+        if ( interval < aInterval.Int() - aIntervalWindow.Int() || 
+             interval > aInterval.Int() + KTimerResolution )
+            {
+            ret = EFalse;
+            }
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert the intervals from 64 bit to 32 bit and call 32 bit checking 
+// function.
+// ---------------------------------------------------------------------------
+//
+TBool CTestFlexPeriodic::AreTimestampsAtWindow( 
+    const RArray<TTime>& aTimestamps,
+    const TTimeIntervalMicroSeconds& aDelay,
+    const TTimeIntervalMicroSeconds& aInterval,
+    const TTimeIntervalMicroSeconds& aDelayWindow,
+    const TTimeIntervalMicroSeconds& aIntervalWindow )
+    {
+    __ASSERT_ALWAYS(
+        I64HIGH( aDelay.Int64() ) == 0 &&
+        I64HIGH( aInterval.Int64() ) == 0 &&
+        I64HIGH( aDelayWindow.Int64() ) == 0 &&
+        I64HIGH( aIntervalWindow.Int64() ) == 0,
+        User::Panic( KTestFlexTimerPanicCategory, KErrArgument ) );
+
+    TTimeIntervalMicroSeconds32 delay( I64INT( aDelay.Int64() ) );
+    TTimeIntervalMicroSeconds32 interval( I64INT( aInterval.Int64() ) );
+    TTimeIntervalMicroSeconds32 delayWindow( I64INT( aDelayWindow.Int64() ) );
+    TTimeIntervalMicroSeconds32 intervalWindow( I64INT( aIntervalWindow.Int64() ) );
+
+    return AreTimestampsAtWindow( aTimestamps, 
+                                  delay,
+                                  interval,
+                                  delayWindow,
+                                  intervalWindow );
+    }
+
+// ---------------------------------------------------------------------------
+// Compare are timestamp arrays same
+// ---------------------------------------------------------------------------
+//
+TBool CTestFlexPeriodic::AreTimestampsSame(
+    const RArray<TTime>& aLeft,
+    const RArray<TTime>& aRight )
+    {
+    TBool ret( ETrue );
+    if ( aLeft.Count() == aRight.Count() )
+        {
+        for ( TInt i( 0 ); i < aLeft.Count(); ++i )
+            {
+            if ( aLeft[i] != aRight[i] )
+                { // Different timestamp has been found
+                ret = EFalse;
+                break;
+                }
+            }
+        }
+    else
+        { // Arrays has different number of timestamps.
+        ret = EFalse;
+        }
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// ___ ____ _  _ ___  _    ____ ___ ____    ____ _  _ _  _ ____ . ____ 
+//  |  |___ |\/| |__] |    |__|  |  |___    |___ |  | |\ | |    ' [__  
+//  |  |___ |  | |    |___ |  |  |  |___    |    |__| | \| |___   ___] 
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// Configure window sizes - template function
+// 
+// Timers are designed so that the 1st timer will test that the delay is
+// correct and the 2nd timer will test that the interval is correct
+// ---------------------------------------------------------------------------
+template <class firstType, class secondType>
+TInt CTestFlexPeriodic::ConfigureWindowL( TTestResult& aResult )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const firstType KFirstDelay( 3000000 );             // 3 sec
+    const firstType KFirstInterval( 2000000 );          // 2 sec
+    const firstType KFirstDelayWindow( 0 );             // no window
+    const firstType KFirstIntervalWindow( 1500000 );    // 1.5 sec
+
+    const secondType KSecondDelay( 3500000 );           // 3.5 sec
+    const secondType KSecondInterval( 1000000 );        // 1 sec
+    const secondType KSecondDelayWindow( 1500000 );     // 1.5 sec
+    const secondType KSecondIntervalWindow( 0 );        // no window
+
+    const TUint KTestRunTime( 10000000 ); // 10 sec
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Create, configure and start the flexible periodic timer
+    RArray<TTime> firstTimestamps;
+    CFlexPeriodic* firstTimer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( firstTimer );
+    firstTimer->Configure( KFirstDelayWindow, KFirstIntervalWindow );
+    firstTimer->Start( 
+        KFirstDelay, 
+        KFirstInterval, 
+        TCallBack( AddTimestamp, &firstTimestamps ) );
+
+    RArray<TTime> secondTimestamps;
+    CFlexPeriodic* secondTimer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( secondTimer );
+    secondTimer->Configure( KSecondDelayWindow, KSecondIntervalWindow );
+    secondTimer->Start( 
+        KSecondDelay, 
+        KSecondInterval,
+        TCallBack( AddTimestamp, &secondTimestamps ) );
+
+    // Initialize timer expiration time array with starting time to 
+    // ease analysing of data.
+    TTime startTime;
+    startTime.UniversalTime();
+    firstTimestamps.Append( startTime );
+    secondTimestamps.Append( startTime );
+
+    // The execution will be pending here while active scheduler is running...
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Analyze results
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    // Check the 1st timer expiration time
+    if ( !AreTimestampsAtWindow( 
+            firstTimestamps, 
+            KFirstDelay, 
+            KFirstInterval, 
+            KFirstDelayWindow, 
+            KFirstIntervalWindow ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. First timer not in window.") );
+        }
+
+    // Check the 2nd timer expiration time
+    else if ( !AreTimestampsAtWindow( 
+            secondTimestamps, 
+            KSecondDelay, 
+            KSecondInterval, 
+            KSecondDelayWindow, 
+            KSecondIntervalWindow ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Second timer not in window.") );
+        }
+    
+    // Check that both timers are expired at the same time
+    else if ( !AreTimestampsSame( firstTimestamps, secondTimestamps ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Timers are not expired at the same time.") );
+        }
+
+    // Clean up
+    secondTimer->Cancel();
+    secondTimestamps.Close();
+    CleanupStack::PopAndDestroy( secondTimer );
+
+    firstTimer->Cancel();
+    firstTimestamps.Close();
+    CleanupStack::PopAndDestroy( firstTimer );
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Configure window sizes and start timer with given values - template 
+// function
+// ---------------------------------------------------------------------------
+template <class configureType, class startType>
+void CTestFlexPeriodic::ConfigureAndStartTimerL( 
+    RArray<TTime>& aTimestamps,
+    TInt64 aDelay,
+    TInt64 aInterval,
+    TInt64 aDelayWindow,
+    TInt64 aIntervalWindow )
+    {
+    const startType KDelay( aDelay );
+    const startType KInterval( aInterval );
+    const configureType KDelayWindow( aDelayWindow );
+    const configureType KIntervalWindow( aIntervalWindow );
+
+    const TUint KTestRunTime( 3000000 );
+
+    TTime now;
+    now.UniversalTime();
+    aTimestamps.Append( now );
+
+    // Create and start the flexible periodic timer
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Configure( KDelayWindow, KIntervalWindow );
+    timer->Start( KDelay, KInterval, TCallBack( AddTimestamp, &aTimestamps ) );
+    
+    // The execution will be pending here while active scheduler is running...
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Clean up
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with NULL callback 
+// ---------------------------------------------------------------------------
+//
+template<class startType>
+TInt CTestFlexPeriodic::StartWithNullCallBackL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const startType KTimerDelay( 1000000 );
+    const startType KTimerInterval( 1000000 );
+
+    TInt(* nullCallback)(TAny*) = NULL;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   31 (EFlexPeriodicCallbackFunctionIsNull)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 31 );
+    
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( nullCallback, NULL ) );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Panic thread after a few seconds
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::DoPanicL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds32 KTimerDelay( 1000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 1000000 );
+    const TTimeIntervalMicroSeconds32 KTestRunTime( 3000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( DoNothing, NULL ) );
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    User::Panic(_L("Die die die!"), 0xDEAD);
+
+    // We should NEVER be here...
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// ____ _  _ _  _    _ _  _    ___ _  _ ____ ____ ____ ___  
+// |__/ |  | |\ |    | |\ |     |  |__| |__/ |___ |__| |  \ 
+// |  \ |__| | \|    | | \|     |  |  | |  \ |___ |  | |__/ 
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// Run test case in own thread
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::RunInThread( 
+    RThread& aThread, 
+    TTestCaseArguments& aArguments )
+    {
+    // RThread::Create() parameters
+    const TInt stackSize = 1024;
+    const TInt heapMinSize = 1024;
+    const TInt heapMaxSize = 1024;
+
+    TBuf<8> processName;
+    processName.Format( _L("%x"), &aArguments.iResult );
+    
+    // Create the thread
+    TInt ret = aThread.Create(
+        processName,
+        RunTestCase, 
+        stackSize,
+        heapMinSize,
+        heapMaxSize,
+        &aArguments,
+        EOwnerProcess );
+
+    // Start execution of the thread
+    aThread.Resume();
+
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Create cleanup stack
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::RunTestCase( TAny* aArgument )
+    {
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+
+    // Out of memory assert
+    __ASSERT_ALWAYS(
+        cleanup != NULL, 
+        User::Panic( KTestFlexTimerPanicCategory, KErrNoMemory ) );
+    
+    TRAPD( err, CTestFlexPeriodic::RunTestCaseL( aArgument ) );
+
+    delete cleanup;
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Create scheduler and run the test case
+// ---------------------------------------------------------------------------
+//
+void CTestFlexPeriodic::RunTestCaseL( TAny* aArgument )
+    {
+    // Create and install active scheduler
+    CActiveScheduler* scheduler = scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+    
+    // Parse the arguments
+    TTestCaseArguments* args = reinterpret_cast<TTestCaseArguments*>( aArgument );
+    
+    // Call the function pointer with given arguments
+    TInt ret = (*(args->iTestFunction))(args->iResult, args->iCallback );
+    User::LeaveIfError( ret );
+
+    // Clean up
+    CleanupStack::PopAndDestroy( scheduler );
+    }
+
+// ---------------------------------------------------------------------------
+// ___ ____ ____ ___    ____ ____ ____ ____ ____ 
+//  |  |___ [__   |     |    |__| [__  |___ [__  
+//  |  |___ ___]  |     |___ |  | ___] |___ ___] 
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start one CFlexPeriodic and wait for few expirations.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartOneTimerL( 
+        TTestResult& aResult, 
+        CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds32 KTickInterval( 1000000 ); // 1 sec
+    const TUint KTestRunTime( 5000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Storage for flexible periodic timer timestamps
+    RArray<TTime> timestamps;
+
+    // Create and start the flexible periodic timer
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Start( 
+        KTickInterval, 
+        KTickInterval, 
+        TCallBack( AddTimestamp, &timestamps ) );
+
+    // Initialize timer expiration time array with starting time to 
+    // ease analysing of data.
+    TTime startTime;
+    startTime.UniversalTime();
+    timestamps.Append( startTime );
+    
+    // The execution will be pending here while active scheduler is running...
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Analyze results
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    // Only start time in timestamp array
+    if ( timestamps.Count() == 1 )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. No timer expired.") );
+        }
+
+    // Check that the timers are expired at maximum delay due there are only
+    // one timer, so, no alignment can be happened.
+    if ( !AreTimestampsAtWindow( timestamps, KTickInterval, KTickInterval, 0, 0 ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Timer not in maximum window.") );
+        }
+
+    // Clean up
+    timer->Cancel();
+    timestamps.Close();
+    CleanupStack::PopAndDestroy( timer );
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start one CFlexPeriodic and wait for few expirations.
+// Give also Error callback function.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartOneTimerWithErrorCbL( 
+        TTestResult& aResult, 
+        CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds32 KTickInterval( 1000000 ); // 1 sec
+    const TUint KTestRunTime( 5000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Storage for flexible periodic timer timestamps
+    RArray<TTime> timestamps;
+
+    // Create and start the flexible periodic timer
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Start( 
+        KTickInterval, 
+        KTickInterval, 
+        TCallBack( AddTimestamp, &timestamps ),
+        TCallBack( PanicClient, NULL ) );
+
+    // Initialize timer expiration time array with starting time to 
+    // ease analysing of data.
+    TTime startTime;
+    startTime.UniversalTime();
+    timestamps.Append( startTime );
+    
+    // The execution will be pending here while active scheduler is running...
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Analyze results
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    // Only start time in timestamp array
+    if ( timestamps.Count() == 1 )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. No timer expired.") );
+        }
+
+    // Check that the timers are expired at maximum delay due there are only
+    // one timer, so, no alignment can be happened.
+    if ( !AreTimestampsAtWindow( timestamps, KTickInterval, KTickInterval, 0, 0 ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Timer not in maximum window.") );
+        }
+
+    // Clean up
+    timer->Cancel();
+    timestamps.Close();
+    CleanupStack::PopAndDestroy( timer );
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start one CFlexPeriodic, cancel it and restart it in callback
+// function.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::CallbackRestartL( 
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds KTickInterval( 1000000 ); // 1 sec
+    const TTimeIntervalMicroSeconds KTick2ndInterval( 2000000 ); // 2 sec
+    const TUint KTestRunTime( 10000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    RArray<TTime> firstTimestamps;
+    RArray<TTime> secondTimestamps;
+
+    TRestartInfo info;
+    info.iTimer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    info.iFirstTicksLeft = 1;
+    info.iFirstTimestamps = &firstTimestamps;
+    info.iSecondTimestamps = &secondTimestamps;
+    info.iSecondInterval = KTick2ndInterval;
+
+    // Create and start the flexible periodic timer
+    CleanupStack::PushL( info.iTimer );
+    info.iTimer->Start( 
+        KTickInterval, 
+        KTickInterval, 
+        TCallBack( RestartTimer, &info ) );
+
+    // Initialize timer expiration time array with starting time to 
+    // ease analysing of data.
+    TTime startTime;
+    startTime.UniversalTime();
+    firstTimestamps.Append( startTime );
+    
+    // The execution will be pending here while active scheduler is running...
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Analyze results
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    // Check the 1st timer expiration time
+    if ( !AreTimestampsAtWindow( firstTimestamps, KTickInterval, KTickInterval, 0, 0 ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Pre-reset timer not in maximum window.") );
+        }
+    
+    // Check the rest of timers
+    else if ( !AreTimestampsAtWindow( secondTimestamps, KTick2ndInterval, KTick2ndInterval, 0, 0 ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Post-reset timer not in maximum window.") );
+        }
+    
+    // Clean up
+    info.iTimer->Cancel();
+    firstTimestamps.Close();
+    secondTimestamps.Close();
+    CleanupStack::PopAndDestroy( info.iTimer );
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure window sizes - 32 bit
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWindow32L( 
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    return ConfigureWindowL<TTimeIntervalMicroSeconds32,TTimeIntervalMicroSeconds32>( aResult );
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure window sizes - 64 bit
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWindow64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    return ConfigureWindowL<TTimeIntervalMicroSeconds,TTimeIntervalMicroSeconds>( aResult );
+    }
+
+// ---------------------------------------------------------------------------
+// OK TEST CASE: Configure window sizes - mixed 32 bit and 64 bit
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWindowMixL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    return ConfigureWindowL<TTimeIntervalMicroSeconds32,TTimeIntervalMicroSeconds>( aResult );
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure after timer has started 
+// The test case is divided into following parts:
+// 1) Remove slack from the heartbeat to make it sure that timer's default
+//    windows does not cause the drifting of the timer.
+// 2) Start timer, try to configure it, verify that configure has not been
+//    changed (no alignment should be made by heartbeat)
+// 3) Cancel the timer and start it with a callback that tries to configure
+//    it while in callback, check the results
+// 4) Verify that the configuration stil works by happened timer alignment
+//    by the heartbeat
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureAfterStartL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    
+    // Heartbeat timer
+    // Use 1us to adjust the engine's timer. 0 returns immediately.
+    const TTimeIntervalMicroSeconds32 KHeartbeatDelay( 1 );
+    const TTimeIntervalMicroSeconds32 KHeartbeatInterval( 1000000 );
+    const TTimeIntervalMicroSeconds32 KHeartbeatDelayWindow( 0 );
+    const TTimeIntervalMicroSeconds32 KHeartbeatIntervalWindow( 0 );
+
+    // Timer under test
+    const TTimeIntervalMicroSeconds32 KTimerDelayNow( 0 );
+    const TTimeIntervalMicroSeconds32 KTimerDelay( 2000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 2000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInitialDelayWindow( 0 );
+    const TTimeIntervalMicroSeconds32 KTimerInitialIntervalWindow( 0 );
+
+    const TTimeIntervalMicroSeconds32 KTimerDelayWindow32( 1500000 );
+    const TTimeIntervalMicroSeconds32 KTimerIntervalWindow32( 1500000 );
+
+    const TTimeIntervalMicroSeconds KTimerDelayWindow64( 1500000 );
+    const TTimeIntervalMicroSeconds KTimerIntervalWindow64( 1500000 );
+    
+    const TUint KConfigNokTestRunTime( 7000000 );
+    const TUint KTestCbConfigRunTime( KHeartbeatInterval.Int() );
+    const TUint KConfigOkTestRunTime( 4000000 );
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Create, configure and initialize and start the heartbeat
+    // This timer is used for checking that the timer under test is reacting
+    // correctly to configurations.
+    RArray<TTime> heartbeatTimes;
+    CFlexPeriodic* heartbeat = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( heartbeat );
+    heartbeat->Configure( KHeartbeatDelayWindow, KHeartbeatIntervalWindow );
+    heartbeat->Start( 
+        KHeartbeatDelay, 
+        KHeartbeatInterval, 
+        TCallBack( AddTimestamp, &heartbeatTimes ) );
+
+    // Remove the slack from timer start up -- wait till next second
+    const TInt64 KSecondInMicroSeconds( 1000000 );
+    TTime now;
+    now.UniversalTime();
+    heartbeatTimes.Append( now );
+    TUint slack( I64LOW( KSecondInMicroSeconds - now.Int64() % KSecondInMicroSeconds ) );
+
+                     //    //  ___     _____
+    WaitL( slack ); // // // //_ // //  //
+                   //_//_// //  // //  //
+
+    // Create and start the flexible periodic timer
+    RArray<TTime> timestamps;
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+    timer->Configure( KTimerInitialDelayWindow, KTimerInitialIntervalWindow );
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( AddTimestamp, &timestamps ) );
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    if ( timer->Configure( KTimerDelayWindow32, KTimerIntervalWindow32 ) != KErrInUse )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. 32 bit configure didn't return KErrInUse") );
+        }
+    else if ( timer->Configure( KTimerDelayWindow64, KTimerIntervalWindow64 ) != KErrInUse )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. 64 bit configure didn't return KErrInUse") );
+        }
+
+    // Initialize timer expiration time array with starting time to 
+    // ease analysing of data.
+    now.UniversalTime();
+    timestamps.Append( now );
+                                     //    //  ___     _____
+    WaitL( KConfigNokTestRunTime ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    // Check the 1st timer expiration time
+    RDebug::Print( _L("Timer:") );
+    if ( !AreTimestampsAtWindow( 
+            timestamps, 
+            KTimerDelay,
+            KTimerInterval,
+            KTimerInitialDelayWindow,
+            KTimerInitialIntervalWindow ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Configuration changed after start. ") );
+        }
+
+    // Restart the timer to try configuration while callback
+    timer->Cancel();
+
+    TConfigureInfo configInfo;
+    configInfo.iTimer = timer;
+    configInfo.iDelayWindow = KTimerDelayWindow32.Int();
+    configInfo.iIntervalWindow = KTimerIntervalWindow32.Int();
+    configInfo.iConfigResult32 = 0xDEADBEEF; // Initialize result
+    configInfo.iConfigResult64 = 0xDEADBEEF; // Initialize result
+
+    timer->Start(
+        KTimerDelayNow, 
+        KTimerInterval, 
+        TCallBack( ConfigureTimer, &configInfo ) );
+
+                                    //    //  ___     _____
+    WaitL( KTestCbConfigRunTime ); // // // //_ // //  //
+                                  //_//_// //  // //  //
+
+    timer->Cancel();
+
+    RDebug::Print( _L("configInfo.iConfigResult32=%d (0x%x)"), configInfo.iConfigResult32, configInfo.iConfigResult32 );
+    RDebug::Print( _L("configInfo.iConfigResult64=%d (0x%x)"), configInfo.iConfigResult64, configInfo.iConfigResult64 );
+
+    // Analyze the results
+    if ( configInfo.iConfigResult32 != KErrInUse )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. 32 bit configure in callback didn't return KErrInUse") );
+        }
+    else if ( configInfo.iConfigResult64 != KErrInUse )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. 64 bit configure in callback didn't return KErrInUse") );
+        }
+
+    // Test that the configuration still works
+    RArray<TTime> secondTimestamps;
+    now.UniversalTime();
+    secondTimestamps.Append( now );
+
+    if ( timer->Configure( KTimerDelayWindow32, KTimerIntervalWindow32 ) != KErrNone )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Configure failed.") );
+        }
+    else
+        {
+        timer->Start(
+            KTimerDelay,
+            KTimerInterval,
+            TCallBack( AddTimestamp, &secondTimestamps ));
+
+                                        //    //  ___     _____
+        WaitL( KConfigOkTestRunTime ); // // // //_ // //  //
+                                      //_//_// //  // //  //
+
+        // Check timestamps, they should be the same as heartbeat
+        RDebug::Print( _L("secondTimestamps:") );
+        if ( !AreTimestampsAtWindow( 
+                secondTimestamps, 
+                KHeartbeatInterval, // Heartbeat was running already 
+                KHeartbeatInterval,
+                KHeartbeatInterval, // There can be adjustement with 1st expiration 
+                0 ) )
+            {
+            aResult.SetResult( 
+                KErrGeneral, 
+                _L("Test case failed. Configure does not work.") );
+            }
+        }
+
+    RDebug::Print( _L("Heartbeat:") );
+    if ( !AreTimestampsAtWindow( 
+            heartbeatTimes, 
+            KHeartbeatDelay,
+            KHeartbeatInterval,
+            KHeartbeatDelayWindow,
+            KHeartbeatIntervalWindow ) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Heartbeat failure.") );
+        }
+
+    // Clean up
+    timestamps.Close();
+    secondTimestamps.Close();
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    heartbeatTimes.Close();
+    heartbeat->Cancel();
+    CleanupStack::PopAndDestroy( heartbeat );
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a running timer again.
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartAfterStartL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds32 KTimerDelay( 2000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 2000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+
+    // This start should work...
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( DoNothing, NULL ) );
+
+    // ... and next start should panic with
+    // Panic category: "E32USER-CBase"
+    // Panic reason:   42 (attempt to active CActive when a request is still 
+    //                     outstanding)
+    
+    // Set panic code 42 to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        42 );
+
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( DoNothing, NULL ) );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    // Clean up
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    __UHEAP_MARKEND;    
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a running timer again in callback function
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartInCallbackL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    // Constants
+    const TTimeIntervalMicroSeconds32 KTimerDelay( 1000000 );
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 1000000 );
+    const TTimeIntervalMicroSeconds32 KTestRunTime( 3000000 );
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    CFlexPeriodic* timer = CFlexPeriodic::NewL( CActive::EPriorityStandard );
+    CleanupStack::PushL( timer );
+
+    // The callback should panic with
+    // Panic category: "E32USER-CBase"
+    // Panic reason:   42 (attempt to active CActive when a request is still 
+    //                     outstanding)
+    
+    // Set panic code 42 to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        42 );
+
+    timer->Start( 
+        KTimerDelay, 
+        KTimerInterval, 
+        TCallBack( StartTimer, timer ) );
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    // Clean up
+    timer->Cancel();
+    CleanupStack::PopAndDestroy( timer );
+
+    __UHEAP_MARKEND;    
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with negative delay, 32 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNegativeDelay32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+
+    RArray<TTime> timestamps;
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   6 (EFlexPeriodicDelayLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 6 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with zero interval, 32 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithZeroInterval32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( 0 );
+
+    RArray<TTime> timestamps;
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   7 (EFlexPeriodicIntervalTooSmall)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 7 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with negative interval, 32 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNegativeInterval32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+
+    RArray<TTime> timestamps;
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   7 (EFlexPeriodicIntervalTooSmall)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 7 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with negative delay, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNegativeDelay64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   6 (EFlexPeriodicDelayLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 6 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with zero interval, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithZeroInterval64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( 0 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   7 (EFlexPeriodicIntervalTooSmall)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 7 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with negative interval, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNegativeInterval64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   7 (EFlexPeriodicIntervalTooSmall)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 7 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure timer with negative delay window, 32 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWithNegativeDelayWindow32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   8 (EFlexPeriodicDelayWindowLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 8 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KAllowedValue,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure timer with negative interval window, 32 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWithNegativeIntervalWindow32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   9 (EFlexPeriodicIntervalWindowLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 9 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KAllowedValue,
+        KAllowedValue,
+        KAllowedValue,
+        KIllegalValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure timer with negative delay window, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWithNegativeDelayWindow64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   8 (EFlexPeriodicDelayWindowLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 8 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KAllowedValue,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure timer with negative interval window, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ConfigureWithNegativeIntervalWindow64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt KIllegalValue( -1 );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   9 (EFlexPeriodicIntervalWindowLessThanZero)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 9 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KAllowedValue,
+        KAllowedValue,
+        KAllowedValue,
+        KIllegalValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start with minimum and maximum values
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithMinAndMaxL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KMinimumDelayValue( 0 );
+    const TInt KMinimumIntervalValue( 1 );
+    const TInt KNormalValue( 1000000 );
+    const TInt KMaximum32BitValue( 0x7FFFFFFF );
+
+//    const TInt64 KLarge64BitValue( 0x6FFFFFFFFFFFFFFF );  // Should not panic (till few years)
+
+    // Years * Days * Hours * Minutes * Seconds * Microseconds
+    const TInt64 KLarge64BitValue( ((TInt64)(1)) * 365 * 24 * 60 * 60 * 1000000 );
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    RArray<TTime> timestamps;
+
+    TTime now;
+    now.UniversalTime();
+
+    // > DEBUG
+    TTimeIntervalMicroSeconds longLongInterval( KLarge64BitValue );
+    now += longLongInterval;
+    TDateTime date;
+    date = now.DateTime();
+    // < DEBUG
+
+    // Start with min delay, 32 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KMinimumDelayValue,
+        KNormalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds32( KMinimumDelayValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 32 bit min delay failed") );
+        }
+    timestamps.Reset();
+
+    // Start with max delay, 32 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KMaximum32BitValue,
+        KNormalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    // Only one timestamp (the start time) is allowed
+    if ( timestamps.Count() > 1 )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 32 bit max delay failed") );
+        }
+    timestamps.Reset();
+
+    // Start with min interval, 32 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KNormalValue,
+        KMinimumIntervalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KMinimumIntervalValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 32 bit min interval failed") );
+        }
+    timestamps.Reset();
+
+    // Start with max interval, 32 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32>(
+        timestamps,
+        KNormalValue,
+        KMaximum32BitValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KMaximum32BitValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ),
+            TTimeIntervalMicroSeconds32( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 32 bit min interval failed") );
+        }
+    timestamps.Reset();
+
+    // Start with min delay, 64 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KMinimumDelayValue,
+        KNormalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds( KMinimumDelayValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 64 bit min delay failed") );
+        }
+    timestamps.Reset();
+
+    // Start with large delay, 64 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KLarge64BitValue,
+        KNormalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    // Only one timestamp (the start time) is allowed
+    if ( timestamps.Count() > 1 )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 64 bit max delay failed") );
+        }
+    timestamps.Reset();
+
+    // Start with min interval, 64 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KNormalValue,
+        KMinimumIntervalValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KMinimumIntervalValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 64 bit min interval failed") );
+        }
+    timestamps.Reset();
+
+    // Start with large interval, 64 bit
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KNormalValue,
+        KLarge64BitValue,
+        KNormalValue,
+        KNormalValue );
+    // Validate results
+    // AreTimestampsAtWindow() does not accept values over 0xFFFFFFFF.
+    // However, this is not a problem due there should be only the timestamps
+    // of start time and delay expiration; 32 bit value can be used instead of
+    // the real interval.
+    if ( !AreTimestampsAtWindow(
+            timestamps,
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KMaximum32BitValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ),
+            TTimeIntervalMicroSeconds( KNormalValue ) ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. 64 bit max interval failed") );
+        }
+    timestamps.Reset();
+
+    // If test execution is here, we'll passed
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    // Clean up
+    timestamps.Close();
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with maximum delay, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithMaximumDelay64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt64 KIllegalValue( 0x7FFFFFFFFFFFFFFF );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   24 (EFlexTimerServerIllegalTimerValue)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 24 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with maximum interval, 64 bit interface
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithMaximumInterval64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback  )
+    {
+    __UHEAP_MARK;
+
+    const TInt KAllowedValue( 1 );
+    const TInt64 KIllegalValue( 0x7FFFFFFFFFFFFFFF );
+    
+    RArray<TTime> timestamps;
+    
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // ConfigureAndStartTimerL should panic:
+    //  Category: "CFlexPeriodic" 
+    //  Reason:   24 (EFlexTimerServerIllegalTimerValue)
+    // Set the panic code to acceptable exit reason
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 24 );
+
+    ConfigureAndStartTimerL<TTimeIntervalMicroSeconds, TTimeIntervalMicroSeconds>(
+        timestamps,
+        KAllowedValue,
+        KIllegalValue,
+        KAllowedValue,
+        KAllowedValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone );
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    // Clean up
+    timestamps.Close();
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with NULL callback (32 bit)
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNullCallBack32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    return StartWithNullCallBackL<TTimeIntervalMicroSeconds32>( aResult, aCallback );
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with NULL callback (64 bit)
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::StartWithNullCallBack64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    return StartWithNullCallBackL<TTimeIntervalMicroSeconds>( aResult, aCallback );
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Client crashes
+// 1) Start two timers in separate threads
+// 2) The 1st timer will panic after a while
+// 3) Check that the 2nd timer is ok -> server works OK
+// ---------------------------------------------------------------------------
+//
+TInt CTestFlexPeriodic::ClientCrashL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    __UHEAP_MARK;
+
+    // Must be bigger than ClientCrashL and StartOneTimerL
+    const TTimeIntervalMicroSeconds32 KTestRunTime( 6000000 );
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Start test case ClientCrashL
+    RThread threadA;
+    TTestResult resultA;
+    TTestCaseArguments caseA = { DoPanicL, resultA, aCallback }; 
+    RunInThread( threadA, caseA );
+
+    // Start test case StartOneTimerL
+    RThread threadB;
+    TTestResult resultB;
+    TTestCaseArguments caseB = { StartOneTimerL, resultB, aCallback }; 
+    RunInThread( threadB, caseB );
+
+                            //    //  ___     _____
+    WaitL( KTestRunTime ); // // // //_ // //  //
+                          //_//_// //  // //  //
+
+    // Analyze results
+    aResult.SetResult(KErrNone, _L("Test case passed.") );
+
+    // ClientCrashL should be paniced with reason 0xDEAD
+    if ( threadA.ExitType() != EExitPanic || threadA.ExitReason() != 0xDEAD )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Client did not panic (correctly).") );
+        }
+    // StartOneTimerL should be finished ok
+    else if ( resultB.iResult != KErrNone || threadB.ExitType() == EExitPanic )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Timer failed.") );
+        }
+
+    threadA.Close();
+    threadB.Close();
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/testflextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,745 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDE FILES
+#include <StifTestInterface.h>
+#include "TestFlexTimer.h"
+#include "SettingServerClient.h"
+#include "testflexperiodic.h"
+#include "testcflextimer.h"
+#include "testrflextimer.h"
+#include "rflextimerservermonitor.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::CTestFlexTimer
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CTestFlexTimer::CTestFlexTimer()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CTestFlexTimer::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+    iAddTestCaseTitleToLogName = loggerSettings.iAddTestCaseTitle;
+
+    iStdLog = CStifLogger::NewL( KTestFlexTimerLogPath, 
+                                 KTestFlexTimerLogFile);
+    iLog = iStdLog;
+    
+    iVersionLogged = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CTestFlexTimer* CTestFlexTimer::NewL()
+    {
+    CTestFlexTimer* self = new (ELeave) CTestFlexTimer;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CTestFlexTimer::~CTestFlexTimer()
+    { 
+    iLog = NULL;
+    delete iStdLog;
+    iStdLog = NULL;
+    delete iTCLog;
+    iTCLog = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CTestFlexTimer::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::CreateTitleLoggerL
+// Check for settings and create logger with test case title in file name.
+// -----------------------------------------------------------------------------
+//
+void CTestFlexTimer::CreateTitleLoggerL(void)
+    {
+    //Open new log file with test case title in file name
+    if(iAddTestCaseTitleToLogName)
+        {
+        // Check if there is no test case logger already created.
+        if(iTCLog) 
+            { 
+            delete iTCLog; 
+            iTCLog = NULL; 
+            } 
+            
+        TFileName logFileName;
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        
+        logFileName.Format(KTestFlexTimerLogFileWithTitle, &title);
+
+        iTCLog = CStifLogger::NewL(KTestFlexTimerLogPath, 
+                                 logFileName);
+        iLog = iTCLog; 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::CreateStdLoggerL
+// Check for logger settings and create standard logger.
+// -----------------------------------------------------------------------------
+//
+void CTestFlexTimer::DeleteTitleLogger(void)
+    {
+    //Delete title logger
+    if(iAddTestCaseTitleToLogName)
+        {
+        iLog = iStdLog;
+        delete iTCLog;
+        iTCLog = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CTestFlexTimer::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+        }
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CTestFlexTimer::RunTestCaseL(
+    const TInt aCaseNumber,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    SendTestModuleVersion();
+
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case( aCaseNumber );
+
+    _LIT( KLogInfo, "Starting testcase [%S]" );
+    iLog->Log( KLogInfo, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        //Open new log file with test case title in file name
+        CreateTitleLoggerL();
+    
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+
+        // Create and install an active scheduler for timers
+        CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+        CleanupStack::PushL( scheduler );
+        CActiveScheduler::Install( scheduler );
+        //execStatus  = ( this->*iMethod )( aResult );
+        TRAPD(err, execStatus  = ( *iMethod )( aResult, this ));
+
+        CleanupStack::PopAndDestroy( scheduler );
+
+        // Test case was executed
+        DeleteTitleLogger();
+
+        User::LeaveIfError(err);
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CTestFlexTimer::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CTestFlexTimer::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CTestFlexTimer::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CTestFlexTimer::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CTestFlexTimer::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CTestFlexTimer::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+//-----------------------------------------------------------------------------
+// CTemplateScriptTestFlexTimer::SendTestModuleVersion
+// Method used to send version of test module
+//-----------------------------------------------------------------------------
+//
+void CTestFlexTimer::SendTestModuleVersion()
+	{
+	if(iVersionLogged)
+		{
+		return;
+		}
+	
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("TestFlexTimer.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	iVersionLogged = ETrue;
+	}
+
+// ---------------------------------------------------------------------------
+// This function contains an array of all available test cases 
+// i.e pair of case name and test function. If case specified by parameter
+// aCaseNumber is found from array, then that item is returned.
+//
+// The reason for this rather complicated function is to specify all the
+// test cases only in one place. It is not necessary to understand how
+// function pointers to class member functions works when adding new test
+// cases. See function body for instructions how to add new test case.
+// ---------------------------------------------------------------------------
+//
+const TCaseInfo CTestFlexTimer::Case( const TInt aCaseNumber ) const 
+    {
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CDemoModule::PrintTest. Otherwise the compiler
+        // gives errors.
+
+        // Start FlexTimer server monitoring
+        ENTRY( "FlexTimerServer: Start crash monitoring", CTestFlexTimer::StartServerMonitoringL ),
+	    ENTRY( "FlexTimerClient: Change Priority: MuchMore", CTestFlexTimer::SetThreadPriorityMuchMore ),
+        ENTRY( "FlexTimerClient: Change Priority: Normal", CTestFlexTimer::SetThreadPriorityNormal ),
+
+        // CFlexPeriodic tests
+        ENTRY( "CFlexPeriodic: Start one timer", CTestFlexPeriodic::StartOneTimerL ),
+        ENTRY( "CFlexPeriodic: Start one timer with error CB", CTestFlexPeriodic::StartOneTimerWithErrorCbL ),
+        ENTRY( "CFlexPeriodic: Restart timer in callback", CTestFlexPeriodic::CallbackRestartL ),
+        ENTRY( "CFlexPeriodic: 32bit configure", CTestFlexPeriodic::ConfigureWindow32L ),
+        ENTRY( "CFlexPeriodic: 64bit configure", CTestFlexPeriodic::ConfigureWindow64L ),
+        ENTRY( "CFlexPeriodic: Mixed bit configure", CTestFlexPeriodic::ConfigureWindowMixL ),
+        ENTRY( "CFlexPeriodic: Configure after start", CTestFlexPeriodic::ConfigureAfterStartL ),
+        ENTRY( "CFlexPeriodic: Start timer twice", CTestFlexPeriodic::StartAfterStartL ),
+        ENTRY( "CFlexPeriodic: Start timer in callback", CTestFlexPeriodic::StartInCallbackL ),
+        ENTRY( "CFlexPeriodic: Start timer with negative delay (32 bit)", CTestFlexPeriodic::StartWithNegativeDelay32L ),
+        ENTRY( "CFlexPeriodic: Start timer with zero interval (32 bit)", CTestFlexPeriodic::StartWithZeroInterval32L ),
+        ENTRY( "CFlexPeriodic: Start timer with negative interval (32 bit)", CTestFlexPeriodic::StartWithNegativeInterval32L ),
+        ENTRY( "CFlexPeriodic: Start timer with negative delay (64 bit)", CTestFlexPeriodic::StartWithNegativeDelay64L ),
+        ENTRY( "CFlexPeriodic: Start timer with zero interval (64 bit)", CTestFlexPeriodic::StartWithZeroInterval64L ),
+        ENTRY( "CFlexPeriodic: Start timer with negative interval (64 bit)", CTestFlexPeriodic::StartWithNegativeInterval64L ),
+        ENTRY( "CFlexPeriodic: Configure timer with negative delay window (32 bit)", CTestFlexPeriodic::ConfigureWithNegativeDelayWindow32L ),
+        ENTRY( "CFlexPeriodic: Configure timer with negative interval window (32 bit)", CTestFlexPeriodic::ConfigureWithNegativeIntervalWindow32L ),
+        ENTRY( "CFlexPeriodic: Configure timer with negative delay window (64 bit)", CTestFlexPeriodic::ConfigureWithNegativeDelayWindow64L ),
+        ENTRY( "CFlexPeriodic: Configure timer with negative interval window (64 bit)", CTestFlexPeriodic::ConfigureWithNegativeIntervalWindow64L ),
+        ENTRY( "CFlexPeriodic: Start timer with min and max values", CTestFlexPeriodic::StartWithMinAndMaxL ),
+        ENTRY( "CFlexPeriodic: Start timer with maximum delay (64 bit)", CTestFlexPeriodic::StartWithMaximumDelay64L ),
+        ENTRY( "CFlexPeriodic: Start timer with maximum interval (64 bit)", CTestFlexPeriodic::StartWithMaximumInterval64L ),
+        ENTRY( "CFlexPeriodic: Start timer NULL callback function (32 bit)", CTestFlexPeriodic::StartWithNullCallBack32L ),
+        ENTRY( "CFlexPeriodic: Start timer NULL callback function (64 bit)", CTestFlexPeriodic::StartWithNullCallBack64L ),
+        ENTRY( "CFlexPeriodic: Client crash", CTestFlexPeriodic::ClientCrashL ),
+        //CFlexTimer tests
+        ENTRY( "CFlexTimer: Create and destroy a timer - After", CTestCFlexTimer::CreateAndDestroyCFlexTimerL ),
+        ENTRY( "CFlexTimer: Create and expire a timer - After", CTestCFlexTimer::CreateAndExpireCFlexTimerL ),
+        ENTRY( "CFlexTimer: Create two timers and expire those - overlapping - After 32bit", CTestCFlexTimer::CreateAndExpireTwoOverlappingAfterTimersL ),
+        ENTRY( "CFlexTimer: Create two timers and expire those - overlapping - After 64bit", CTestCFlexTimer::CreateAndExpireTwoOverlappingAfterTimers64L ),
+        ENTRY( "CFlexTimer: Create two timers and expire those - non overlapping - After", CTestCFlexTimer::CreateAndExpireTwoNonOverlappingAfterTimersL ),
+        ENTRY( "CFlexTimer: Create zillion timers and expire them at rapid sequence", CTestCFlexTimer::HumongousAmountOfTimeridelidilidousL ),
+        ENTRY( "CFlexTimer: Create overlapping After and At timers and non-overlapping AtUTC", CTestCFlexTimer::CreateAndExpireThreeTimersL ),
+        ENTRY( "CFlexTimer: Start and cancel timers", CTestCFlexTimer::NormalCancelL ),
+        ENTRY( "CFlexTimer: Cancel timer that would have triggered another timer", CTestCFlexTimer::CancelTimerThatWouldHaveTriggeredAnotherTimerL ),
+        ENTRY( "CFlexTimer: Configure 50 pct and 10 pct windows - overlap - 1", CTestCFlexTimer::ConfigureCTimerOverlap1L ),
+        ENTRY( "CFlexTimer: Configure 50 pct and 10 pct windows - overlap - 2", CTestCFlexTimer::ConfigureCTimerOverlap2L ),
+        ENTRY( "CFlexTimer: Configure 0 pct and 100 pct windows - overlap - 3", CTestCFlexTimer::ConfigureCTimerOverlap3L ),
+        ENTRY( "CFlexTimer: Configure 0 pct and 10 pct windows - non-overlap - 1", CTestCFlexTimer::ConfigureCTimerNonOverlap1L ),
+        ENTRY( "CFlexTimer: Configure 50 pct and 50 pct windows - non-overlap - 2", CTestCFlexTimer::ConfigureCTimerNonOverlap2L ),     
+        ENTRY( "CFlexTimer: System Time Changes", CTestCFlexTimer::SystemTimeChangesL ),
+        ENTRY( "CFlexTimer: Time zone changes", CTestCFlexTimer::TimeZoneChangesL ),
+        ENTRY( "CFlexTimer: Dumbass parameters for CFlexTimer", CTestCFlexTimer::DumbAssParametersForCTimerL ),
+        ENTRY( "CFlexTimer: 32bit After called with zero interval", CTestCFlexTimer::DumbAssParametersForCTimerZero32bitL ),
+        ENTRY( "CFlexTimer: 64bit After called with zero interval", CTestCFlexTimer::DumbAssParametersForCTimerZero64bitL ),
+        ENTRY( "CFlexTimer: 64bit After called with max interval", CTestCFlexTimer::DumbAssParametersForCTimer64MaxL ),
+        ENTRY( "CFlexTimer: 64bit After called with three year interval", CTestCFlexTimer::DumbAssParametersForCTimer64ThreeYearsL ),
+        ENTRY( "CFlexTimer: 64bit After called with one year interval", CTestCFlexTimer::DumbAssParametersForCTimer64OneYearL ),
+        ENTRY( "CFlexTimer: After (32bit) called with negative value", CTestCFlexTimer::AfterWithNegativeValueL ),
+        ENTRY( "CFlexTimer: At with current time", CTestCFlexTimer::AtWithCurrentTimeL ),
+        ENTRY( "CFlexTimer: AtUTC with current time", CTestCFlexTimer::AtUTCWithCurrentTimeL ),
+        ENTRY( "CFlexTimer: At with three year timer", CTestCFlexTimer::AtWithThreeYearsL ),
+        ENTRY( "CFlexTimer: At with one year timer", CTestCFlexTimer::AtWithOneYearL ),
+        ENTRY( "CFlexTimer: At() with time in the past", CTestCFlexTimer::AtWithTimeInThePastL ),
+        ENTRY( "CFlexTimer: Cancel timer that is already expired", CTestCFlexTimer::CancelExpiredTimerL ),
+        ENTRY( "CFlexTimer: Left side of the window is in the past", CTestCFlexTimer::ConfigureLeftSideInThePastL ),
+        ENTRY( "CFlexTimer: Left side of the window is in the past", CTestCFlexTimer::ConfigureLeftSideInThePastWindowCheckL ),
+        ENTRY( "CFlexTimer: Configure(32bit) called with negative window size", CTestCFlexTimer::ConfigureWithNegativeWindowSize32L ),
+        ENTRY( "CFlexTimer: Configure(64bit) called with negative window size", CTestCFlexTimer::ConfigureWithNegativeWindowSize64L ),
+        ENTRY( "CFlexTimer: Configure(32bit) called with max positive value", CTestCFlexTimer::ConfigureWithMaxWindow32L ),
+        ENTRY( "CFlexTimer: Configure(64bit) called with three year value", CTestCFlexTimer::ConfigureWithThreeYearWindow64L ),
+        ENTRY( "CFlexTimer: Configure(64bit) called with max positive value", CTestCFlexTimer::ConfigureWithMaxWindow64L ),
+        ENTRY( "CFlexTimer: Configure called while timer is already in use", CTestCFlexTimer::ConfigureWhileTimerIsInUseL ),
+        ENTRY( "CFlexTimer: Timer is started twise", CTestCFlexTimer::TimerIsStartedTwiceL ),
+        ENTRY( "CFlexTimer: Two timers, while high CPU load.", CTestCFlexTimer::CpuLoadCreateAndExpireTwoOverlappingAfterTimersL ),
+        ENTRY( "CFlexTimer: Many timers, while high CPU load.", CTestCFlexTimer::CpuLoadManyTimersL ),
+        // RFlexTimer tests
+        ENTRY( "RFlexTimer: Start timer with After (32 bit)", CTestRFlexTimer::ExpireAfter32L ),
+        ENTRY( "RFlexTimer: Start timer with After (64 bit)", CTestRFlexTimer::ExpireAfter64L ),
+        ENTRY( "RFlexTimer: Start timer with AfterTicks", CTestRFlexTimer::ExpireAfterTicksL ),
+        ENTRY( "RFlexTimer: Start timer with At", CTestRFlexTimer::ExpireAtL ),
+        ENTRY( "RFlexTimer: Start timer with AtUTC", CTestRFlexTimer::ExpireAtUtcL ),
+        ENTRY( "RFlexTimer: Call After (32 bit) before Connect", CTestRFlexTimer::After32WithoutConnect ),
+        ENTRY( "RFlexTimer: Call After (64 bit) before Connect", CTestRFlexTimer::After64WithoutConnect ),
+        ENTRY( "RFlexTimer: Call AfterTicks before Connect", CTestRFlexTimer::AfterTicksWithoutConnect ),
+        ENTRY( "RFlexTimer: Call At before Connect", CTestRFlexTimer::AtWithoutConnect ),
+        ENTRY( "RFlexTimer: Call AtUTC before Connect", CTestRFlexTimer::AtUtcWithoutConnect ),
+        ENTRY( "RFlexTimer: Call Configure (32 bit) before Connect", CTestRFlexTimer::Configure32WithoutConnect ),
+        ENTRY( "RFlexTimer: Call Configure (64 bit) before Connect", CTestRFlexTimer::Configure64WithoutConnect ),
+        ENTRY( "RFlexTimer: Call Cancel before Connect", CTestRFlexTimer::CancelWithoutConnect ),
+        ENTRY( "RFlexTimer: Call After twice", CTestRFlexTimer::CallAfterTwiceL ),
+        ENTRY( "RFlexTimer: Call AfterTicks twice", CTestRFlexTimer::CallAfterTicksTwiceL ),
+        ENTRY( "RFlexTimer: Call At twice", CTestRFlexTimer::CallAtTwiceL ),
+        ENTRY( "RFlexTimer: Call AtUTC twice", CTestRFlexTimer::CallAtUtcTwiceL ),
+        ENTRY( "RFlexTimer: Call Connect twice", CTestRFlexTimer::CallConnectTwiceL ),
+        ENTRY( "RFlexTimer: Reconnect to the server", CTestRFlexTimer::ReconnectL ),
+        ENTRY( "RFlexTimer: Cancel before start", CTestRFlexTimer::CancelWithoutStart ),
+        ENTRY( "RFlexTimer: Call AfterTicks with negative ticks", CTestRFlexTimer::NegativeTicksInAfterTicksL ),
+        ENTRY( "RFlexTimer: Call AfterTicks with zero ticks", CTestRFlexTimer::ZeroTicksInAfterTicksL ),
+        ENTRY( "RFlexTimer: Change time while AfterTicks running", CTestRFlexTimer::ChangeTimeWhileAfterTicksL ),
+        ENTRY( "RFlexTimer: Test AfterTicks windows", CTestRFlexTimer::TestAfterTicksWindowL ),
+        // High priority client tests
+        ENTRY( "FlexTimerClient: Change Priority: MuchMore", CTestFlexTimer::SetThreadPriorityMuchMore ),
+        ENTRY( "CFlexTimer: Two timers, while high CPU load.", CTestCFlexTimer::CpuLoadCreateAndExpireTwoOverlappingAfterTimersL ),
+        ENTRY( "CFlexTimer: Many timers, while high CPU load.", CTestCFlexTimer::CpuLoadManyTimersL ),
+        ENTRY( "FlexTimerClient: Change Priority: Normal", CTestFlexTimer::SetThreadPriorityNormal ),
+        // FlexTimerServer tests
+        ENTRY( "FlexTimerServer: Stop crash monitoring", CTestFlexTimer::StopServerMonitoringL ),
+
+        ENTRY( "FlexTimerServer: Start second server", CTestFlexTimer::StartSecondServerL ),
+        };
+    
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+    }
+
+// ========== Server level test cases ==========
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start monitoring the FlexTimer server
+// ---------------------------------------------------------------------------
+TInt CTestFlexTimer::StartServerMonitoringL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    RFlexTimerServerMonitor monitor;
+    User::LeaveIfError( monitor.Connect() );
+    User::LeaveIfError( monitor.StartMonitoring() );
+    monitor.Close();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Stop monitoring the FlexTimer server and check has the server
+// crashded.
+// ---------------------------------------------------------------------------
+TInt CTestFlexTimer::StopServerMonitoringL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    RFlexTimerServerMonitor monitor;
+    User::LeaveIfError( monitor.Connect() );
+    
+    TBool hasServerCrashed; 
+    User::LeaveIfError( monitor.GetStatus( hasServerCrashed ) );
+    
+    User::LeaveIfError( monitor.StopMonitoring() );
+    monitor.Close();
+
+    // By default everything has gone ok 
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( hasServerCrashed )
+        {
+        aResult.SetResult( 
+            KErrGeneral,
+            _L("Test case failed. FlexTimerServer has crashed.") );
+        }
+    
+    return KErrNone;        
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start second FlexTimerServer. Main purpose of this test case is 
+// to increase test coverage.
+// ---------------------------------------------------------------------------
+TInt CTestFlexTimer::StartSecondServerL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+
+    // Default result if anything leaves i.e. no analyze done.
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Make sure that the server is up'n'running
+    RFlexTimer timer;
+    timer.Connect();
+    timer.Close();
+    
+    // Open handle to the server process
+    RProcess flexTimerServer;
+    User::LeaveIfError( flexTimerServer.Create( 
+            _L("FlexTimerServer.exe"), 
+            _L(""), 
+            EOwnerThread ) );
+
+    // Kick the server runnin'
+    flexTimerServer.Resume();
+
+    // Wait until the server process has been started.
+    TRequestStatus status;
+    flexTimerServer.Rendezvous( status );
+    User::WaitForRequest( status );
+
+    // Kill the server - if it has been able to been created
+    flexTimerServer.Kill( 0 );
+    
+    // Clean up
+    flexTimerServer.Close();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+// ---------------------------------------------------------------------------
+// TEST CASE: This test case can be used to change client priority to 
+// EPriorityMuchMore.
+// ---------------------------------------------------------------------------
+TInt CTestFlexTimer::SetThreadPriorityMuchMore(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    RThread thisThread;
+    
+    thisThread.SetPriority( EPriorityMuchMore );
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    return KErrNone;
+    }
+// ---------------------------------------------------------------------------
+// TEST CASE: This test case can be used to change client priority to 
+// EPriorityMuchMore.
+// ---------------------------------------------------------------------------
+TInt CTestFlexTimer::SetThreadPriorityNormal(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    RThread thisThread;
+    
+    thisThread.SetPriority( EPriorityNormal );
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    return KErrNone;
+    }
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CTestFlexTimer::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/flextimer/test/testflextimer/src/testrflextimer.cpp	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,1228 @@
+/*
+* ============================================================================
+*  Name        : testrflextimer.cpp
+*  Part of     : src / testflextimer
+*  Description : STIF test cases for RFlexTimer
+*  Version     : %version: 1 %
+*
+*  Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
+*  All rights reserved.
+*  This component and the accompanying materials are made available
+*  under the terms of the License "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:
+*  Nokia Corporation
+* ============================================================================
+* Template version: 4.1
+*/
+
+#include <e32debug.h>               // for RDebug
+#include <rflextimer.h>             // for RFlexTimer
+#include <stiftesteventinterface.h> // for TEventIf 
+#include "testflextimer.h"          // for global constants
+#include "testrflextimer.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CTestRFlexTimer::CTestRFlexTimer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CTestRFlexTimer::~CTestRFlexTimer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ___  ____ _    ____ _   _    ____ _  _ ____ ____ _  _ ____ 
+// |  \ |___ |    |__|  \_/     |    |__| |___ |    |_/  [__  
+// |__/ |___ |___ |  |   |      |___ |  | |___ |___ | \_ ___] 
+// 
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+TBool CTestRFlexTimer::IsDelayOk( 
+    const TTimeIntervalMicroSeconds aDelay,
+    const TTimeIntervalMicroSeconds32 aInterval,
+    const TTimeIntervalMicroSeconds32 aWindow )
+    {
+    TTimeIntervalMicroSeconds interval( aInterval.Int() );
+    TTimeIntervalMicroSeconds window( aWindow.Int() );
+    return IsDelayOk( aDelay, interval, window );
+    }
+
+// ---------------------------------------------------------------------------
+TBool CTestRFlexTimer::IsDelayOk( 
+    const TTimeIntervalMicroSeconds aDelay,
+    const TTimeIntervalMicroSeconds32 aInterval,
+    const TTimeIntervalMicroSeconds aWindow )
+    {
+    TTimeIntervalMicroSeconds interval( aInterval.Int() );
+    return IsDelayOk( aDelay, interval, aWindow );
+    }
+
+// ---------------------------------------------------------------------------
+TBool CTestRFlexTimer::IsDelayOk( 
+    const TTimeIntervalMicroSeconds aDelay,
+    const TTimeIntervalMicroSeconds aInterval,
+    const TTimeIntervalMicroSeconds32 aWindow )
+    {
+    TTimeIntervalMicroSeconds window( aWindow.Int() );
+    return IsDelayOk( aDelay, aInterval, window );
+    }
+
+// ---------------------------------------------------------------------------
+TBool CTestRFlexTimer::IsDelayOk( 
+    const TTimeIntervalMicroSeconds aDelay,
+    const TTimeIntervalMicroSeconds aInterval,
+    const TTimeIntervalMicroSeconds aWindow )
+    {
+    /**
+     *  Timer can be expired 1 sec late or 1 system tick (15625 microseconds)
+     *  early.
+     */
+    const TInt64 KTimerResolution( 1000000 ); 
+    const TInt64 KTickResolution( 1000000 / 64 );
+    
+    RDebug::Print( 
+       _L("=== Timer delay: %Ld, interval: %Ld, window: %Ld"), 
+       aDelay.Int64(),
+       aInterval.Int64(),
+       aWindow.Int64() );
+    
+    return !( aDelay.Int64() < aInterval.Int64() - aWindow.Int64() - KTickResolution ||
+              aDelay.Int64() > aInterval.Int64() + KTimerResolution );
+    }
+
+// ---------------------------------------------------------------------------
+// Create, configure, start with AfterTicks and close RFlexTimer 
+// ---------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CTestRFlexTimer::ExecuteAfterTicksL(
+    TInt aTicks,
+    TTimeIntervalMicroSeconds aWindowSize )
+    {
+    // Create, connect and configure the timer handle
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    User::LeaveIfError( timer.Configure( aWindowSize ) );
+    
+    TTime startTime;
+    startTime.UniversalTime();
+    
+    // Run the timer and wait its expiration
+    TRequestStatus status;
+    timer.AfterTicks( status, aTicks );
+    User::WaitForRequest( status );
+    
+    TTime endTime;
+    endTime.UniversalTime();
+
+    // Clean up
+    timer.Close();
+
+    // Return running time of the timer
+    return endTime.MicroSecondsFrom( startTime );
+    }
+
+// ---------------------------------------------------------------------------
+// ___ ____ ____ ___    ____ ____ ____ ____ ____ 
+//  |  |___ [__   |     |    |__| [__  |___ [__  
+//  |  |___ ___]  |     |___ |  | ___] |___ ___] 
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a timer using After (32 bit) and wait it to expire.
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ExpireAfter32L(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+    
+    const TTimeIntervalMicroSeconds32 KInterval( 3000000 ); // Time to wait timer
+    const TTimeIntervalMicroSeconds KWindow( 0 );           // Window for check results
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    timer.After( status, KInterval );
+
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a timer using After (32 bit) and wait it to expire.
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ExpireAfter64L(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+    
+    const TTimeIntervalMicroSeconds KInterval( 3000000 );   // Time to wait timer
+    const TTimeIntervalMicroSeconds KWindow( 0 );           // Window for check results
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    timer.After( status, KInterval );
+
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a timer using AfterTicks and wait it to expire.
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ExpireAfterTicksL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+    
+    const TTimeIntervalMicroSeconds32 KInterval( 3000000 );     // Time to wait timer
+    const TTimeIntervalMicroSeconds KWindow( 0 );               // Window for check results
+    const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 ); // System tick: 1/64 sec
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    
+    timer.AfterTicks( status, KInterval.Int() / KOneTick.Int() );
+    
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a timer using At and wait it to expire.
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ExpireAtL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+    
+    const TTimeIntervalMicroSeconds KInterval( 3000000 ); // Time to wait timer
+    const TTimeIntervalMicroSeconds KWindow( 0 );         // Window for check results
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    TTime now;
+    now.HomeTime();
+    
+    timer.At( status, now + KInterval );
+
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+    
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start a timer using AtUTC and wait it to expire.
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ExpireAtUtcL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    __UHEAP_MARK;
+    
+    const TTimeIntervalMicroSeconds KInterval( 3000000 ); // Time to wait timer
+    const TTimeIntervalMicroSeconds KWindow( 0 );         // Window for check results
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    TTime now;
+    now.UniversalTime();
+    
+    timer.AtUTC( status, now + KInterval );
+
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with After (32 bit) without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::After32WithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    TRequestStatus status;
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    timer.After( status, TTimeIntervalMicroSeconds32( 1000000 ) );
+    User::WaitForRequest( status ); // PANIC
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with After (64 bit) without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::After64WithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    TRequestStatus status;
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+
+    // Do the actual test
+    //-----------------------------------------------------
+    
+    RFlexTimer timer;
+
+    timer.After( status, TTimeIntervalMicroSeconds( 1000000 ) );
+    User::WaitForRequest( status ); // PANIC
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with AfterTicks without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::AfterTicksWithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    TRequestStatus status;
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    timer.AfterTicks( status, 1000 );
+    User::WaitForRequest( status ); // PANIC
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with At without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::AtWithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    TRequestStatus status;
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    TTime expirationTime;
+    expirationTime.HomeTime();
+    expirationTime += TTimeIntervalMicroSeconds( 1000000 );
+    
+    timer.At( status, expirationTime );
+    User::WaitForRequest( status ); // PANIC
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start timer with At without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::AtUtcWithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    TRequestStatus status;
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    TTime expirationTime;
+    expirationTime.UniversalTime();
+    expirationTime += TTimeIntervalMicroSeconds( 1000000 );
+    
+    timer.AtUTC( status, expirationTime );
+    User::WaitForRequest( status ); // PANIC
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure (32 bit) timer without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::Configure32WithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    timer.Configure( TTimeIntervalMicroSeconds32( 1000000 ) ); // PANIC
+    // Configure is synchronous command. No need to wait.
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Configure (32 bit) timer without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::Configure64WithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    timer.Configure( TTimeIntervalMicroSeconds( 1000000 ) ); // PANIC
+    // Configure is synchronous command. No need to wait.
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Cancel timer without connecting first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CancelWithoutConnect(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+
+    // Test should panic with
+    // Category: "KERN-EXEC"
+    // Reason:   0
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        0 );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    timer.Cancel(); // PANIC
+    // Cancel is synchronous command. No need to wait.
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Call After twice
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CallAfterTwiceL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   15 (EFlexTimerServerErrorPendingTimer)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        15 );
+
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    timer.After( status, TTimeIntervalMicroSeconds32( 100000 ) );
+    timer.After( status, TTimeIntervalMicroSeconds( 100000 ) );
+
+    User::WaitForRequest( status ); // PANIC
+
+    timer.Close();
+
+    //-----------------------------------------------------
+
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Call AfterTicks twice
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CallAfterTicksTwiceL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   15 (EFlexTimerServerErrorPendingTimer)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        15 );
+
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    timer.AfterTicks( status, 1000 );
+    timer.AfterTicks( status, 1000 );
+
+    User::WaitForRequest( status ); // PANIC
+
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Call At twice
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CallAtTwiceL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   15 (EFlexTimerServerErrorPendingTimer)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        15 );
+
+    TRequestStatus status;
+
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+
+    TTime expirationTime;
+    expirationTime.HomeTime();
+    expirationTime += TTimeIntervalMicroSeconds( 1000000 );
+    
+    timer.At( status, expirationTime );
+    timer.At( status, expirationTime );
+
+    User::WaitForRequest( status ); // PANIC
+
+    timer.Close();
+
+    //-----------------------------------------------------
+
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Call AtUTC twice
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CallAtUtcTwiceL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   15 (EFlexTimerServerErrorPendingTimer)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        15 );
+
+    TRequestStatus status;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    
+    TTime expirationTime;
+    expirationTime.UniversalTime();
+    expirationTime += TTimeIntervalMicroSeconds( 1000000 );
+    
+    timer.AtUTC( status, expirationTime );
+    timer.AtUTC( status, expirationTime );
+
+    
+    User::WaitForRequest( status ); // PANIC
+
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Call Connect twice
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CallConnectTwiceL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   33 (EFlexTimerAlreadyConnected)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        33 );
+
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    User::LeaveIfError( timer.Connect() ); // PANIC
+
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Reconnect the handle to the server
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ReconnectL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    timer.Close();
+    User::LeaveIfError( timer.Connect() );
+    timer.Close();
+    
+    //-----------------------------------------------------
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Cancel timer without starting it first
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::CancelWithoutStart(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+
+    User::LeaveIfError( timer.Connect() );
+    timer.Cancel();
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start tick timer with negative ticks
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::NegativeTicksInAfterTicksL(
+    TTestResult& aResult, 
+    CTestFlexTimer* aCallback )
+    {
+    const TInt KTestValue( -1 );
+    
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    // Test should panic with
+    // Category: "RFlexTimer"
+    // Reason:   2 (EFlexTimerAfterTicksIntervalLessThanZero)
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::EPanic,
+        2 );
+
+    TTimeIntervalMicroSeconds delay = ExecuteAfterTicksL( KTestValue );
+
+    // No panic, change result back to normal
+    aCallback->TestModuleIf().SetExitReason( 
+        CTestModuleIf::ENormal,
+        KErrNone );
+
+    aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Start tick timer with zero ticks
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ZeroTicksInAfterTicksL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    const TInt KTestValue( 0 );
+    
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTimeIntervalMicroSeconds delay = ExecuteAfterTicksL( KTestValue );
+
+    // Analyze the results
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( delay, 
+                     TTimeIntervalMicroSeconds( KTestValue ),
+                     TTimeIntervalMicroSeconds( 0 )) )
+        {
+        aResult.SetResult( 
+            KErrGeneral, 
+            _L("Test case failed. Wrong expiration time.") );
+        }
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Change system time while tick timer is active
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::ChangeTimeWhileAfterTicksL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+    const TTimeIntervalMicroSeconds32 KTimerInterval( 10000000 );   // Time to wait timer
+    const TTimeIntervalMicroSeconds KWaitTillChangeTime( 1000000 ); // Time to wait before change system time
+    const TTimeIntervalMicroSeconds KTimeChange( 3000000 );         // Duration to change system time
+
+    // Interval for check results
+    const TTimeIntervalMicroSeconds KInterval( KTimerInterval.Int() + KTimeChange.Int64() );
+    const TTimeIntervalMicroSeconds KWindow( 0 );                   // Window for check results
+    const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 );     // System tick: 1/64 sec
+
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus status, helperStatus;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timer;
+    User::LeaveIfError( timer.Connect() );
+    
+    timer.AfterTicks( status, KTimerInterval.Int() / KOneTick.Int() );
+
+    //-----------------------------------------------------
+    // ... meanwhile change system time
+
+        RFlexTimer helper;
+        
+        User::LeaveIfError( helper.Connect() );
+        helper.After( helperStatus, KWaitTillChangeTime );
+    
+                                               //    //  ___     _____
+        User::WaitForRequest( helperStatus ); // // // //_ // //  //
+                                             //_//_// //  // //  //
+        
+        TTime newNow;
+        newNow.UniversalTime();
+        newNow += KTimeChange;
+        
+        User::SetUTCTime( newNow );
+    
+        helper.Close();
+
+    // The test continues...
+    //-----------------------------------------------------
+    
+                                     //    //  ___     _____
+    User::WaitForRequest( status ); // // // //_ // //  //
+                                   //_//_// //  // //  //
+
+    timer.Close();
+
+    //-----------------------------------------------------
+
+    // Verify the test
+    TTime endTime;
+    endTime.UniversalTime();
+
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    if ( !IsDelayOk( endTime.MicroSecondsFrom( startTime ), KInterval, KWindow ) )
+        {
+        //RDebug::Print( _L("Timer delay: %lld"), 
+        //               endTime.MicroSecondsFrom( startTime ).Int64() );
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Wrong expiration.") );
+        }
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// TEST CASE: Timer window works correctly
+// ---------------------------------------------------------------------------
+//
+TInt CTestRFlexTimer::TestAfterTicksWindowL(
+    TTestResult& aResult, 
+    CTestFlexTimer* /* aCallback */ )
+    {
+
+    // T1: expiration after 4-8 sec
+    const TTimeIntervalMicroSeconds32 KTimerOneInterval( 8000000 );
+    const TTimeIntervalMicroSeconds32 KTimerOneWindow( 4000000 );
+
+    // T2: expiration after 9-10 sec
+    // T2's interval must not overlap with T1's -- otherwise T1 will be 
+    // delayed
+    const TTimeIntervalMicroSeconds32 KTimerTwoInterval( 10000000 );
+    const TTimeIntervalMicroSeconds32 KTimerTwoWindow( 1000000 );
+
+    // T3: expiration after 5 secs
+    const TTimeIntervalMicroSeconds KAfterTimerInterval( 5000000 );
+    const TTimeIntervalMicroSeconds KAfterTimerWindow( 0 );
+
+    // System tick: 1/64 sec
+    const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 );
+    const TTimeIntervalMicroSeconds KNoWindow( 0 );
+
+    
+    
+    // Initialize case
+    aResult.SetResult( KErrGeneral, _L("Test case leaved") );
+
+    TTime startTime;
+    startTime.UniversalTime();
+    TRequestStatus oneStatus, twoStatus, afterStatus;
+    
+    // Do the actual test
+    //-----------------------------------------------------
+
+    RFlexTimer timerOne;
+    User::LeaveIfError( timerOne.Connect() );
+    timerOne.Configure( KTimerOneWindow );
+    timerOne.AfterTicks( oneStatus, KTimerOneInterval.Int() / KOneTick.Int() );
+
+    RFlexTimer timerTwo;
+    User::LeaveIfError( timerTwo.Connect() );
+    timerTwo.Configure( KTimerTwoWindow );
+    timerTwo.AfterTicks( twoStatus, KTimerTwoInterval.Int() / KOneTick.Int() );
+    
+    RFlexTimer afterTimer;
+    User::LeaveIfError( afterTimer.Connect() );
+    afterTimer.Configure( KAfterTimerWindow );
+    afterTimer.After( afterStatus, KAfterTimerInterval );
+    
+                                        //    //  ___     _____
+    User::WaitForRequest( oneStatus ); // // // //_ // //  //
+                                      //_//_// //  // //  //
+
+    TTime oneEndTime;
+    oneEndTime.UniversalTime();
+                                        //    //  ___     _____
+    User::WaitForRequest( twoStatus ); // // // //_ // //  //
+                                      //_//_// //  // //  //
+
+    TTime twoEndTime;
+    twoEndTime.UniversalTime();
+    
+    timerOne.Close();
+    timerTwo.Close();
+    afterTimer.Close();
+
+    //-----------------------------------------------------
+    
+    // Handle afterStatus too - to get rid of unhandled asynchronous message
+    // error from STIF.
+    User::WaitForRequest( afterStatus );
+    
+    aResult.SetResult( KErrNone, _L("Test case passed") );
+    
+    // T1 should be expired at the same time than T3 - check with T3's values
+    if ( !IsDelayOk( oneEndTime.MicroSecondsFrom( startTime ), KAfterTimerInterval, KNoWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Timer one wrong expiration.") );
+        }
+    // T2 should be expired at it's max window
+    else if ( !IsDelayOk( twoEndTime.MicroSecondsFrom( startTime ), KTimerTwoInterval, KNoWindow ) )
+        {
+        aResult.SetResult( KErrGeneral, _L("Test case failed. Timer two wrong expiration.") );
+        }
+    
+    __UHEAP_MARKEND;
+
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keepalive/group/bld.inf	Mon May 24 20:51:35 2010 +0300
@@ -0,0 +1,27 @@
+/*
+* 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 keepalive collection.
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+#include "../flextimer/group/bld.inf"
+
+PRJ_TESTMMPFILES
+