Revision: 201003 RCL_3 PDK_3.0.h
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Sat, 20 Feb 2010 00:05:00 +0200
branchRCL_3
changeset 3 a811597961f0
parent 0 4e1aa6a622a0
child 5 1a73e8f1b64d
Revision: 201003 Kit: 201007
accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp
commonservices/PlatformEnv/data/estart_mds.txt
commonservices/PlatformEnv/data/estart_mds_ms.txt
mediator/tsrc/public/basic/group/MediatorTest.pkg
psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.pkg
sensorservices/sensorserver/tsrc/sensorsrvtest/conf/SensorTestModule_OOM.cfg
sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist.rss
sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist_hw.rss
sysstatemgmt/ssmcmdlists/data/uiservicescmdlist.rss
sysstatemgmt/systemstatemgr/cmd/inc/ssmcommandlistresourcereaderimpl.h
sysstatemgmt/systemstatemgr/cmd/src/ssmcommandfactory.cpp
sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistimpl.cpp
sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereader.cpp
sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereaderimpl.cpp
sysstatemgmt/systemstatemgr/inc/ssmadaptationcli.h
sysstatemgmt/systemstatemgr/sus/inc/ssmadaptationcmn.h
sysstatemgmt/systemstatemgr/sus/inc/susadaptionserver.h
sysstatemgmt/systemstatemgr/sus/inc/susemergencycallrfadaptation.h
sysstatemgmt/systemstatemgr/sus/inc/suspanic.h
sysstatemgmt/systemstatemgr/sus/src/ssmadaptationcli.cpp
sysstatemgmt/systemstatemgr/sus/src/susadaptionserver.cpp
sysstatemgmt/systemstatemgr/sus/src/susemergencycallrfadaptation.cpp
sysstatemgmt/systemstatemgr/test/tsus/group/tsus_ssmutilsrv.mmp
sysstatemgmt/systemstatemgr/test/tsus/inc/tsus_startadaptationserver.h
sysstatemgmt/systemstatemgr/test/tsus/inc/tsus_step_adaptionserver.h
sysstatemgmt/systemstatemgr/test/tsus/scripts/ssmatest_sus_adaptionserver.script
sysstatemgmt/systemstatemgr/test/tsus/src/tsus_startadaptationserver.cpp
sysstatemgmt/systemstatemgr/test/tsus/src/tsus_step_adaptionserver.cpp
sysstatemgmt/systemstatereferenceplugins/clayer/group/bld.inf
sysstatemgmt/systemstatereferenceplugins/clayer/group/ssmclayersup.mmp
sysstatemgmt/systemstatereferenceplugins/clayer/inc/ssmsecuritynotecontroller.h
sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsecuritynotecontroller.cpp
sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsimstatusobserver.cpp
sysstatemgmt/systemstatereferenceplugins/localinc/ssmpanic.h
sysstatemgmt/systemstatereferenceplugins/test/tclayer/group/tclayer_server.mmp
sysstatemgmt/systemstatereferenceplugins/test/tintcustcmd/group/101F8762.txt
sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/group/101F8762.txt
sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/inc/tcmd_step_publishstartupmode.h
sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/scripts/ssrefpluginstest_custcmd_publishstartupmode.script
sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_server.cpp
sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_publishstartupmode.cpp
sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp
sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.cpp
sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.h
--- a/accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/accessoryservices/accessoryserver/src/Server/AccSrvConnectionController.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -796,7 +796,6 @@
 			    case EAccModeLoopset:
 			    case EAccModeMusicStand:
 			    case EAccModeTVOut:
-			    case EAccModeHDMI:
 			    case EAccModeHeadphones:
 			    {
 				  TAccPolGenericID genericID;
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -291,7 +291,86 @@
 
                     // Set audio format
                     TUid audioFormat;
-                    audioFormat.iUid = audioDataBlock->iAudioFormatCode;
+                    // Map the audio format code defined in 
+                    // cea861ediddatatypes.h to accpolhdmiaudioformat.h
+                    switch ( audioDataBlock->iAudioFormatCode )
+                        {
+                        case KAudioFormatCodePCM:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatPCM16;
+                            break;
+                            }
+                        case KAudioFormatCodeAC3:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatAC3;
+                            break;
+                            }
+                        case KAudioFormatCodeMPEG1:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatMPEG1;
+                            break;
+                            }
+                        case KAudioFormatCodeMP3:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatMP3;
+                            break;
+                            }
+                        case KAudioFormatCodeMPEG2:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatMPEG2;
+                            break;
+                            }
+                        case KAudioFormatCodeAACLC:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatAACLC;
+                            break;
+                            }
+                        case KAudioFormatCodeDTS:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatDTS;
+                            break;
+                            }
+                        case KAudioFormatCodeATRAC:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatATRAC;
+                            break;
+                            }
+                        case KAudioFormatCodeDSD:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatDSD;
+                            break;
+                            }
+                        case KAudioFormatCodeEAC3:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatEAC3;
+                            break;
+                            }
+                        case KAudioFormatCodeDTSHD:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatDTSHD;
+                            break;
+                            }
+                        case KAudioFormatCodeMLP:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatMLP;
+                            break;
+                            }
+                        case KAudioFormatCodeDST:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatDST;
+                            break;
+                            }
+                        case KAudioFormatCodeWMAPRO:
+                            {
+                            audioFormat = HdmiAudioFormat::KUidFormatWMAPRO;
+                            break;
+                            }
+                        default:
+                            {
+                            audioFormat.iUid = KAudioFormatCodeNA;
+                            break;
+                            }
+                        }
                     hdmiAudioFormat->SetAudioFormat( audioFormat ); // const TUid aAudioFormat,
 
                     // Set bit resolution
--- a/commonservices/PlatformEnv/data/estart_mds.txt	Tue Feb 02 00:53:00 2010 +0200
+++ b/commonservices/PlatformEnv/data/estart_mds.txt	Sat Feb 20 00:05:00 2010 +0200
@@ -1,18 +1,21 @@
+# ============================================================================
+#  Name      estart_mds.txt
+#  Part of   
 #
-# 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".
+#  Description
+#     MDS Drive mappings that override default Symbian mappings
+#  Version
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
+#  Copyright (C) 2007 Nokia Corporation.
+#  This material, including documentation and any related 
+#  computer programs, is protected by copyright controlled by 
+#  Nokia Corporation. All rights are reserved. Copying, 
+#  including reproducing, storing,  adapting or translating, any 
+#  or all of this material requires the prior written consent of 
+#  Nokia Corporation. This material also contains confidential 
+#  information which may not be disclosed to others without the 
+#  prior written consent of Nokia Corporation.
+# ============================================================================
 
 
 E:  1  EFAT32  FAT   0       FS_FORMAT_CORRUPT                      # MEMORYCARD 1 Partition 0
--- a/commonservices/PlatformEnv/data/estart_mds_ms.txt	Tue Feb 02 00:53:00 2010 +0200
+++ b/commonservices/PlatformEnv/data/estart_mds_ms.txt	Sat Feb 20 00:05:00 2010 +0200
@@ -1,18 +1,21 @@
+# ============================================================================
+#  Name      estart_mds_ms.txt
+#  Part of   
 #
-# 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".
+#  Description
+#     MDS Drive mappings that override default Symbian mappings
+#  Version
 #
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
+#  Copyright (C) 2008 Nokia Corporation.
+#  This material, including documentation and any related 
+#  computer programs, is protected by copyright controlled by 
+#  Nokia Corporation. All rights are reserved. Copying, 
+#  including reproducing, storing,  adapting or translating, any 
+#  or all of this material requires the prior written consent of 
+#  Nokia Corporation. This material also contains confidential 
+#  information which may not be disclosed to others without the 
+#  prior written consent of Nokia Corporation.
+# ============================================================================
 
 
 E:  1  EFAT32  FAT   0       FS_FORMAT_CORRUPT                      # MEMORYCARD 1 Partition 0
--- a/mediator/tsrc/public/basic/group/MediatorTest.pkg	Tue Feb 02 00:53:00 2010 +0200
+++ b/mediator/tsrc/public/basic/group/MediatorTest.pkg	Sat Feb 20 00:05:00 2010 +0200
@@ -28,3 +28,6 @@
 
 "\epoc32\release\armv5\urel\mediatortest.dll"-"c:\sys\bin\mediatortest.dll"
 "..\init\mediatortest.ini"-"c:\testframework\mediatortest.ini"
+"\epoc32\release\armv5\urel\MediatorTestPlugin.dll"-"c:\sys\bin\MediatorTestPlugin.dll"
+"\epoc32\data\z\resource\plugins\MediatorTestPlugin.rsc"-"c:\data\z\resource\plugins\MediatorTestPlugin.rsc"
+"\epoc32\data\z\private\10207449\events\StaticEvents.rsc"-"c:\data\z\private\10207449\events\StaticEvents.rsc"
--- a/psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.pkg	Tue Feb 02 00:53:00 2010 +0200
+++ b/psmservices/psmserver/tsrc/PsmTestModule/group/PsmTestModule.pkg	Sat Feb 20 00:05:00 2010 +0200
@@ -29,3 +29,11 @@
 "..\conf\PsmTestModule.cfg"-"c:\testframework\PsmTestModule.cfg"
 "..\init\PsmTestModule_armi.ini"-"c:\testframework\PsmTestModule_armi.ini"
 
+;data files
+
+"\epoc32\data\z\private\2000B187\10200EE1.xml"-"c:\private\2000B187\10200EE1.xml"
+"\epoc32\data\z\private\2000B187\10200EE2.xml"-"c:\private\2000B187\10200EE2.xml"
+"\epoc32\data\z\private\2000B187\10200EE4.xml"-"c:\private\2000B187\10200EE4.xml"
+"\epoc32\data\z\private\2000B187\10200EE5.xml"-"c:\private\2000B187\10200EE5.xml"
+"\epoc32\data\z\private\2000B187\cenrep\10200EE3.xml"-"c:\private\2000B187\cenrep\10200EE3.xml"
+"\epoc32\data\z\private\10202BE9\10200EE3.txt"-"c:\private\10202BE9\10200EE3.txt"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensorservices/sensorserver/tsrc/sensorsrvtest/conf/SensorTestModule_OOM.cfg	Sat Feb 20 00:05:00 2010 +0200
@@ -0,0 +1,2953 @@
+/*
+* 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:  ?Description
+*
+*/
+
+
+// Publish&Subscribe definitions
+// From SensrvInternalPSKeys.h
+[Define]
+KSensrvLeaveFirstStubConstruction 1
+KSensrvLeaveSecondStubConstruction 2
+KSensrvStubConstructionDelay 3
+KSensrvFirstStubChannelCount 4
+KSensrvSecondStubChannelCount 5
+KSensrvLatestOpenedChannel 6
+KSensrvLatestClosedChannel 7
+KSensrvLatestStartListeningChannel 8
+KSensrvLatestStopListeningChannel 9
+KSensrvSamplingInterval 10
+KSensrvStubConstructionJam 11
+KSensrvStartListeningJam 12
+KSensrvStopListeningJam 13
+KSensrvOpenChannelAsyncJam 14
+KSensrvCloseChannelAsyncJam 15
+KSensrvChannelOpenedError 16
+KSensrvChannelClosedError 17
+KSensrvStartListeningLeave 18
+KSensrvStopListeningLeave 19
+KSensrvDataListeningJam 20
+KSensrvDataListeningBufferFilledError 21
+KSensrvForceBufferFilledJam 22
+KSensrvForceBufferFilledLeave 23
+KSensrvOpenChannelMethodJam 24
+KSensrvCloseChannelMethodJam 25
+KSensrvOpenChannelError 26
+KSensrvCloseChannelError 27
+KSensrvChannelOpenedWithError 28
+KSensrvPropertyChanged 29
+KSensrvOpenChannelMethodPanic 30
+KSensrvOpenChannelAsyncPanic 31
+KSensrvCloseChannelMethodPanic 32
+KSensrvCloseChannelAsyncPanic 33
+KSensrvStartListeningMethodPanic 34
+KSensrvDataListeningPanic 35
+KSensrvStopListeningMethodPanic 36
+KSensrvStopListeningAsyncPanic 37
+KSensrvForceBufferFilledPanic 38
+KSensrvSSYUnloadingCount 39
+KSensrvBufferFilledNegativeCount 40
+KSensrvGetAllPropertyCount 41
+KSensrvGetPropertyLeave 42
+KSensrvGetPropertyJam 43
+KSensrvSetPropertyLeave 44
+KSensrvSetPropertyJam 45
+KSensrvGetAllPropertiesLeave 46
+KSensrvGetAllPropertiesJam 47
+KSensrvGetPropertyPanic 48;
+KSensrvSetPropertyPanic 49;
+KSensrvGetAllPropertiesPanic 50;
+KSensrvCheckPropertyDependenciesLeave 51
+KSensrvCheckPropertyDependenciesJam 52
+KSensrvCheckPropertyDependenciesPanic 53
+KSensrvGetDataOverflowTest 54
+KSensrvGetDataNotFoundTest 55
+KSensorTestModuleProcessCommand 56
+KSensrvSingleBufferFilledNegativeCount 57
+KSensrvCreateNewChannelsFirst 58
+KSensrvCreateNewChannelsSecond 59
+KSensrvRemoveNewChannelsFirst 60
+KSensrvRemoveNewChannelsSecond 61
+KSensrvRegisterZeroChannels 62
+KSensrvRegisterInvalidChannels 63
+KSensrvFirstStubDoubleTappingChannelCount 64
+KSensrvSetPropertyArray 65
+KSensrvCheckPluginLoaded 66
+
+KSensrvSignalAftedDataReseived 100
+KSensrvWaitTestCompletion 101
+
+KSensorTestModuleComplete1 200
+KSensorTestModuleComplete2 201
+KSensorTestModuleComplete3 202
+KSensorTestModuleComplete4 203
+KSensorTestModuleComplete5 204
+KSensorTestModuleComplete6 205
+KSensorTestModuleComplete7 206
+KSensorTestModuleComplete8 207
+KSensorTestModuleComplete9 208
+KSensorTestModuleComplete10 209 
+KSensorTestModuleComplete11 210 
+KSensorTestModuleComplete12 211 
+KSensorTestModuleComplete13 212 
+KSensorTestModuleComplete14 213 
+KSensorTestModuleComplete15 214
+
+// Errors
+KErrNotFound -1
+KErrGeneral -2
+KErrCancel -3
+KErrNoMemory -4
+KErrNotSupported -5
+KErrArgument -6
+KErrOverflow -9
+KErrAlreadyExists -11
+KErrPermissionDenied -46
+KErrAccessDenied -21
+
+ESensrvMinor 1
+ESensrvFatal 2
+
+// Property from sensrvgeneralproperties.h
+KSensrvPropIdDataRate 2
+KSensrvPropIdAvailability 4
+KSensrvPropIdMeasureRange 5
+KSensrvPropIdChannelScale 9
+KSensrvSensorDescription 19
+
+// Commands for test process (SensorTestModuleTypes.h)
+KProcessCommandSetProperty  1
+KProcessCommandOpenChannel  2
+KProcessCommandCloseChannel 3
+KProcessCommandFindChannel  4
+
+// Condition enumerations
+ESensrvOrConditionSet 0
+ESensrvAndConditionSet 1
+
+ESensrvSingleLimitCondition 0
+ESensrvRangeConditionLowerLimit 1
+ESensrvRangeConditionUpperLimit 2
+ESensrvBinaryCondition 3
+
+ESensrvOperatorEquals 0
+ESensrvOperatorGreaterThan 1
+ESensrvOperatorGreaterThanOrEquals 2
+ESensrvOperatorLessThan 3
+ESensrvOperatorLessThanOrEquals 4
+ESensrvOperatorBinaryAnd 5
+ESensrvOperatorBinaryAll 6
+
+KSensorTestModuleEventChannelType 519761901
+KSensrvChannelIdAccelerometerXYZAxisData 270553214
+KSensrvChannelTypeIdAccelerometerDoubleTappingData 270553217
+
+KSensrvAccelerometerDataItemSize 20
+KSensrvEventChannelDataItemSize 16
+KSensrvDoubleTappingDataItemSize 12
+
+iAxisX 1
+iAxisY 2
+iAxisZ 3
+
+iTimeStampFromEventPlugin 0
+iTimeStampFromAccelerometerPlugin 1
+
+iDirection 1
+
+KSensrvUncertainExpectedValue 99999999
+
+// Change types
+ESensrvChannelRemoved 1
+ESensrvChannelAdded 2
+
+// SetPropertyIndication types
+ESetPropertyIndicationUnknown 0
+ESetPropertyIndicationAvailable 1
+ESetPropertyIndicationPossible 2
+ESetPropertyIndicationUnavailable 3
+
+//OOM Testing
+KNumberToRepeatOOMTest 5
+[Enddefine]
+
+
+[StifSettings]
+// Add stif settings here
+CheckHeapBalance= on
+[EndStifSettings]
+
+[Test]
+title Check plugin loaded just once channel opened
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+
+testClass ShutdownServer
+pause 2000
+testClass StartServer
+pause 2000
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+[Endtest] 
+
+[Test]
+title Open and Close two channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass1 CloseChannel
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+
+
+[Test]
+title Start server without Ssystubs
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass ShutdownServer
+testClass SetPSValue KSensrvLeaveFirstStubConstruction KErrNoMemory
+testClass SetPSValue KSensrvLeaveSecondStubConstruction KErrNoMemory
+testClass StartServer
+pause 3000
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+[Endtest] 
+
+[Test]
+title Start server with one Ssystub
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass ShutdownServer
+testClass SetPSValue KSensrvLeaveFirstStubConstruction KErrNoMemory
+testClass StartServer
+pause 3000
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+[Endtest] 
+
+[Test]
+title Start server with two Ssystub
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass ShutdownServer
+testClass StartServer
+pause 3000
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+[Endtest] 
+
+
+// Invalid because of new static channel registration
+/*
+[Test]
+title Start server with zero and one channel
+create SensorTestModule testClass
+testClass ShutdownServer
+testClass SetPSValue KSensrvFirstStubChannelCount 0
+testClass SetPSValue KSensrvSecondStubChannelCount 1
+testClass StartServer
+pause 3000
+testClass ShutdownServer
+delete testClass
+[Endtest] 
+*/
+
+
+[Test]
+title Create and destroy channel finder
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass CreateAndDestroyChannelFinder
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+[Endtest] 
+
+[Test]
+title Create two channel finders
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass CreateAndDestroyChannelFinder
+testClass1 CreateAndDestroyChannelFinder
+testClass ShutdownServer
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+[Endtest] 
+
+[Test]
+title Find channel: Find all channels
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass FindChannels 0 0 0 0 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channel: Find one channel "First1 VendorFirst"
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass FindChannels 0 0 0 0 0 First1 VendorFirst
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Channel not found "Second1 VendorFirst"
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass FindChannels 0 0 0 0 0 Second1 VendorFirst
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Requery
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvFirstStubChannelCount 10
+testClass SetPSValue KSensrvSecondStubChannelCount 3
+testClass FindChannels 0 0 0 0 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Ssystubs construction jam
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvStubConstructionJam 1
+testClass FindChannels 0 0 0 0 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Ssystubs construction delay
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvStubConstructionDelay 5
+testClass FindChannels 0 0 0 0 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Ssystubs construction delay(two client)
+create SensorTestModule testClass
+testClass SetCompletedKey KSensorTestModuleComplete1
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetPSValue KSensrvStubConstructionDelay 5
+testClass SetPSValue KSensrvWaitTestCompletion 0
+testClass FindChannels 0 0 0 0 0
+testClass1 SetPSValue KSensrvWaitTestCompletion 1
+testClass1 FindChannels 0 0 0 0 0
+testClass WaitCompletedKey
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Find channels: Ssystubs construction delay(three client)
+create SensorTestModule testClass
+create SensorTestModule testClass1
+create SensorTestModule testClass2
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass2 SetCompletedKey KSensorTestModuleComplete3
+testClass SetPSValue KSensrvStubConstructionDelay 5
+testClass SetPSValue KSensrvWaitTestCompletion 0
+testClass FindChannels 0 0 0 0 0
+testClass1 FindChannels 0 0 0 0 0
+testClass2 SetPSValue KSensrvWaitTestCompletion 1
+testClass2 FindChannels 0 0 0 0 0
+testClass WaitCompletedKey
+testClass1 WaitCompletedKey
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+delete testClass2
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Find channel: Find all channels(CAP_SERVER capabilities)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass CreateNewProcess 1
+testClass SetProcessPSValue 1 KProcessCommandFindChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Find channel: Find all channels(WriteDeviceData capabilities)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass CreateNewProcess 3
+testClass SetProcessPSValue 3 KProcessCommandFindChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Find channel: Find all channels(ReadDeviceData capabilities)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass CreateNewProcess 4
+testClass SetProcessPSValue 4 KProcessCommandFindChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Open and Close channel
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Open channel twice
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+allownextresult KErrAlreadyExists
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Open and Close two channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass1 CloseChannel
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Open channel asynchronous error
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvChannelOpenedWithError KErrGeneral
+allownextresult KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvChannelOpenedWithError 0
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Open channel return error
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvOpenChannelError KErrGeneral
+allownextresult KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvOpenChannelError 0
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Close channel return error
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvCloseChannelError KErrGeneral
+testClass CloseChannel
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvCloseChannelError 0
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY do not call ChannelOpened
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvChannelOpenedError 1
+allownextresult KErrCancel
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvChannelOpenedError 0
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY do not call ChannelClosed
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvChannelClosedError 1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass SetPSValue KSensrvChannelClosedError 0
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Start listening twice
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvSamplingInterval 100
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 15 10000 3
+allownextresult KErrAlreadyExists
+testClass StartDataListening 15 10000 3
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: two channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 22 1000 5
+testClass1 OpenChannel 0 0 0 0 0 Second0 VendorSecond
+testClass1 StartDataListening 22 1000 10
+testClass WaitCompletedKey
+testClass CloseChannel
+delete testClass
+testClass1 WaitCompletedKey
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Listening: two same channels:
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 22 1000 5
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartDataListening 22 1000 10
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 WaitCompletedKey
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Listening: Start listening Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvStartListeningLeave KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+allownextresult KErrGeneral
+testClass StartDataListening 15 10000 3
+testClass SetPSValue KSensrvStartListeningLeave 0
+testClass StartDataListening 15 10000 3
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Stop listening Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvStopListeningLeave KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 15 10000 3
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvStopListeningLeave 0
+testClass StartDataListening 15 10000 3
+testClass WaitCompletedKey
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Start listening when channel is not open
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass FindChannels 0 0 0 0 0 First1 VendorFirst
+allownextresult KErrNotFound
+testClass StartListeningWhenChannelIsNotOpen 15 10000 3
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: ForceBufferFilled Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvForceBufferFilledLeave KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvSamplingInterval 200
+testClass StartDataListening 22 1000 10
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvForceBufferFilledLeave 0
+testClass StartDataListening 22 1000 10
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: GetData overflow test
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvGetDataOverflowTest 1
+testClass StartDataListening 10 1000 5
+allownextresult KErrOverflow
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvGetDataOverflowTest 0
+testClass StartDataListening 10 1000 5
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: GetData 'data not found' test
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvGetDataNotFoundTest 1
+testClass StartDataListening 10 1000 5
+allownextresult KErrNotFound
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvGetDataNotFoundTest 0
+testClass StartDataListening 10 1000 5
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Sample size 1
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvSamplingInterval 200
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 1 10000 10
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: One per channel, six channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+create SensorTestModule testClass2
+create SensorTestModule testClass3
+create SensorTestModule testClass4
+create SensorTestModule testClass5
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass2 SetCompletedKey KSensorTestModuleComplete3
+testClass3 SetCompletedKey KSensorTestModuleComplete4
+testClass4 SetCompletedKey KSensorTestModuleComplete5
+testClass5 SetCompletedKey KSensorTestModuleComplete6
+testClass SetPSValue KSensrvSamplingInterval 10
+testClass SetPSValue KSensrvFirstStubChannelCount 10
+testClass OpenChannel 0 0 0 0 0 First0 VendorFirst
+testClass StartDataListening 10 0 200
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartDataListening 3 0 600
+testClass2 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass2 StartDataListening 1 0 2000
+testClass3 OpenChannel 0 0 0 0 0 First3 VendorFirst
+testClass3 StartDataListening 1 10 2000
+testClass4 OpenChannel 0 0 0 0 0 First4 VendorFirst
+testClass4 StartDataListening 3 30 600
+testClass5 OpenChannel 0 0 0 0 0 First5 VendorFirst
+testClass5 StartDataListening 10 100 200
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 WaitCompletedKey
+testClass1 CloseChannel
+testClass2 WaitCompletedKey
+testClass2 CloseChannel
+testClass3 WaitCompletedKey
+testClass3 CloseChannel
+testClass4 WaitCompletedKey
+testClass4 CloseChannel
+testClass5 WaitCompletedKey
+testClass5 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+delete testClass2
+delete testClass3
+delete testClass4
+delete testClass5
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]
+title Listening: Restarting listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetPSValue KSensrvSamplingInterval 10
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 3 10000 40
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 5 10000 30
+testClass WaitCompletedKey
+testClass StartDataListening 4 10000 20
+testClass WaitCompletedKey
+testClass StartDataListening 3 10000 10
+testClass WaitCompletedKey
+testClass StartDataListening 2 10000 5
+testClass WaitCompletedKey
+testClass StartDataListening 1 10000 1
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Extreme values
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetPSValue KSensrvSamplingInterval 10
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 2000000000 2000000000 10
+testClass WaitCompletedKey
+//testClass StartDataListening 0 0 10
+//testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Listening: Buffer write error (negative count on buffer filled)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvBufferFilledNegativeCount 1
+testClass StartDataListening 15 10000 2
+allownextresult ESensrvMinor
+testClass WaitCompletedKey
+allownextresult ESensrvFatal
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvBufferFilledNegativeCount 0
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 15 10000 2
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY Unloading: Unloading after normal close
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 15 10000 1
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass WaitSSYUnloading 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY Unloading: Unloading after open error
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvOpenChannelError KErrGeneral
+allownextresult KErrGeneral
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass WaitSSYUnloading 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY Unloading: Unloading after close error
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 15 10000 1
+testClass WaitCompletedKey
+testClass SetPSValue KSensrvCloseChannelError KErrGeneral
+testClass CloseChannel
+testClass WaitSSYUnloading 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title SSY Unloading: Unloading after server start
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass FindChannels 0 0 0 0 0 First1 VendorFirst
+testClass WaitSSYUnloading 2 // 2 dynamic channel SSYs are loaded when FindChannels queries all channels to verify result
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Set and Get a property. Property type TInt
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Set and Get a property. Property type TReal
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetProperty KSensrvPropIdMeasureRange 1 200
+testClass GetProperty KSensrvPropIdMeasureRange 1 200
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Set and Get a property. Property type TDes
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetProperty KSensrvSensorDescription 1 test
+testClass GetProperty KSensrvSensorDescription 1 test
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Get all properties
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvGetAllPropertyCount 10
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetAllProperties
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Get all properties ( Requery )
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvGetAllPropertyCount 50
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetAllProperties
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Get array property
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvSetPropertyArray 3
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetAllPropertiesWithPropertyId
+testClass GetAllPropertiesWithArrayIndex
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property Listening: Start and stop property listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvPropertyChanged 500 ms
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+pause 2000 // pause for 2 seconds
+testClass StopPropertyListening
+testClass CheckPropertyChangedCount
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property Listening: Start property listening twice
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvPropertyChanged 500 ms
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+allownextresult KErrAlreadyExists
+testClass StartPropertyListening
+pause 2000 // pause for 2 seconds
+testClass StopPropertyListening
+testClass CheckPropertyChangedCount
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property Listening: Start and stop property and data listening 
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvPropertyChanged 500 ms
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 20 10000 30
+testClass StartPropertyListening
+pause 2000 // pause for 2 seconds
+testClass StopPropertyListening
+testClass WaitCompletedKey
+testClass CheckPropertyChangedCount
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property Listening: Restart property listening 
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvPropertyChanged 200 ms
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 20 10000 30
+testClass StartPropertyListening
+pause 1000 // pause for 1 seconds
+testClass StopPropertyListening
+testClass CheckPropertyChangedCount
+pause 1000 // pause for 1 seconds
+testClass CheckPropertyChangedCount 0
+testClass StartPropertyListening
+pause 1000 // pause for 1 seconds
+testClass StopPropertyListening
+testClass CheckPropertyChangedCount
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property Listening: Three clients listening
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete1
+create SensorTestModule testClass2
+testClass2 SetCompletedKey KSensorTestModuleComplete2
+create SensorTestModule testClass3
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass3 SetCompletedKey KSensorTestModuleComplete3
+testClass1 OpenChannel 0 0 0 0 0 First0 VendorFirst
+testClass2 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass3 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass1 StartDataListening 10 10000 30
+testClass2 StartDataListening 10 10000 30
+testClass3 StartDataListening 10 10000 30
+testClass1 StartPropertyListening
+testClass2 StartPropertyListening
+testClass3 StartPropertyListening
+testClass1 SetProperty KSensrvPropIdDataRate 1 200
+testClass1 SetProperty KSensrvPropIdMeasureRange 1 200
+testClass1 SetProperty KSensrvSensorDescription 1 test
+testClass2 SetProperty KSensrvPropIdDataRate 1 200
+testClass2 SetProperty KSensrvPropIdMeasureRange 1 200
+testClass2 SetProperty KSensrvSensorDescription 1 test
+testClass3 SetProperty KSensrvPropIdDataRate 1 200
+testClass3 SetProperty KSensrvPropIdMeasureRange 1 200
+testClass3 SetProperty KSensrvSensorDescription 1 test
+pause 1000 // pause for 1 seconds
+testClass1 CheckPropertyChangedCount 6
+testClass2 CheckPropertyChangedCount 6
+testClass3 CheckPropertyChangedCount 6
+testClass1 StopPropertyListening
+testClass2 StopPropertyListening
+testClass3 StopPropertyListening
+testClass1 WaitCompletedKey
+testClass2 WaitCompletedKey
+testClass3 WaitCompletedKey
+testClass1 CloseChannel
+testClass2 CloseChannel
+testClass3 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass1
+delete testClass2
+delete testClass3
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: SetProperty Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvSetPropertyLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvSetPropertyLeave 0
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass StartDataListening 10 10000 5
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: SetProperty Leave when data listening and property listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 20 10000 30
+testClass StartPropertyListening
+testClass SetPSValue KSensrvSetPropertyLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvSetPropertyLeave 0
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartPropertyListening
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass CheckPropertyChangedCount 0
+testClass1 CheckPropertyChangedCount 1
+testClass StopPropertyListening
+testClass1 StopPropertyListening
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: GetProperty Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvGetPropertyLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvGetPropertyLeave 0
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass StartDataListening 10 10000 5
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: GetProperty Leave when data listening and property listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 30 10000 30
+testClass StartPropertyListening
+testClass SetPSValue KSensrvGetPropertyLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvGetPropertyLeave 0
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartPropertyListening
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass CheckPropertyChangedCount 0
+testClass1 CheckPropertyChangedCount 1
+testClass StopPropertyListening
+testClass1 StopPropertyListening
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: GetAllProperties Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvGetAllPropertyCount 10
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvGetAllPropertiesLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass GetAllProperties
+testClass SetPSValue KSensrvGetAllPropertiesLeave 0
+testClass StartDataListening 10 10000 10
+testClass GetAllProperties
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: GetAllProperties Leave when data listening and property listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvGetAllPropertyCount 10
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 20 10000 30
+testClass StartPropertyListening
+testClass SetPSValue KSensrvGetAllPropertiesLeave KErrPermissionDenied
+allownextresult KErrPermissionDenied
+testClass GetAllProperties
+testClass SetPSValue KSensrvGetAllPropertiesLeave 0
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartPropertyListening
+testClass GetAllProperties
+testClass SetProperty KSensrvPropIdDataRate 1 200
+pause 2000
+testClass CheckPropertyChangedCount 0
+testClass1 CheckPropertyChangedCount 1
+testClass StopPropertyListening
+testClass1 StopPropertyListening
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: CheckPropertyDependenciesL Leave
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass SetPSValue KSensrvCheckPropertyDependenciesLeave KErrArgument
+allownextresult KErrArgument
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvCheckPropertyDependenciesLeave 0
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass StartDataListening 10 10000 5
+testClass WaitCompletedKey
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: CheckPropertyDependenciesL Leave when data listening and property listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartDataListening 20 10000 30
+testClass StartPropertyListening
+testClass SetPSValue KSensrvCheckPropertyDependenciesLeave KErrArgument
+allownextresult KErrArgument
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass SetPSValue KSensrvCheckPropertyDependenciesLeave 0
+create SensorTestModule testClass1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartPropertyListening
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass CheckPropertyChangedCount 0
+testClass1 CheckPropertyChangedCount 1
+testClass StopPropertyListening
+testClass1 StopPropertyListening
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: SetProperty - Capability test
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 StartPropertyListening
+allownextresult KErrPermissionDenied
+testClass SetProperty KSensrvPropIdChannelScale 1 200
+testClass SetProperty KSensrvPropIdDataRate 1 200
+testClass GetProperty KSensrvPropIdDataRate 1 200
+testClass StartDataListening 10 10000 5
+testClass WaitCompletedKey
+testClass CheckPropertyChangedCount 0
+testClass1 CheckPropertyChangedCount 1
+testClass CloseChannel
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Set a property from multiple processes, set is denyed for process 2.
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CreateNewProcess 2
+testClass SetProcessPSValue 1 KProcessCommandOpenChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass SetProcessPSValue 2 KProcessCommandOpenChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass SetProcessPSValue 1 KProcessCommandSetProperty 0 KSensrvPropIdDataRate 1 200
+testClass WaitCompletedKey
+testClass SetProcessPSValue 2 KProcessCommandSetProperty -21 KSensrvPropIdDataRate 1 200
+testClass WaitCompletedKey
+testClass SetProcessPSValue 1 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass SetProcessPSValue 2 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]  
+title Reg: SSY registers and removes new channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass CloseChannel
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+testClass StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass AdjustChannels 4 VendorNew KSensrvCreateNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 4
+testClass OpenChannel 0 0 0 0 0 NULL VendorNew
+testClass StartDataListening 15 10000 3
+testClass WaitCompletedKey
+testClass CloseChannel
+testClass AdjustChannels 2 VendorNew KSensrvRemoveNewChannelsFirst
+testClass SetPSValue KSensrvWaitTestCompletion 1
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 2
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]  
+title Reg: Restart listening after stopping it.
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+testClass StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass AdjustChannels 4 VendorNew KSensrvCreateNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 4
+testClass AdjustChannels 2 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 2
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass AdjustChannels 5 VendorNew KSensrvCreateNewChannelsFirst 
+pause 100 //0.1s
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 7
+testClass StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass AdjustChannels 4 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 3
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]  
+title Reg: Two SSYs register and remove new channels, with two listeners
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 Second1 VendorSecond
+testClass1 CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass1 StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+pause 500
+testClass AdjustChannels 7 VendorNew KSensrvCreateNewChannelsFirst 4
+testClass1 AdjustChannels 7 VendorNew KSensrvCreateNewChannelsSecond 3
+testClass WaitCompletedKey
+testClass1 WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 7
+testClass AdjustChannels 4 VendorNew KSensrvRemoveNewChannelsFirst 2
+testClass1 AdjustChannels 4 VendorNew KSensrvRemoveNewChannelsSecond 2
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 3
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass1 StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]  
+title Reg: SSY unregisters an active channel
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetPSValue KSensrvSamplingInterval 100
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 CloseChannel
+testClass1 FindChannels 0 0 0 0 0 NULL VendorNew
+testClass1 CheckFoundChannelCount 0
+testClass1 AdjustChannels 1 VendorNew KSensrvCreateNewChannelsFirst  
+pause 500
+testClass1 StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+testClass OpenChannel 0 0 0 0 0 NULL VendorNew
+testClass StartDataListening 3 10000 30
+pause 500
+testClass1 AdjustChannels 1 VendorNew KSensrvRemoveNewChannelsFirst  
+// Since the failure to open proxy completes quite fast, 
+// it might be that minor error completion is not yet handled,
+// when fatal comes, so allow both results for the wait
+allownextresult ESensrvMinor
+allownextresult ESensrvFatal
+testClass WaitCompletedKey
+testClass1 WaitCompletedKey
+testClass1 FindChannels 0 0 0 0 0 NULL VendorNew
+testClass1 CheckFoundChannelCount 0
+testClass1 StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+allownextresult KErrNotFound
+testClass OpenChannel 0 0 0 0 0 NULL VendorNew
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+[Test]  
+title Reg: Previously registered and removed channels get correct id upon re-registration
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 NULL VendorNew
+pause 500
+testClass AdjustChannels 20 VendorNew KSensrvCreateNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 20
+testClass StoreFoundChannels 1
+testClass AdjustChannels 6 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass AdjustChannels 10 VendorNew KSensrvCreateNewChannelsFirst  
+testClass WaitCompletedKey
+testClass AdjustChannels 21 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass AdjustChannels 3 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+testClass AdjustChannels 11 VendorNew KSensrvCreateNewChannelsFirst 
+testClass WaitCompletedKey
+testClass AdjustChannels 2 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass AdjustChannels 11 VendorNew KSensrvCreateNewChannelsFirst 
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 20
+testClass StoreFoundChannels 0
+testClass AdjustChannels 20 VendorNew KSensrvRemoveNewChannelsFirst  
+testClass WaitCompletedKey
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorNew
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with same priority appears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 1
+testClass SetProcessPSValue 1 KProcessCommandOpenChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationPossible 1
+testClass SetProcessPSValue 1 KProcessCommandSetProperty 0 KSensrvPropIdDataRate 1 200
+testClass WaitCompletedKey
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationUnavailable 1
+//testClass WaitCompletedKey
+testClass StopPropertyListening
+testClass SetProcessPSValue 1 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with same priority disappears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 1
+testClass SetProcessPSValue 1 KProcessCommandOpenChannel 0 0 0 0
+pause 2000
+testClass SetProcessPSValue 1 KProcessCommandCloseChannel 0 0 0 0
+pause 2000
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationAvailable 2
+testClass StopPropertyListening
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with lower priority appears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 2
+testClass SetProcessPSValue 2 KProcessCommandOpenChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass SetProcessPSValue 2 KProcessCommandSetProperty -21 KSensrvPropIdDataRate 1 200
+testClass WaitCompletedKey
+testClass CheckListenedSetPropertySuccessIndicator -1 0
+testClass StopPropertyListening
+testClass SetProcessPSValue 2 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with lower priority disappears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 2
+testClass SetProcessPSValue 2 KProcessCommandOpenChannel 0 0 0 0
+pause 2000
+testClass SetProcessPSValue 2 KProcessCommandCloseChannel 0 0 0 0
+pause 2000
+testClass CheckListenedSetPropertySuccessIndicator -1 0
+testClass StopPropertyListening
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with higher priority appears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 3
+testClass SetProcessPSValue 3 KProcessCommandOpenChannel 0 0 0 0
+testClass SetProcessPSValue 3 KProcessCommandSetProperty 0 KSensrvPropIdDataRate 1 200
+testClass WaitCompletedKey
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationUnavailable 1
+testClass StopPropertyListening
+testClass SetProcessPSValue 3 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with higher priority disappears
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 3
+testClass SetProcessPSValue 3 KProcessCommandOpenChannel 0 0 0 0
+pause 2000
+testClass SetProcessPSValue 3 KProcessCommandCloseChannel 0 0 0 0
+pause 2000
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationAvailable 2
+testClass StopPropertyListening
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Property: Start listening set success indicator, listener with higher priority disappears but same remains
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass StartPropertyListening
+testClass CreateNewProcess 3
+testClass SetProcessPSValue 3 KProcessCommandOpenChannel 0 0 0 0
+pause 2000
+testClass CreateNewProcess 1
+testClass SetProcessPSValue 1 KProcessCommandOpenChannel 0 0 0 0
+pause 2000
+testClass SetProcessPSValue 3 KProcessCommandCloseChannel 0 0 0 0
+pause 2000
+testClass CheckListenedSetPropertySuccessIndicator ESetPropertyIndicationPossible 2
+testClass SetProcessPSValue 1 KProcessCommandCloseChannel 0 0 0 0
+testClass StopPropertyListening
+testClass KillProcess
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Auto-shutdown: start first client
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+pause 2000
+testClass CheckServerAlive 1
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Auto-shutdown: start second client
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+allownextresult KErrAlreadyExists
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CheckServerAlive 1
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Auto-shutdown: shutdown first client
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass1 CloseChannel
+delete testClass1
+pause 5000
+testClass CheckServerAlive 1
+testClass CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Auto-shutdown: shutdown second client
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass1 CloseChannel
+testClass CloseChannel
+pause 10000
+testClass CheckServerAlive 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass1
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: SSY loaded for query channels, channel is available
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvFirstStubChannelCount 11
+pause 100
+testClass SetPSValue KSensrvWaitTestCompletion 0
+testClass FindChannels 0 0 0 0 0 First10 VendorFirst
+testClass WaitCompletedKey
+testClass CheckFoundChannelCount 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: SSY loaded for query channels, channel is unavailable
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvFirstStubChannelCount 10
+pause 100
+testClass SetPSValue KSensrvWaitTestCompletion 0
+testClass FindChannels 0 0 0 0 0 First10 VendorFirst
+testClass WaitCompletedKey
+testClass CheckFoundChannelCount 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: SSY loaded for change listening
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+pause 100
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: Change listening, SSY unload is denied
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+testClass CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass WaitSSYUnloading 0
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: Change listening, SSY unload is allowed
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+testClass CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+testClass WaitSSYUnloading 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: Two clients change listening, SSY unload is denied
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+testClass CloseChannel
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass1 StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass WaitSSYUnloading 0
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+testClass1 StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title DynChannels: Two clients change listening, SSY unload is allowed
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass GetPSValue KSensrvCheckPluginLoaded 0
+testClass SetCompletedKey KSensorTestModuleComplete1
+
+testClass1 SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass GetPSValue KSensrvCheckPluginLoaded 1
+testClass CloseChannel
+testClass1 OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 CloseChannel
+testClass StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass1 StartChannelChangeListening 0 0 0 0 0 First10 VendorFirst
+testClass StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+testClass1 StopChannelChangeListening 0 0 0 0 0 NULL VendorFirst
+testClass WaitSSYUnloading 1
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Dependent Channels: Open and Close two channels
+create SensorTestModule testClass
+create SensorTestModule testClass1
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass1 SetPSValue KSensrvChannelOpenedError KErrNotSupported
+testClass1 OpenChannel 0 0 0 0 0 First2 VendorFirst
+testClass GetProperty KSensrvPropIdAvailability 1 1
+testClass1 GetProperty KSensrvPropIdAvailability 1 0
+testClass CloseChannel
+testClass1 GetProperty KSensrvPropIdAvailability 1 1
+testClass1 CloseChannel
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+[Test]
+title Dependent Channels: Three dependent channels, listener with higher priority appears for the unavailable channel
+create SensorTestModule testClass
+create SensorTestModule testClass1
+create SensorTestModule testClass2
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass2 SetCompletedKey KSensorTestModuleComplete3
+testClass2 OpenChannel 0 0 0 0 0 First2 VendorFirst 1
+testClass1 SetCompletedKey KSensorTestModuleComplete2
+testClass1 OpenChannel 0 0 0 0 0 First0 VendorFirst 1
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass SetPSValue KSensrvChannelOpenedError KErrNotSupported
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst 0
+testClass GetProperty KSensrvPropIdAvailability 1 0
+testClass1 GetProperty KSensrvPropIdAvailability 1 1
+testClass2 GetProperty KSensrvPropIdAvailability 1 1
+testClass CreateNewProcess 3
+testClass SetProcessPSValue 3 KProcessCommandOpenChannel 0 0 0 0
+testClass GetProperty KSensrvPropIdAvailability 1 0
+testClass1 GetProperty KSensrvPropIdAvailability 1 1
+testClass SetProcessPSValue 3 KProcessCommandCloseChannel 0 0 0 0
+testClass WaitCompletedKey
+testClass GetProperty KSensrvPropIdAvailability 1 1
+testClass1 GetProperty KSensrvPropIdAvailability 1 1
+testClass CloseChannel
+testClass1 GetProperty KSensrvPropIdAvailability 1 1
+testClass1 CloseChannel
+testClass KillProcess
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass
+delete testClass1
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
+
+// This case panics intensionally in debug builds
+[Test]
+title Reg: SSY registers zero channels (UDEB panics!)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass SetPSValue KSensrvRegisterZeroChannels 0
+pause 500
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+allownextresult KErrArgument
+testClass GetPsResult KSensrvRegisterZeroChannels
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass 
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest] 
+
+// This case panics intensionally in debug builds
+[Test]
+title Reg: SSY registers invalid channels (UDEB panics!)
+create SensorTestModule testClass
+
+oomignorefailure ON
+loop KNumberToRepeatOOMTest
+oomheapfailnext 5
+
+testClass SetCompletedKey KSensorTestModuleComplete1
+testClass OpenChannel 0 0 0 0 0 First1 VendorFirst
+testClass CloseChannel
+testClass SetPSValue KSensrvRegisterInvalidChannels 0
+pause 500
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+allownextresult KErrArgument
+testClass GetPsResult KSensrvRegisterInvalidChannels
+testClass FindChannels 0 0 0 0 0 NULL VendorNew
+testClass CheckFoundChannelCount 0
+
+endloop
+oomignorefailure OFF
+oomheaptonormal
+
+delete testClass 
+create SensorTestModule sd
+sd ShutdownServer
+delete sd
+[Endtest]
--- a/sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist.rss	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist.rss	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -92,10 +92,9 @@
 #endif // __JAVA
         r_cmd_watcher,
         r_cmd_dmutilsrv,
-	r_cmd_mediasyncserver,  // Should be executed before contentharvester
         // prio 0xFFA7
         r_cmd_contentharvester,
-        r_cmd_harvestersrv,
+        r_cmd_mdswatchdog,
         r_cmd_predefinedcontacts,
         r_cmd_xnthemesrv,
         r_cmd_ncnlist,
@@ -115,7 +114,8 @@
 #ifdef FF_LBT_ENGINE
         r_cmd_lbtsrv,
 #endif // FF_LBT_ENGINE
-        r_cmd_fsemail,
+        r_cmd_emailsrvrmon,
+        r_cmd_taskswitcher,
         // prio 0xFFA6
         r_cmd_dmfirstbootreason,
         r_cmd_fota,
@@ -124,6 +124,8 @@
         // prio 0x7F97
 	r_cmd_dcmo,
         r_cmd_amastart,
+	      // prio 0x7F96
+	      r_cmd_multiple_wait,
         // prio 0x7EFF
         r_cmd_activitymonitor1,
         // prio 0x7EFE
@@ -160,7 +162,13 @@
 	r_cmd_activitymonitor9,
 	// prio 0x7EEC
 	r_cmd_mylocationsengine,
-	    r_cmd_startupready      // Last command, prio 0x0000
+#ifdef FF_ATT_ADDRESS_BK
+	//prio 0x7EEA
+	r_cmd_activitymonitor10,
+	//prio 0x7EE9
+	r_cmd_aab,
+#endif
+	r_cmd_startupready      // Last command, prio 0x0000
         };
     }
 
@@ -169,6 +177,21 @@
 // ===========================================================================
 //
 
+// -----------------------------------------------------------------------------
+// r_cmd_aab
+// -----------------------------------------------------------------------------
+//
+#ifdef FF_ATT_ADDRESS_BK 
+RESOURCE SSM_START_APP_INFO r_cmd_aab
+    {
+    priority = 0x7EE9;
+    name = "z:\\sys\\bin\\AABPhonebookapp.exe";
+    retries = 2;
+    background = 1; // To background
+    monitor_info = r_mon_3_restarts_ignore;
+    }
+#endif
+
 // ---------------------------------------------------------------------------
 // r_cmd_activitymonitor1
 // ---------------------------------------------------------------------------
@@ -305,6 +328,23 @@
     }
 	
 // ---------------------------------------------------------------------------
+// r_cmd_activitymonitor10
+// ---------------------------------------------------------------------------
+//
+#ifdef FF_ATT_ADDRESS_BK
+RESOURCE SSM_START_CUSTOM_COMMAND r_cmd_activitymonitor10
+    {
+    priority = 0x7EEA;
+    severity = ECmdCriticalSeverity;
+    execution_behaviour = ESsmWaitForSignal;
+    dllname = "ssmactivitycmd.dll";
+    ordinal = 1; // SsmActivityCmdNewL
+    retries = 2;
+    dll_data = r_dlldata_activitymonitor_timeout;
+    }
+#endif
+	
+// ---------------------------------------------------------------------------
 // r_cmd_adtupdater
 // ---------------------------------------------------------------------------
 //
@@ -508,17 +548,14 @@
     }
 
 // ---------------------------------------------------------------------------
-// r_cmd_fsemail
+// r_cmd_emailsrvrmon
 // ---------------------------------------------------------------------------
 //
-RESOURCE SSM_START_APP_INFO r_cmd_fsemail
+RESOURCE SSM_START_APP_INFO r_cmd_emailsrvrmon
     {
     priority = 0xFFA7;
-    name = "fsmailserver.exe";
-    execution_behaviour = ESsmWaitForSignal;
-    timeout = 10000;
-    background = 1; // To background
-    monitor_info = r_mon_3_restarts_ignore;
+    name = "emailservermonitor.exe";
+    execution_behaviour = ESsmFireAndForget;
     conditional_information = r_cond_feat_emailfw;
     }
 
@@ -537,16 +574,14 @@
     }
 
 // ---------------------------------------------------------------------------
-// r_cmd_harvestersrv
+// r_cmd_mdswatchdog
 // ---------------------------------------------------------------------------
 //
-RESOURCE SSM_START_PROCESS_INFO r_cmd_harvestersrv
+RESOURCE SSM_START_PROCESS_INFO r_cmd_mdswatchdog
     {
     priority = 0xFFA7;
-    name = "harvesterserver.exe";
-    execution_behaviour = ESsmWaitForSignal;
-    timeout = 10000;
-    monitor_info = r_mon_3_restarts_ignore;
+    name = "mdswatchdog.exe";
+    execution_behaviour = ESsmFireAndForget;
     }
 
 // ---------------------------------------------------------------------------
@@ -627,19 +662,6 @@
     }
 	
 // ---------------------------------------------------------------------------
-// r_cmd_mediasyncserver
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_START_PROCESS_INFO r_cmd_mediasyncserver
-    {
-    priority = 0xFFA6;
-    name = "z:\\sys\\bin\\mediasyncserver.exe";
-    execution_behaviour = ESsmWaitForSignal;
-    timeout = 10000;
-    monitor_info = r_mon_3_restarts_ignore;
-    }
-		
-// ---------------------------------------------------------------------------
 // r_cmd_ncnlist
 // ---------------------------------------------------------------------------
 //
@@ -1084,6 +1106,27 @@
     execution_behaviour = ESsmFireAndForget;
     }
 
+// ---------------------------------------------------------------------------
+// r_cmd_item_taskswitcher
+// ---------------------------------------------------------------------------  
+RESOURCE SSM_START_APP_INFO r_cmd_taskswitcher
+     {
+     priority = 0xFFA7;
+     name = "z:\\sys\\bin\\taskswitcher.exe";
+     execution_behaviour = ESsmDeferredWaitForSignal;
+     background = 1; // To background
+     monitor_info = r_mon_3_restarts_ignore;
+     }
+
+// ---------------------------------------------------------------------------
+// r_cmd_multiple_wait
+// ---------------------------------------------------------------------------
+//
+RESOURCE SSM_MULTIPLE_WAIT r_cmd_multiple_wait
+     {
+     priority = 0x7F96;     
+     }
+
 // ===========================================================================
 // Conditional blocks in alphabetical order
 // ===========================================================================
--- a/sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist_hw.rss	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/ssmcmdlists/data/noncriticalcmdlist_hw.rss	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -72,7 +72,6 @@
         r_cmd_sipprofilesrv,
 #endif // defined !SYMBIAN_EXCLUDE_SIP
         r_cmd_remotelock,
-        r_cmd_hotspotsrv,
 	// prio 0x7EF1
 	r_cmd_activitymonitor1,
 	// prio 0x7EF0
@@ -133,19 +132,6 @@
 	
 	
 // ---------------------------------------------------------------------------
-// r_cmd_hotspotsrv
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_START_PROCESS_INFO r_cmd_hotspotsrv
-    {
-    priority = 0xFFA7;
-    name = "hotspotserver.exe";
-    execution_behaviour = ESsmWaitForSignal;
-    timeout = 10000;
-    conditional_information = r_cond_protwlan_and_firstboot_or_deeprfs_or_normalrfs;
-    }
-
-// ---------------------------------------------------------------------------
 // r_cmd_provisioning
 // ---------------------------------------------------------------------------
 //
@@ -206,26 +192,6 @@
 //
 
 // ---------------------------------------------------------------------------
-// r_cond_ps_firstboot
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_PUB_SUB_VALUE r_cond_ps_firstboot
-    {
-    category		  = 0x101F8766; // KPSUidStartup
-    key           = 0x00000013; // KPSStartupFirstBoot
-    value         = 101;        // EPSStartupFirstBoot
-    }
-
-// ---------------------------------------------------------------------------
-// r_cond_feat_protocolwlan
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_FEATURE_VALUE r_cond_feat_protocolwlan
-    {
-    feature_id = KFeatureIdProtocolWlan;
-    }
-
-// ---------------------------------------------------------------------------
 // r_cond_feat_remotelock
 // ---------------------------------------------------------------------------
 //
@@ -244,60 +210,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// r_cond_firstboot_or_deeprfs
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_LOGICAL_OR r_cond_firstboot_or_deeprfs
-    {
-    lhs = r_cond_ps_deep_rfs;
-    rhs = r_cond_ps_firstboot;
-    }
-
-// ---------------------------------------------------------------------------
-// r_cond_firstboot_or_deeprfs_or_normalrfs
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_LOGICAL_OR r_cond_firstboot_or_deeprfs_or_normalrfs
-    {
-    lhs = r_cond_ps_normal_rfs;
-    rhs = r_cond_firstboot_or_deeprfs;
-    }
-
-// ---------------------------------------------------------------------------
-// r_cond_ps_normal_rfs
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_PUB_SUB_VALUE r_cond_ps_normal_rfs
-    {
-    category = 0x101F8766; // KPSUidStartup
-    key = 0x00000045;      // KPSStartupReason
-    value = ENormalRFSReset;
-    }
-
-// ---------------------------------------------------------------------------
-// r_cond_ps_deep_rfs
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_PUB_SUB_VALUE r_cond_ps_deep_rfs
-    {
-    category = 0x101F8766; // KPSUidStartup
-    key = 0x00000045;      // KPSStartupReason
-    value = EDeepRFSReset;
-    }
-
-// ---------------------------------------------------------------------------
-// r_cond_protwlan_and_firstboot_or_deeprfs_or_normalrfs
-// ( protocol WLAN ) AND ( first boot OR deep RFS OR normal RFS )
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_CND_LOGICAL_AND r_cond_protwlan_and_firstboot_or_deeprfs_or_normalrfs
-    {
-    lhs = r_cond_feat_protocolwlan;
-    rhs = r_cond_firstboot_or_deeprfs_or_normalrfs;
-    }
-	
-
-// ---------------------------------------------------------------------------
 // r_dlldata_activitymonitor_timeout
 // ---------------------------------------------------------------------------
 //
--- a/sysstatemgmt/ssmcmdlists/data/uiservicescmdlist.rss	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/ssmcmdlists/data/uiservicescmdlist.rss	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -83,11 +83,10 @@
         // prio 0xFF97
         r_cmd_tzsrv,
         r_cmd_cntsrv,
-        r_cmd_randsrv,
         r_cmd_mediator,
         r_cmd_hwrmsrv,
         r_cmd_rtc,
-        // prio 0xFF96 - tzsrv, randsrv, cntsrv, mediator, hwrmsrv
+        // prio 0xFF96 - tzsrv, cntsrv, mediator, hwrmsrv
         r_cmd_multiwaitforever1,
         // prio 0xFF87
         r_cmd_dbrecovery,
@@ -294,19 +293,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// r_cmd_randsrv
-// ---------------------------------------------------------------------------
-//
-RESOURCE SSM_START_PROCESS_INFO r_cmd_randsrv
-    {
-    priority = 0xFF97;
-    name = "Z:\\sys\\bin\\randsvr.exe";
-    severity = ECmdCriticalSeverity;
-    execution_behaviour = ESsmWaitForSignal;
-    retries = 2;
-    }
-
-// ---------------------------------------------------------------------------
 // r_cmd_rfsdeep
 // ---------------------------------------------------------------------------
 //
--- a/sysstatemgmt/systemstatemgr/cmd/inc/ssmcommandlistresourcereaderimpl.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/inc/ssmcommandlistresourcereaderimpl.h	Sat Feb 20 00:05:00 2010 +0200
@@ -55,7 +55,8 @@
 		EInitialiseNextStep,
 		EInitialiseSysDriveStep,
 		EPrepareFirstStep,
-		EPrepareNextStep
+		EPrepareNextStep,
+		EInitialiseExtFolderStep
 		};
 
 	NONSHARABLE_CLASS(TMapping)
@@ -118,6 +119,9 @@
 		void DoInitialiseNextStepL();
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 		void DoInitialiseSysDriveStepL();
+#ifdef __WINS__ 
+		void DoInitialiseExtFolderStepL();
+#endif
 #endif
 		CResourceFile* OpenResourceFileL(const TDesC& aFileName);
 		void ParseFileL(CResourceFile* aResourceFile);
@@ -135,6 +139,12 @@
 		RBuf iSystemDrivePath;
 		CDir* iRssFileEntriesInSysDrive;
 		TInt iSysDriveEntryIndex;
+#ifdef __WINS__ 
+	    CDir* iExtendedResourceFileEntries;
+	    RBuf iExtendedPath;
+	    TInt iExtendedEntryIndex;
+#endif //__WINS__
+	      
 #endif	//SYMBIAN_SSM_FLEXIBLE_MERGE
 		};
 
--- a/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandfactory.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandfactory.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -333,7 +333,6 @@
     {
     CSsmCommandBase* cmd = NULL;
     TSsmCommandType const cmdType = aSsmCommand.Type();
-    DEBUGPRINT2A("Adding command type in CLE commandlist: %d", cmdType);
     
     switch(cmdType)
         {
--- a/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistimpl.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistimpl.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -237,8 +237,6 @@
 //@panic ECmdNullPtr if the information used to create command is null
 void CSsmCommandListImpl::Execute( const TInt aIndex, TRequestStatus& aStatus )
 	{
-	DEBUGPRINT2A("CSsmCommandListImpl::Execute - List Count() = %d", Count());
-	
 	__ASSERT_DEBUG( __IN_RANGE(aIndex, iCmdList.Count()), PanicNow(KPanicCmdList, ECmdListBadIdx));
 	__ASSERT_DEBUG( iCmdList[ aIndex ], PanicNow(KPanicCmdList, ECmdNullPtr));
 	
@@ -333,9 +331,9 @@
 		SSMLOGLEAVE(KErrArgument);
 		}
 	
-	const TSsmCommandType cmdType = aCmd->Type();	
+	const TSsmCommandType cmdType = aCmd->Type();
 	DEBUGPRINT2A("Adding command type: %d", cmdType);
-	
+
     if (ESsmCmdPublishSystemState == cmdType) 
         {
         ++iPublishSysStateCmdCount;
--- a/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereader.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereader.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -19,6 +19,7 @@
 #include "ssmpanic.h"
 #include "ssmcommandlistresourcereaderimpl.h"
 #include "ssmcommandlistimpl.h"
+#include "ssmdebug.h"
 
 /**
 Constructs a new command list resource reader object.
@@ -207,6 +208,7 @@
 EXPORT_C CSsmCommandList* CSsmCommandListResourceReader::GetCommandList()
 	{
 	__ASSERT_DEBUG(iImpl->IsCommandListReady(), PanicNow(KPanicCmdResourceReader, ENoPreparedCommandList));
+	DEBUGPRINT2A("CSsmCommandListResourceReader::GetCommandList - List Count() = %d", iCommandList->Count());
 	CSsmCommandList* const commandList = iCommandList;
 	iCommandList = NULL; // return ownership of command list to the caller
 	return commandList;
--- a/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereaderimpl.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/cmd/src/ssmcommandlistresourcereaderimpl.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -29,7 +29,25 @@
 #include "ssmpanic.h"
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 #include "ssmcommandlistimpl.h"
-#endif
+#ifdef __WINS__
+#include <u32hal.h>
+
+//Literal to be appended with the main folder path to get the extended folder path
+_LIT(KExtendedCommandListPath, "_ext\\");
+
+//Used for checking the presence of keyword for using extended folder in epoc.ini
+static TBool IsExtendedFolderDisabled()
+    {
+    TBool isMinimalBootDisable = EFalse;
+    
+    //If the keyword "MINIMALSTART" is found in epoc.ini then only commands from main folder are 
+    //executed else commands from both main and extended folder are executed.
+    UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty, (TAny*)"MINIMALSTART", &isMinimalBootDisable);
+    return isMinimalBootDisable;
+    }
+#endif // __WINS__
+#endif //SYMBIAN_SSM_FLEXIBLE_MERGE
+
 
 CSsmCommandListResourceReaderImpl* CSsmCommandListResourceReaderImpl::NewL(RFs& aFs, const TDesC& aCommandListPath, MSsmConditionalCallback& aConditionalCallback)
 	{
@@ -180,7 +198,7 @@
 			break;
 			}
 		}
-	DEBUGPRINT3(_L("Mapping Array for substate %d Contains %d entries"), iMappings[mappingIndex].iCommandListId, aMappingArray.Count());
+	DEBUGPRINT3(_L("Mapping Array for substate %04x Contains %d entries"), iMappings[mappingIndex].iCommandListId, aMappingArray.Count());
 	}
 
 #else
@@ -276,6 +294,9 @@
 
 CSsmCommandListResourceReaderImpl::CInitialiser::CInitialiser(RFs& aFs, CResourcePool& aResourcePool)
 	:CActiveBase(EPriorityStandard),  iFs(aFs), iResourcePool(aResourcePool)
+#if defined(SYMBIAN_SSM_FLEXIBLE_MERGE) && defined(__WINS__)
+	, iExtendedEntryIndex(0)
+#endif //SYMBIAN_SSM_FLEXIBLE_MERGE && __WINS__
 	{
 	CActiveScheduler::Add(this);
 	}
@@ -287,6 +308,10 @@
 	iPath.Close();
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 	iSystemDrivePath.Close();
+#ifdef __WINS__ 
+	iExtendedPath.Close();
+#endif //__WINS__
+
 #endif
 	}
 
@@ -300,6 +325,10 @@
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 	delete iRssFileEntriesInSysDrive;
 	iRssFileEntriesInSysDrive = NULL;
+#ifdef __WINS__ 
+	delete iExtendedResourceFileEntries;
+	iExtendedResourceFileEntries = NULL;
+#endif //__WINS__
 #endif
 	}
 
@@ -351,7 +380,12 @@
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 	case EInitialiseSysDriveStep:
 		DoInitialiseSysDriveStepL();
-		break;		
+		break;
+#ifdef __WINS__ 
+	case EInitialiseExtFolderStep:
+	    DoInitialiseExtFolderStepL();
+	    break;
+#endif //__WINS__
 #endif
 	default:
 		PanicNow(KPanicCmdResourceReader, EInvalidRunLAction);
@@ -404,6 +438,24 @@
 	iEntryIndex = iResourceFileEntries->Count();
 
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
+#ifdef __WINS__
+	if(!IsExtendedFolderDisabled())
+	    {
+	    TFileName extPath(iPath);
+	    extPath.Replace(iPath.Length() - 1, 1, KExtendedCommandListPath);
+	    iExtendedPath.CreateL(extPath);
+	    DEBUGPRINT2(_L("Extended list path is %S"), &extPath);
+
+	    extPath.Append(KStar);
+	    const TInt extErr = (iFs.GetDir(extPath, TUidType(KUidResourceFile, TUid::Uid(KUidSsmCommandListResourceFile)), ESortNone, iExtendedResourceFileEntries));
+	    if (KErrNone == extErr)
+	        {
+	        iExtendedEntryIndex = iExtendedResourceFileEntries->Count();
+	        DEBUGPRINT2(_L("Number of resource files in extended folder : %d"), iExtendedEntryIndex);
+	        }	    
+	    }
+#endif //__WINS__
+
 	DEBUGPRINT2(_L("Number of resource files in ROM Drive : %d"),iEntryIndex );
 	// Now, get list of command list resource filenames from system drive too
 	TFileName sysPath(iSystemDrivePath);
@@ -471,16 +523,44 @@
 		}
 	else
 		{
-		// initialisation complete
-		iAction = EIdle;
-		delete iRssFileEntriesInSysDrive;
-		iRssFileEntriesInSysDrive = NULL;
+        iAction = EIdle;
+        delete iRssFileEntriesInSysDrive;
+        iRssFileEntriesInSysDrive = NULL;
+
+#ifdef __WINS__
+        if(!IsExtendedFolderDisabled())
+            {
+            //Initialise the command list from extended list only if it is enabled
+            iAction = EInitialiseExtFolderStep;    
+            }
+#endif //__WINS__
 		}
 	}
-#endif
+
+#ifdef __WINS__
+void CSsmCommandListResourceReaderImpl::CInitialiser::DoInitialiseExtFolderStepL()
+    {
+    //Append the file names from the extended folder only if it is enabled 
+    if (iExtendedEntryIndex--)
+        {
+        TFileName filename(iExtendedPath);
+        filename.Append((*iExtendedResourceFileEntries)[iExtendedEntryIndex].iName);
+        CResourceFile* const resourceFile = OpenResourceFileL(filename);
+        ParseFileL(resourceFile);
+        }
+    else
+        {
+        // initialisation complete
+        iAction = EIdle;
+        delete iExtendedResourceFileEntries;
+        iExtendedResourceFileEntries = NULL;
+        }
+    }
+#endif //__WINS__
+#endif //SYMBIAN_SSM_FLEXIBLE_MERGE
+
 CResourceFile* CSsmCommandListResourceReaderImpl::CInitialiser::OpenResourceFileL(const TDesC& aFileName)
 	{
-
 	// open the resource file
 	RFile file;
 	CleanupClosePushL(file);
@@ -733,7 +813,6 @@
 				iListReader.AdvanceL(sizeof(TUint16));
 				}
 			}
-		DEBUGPRINT2A("The value of RssFile's current command is %d ", iCommandIndexInRssFile[iCurrentCommandListInMapping]);
 #else
 	while(iCommandIndex && iBatchIndex--)
 		{
@@ -741,7 +820,6 @@
 #endif
 		// open command resource
 		const TInt commandResourceId = iListReader.ReadInt32L();
-		DEBUGPRINT2A("Reading command resource id %x", commandResourceId);
 		RResourceReader commandReader;
 #ifdef SYMBIAN_SSM_FLEXIBLE_MERGE
 		commandReader.OpenLC(iMappingArray[iCurrentCommandListInMapping].iResourceFile, commandResourceId);
--- a/sysstatemgmt/systemstatemgr/inc/ssmadaptationcli.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/inc/ssmadaptationcli.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -36,8 +36,12 @@
 public:
 	IMPORT_C TInt Connect();
 	IMPORT_C TInt Connect(TInt aAsyncMessageSlotCount);
+	//Used by testcode only
+#ifdef TEST_SSM_SERVER
+    TInt Connect(const TDesC& aServerName);
+#endif //TEST_SSM_SERVER
 private:
-	TInt DoConnect(TInt aAsyncMessageSlotCount);
+    TInt DoConnect(const TDesC& aServerName, TInt aAsyncMessageSlotCount);
 	TVersion Version() const;
 	};
 
--- a/sysstatemgmt/systemstatemgr/sus/inc/ssmadaptationcmn.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/inc/ssmadaptationcmn.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -30,13 +30,11 @@
 	TInt Int0() const;
 	void ReadL(TInt aParamNumber,TPtr8 aParam);
 	TInt GetDesLength(TInt aParam);
+	void SetMessage(const RMessage2& aMessage);
 private:
 	RMessage2 iMessage;
-	TBool iMessageAvailable;
 public :
-	TSusAdaptionServerRequests iRequestType;
-	//To know whether the object is created using reserved heap or not.
-	TBool iUsingReservedHeap;
+	TSusAdaptionServerRequests iRequestType;	
 	};
 
 class RSsmAdaptationRequestQueue
@@ -48,14 +46,11 @@
 	void RemoveFromQueueAndComplete(const RMessage2 &aMessage);
 	TInt Queue(CAdaptationMessage *aPendingRequest);
 	void NotifyAndRemoveAll();
-	void RemoveFromQueueAndComplete(const RMessage2 &aMessage, RHeap *aReservedHeap);	
-	void NotifyAndRemoveAll(RHeap *aReservedHeap);
-	TInt Reserve(TInt aReserverCount);
-	TInt Count();
-	
+	TInt Count();	
 private:
 	RPointerArray<CAdaptationMessage > iQueue;
 		
 	};
 
+
 #endif	__SSMADAPTATIONCMN_H__
--- a/sysstatemgmt/systemstatemgr/sus/inc/susadaptionserver.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/inc/susadaptionserver.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -37,6 +37,8 @@
 	{	
 public:
 	static CSsmAdaptationServer* NewLC();
+	static CSsmAdaptationServer* NewLC(const TDesC& aServerName);
+
 	~CSsmAdaptationServer();
 
 	//State Adaptation services 
@@ -73,7 +75,7 @@
 	void DoDeactivateRfForEmergencyCallL(const RMessage2& aMessage);
 	void DoEmergencyCallRfCancelL(const RMessage2& aMessage);
 	TInt SetAsPriorityClientL(CSsmAdaptationSession* aSession);
-	void RemovePriorityClient(CSsmAdaptationSession* aSession);
+	void RemovePriorityClient(CSsmAdaptationSession* aSession);	
 #ifdef _DEBUG
 	void UnloadAdaptationsAndObservers();
 #endif
@@ -86,7 +88,7 @@
 //From Policy Server
 	CPolicyServer::TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
 	CSsmAdaptationServer();
-	void ConstructL();
+	void ConstructL(const TDesC& aServerName);
 	//from CServer2
 	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
 	void LoadStateAdaptationL();
--- a/sysstatemgmt/systemstatemgr/sus/inc/susemergencycallrfadaptation.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/inc/susemergencycallrfadaptation.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -37,12 +37,11 @@
 
 @internalComponent
 */
-
-
+class CEmergencyAdaptationMessage;
 class CEmergencyCallRfAdaptation : public CActive
 {
 public:
-	static CEmergencyCallRfAdaptation* NewL(MEmergencyCallRfAdaptation& aAdaptation);
+	static CEmergencyCallRfAdaptation* NewL(MEmergencyCallRfAdaptation* aAdaptation);
 	~CEmergencyCallRfAdaptation();
 
 	void Release();
@@ -52,38 +51,71 @@
 	void SetPriorityClientSession(CSsmAdaptationSession* aPriorityClientSession);
 	void RemovePriorityClientSession();
 	void ReserveMemoryL();
+	void DeleteAdaptationMessage();
+	void NotifyAndRemoveAll();
+	void Dequeue(CEmergencyAdaptationMessage *&aCurrentMessage);
 protected:
 	void RunL();
 	TInt RunError( TInt aError );
 	void DoCancel();
+	void ConstructL(MEmergencyCallRfAdaptation* aAdaptation);
 
 private:
 
-	CEmergencyCallRfAdaptation(MEmergencyCallRfAdaptation& aAdaptation);
+	CEmergencyCallRfAdaptation();
 	void SubmitOrQueueL(const RMessage2 &aMessage);
-	void Submit(CAdaptationMessage*& aMessage);
+	void Submit(CEmergencyAdaptationMessage*& aMessage);
 	
 private:
-	CAdaptationMessage *iCurrentMessage;
-	RSsmAdaptationRequestQueue iPendingRequestsQueue;
+	CEmergencyAdaptationMessage *iCurrentMessage;	
+	RPointerArray<CEmergencyAdaptationMessage>iPendingEmergencyRequestsQueue;
 	
-	MEmergencyCallRfAdaptation& iEmergencyCallRfAdaptation;
-	//Reserving Heap to create CAdaptationMessage in OOM condition for priority clients
-	RHeap* iReservedHeap;
+	MEmergencyCallRfAdaptation* iEmergencyCallRfAdaptation;
 	//For storing PriorityClientsession
     CSsmAdaptationSession* iPriorityClientSession;
+    
+    //Count of unused reserved pointers.  
+    TInt iReserveMsgCount;
+    //Pointer Array to store reserved adaptation message pointers
+    RPointerArray<CEmergencyAdaptationMessage> iAdaptationReservedMessageArray; 
     };
 
+enum TMessageStatus
+    {
+    EMsgStatusNULL = 0, //Default status of Message is 0
+    EMsgReserved   = 1, //Flag to indicate the message is using Reserved memory.
+    EMsgInUse      = 2  //Flag to indicate the Reserved message is Used.
+    };
 /**
- * Used for pushing the CAdaptationMessage object in to cleanup stack. This is needed as
- * the message is created using the reserved heap should be freed back to reserved heap
- * instead of deleting.
- * @internalComponent
+ * Class to hold CAdaptationMessage pointer and the value to know whether the current message is from reserved pool
+ * or normal message.
  */
-struct TStoreAdaptationMessage 
+class CEmergencyAdaptationMessage : public CBase
     {
+public:    
+    static CEmergencyAdaptationMessage* NewL(const RMessage2& aMessage);
+    static CEmergencyAdaptationMessage* NewL(const RMessage2& aMessage, const TInt8 aMessageStatus);    
+    
+    ~CEmergencyAdaptationMessage();
+    
+    inline void UnsetMessageStatus(const TInt8 aMessageStatus);
+    inline void SetMessageStatus(const TInt8 aMessageStatus);
+    inline TBool IsMessageReserved() const;
+    inline TBool IsMessageInuse() const;    
+    void SetMessage(const RMessage2& aMessage);
+    TInt Function() const;
+    CSession2 *Session() const;
+    void Complete(TInt aReason);
+    
+protected:
+    void ConstructL(const RMessage2& aMessage);
+    
+private:
+    CEmergencyAdaptationMessage(const TInt8 aMessageStatus);
+    
+private:
     CAdaptationMessage* iAdaptationMessage;
-    RHeap* iReservedHeap;
+    // To know the Adaptation Message status.
+    TInt8 iMessageStatus;
     };
-
 #endif // __SUSEMERGENCYCALLRFADAPTATION_H__
--- a/sysstatemgmt/systemstatemgr/sus/inc/suspanic.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/inc/suspanic.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -36,7 +36,12 @@
 	//CSusAdaptionServer errors
 	EAdaptionServerError1,
 	EAdaptionServerError2,
-	ELibraryAlreadyOpen
+	ELibraryAlreadyOpen,
+	
+	//Emergency Adaptation panic codes
+	EEmergencyCallRfAdaptationNullPtrError1,
+	EEmergencyCallRfAdaptationNullPtrError2,
+	EEmergencyAdaptationMessageNullPtrError
 	};
 
 #endif // __SUSPANICCODES_H__
--- a/sysstatemgmt/systemstatemgr/sus/src/ssmadaptationcli.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/src/ssmadaptationcli.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -33,8 +33,7 @@
  */
 EXPORT_C TInt RSsmAdaptationBase::Connect()
 	{
-	const TInt err = DoConnect(KAsyncMessageSlots);
-	return err;
+	return Connect(KAsyncMessageSlots);	 
 	}
 
 /**
@@ -52,15 +51,30 @@
  */
 EXPORT_C TInt RSsmAdaptationBase::Connect(TInt aAsyncMessageSlotCount)
 	{
-	const TInt err = DoConnect(aAsyncMessageSlotCount);
+	const TInt err = DoConnect(KSusAdaptionServerName, aAsyncMessageSlotCount);
 	return err;
-	}
+	} 
+
+/**
+ * This exists for testing purposes only
+ * @internalComponent
+ */
+#ifdef TEST_SSM_SERVER
 
-TInt RSsmAdaptationBase::DoConnect(TInt aAsyncMessageSlotCount)
+TInt RSsmAdaptationBase::Connect(const TDesC& aServerName)
+    {
+    return DoConnect(aServerName, KAsyncMessageSlots);
+    }
+#endif //TEST_SSM_SERVER
+
+/**
+ @internalComponent
+ */
+TInt RSsmAdaptationBase::DoConnect(const TDesC& aServerName, const TInt aAsyncMessageSlotCount)
 	{
 	if(!Handle())
 		{
-		return CreateSession(KSusAdaptionServerName, Version(), aAsyncMessageSlotCount);
+		return CreateSession(aServerName, Version(), aAsyncMessageSlotCount);
 		}
 	
 	return KErrAlreadyExists;
--- a/sysstatemgmt/systemstatemgr/sus/src/susadaptionserver.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/src/susadaptionserver.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -59,8 +59,8 @@
 	};
 
 //ESetAsPriorityClient request is allowed only for priotity clients(Telephony). Inorder to prevent the access
-//client request will be policed using C32 SID
-#define KC32SecureId 0x10003D33
+//client request will be policed using C32exe.exe SID
+#define KC32SecureId 0x101F7989
 
 /**
  Array containing the different security checks performed by this server 
@@ -168,8 +168,7 @@
 	}
  
  
-CSsmAdaptationServer::CSsmAdaptationServer( ): CPolicyServer(EPriorityStandard, KSusAdaptionServerPolicy)
-,iPriorityClientSession(NULL)
+CSsmAdaptationServer::CSsmAdaptationServer(): CPolicyServer(EPriorityStandard, KSusAdaptionServerPolicy)
 	{
 	}
 
@@ -207,15 +206,26 @@
  */
 CSsmAdaptationServer* CSsmAdaptationServer::NewLC( )
 	{
-	CSsmAdaptationServer* server = new(ELeave) CSsmAdaptationServer();
-	CleanupStack::PushL (server );
-	server->ConstructL ( );
-	return server;
+	return CSsmAdaptationServer::NewLC(KSusAdaptionServerName);
 	}
 
 /**
+ * Overloaded NewLC, which starts the server with the provided name.
+ @param aServerName - Name of the Server.
  */
-void CSsmAdaptationServer::ConstructL( )
+CSsmAdaptationServer* CSsmAdaptationServer::NewLC(const TDesC& aServerName)
+    {
+    CSsmAdaptationServer* server = new(ELeave) CSsmAdaptationServer();
+    CleanupStack::PushL(server);
+    server->ConstructL(aServerName);
+    return server;
+    }
+
+
+/**
+ * ConstructL()
+ */
+void CSsmAdaptationServer::ConstructL(const TDesC& aServerName)
 	{
 
 	__ASSERT_ALWAYS( KErrNone == User::SetCritical(User::ESystemCritical),
@@ -225,7 +235,7 @@
 			User::Panic(KPanicSsmSus, EAdaptionServerError2));
 
 	iSusAdaptationPluginLoader = CSusAdaptationPluginLoader::NewL();
-	TInt err = Start(KSusAdaptionServerName);
+	TInt err = Start(aServerName);
 #ifdef  TESTSUSADAPTATIONPLUGINLOAD_OOM
 	if (err != KErrNone && err != KErrAlreadyExists)
 		{
@@ -501,12 +511,8 @@
         {
         LoadEmergencyCallRfAdaptationL();    
         }
-
 	iEmergencyCallRfAdaptation->DoEmergencyCallRfAdaptationCancelL(aMessage);
 	}
-
-
-	
 	
 void CSsmAdaptationServer::LoadStateAdaptationL()
 	{
@@ -564,11 +570,9 @@
 	{
 	MEmergencyCallRfAdaptation *emergencyCallRfAdaptationPlugin = iSusAdaptationPluginLoader->CreateEmergencyCallRfAdaptationL();
     CleanupReleasePushL(*emergencyCallRfAdaptationPlugin);
-    //From here emergencyCallRfAdaptationPlugin object will be owned by iEmergencyCallRfAdaptation
-    iEmergencyCallRfAdaptation = CEmergencyCallRfAdaptation::NewL(*emergencyCallRfAdaptationPlugin);    
+	//From here emergencyCallRfAdaptationPlugin object will be owned by iEmergencyCallRfAdaptation
+    iEmergencyCallRfAdaptation = CEmergencyCallRfAdaptation::NewL(emergencyCallRfAdaptationPlugin);    
     CleanupStack::Pop(emergencyCallRfAdaptationPlugin);
-    //Reserve memory for performing Emergency call during OOM condition
-    iEmergencyCallRfAdaptation->ReserveMemoryL();    
 	}
 
 #ifdef _DEBUG
@@ -656,15 +660,21 @@
 	}
 
 CAdaptationMessage::CAdaptationMessage(const RMessage2 &aMessage): CBase(),iMessage(aMessage)
-,iMessageAvailable(ETrue),iUsingReservedHeap(EFalse)
 	{
 	}
  
 void CAdaptationMessage::Complete(TInt aReason)
 	{
-	iMessage.Complete(aReason);  	
+    if (!(iMessage.IsNull()))
+        {
+        iMessage.Complete(aReason);  	
+        }
 	}
 
+void CAdaptationMessage::SetMessage(const RMessage2& aMessage)
+    {
+    iMessage = const_cast<RMessage2&> (aMessage);
+    }
 
 void RSsmAdaptationRequestQueue::NotifyAndRemoveAll()
 	{
@@ -679,26 +689,6 @@
 	iQueue.Reset();		
 	}
 
-void RSsmAdaptationRequestQueue::NotifyAndRemoveAll(RHeap *aReservedHeap)
-    {
-    TInt index,count = iQueue.Count();
-    
-    for(index =0;index < count ;index++)
-        {
-        iQueue[index]->Complete(KErrServerTerminated);
-        if(iQueue[index]->iUsingReservedHeap)
-            {
-            aReservedHeap->Free(iQueue[index]);
-            }
-        else
-            {
-            delete iQueue[index];
-            }
-        iQueue[index] = NULL;
-        }
-    iQueue.Reset();     
-    }
-
 void RSsmAdaptationRequestQueue::Close()
 	{
 	iQueue.Close();
@@ -736,33 +726,6 @@
 	
 	}
 
-void RSsmAdaptationRequestQueue::RemoveFromQueueAndComplete(const RMessage2 &aMessage, RHeap *aReservedHeap )
-    {
-
-    CAdaptationMessage *messageToBeDeleted;
-    
-    // iQueue.Count() is recalculated each time as the object is removed from the 
-    // array(which reduces the number of object pointers in the array
-    for(TInt index = 0; index < iQueue.Count(); ++index )
-        {
-        if(aMessage.Session() == iQueue[index]->Session())
-            {
-            messageToBeDeleted = iQueue[index];
-            DEBUGPRINT2A("RSsmAdaptationRequestQueue(aMessage,ReservedHeap)called to cancel the request with function id: %d", messageToBeDeleted->Function());
-            iQueue.Remove(index);
-            messageToBeDeleted->Complete(KErrCancel);
-            if(messageToBeDeleted->iUsingReservedHeap)
-                {
-                aReservedHeap->Free(messageToBeDeleted);
-                }
-            else
-                {
-                delete messageToBeDeleted;
-                }
-            --index;
-            }
-        }
-    }
 void RSsmAdaptationRequestQueue::Dequeue(CAdaptationMessage *&aCurrentMessage)
 	{
 	aCurrentMessage = iQueue[0];
@@ -773,11 +736,6 @@
 	return iQueue.Append(aPendingRequest);
 	} 
 
-TInt RSsmAdaptationRequestQueue::Reserve(TInt aReserverCount)
-    {
-    return(iQueue.Reserve(aReserverCount));
-    }
-
 /**
  * Method to get number of object pointers in the Queue
  */
--- a/sysstatemgmt/systemstatemgr/sus/src/susemergencycallrfadaptation.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/sus/src/susemergencycallrfadaptation.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -18,23 +18,27 @@
 #include <e32debug.h>
 #include <ssm/ssmadaptation.h>
 #include "susemergencycallrfadaptation.h"
+#include "suspanic.h"
 
 
+//Count to reserve space for one Activate Rf call + one Deactive Rf message in Queue
+const TInt KReserveCount = 2;
 /**
- * Function used to cleanup the CAdaptationMessage object which is pushed to cleanup stack incase of Leave
- * CAdaptationMessage message will be freed back to reserved heap incase of it is created using reserved heap.
+ * Function used to cleanup the CAdaptationMessage object which is pushed on to the cleanup stack incase of Leave.
+ * CAdaptationMessage message will be reset to hold default values, if it is using the precreated message pointer.
  * or else message will be deleted.
  */
 static void DoCleanUp(TAny* aAdaptationMessage)
     {
-    TStoreAdaptationMessage* storeMessage = static_cast <TStoreAdaptationMessage*>(aAdaptationMessage);
-    if(storeMessage->iAdaptationMessage->iUsingReservedHeap)
+    CEmergencyAdaptationMessage* storeAdaptationMessage = static_cast <CEmergencyAdaptationMessage*>(aAdaptationMessage);
+    storeAdaptationMessage->Complete(KErrNone);
+    if(storeAdaptationMessage->IsMessageReserved())
         {
-        storeMessage->iReservedHeap->Free(storeMessage->iAdaptationMessage);
+        storeAdaptationMessage->UnsetMessageStatus(EMsgInUse);
         }
     else
         {
-        delete storeMessage->iAdaptationMessage;
+        delete storeAdaptationMessage;
         }
     }
 
@@ -43,71 +47,83 @@
 */
 void CEmergencyCallRfAdaptation::SubmitOrQueueL(const RMessage2 &aMessage)
 	{
-	CAdaptationMessage *messageCopy = NULL;	
-	TRAPD(err , messageCopy = new(ELeave) CAdaptationMessage(aMessage));
-	//Use preallocated heap for creating CAdaptationMessage under OOM condition, if it is a priority client
+    CEmergencyAdaptationMessage *storeAdaptationMessage = NULL;
+    TRAPD(err, storeAdaptationMessage = CEmergencyAdaptationMessage::NewL(aMessage));    
+    
+    //Allow only priority client to perform emergency call.
     if (KErrNoMemory == err && aMessage.Session() == iPriorityClientSession)
         {
-        DEBUGPRINT1A("CAdaptationMessage will be created using Reserved Heap");
-        TAny* messagePtr = iReservedHeap->AllocL(sizeof(CAdaptationMessage));
-        messageCopy = new (messagePtr)CAdaptationMessage(aMessage);
-        messageCopy->iUsingReservedHeap = ETrue;
+        DEBUGPRINT1A("CEmergencyAdaptationMessage will be created using reserved pointers");
+        if ( iReserveMsgCount == 0 )
+           {
+           DEBUGPRINT1A("There is no reserved message to perform emergency call");
+           User::Leave(err);
+           }
+        //Traverse through the reserved message array to look for free message.
+        for ( TInt index = 0 ; index < KReserveCount ; ++index )
+            {
+            //Use the reserve message, if it is not already used.
+            if (!(iAdaptationReservedMessageArray[index]->IsMessageInuse()))
+                {
+                iAdaptationReservedMessageArray[index]->SetMessage(aMessage);
+                iAdaptationReservedMessageArray[index]->SetMessageStatus(EMsgInUse);
+                storeAdaptationMessage = iAdaptationReservedMessageArray[index];
+                --iReserveMsgCount;
+                break;
+                }
+            }
         }
     else
         {
         User::LeaveIfError(err);
         }
-	  
 	if(!IsActive())
 		{
-		Submit(messageCopy);
+		Submit(storeAdaptationMessage);
 		}
 	else 
 		{
-		//Store the CAdaptationMessage pointer and iReservedHeap in a struct inorder to cleanup 
-		//depending on the reserved heap/normal heap used.
-		TStoreAdaptationMessage storeMessage;
-		storeMessage.iAdaptationMessage = messageCopy;
-		storeMessage.iReservedHeap = iReservedHeap;
-		CleanupStack::PushL(TCleanupItem(DoCleanUp, &storeMessage ));
+		//Push the CEmergencyAdaptationMessage pointer on to the cleanup stack and reset/delete the pointer
+		//depending on using precreated pointer/new pointer.
+		CleanupStack::PushL(TCleanupItem(DoCleanUp, storeAdaptationMessage ));
 		DEBUGPRINT2A("CEmergencyCallRfAdaptationRequests queueing request with function id: %d", aMessage.Function());
-		//Reserve heap only in non OOM condition
-		if(messageCopy->iUsingReservedHeap == EFalse)
+		//Reserve slot only in non OOM condition
+		if(!(storeAdaptationMessage->IsMessageReserved()))
 		    {
-		    //Always reserve 2 slots in queue for Emergency call requests. Slots will be reserved if count
-		    //to request memory(RPointerArray.Reserve(count)) is greater than the existing reserved memory in
-		    //RPonterArray. So there will be memory allocation only when
-		    //iPendingRequestsQueue.Count()+ reserveCount + 1(for the present message))
-		    // > already reserved memory.
-		    const TInt reserveCount = 2;
-		    err = iPendingRequestsQueue.Reserve(iPendingRequestsQueue.Count() + reserveCount + 1 );
+		    //Priority clients are allowed to queue only two(KReserveCount) emergengency call request in the OOM condition.
+		    //So always request to reserve only iPendingRequestsQueue.Count()+ iReserveMsgCount + 1
+		    //slots.
+		    //Memory will be only reserved if (iPendingRequestsQueue.Count()+ iReserveMsgCount + 1) > 
+		    //already reserved memory
+            TRAP(err, iPendingEmergencyRequestsQueue.ReserveL(iPendingEmergencyRequestsQueue.Count() + iReserveMsgCount + 1 )); 
 		    }
 		if(KErrNone == err || (KErrNoMemory == err && aMessage.Session() == iPriorityClientSession))
 		    {	 
-		    User::LeaveIfError(iPendingRequestsQueue.Queue(messageCopy));
+		    iPendingEmergencyRequestsQueue.AppendL(storeAdaptationMessage);
 		    }
 		else
 		    {
 		    User::Leave(err);
 		    }
-		CleanupStack::Pop(&storeMessage);
+		CleanupStack::Pop(storeAdaptationMessage);
 		}	
 	}
 
-void CEmergencyCallRfAdaptation::Submit(CAdaptationMessage*& aMessage)
+void CEmergencyCallRfAdaptation::Submit(CEmergencyAdaptationMessage*& aMessage)
 	{
+    __ASSERT_ALWAYS((iEmergencyCallRfAdaptation != NULL), User::Panic(KPanicSsmSus, EEmergencyCallRfAdaptationNullPtrError1));
 	DEBUGPRINT2A("CEmergencyCallRfAdaptationRequests immediate submission of request with function id: %d", aMessage->Function());
 	iCurrentMessage = aMessage;
 	switch(aMessage->Function())
 		{
 		case EActivateRfForEmergencyCall :
 			{
-			iEmergencyCallRfAdaptation.ActivateRfForEmergencyCall(iStatus);
+			iEmergencyCallRfAdaptation->ActivateRfForEmergencyCall(iStatus);
 			break;	
 			}
 		case EDeactivateRfForEmergencyCall :
 			{
-			iEmergencyCallRfAdaptation.DeactivateRfForEmergencyCall(iStatus);
+			iEmergencyCallRfAdaptation->DeactivateRfForEmergencyCall(iStatus);
 			break;	
 			}
 		default :
@@ -126,53 +142,80 @@
 @internalComponent
 */
 
-CEmergencyCallRfAdaptation* CEmergencyCallRfAdaptation::NewL(MEmergencyCallRfAdaptation& aAdaptation)
+CEmergencyCallRfAdaptation* CEmergencyCallRfAdaptation::NewL(MEmergencyCallRfAdaptation* aAdaptation)
 	{
-	CEmergencyCallRfAdaptation* self = new(ELeave) CEmergencyCallRfAdaptation(aAdaptation);
-	return self;	
+	CEmergencyCallRfAdaptation* self = new(ELeave) CEmergencyCallRfAdaptation();
+	CleanupStack::PushL(self);
+	self->ConstructL(aAdaptation);
+	CleanupStack::Pop(self);
+	return self;
 	}
+
+void CEmergencyCallRfAdaptation::ConstructL(MEmergencyCallRfAdaptation* aAdaptation)
+    {
+    ReserveMemoryL();
+    //Taking the ownership of emergencyCallRfAdaptationPlugin after all the leaving function have passed.
+    //If some function leaves before taking ownership of emergencyCallRfAdaptationPlugin, it will be released twice, which causes system to panic.
+    iEmergencyCallRfAdaptation = aAdaptation;
+    }
+
 /**
  * Function to reserve memory to make emergency call during OOM condition
  */
 void CEmergencyCallRfAdaptation :: ReserveMemoryL()
     {
     //Reserve space for one Activate Rf call + one Deactive Rf message in Queue.
-    const TInt reserveCount = 2;
-    // heap requested for one Active Rf call + one Deactive Rf
-    const TInt reservedHeap = reserveCount * sizeof(CAdaptationMessage);    
-    //heap is reserved for storing CAdaptationMessage during OOM condition.
-    iReservedHeap = UserHeap::ChunkHeap(NULL, reservedHeap, reservedHeap); 
-    //Leave with KErrNoMemory if iReservedHeap is NULL    
-    if(iReservedHeap == NULL)
+    iPendingEmergencyRequestsQueue.ReserveL(KReserveCount);
+    
+    //Pre-create an array to hold CEmergencyAdaptationMessage pointer, this is of size CEmergencyAdaptationMessage.
+    RMessage2 message;    
+    for( TInt index = 0 ; index < KReserveCount ; ++index )
         {
-        User::Leave(KErrNoMemory);
+        CEmergencyAdaptationMessage* adaptationMessage = NULL;
+        adaptationMessage = CEmergencyAdaptationMessage::NewL(message, EMsgReserved);
+        CleanupStack::PushL(adaptationMessage);
+        iAdaptationReservedMessageArray.AppendL(adaptationMessage);
+        CleanupStack::Pop(adaptationMessage);
         }
-    User::LeaveIfError(iPendingRequestsQueue.Reserve(reserveCount));   
     }
 
-
 CEmergencyCallRfAdaptation::~CEmergencyCallRfAdaptation()
 	{
-	iPendingRequestsQueue.NotifyAndRemoveAll(iReservedHeap);
+    NotifyAndRemoveAll();
 	Cancel();
-	iPendingRequestsQueue.Close();
-	if(iReservedHeap != NULL)
-	    {
-        iReservedHeap->Reset();
-        iReservedHeap->Close();
-	    }
+	iPendingEmergencyRequestsQueue.Close();	
+	iAdaptationReservedMessageArray.ResetAndDestroy();	 
 	Release();
 	}
 
-CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation(MEmergencyCallRfAdaptation& aAdaptation) : CActive(EPriorityStandard), iEmergencyCallRfAdaptation(aAdaptation)
-, iReservedHeap(NULL)
+void CEmergencyCallRfAdaptation::NotifyAndRemoveAll()
+    {
+    TInt count = iPendingEmergencyRequestsQueue.Count();
+    
+    for(TInt index =0; index < count; ++index)
+        {
+        iPendingEmergencyRequestsQueue[index]->Complete(KErrServerTerminated);
+        if (!(iPendingEmergencyRequestsQueue[index]->IsMessageReserved()))
+            {
+            delete iPendingEmergencyRequestsQueue[index];
+            }
+        iPendingEmergencyRequestsQueue[index] = NULL;
+        }
+    iPendingEmergencyRequestsQueue.Reset();
+    }
+
+CEmergencyCallRfAdaptation::CEmergencyCallRfAdaptation() : CActive(EPriorityStandard)
+,iReserveMsgCount(KReserveCount)
 	{
 	CActiveScheduler::Add(this);
 	}
 
 void CEmergencyCallRfAdaptation::Release()
 	{
-	iEmergencyCallRfAdaptation.Release();
+	if(iEmergencyCallRfAdaptation != NULL)
+	    {
+	    iEmergencyCallRfAdaptation->Release();
+	    }
 	}
 
 void CEmergencyCallRfAdaptation::DoActivateRfForEmergencyCallL(const RMessage2& aMessage)
@@ -187,15 +230,37 @@
 
 void CEmergencyCallRfAdaptation::DoEmergencyCallRfAdaptationCancelL(const RMessage2& aMessage)
 	{
-
+    __ASSERT_ALWAYS((iEmergencyCallRfAdaptation != NULL), User::Panic(KPanicSsmSus, EEmergencyCallRfAdaptationNullPtrError2));
+    
 	if(iCurrentMessage != NULL)	
 		{
 		if(aMessage.Session() == iCurrentMessage->Session())
 			{
 			DEBUGPRINT1A("CEmergencyCallRfAdaptationRequests cancelling current request as requested");
-			iEmergencyCallRfAdaptation.Cancel();
+			iEmergencyCallRfAdaptation->Cancel();
 			}
-		iPendingRequestsQueue.RemoveFromQueueAndComplete(aMessage, iReservedHeap);
+		CEmergencyAdaptationMessage *messageToBeDeleted;
+        for(TInt index = 0; index < iPendingEmergencyRequestsQueue.Count(); ++index )
+            {
+            if(aMessage.Session() == iPendingEmergencyRequestsQueue[index]->Session())
+                {
+                messageToBeDeleted = iPendingEmergencyRequestsQueue[index];
+                DEBUGPRINT2A("RSsmAdaptationRequestQueue(aMessage,ReservedHeap)called to cancel the request with function id: %d", messageToBeDeleted->Function());
+                iPendingEmergencyRequestsQueue.Remove(index);
+                messageToBeDeleted->Complete(KErrCancel);
+                //Reset the AdaptationMessage if it is created using reserved pointer or delete the pointer 
+                if(messageToBeDeleted->IsMessageReserved())
+                    {
+                    messageToBeDeleted->UnsetMessageStatus(EMsgInUse);
+                    ++iReserveMsgCount;
+                    }
+                else
+                    {
+                    delete messageToBeDeleted;
+                    }
+                --index;
+                }
+            }
 		
 		aMessage.Complete(KErrNone);
 		}
@@ -209,23 +274,16 @@
 
 void CEmergencyCallRfAdaptation::RunL()
 	{
-	
+    __ASSERT_DEBUG((iCurrentMessage != NULL), User::Panic(KPanicSsmSus, EEmergencyAdaptationMessageNullPtrError));
 	DEBUGPRINT2A("CEmergencyCallRfAdaptationRequests processed the request with funtion id: %d", iCurrentMessage->Function());
 	iCurrentMessage->Complete(iStatus.Int());
-	if(iCurrentMessage->iUsingReservedHeap)
-        {
-        iReservedHeap->Free(iCurrentMessage);
-        }
-    else
-        {
-        delete iCurrentMessage;
-        }
+	DeleteAdaptationMessage();
 	iCurrentMessage = NULL;  
 
-	if( (iPendingRequestsQueue.IsEmpty()) == EFalse )
+	if( (iPendingEmergencyRequestsQueue.Count()) > 0 )
 		{
-		CAdaptationMessage *messageCopy = NULL;
-		iPendingRequestsQueue.Dequeue(messageCopy);		
+        CEmergencyAdaptationMessage *messageCopy = NULL;
+        Dequeue(messageCopy);				
 		Submit(messageCopy);
 		} 
 	}
@@ -235,32 +293,18 @@
 	
 	if(iCurrentMessage != NULL)	
 		{
-		iCurrentMessage->Complete(aError);
-        if(iCurrentMessage->iUsingReservedHeap)
-            {
-            iReservedHeap->Free(iCurrentMessage);
-            }
-        else
-            {
-            delete iCurrentMessage;
-            }
+        iCurrentMessage->Complete(aError);
+		DeleteAdaptationMessage();
 		iCurrentMessage = NULL;
 		}
 	
-	while( (iPendingRequestsQueue.IsEmpty()) == EFalse )
-		{
-		iPendingRequestsQueue.Dequeue(iCurrentMessage);
-		iCurrentMessage->Complete(aError);
-		if(iCurrentMessage->iUsingReservedHeap)
-            {
-            iReservedHeap->Free(iCurrentMessage);
-            }
-        else
-            {
-            delete iCurrentMessage;
-            }
-		iCurrentMessage = NULL;
-		}
+	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
+        {
+        Dequeue(iCurrentMessage);
+        iCurrentMessage->Complete(aError);
+        DeleteAdaptationMessage();
+        iCurrentMessage = NULL;
+        }
 	
 	return KErrNone;
 		
@@ -271,30 +315,16 @@
 	if(iCurrentMessage != NULL)	
 		{
 		iCurrentMessage->Complete(KErrCancel);
-		if(iCurrentMessage->iUsingReservedHeap)
-            {
-            iReservedHeap->Free(iCurrentMessage);
-            }
-        else
-            {
-            delete iCurrentMessage;
-            }
+		DeleteAdaptationMessage();
 		iCurrentMessage = NULL;
 		}
 		
-	while( (iPendingRequestsQueue.IsEmpty()) == EFalse )
+	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
 		{
-		iPendingRequestsQueue.Dequeue(iCurrentMessage);
-		iCurrentMessage->Complete(KErrCancel);
-		if(iCurrentMessage->iUsingReservedHeap)
-            {
-            iReservedHeap->Free(iCurrentMessage);
-            }
-        else
-            {
-            delete iCurrentMessage;
-            }
-		iCurrentMessage = NULL;
+        Dequeue(iCurrentMessage);
+        iCurrentMessage->Complete(KErrCancel);
+        DeleteAdaptationMessage();
+        iCurrentMessage = NULL;
 		}
 	}
 
@@ -314,3 +344,128 @@
     iPriorityClientSession = NULL;
     }
 
+/**
+ * Reset the AdaptationMessage if it is created using reserved pointer or delete the pointer
+ */
+void CEmergencyCallRfAdaptation::DeleteAdaptationMessage()
+    {
+    if(iCurrentMessage->IsMessageReserved())
+        {
+        iCurrentMessage->UnsetMessageStatus(EMsgInUse);
+        ++iReserveMsgCount;
+        }
+    else
+        {
+        delete iCurrentMessage;
+        }    
+    }
+
+void CEmergencyCallRfAdaptation::Dequeue(CEmergencyAdaptationMessage *&aCurrentMessage)
+    {
+    aCurrentMessage = iPendingEmergencyRequestsQueue[0];
+    iPendingEmergencyRequestsQueue.Remove(0);
+    }
+
+/**
+ * Constructor.
+ */
+CEmergencyAdaptationMessage::CEmergencyAdaptationMessage(const TInt8 aMessageStatus): iAdaptationMessage(NULL), iMessageStatus(0)
+    {
+    iMessageStatus |= aMessageStatus ;
+    }
+
+/**
+ * Destructor.
+ */
+CEmergencyAdaptationMessage::~CEmergencyAdaptationMessage()
+    {
+    if (iAdaptationMessage != NULL)
+        {
+        delete iAdaptationMessage;
+        }
+    }
+
+CEmergencyAdaptationMessage* CEmergencyAdaptationMessage::NewL(const RMessage2& aMessage)
+    {
+    return CEmergencyAdaptationMessage::NewL(aMessage, EMsgStatusNULL);
+    }
+
+CEmergencyAdaptationMessage* CEmergencyAdaptationMessage::NewL(const RMessage2& aMessage, const TInt8 aMessageStatus)
+    {
+    CEmergencyAdaptationMessage* self = new(ELeave) CEmergencyAdaptationMessage(aMessageStatus);
+    //custom cleanup is not required here as it is a normal message till this point.
+    CleanupStack::PushL(self);
+    self->ConstructL(aMessage);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+void CEmergencyAdaptationMessage::ConstructL(const RMessage2& aMessage)
+    {
+    iAdaptationMessage = new (ELeave)CAdaptationMessage(aMessage);     
+    }
+
+void CEmergencyAdaptationMessage::Complete(TInt aReason)
+    {
+    if (iAdaptationMessage != NULL)
+        {
+        iAdaptationMessage->Complete(aReason);
+        }
+    }
+
+/**
+ * Function to check whether the messages is using reserved heap or not.
+ */
+inline TBool CEmergencyAdaptationMessage::IsMessageReserved()  const
+    {    
+    return (iMessageStatus & EMsgReserved)? ETrue:EFalse;    
+    }
+
+/**
+ * Function to check whether the reserved messages is in use or not.
+ */
+inline TBool CEmergencyAdaptationMessage::IsMessageInuse() const 
+    {    
+    return (iMessageStatus & EMsgInUse)? ETrue:EFalse;    
+    }
+
+/**
+ * Unset the message status .
+ */
+inline void CEmergencyAdaptationMessage::UnsetMessageStatus(const TInt8 aMessageStatus)
+    {    
+    iMessageStatus &= ~aMessageStatus ;
+    }
+
+/**
+ * Set the message status .
+ */
+inline void CEmergencyAdaptationMessage::SetMessageStatus(const TInt8 aMessageStatus)
+    {    
+    iMessageStatus |= aMessageStatus ;
+    }
+
+/**
+ * Sets the RMessage2 .
+ */
+void CEmergencyAdaptationMessage::SetMessage(const RMessage2& aMessage)
+    {    
+    iAdaptationMessage->SetMessage(aMessage);
+    }
+
+/**
+ * Returns the Function .
+ */
+TInt CEmergencyAdaptationMessage::Function() const
+    {    
+    return iAdaptationMessage->Function();
+    }
+
+/**
+ * Returns the Session .
+ */
+CSession2 *CEmergencyAdaptationMessage::Session() const
+    {
+    return iAdaptationMessage->Session();
+    }
+
--- a/sysstatemgmt/systemstatemgr/test/tsus/group/tsus_ssmutilsrv.mmp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/test/tsus/group/tsus_ssmutilsrv.mmp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -33,6 +33,9 @@
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
+// Used for making the production code changes in the server available only for test code.
+macro			TEST_SSM_SERVER
+
 
 // production code
 USERINCLUDE		../../../localinc
@@ -57,6 +60,7 @@
 SOURCE			susmiscadaptation.cpp
 SOURCE			susemergencycallrfadaptation.cpp
 SOURCE 			susadaptationpluginloader.cpp
+SOURCE 			ssmadaptationcli.cpp
 
 
 // testcode
@@ -69,6 +73,7 @@
 SOURCE			tsus_server.cpp
 SOURCE			tsus_ssmsuscli.cpp
 SOURCE			tsus_startserver.cpp
+SOURCE			tsus_startadaptationserver.cpp
 SOURCE			tsus_step_supinfo.cpp
 SOURCE			tsus_step_suploader.cpp
 SOURCE			tsus_step_platsec.cpp
@@ -79,12 +84,12 @@
 SOURCE          tsus_step_susadaptationpluginloader.cpp
 SOURCE 			tsus_step_loadadaptationserver.cpp
 
+
 LIBRARY			euser.lib
 LIBRARY			efsrv.lib
 LIBRARY			estor.lib
 LIBRARY			testexecuteutils.lib 
 LIBRARY			testexecutelogclient.lib 
 LIBRARY			ssmcmn.lib
-LIBRARY 		ssmadaptationcli.lib
 
 SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysstatemgmt/systemstatemgr/test/tsus/inc/tsus_startadaptationserver.h	Sat Feb 20 00:05:00 2010 +0200
@@ -0,0 +1,35 @@
+// 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:Test Adaptation server
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code 
+*/
+ 
+
+#ifndef __TSUS_STARTADAPTATIONSERVER_H__
+#define __TSUS_STARTADAPTATIONSERVER_H__
+
+#include <ssm/ssmsuscli.h>
+
+_LIT(KTestAdaptationServerName,	"AdaptationSrvTest");
+
+extern void RunAdaptationTestSrvL();
+extern TInt TestAdaptationSrvInitFunction(TAny* /*aNothing*/);
+extern TInt StartAdaptationServer(RThread& aServer);
+
+
+#endif //__TSUS_STARTADAPTATIONSERVER_H__
--- a/sysstatemgmt/systemstatemgr/test/tsus/inc/tsus_step_adaptionserver.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/test/tsus/inc/tsus_step_adaptionserver.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -16,7 +16,7 @@
 /**
  @file
  @test
- @internalComponent - Internal Symbian test code 
+ @internalComponent - Internal test code 
 */
  
 
@@ -33,8 +33,14 @@
 class RTestSusAdaptationCli : public RSsmEmergencyCallRfAdaptation
     {
 public:
+#ifdef TEST_SSM_SERVER
+    TInt Connect(const TDesC& aServerName);
+#endif 
     TInt SetHeapFailure(TInt aFailureRate);
     TInt UnSetHeapFailure();
+    TInt SetHeapMark();
+    TInt UnSetHeapMark();
+    
     };
 
 class CSusAdaptionServerTest : public CTestStep
@@ -51,11 +57,15 @@
 private:
 	void doTestForMemoryLeaksL();
 	void doTestProcessCriticalL();
-	void doTestOOML();
+	void doTestOOML();	
+	void StartAndDestroyServerL();
+#ifdef TEST_SSM_SERVER
 	void doTestForEmergencyCallOOM();
-	void StartAndDestroyServerL();
 	void doTestForSettingPriorityClient();
 	void doTestForNormalEmergencyCallinOOM();
+	void doTestForMultipleClientinOOMcondition();
+	void doTestForEmergencyCallOOMIterative();
+#endif
 	};
 
 #endif
--- a/sysstatemgmt/systemstatemgr/test/tsus/scripts/ssmatest_sus_adaptionserver.script	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/test/tsus/scripts/ssmatest_sus_adaptionserver.script	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -16,7 +16,7 @@
 PRINT Run SusAdaptionServerStep tests
 
 //Set the server with SID of telephony(c32 process) to test the emergency call under OOM condition
-RUN_PROGRAM -1 setcap tsus_ssmutilsrv.exe 0003FFFE -SID 10003D33 tsus_ssmutilsrv_WithC32_SID.exe
+RUN_PROGRAM -1 setcap tsus_ssmutilsrv.exe 00001134 -SID 101F7989  tsus_ssmutilsrv_WithC32_SID.exe
 
 
 LOAD_SUITE tsus_ssmutilsrv_WithC32_SID
@@ -36,6 +36,7 @@
 //!						4.Test to set SetPriorityClient() from two diff client 
 //!						5.Normal client calling Activate/DeactivateRfForEmergencyCall Rf in OOM condition
 //!						6.Multiple client performing Activate/DeactivateRfForEmergencyCall during OOM situation
+//!						7.Iterate the OOM through Activate/DeactivateRfForEmergencyCall
 //! @SYMTestExpectedResults 	The test ends with the following results:
 //! 					1.No error is reported a new object is created and the process is set to ESystemCritical.
 //! 					2.Intermediate iterations finish with KErrNoMemory with successful one completing with KErrNone. Memory is not leaked in any iteration.
@@ -43,5 +44,6 @@
 //!						4.Call to SetPriorityClient() with error KErrAlreadyExists fails from the second client
 //!						5.Call fails with KErrNoMemory.
 //!						6.Only Priority client will be able to perform  Activate/DeactivateRfForEmergencyCall, for other client KErrNoMemory will be returned
+//!						7.Activate/DeactivateRfForEmergencyCall works fine.
 RUN_TEST_STEP 100 tsus_ssmutilsrv_WithC32_SID  SusAdaptionServerStep
-END_TESTCASE 			DEVSRVS-SSMA-SUS-0011
\ No newline at end of file
+END_TESTCASE 			DEVSRVS-SSMA-SUS-0011
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysstatemgmt/systemstatemgr/test/tsus/src/tsus_startadaptationserver.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -0,0 +1,92 @@
+// 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:Test Adaptation server 
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal test code 
+*/
+
+#include <e32base.h>
+#include "tsus_startadaptationserver.h"
+#include "susadaptionserver.h"
+#include "ssmdebug.h"
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Test-Server startup code
+////////////////////////////////////////////////////////////////////////////////
+
+void RunAdaptationTestSrvL()
+	{
+	__UHEAP_MARK;
+	CActiveScheduler* sched = new(ELeave) CActiveScheduler();
+    CleanupStack::PushL( sched );
+    CActiveScheduler::Install( sched );
+
+    CSsmAdaptationServer* server = CSsmAdaptationServer::NewLC(KTestAdaptationServerName);
+    RThread::Rendezvous( KErrNone );
+    
+    CActiveScheduler::Start();
+
+    CleanupStack::PopAndDestroy( server );
+    CleanupStack::PopAndDestroy( sched );
+    __UHEAP_MARKEND;
+	} //lint !e1746 Suppress parameter 'aSid' could be made const reference
+
+/**
+ This function is called when the TestServer's thread is resumed.
+ */
+TInt TestAdaptationSrvInitFunction(TAny* /*aNothing*/)
+	{
+    CTrapCleanup* cleanup=CTrapCleanup::New();
+	TInt err = KErrNoMemory;
+	if (cleanup)
+		{
+	    TRAP( err, RunAdaptationTestSrvL());
+	    delete cleanup;
+		}
+    return err;
+	}
+
+/**
+ */
+TInt StartAdaptationServer(RThread& aServer)
+	{
+	DEBUGPRINT2( _L("Starting test-server %S"), &KTestAdaptationServerName );
+	
+	const TInt KMinHeapSize =  0x1000; // 4kB
+	const TInt KMaxHeapSize = 0x100000;// 1MB
+	
+	
+	TInt err = aServer.Create( KTestAdaptationServerName, &TestAdaptationSrvInitFunction, 
+	                                 KDefaultStackSize, KMinHeapSize, KMaxHeapSize, 
+	                                 NULL);
+	if( KErrNone == err )
+		{
+		TRequestStatus trs;
+		aServer.Rendezvous( trs );
+		aServer.Resume();
+		
+		User::WaitForRequest( trs );	
+		
+		//We can't use the 'exit reason' if the server panicked as this is the 
+		//panic 'reason' and may be '0' which cannot be distinguished from KErrNone
+		err = (aServer.ExitType()==EExitPanic) ? KErrGeneral : trs.Int();
+		}
+
+	return err;
+	}
--- a/sysstatemgmt/systemstatemgr/test/tsus/src/tsus_step_adaptionserver.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatemgr/test/tsus/src/tsus_step_adaptionserver.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// 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"
@@ -20,9 +20,19 @@
 */
 
 #include "susadaptionserver.h"
-
+#include <ssm/ssmadaptationcli.h>
 #include "tsus_step_adaptionserver.h"
+#include "tsus_startadaptationserver.h"
 
+#ifdef TEST_SSM_SERVER
+/**
+ * Overloaded function to Connect to the Test Adaptation server
+ */
+TInt RTestSusAdaptationCli::Connect(const TDesC& aServerName)
+    {
+    return RSsmEmergencyCallRfAdaptation::Connect(aServerName);
+    }
+#endif //TEST_SSM_SERVER
 /**
  * Client interface to simulate Heap failure at server side
  */
@@ -46,6 +56,27 @@
         }
     return KErrDisconnected;
     }
+
+TInt RTestSusAdaptationCli::SetHeapMark()
+    {
+    if(Handle())
+        {
+        return SendReceive(EDebugMarkHeap);
+        }
+    return KErrDisconnected;
+    }
+
+/**
+ * Client interface to restore Heap Mark
+ */
+TInt RTestSusAdaptationCli::UnSetHeapMark()
+    {
+    if(Handle())
+        {
+        return SendReceive(EDebugMarkHeapEnd);
+        }
+    return KErrDisconnected;
+    }
  
 CSusAdaptionServerTest::~CSusAdaptionServerTest()
 	{
@@ -79,11 +110,13 @@
 	TEST(KErrNone == err || KErrAlreadyExists == err);
 	TRAP(err, doTestOOML());
 	TEST(err == KErrNone);	
-	
+#ifdef TEST_SSM_SERVER	
 	doTestForNormalEmergencyCallinOOM();
 	doTestForEmergencyCallOOM();
 	doTestForSettingPriorityClient();
-	
+	doTestForMultipleClientinOOMcondition();
+	doTestForEmergencyCallOOMIterative();
+#endif //TEST_SSM_SERVER
 	__UHEAP_MARKEND;
 	
 	INFO_PRINTF1(_L("....CSusAdaptionServerTest tests completed!"));
@@ -191,7 +224,7 @@
 	INFO_PRINTF1(_L("Destroy SSM adaptation server."));
 	delete server;
 	}
-
+#ifdef TEST_SSM_SERVER
 /**
  * Tests for client calling Activate/Deactivate Rf without setting as priorityclient.
  */
@@ -199,16 +232,20 @@
     {
     INFO_PRINTF1(_L("doTestForNormalEmergencyCallinOOM started."));
     __UHEAP_MARK;
+    RThread thread;
+    CleanupClosePushL(thread);
+    TESTL(KErrNone == StartAdaptationServer(thread));
+      
     RTestSusAdaptationCli adaptationclitest;    
-    TInt err = adaptationclitest.Connect();
+    TInt err = adaptationclitest.Connect(KTestAdaptationServerName);
     INFO_PRINTF2(_L("Connect() returned Error %d : Expected Error is KErrNone."),err);
     TEST(err == KErrNone);
     TRequestStatus status;
     // Simulate OOM condition
-    User::__DbgSetAllocFail(EFalse, RAllocator::EDeterministic, 1);
     User::__DbgSetAllocFail(ETrue, RAllocator::EDeterministic, 1);
     //Simulate OOM at Serverside
     adaptationclitest.SetHeapFailure(1);
+    adaptationclitest.SetHeapMark();
     //Normal client calling ActivateRfForEmergencyCall Rf in OOM condition. This call must fail with KErrNoMemory 
     //as there is no memory reserved.
     adaptationclitest.ActivateRfForEmergencyCall(status);
@@ -216,10 +253,12 @@
     User::WaitForRequest(status);    
     //Restore OOM condition
     adaptationclitest.UnSetHeapFailure();
-    adaptationclitest.Close();
-    User::__DbgSetAllocFail(EFalse, RAllocator::ENone, 1);
+    adaptationclitest.UnSetHeapMark();
+    adaptationclitest.Close();    
     User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);
     TEST(status.Int() == KErrNoMemory);
+    thread.Kill(KErrNone);
+    CleanupStack::PopAndDestroy(&thread);
     __UHEAP_MARKEND;
     INFO_PRINTF1(_L("doTestForNormalEmergencyCallinOOM completed.")); 
     }
@@ -233,18 +272,18 @@
     {
     INFO_PRINTF1(_L("doTestForEmergencyCallOOM started."));
     __UHEAP_MARK;
+    RThread thread;
+    CleanupClosePushL(thread); 
+    TESTL(KErrNone == StartAdaptationServer(thread));
     RTestSusAdaptationCli adaptationclitest;    
-    TInt err = adaptationclitest.Connect();
+    TInt err = adaptationclitest.Connect(KTestAdaptationServerName);
     INFO_PRINTF2(_L("Connect() returned Error %d : Expected Error is KErrNone."),err);
-    TEST(err == KErrNone);
+    TEST(err == KErrNone);    
     err = adaptationclitest.SetAsPriorityClient();
+    adaptationclitest.SetHeapMark();
     INFO_PRINTF2(_L("SetAsPriorityClient() returned Error %d : Expected Error is KErrNone."),err);
     TEST(err == KErrNone);
-    //Activate Rf + Deactivate Rf during non OOM situation.
-    //Calls will be queued and processed one after the other. After 3 consecutive requests for 
-    //ActivateRfForEmergencyCall(), first call will be submitted directly to process and other two calls 
-    // will get queued. By end of this process will be having (count + 2) reserved memory in queue.i.e 4 reserved slots
-    TRequestStatus status1,status2,status3,status4,status5,status6; 
+    TRequestStatus status1,status2,status3,status4,status5,status6,status7; 
     adaptationclitest.ActivateRfForEmergencyCall(status1); 
     adaptationclitest.ActivateRfForEmergencyCall(status2);
     adaptationclitest.ActivateRfForEmergencyCall(status3);
@@ -256,41 +295,47 @@
     TEST(status2.Int() == KErrNone);
     TEST(status3.Int() == KErrNone);
     // Simulate OOM condition
-    User::__DbgSetAllocFail(EFalse, RAllocator::EDeterministic, 1);
     User::__DbgSetAllocFail(ETrue, RAllocator::EDeterministic, 1);
     //Simulate OOM at Serverside
     adaptationclitest.SetHeapFailure(1);
  
-    //After the above 2 calls to Activate the Rfs, will be left with 4 reserved memory in queue, so in OOM
-    //condition client can queue 4 activate/deactivate requests.The 5th request will fail with KErrNoMemory
+    //Two simulataneous calls for Active/deactivate Rf are allowed. The 3rd simultaneous request fail with KErrNoMemory
     adaptationclitest.ActivateRfForEmergencyCall(status1); 
-    adaptationclitest.ActivateRfForEmergencyCall(status2);
-    adaptationclitest.DeactivateRfForEmergencyCall(status3);
-    adaptationclitest.DeactivateRfForEmergencyCall(status4);
-    adaptationclitest.DeactivateRfForEmergencyCall(status5);
-    adaptationclitest.DeactivateRfForEmergencyCall(status6);
+    adaptationclitest.DeactivateRfForEmergencyCall(status2);    
+    adaptationclitest.ActivateRfForEmergencyCall(status3);
     // Wait for completion of requests
     User::WaitForRequest(status1);
     User::WaitForRequest(status2);
     User::WaitForRequest(status3);
+  
+    //If the previous request for Activate/Deactivate is already finished. User can perform 2 more calls.
+    adaptationclitest.ActivateRfForEmergencyCall(status4); 
+    adaptationclitest.DeactivateRfForEmergencyCall(status5);
+    
     User::WaitForRequest(status4);
     User::WaitForRequest(status5);
-    User::WaitForRequest(status6);    
+    
+    adaptationclitest.ActivateRfForEmergencyCall(status6); 
+    adaptationclitest.DeactivateRfForEmergencyCall(status7);  
+    adaptationclitest.Cancel();
+    // Wait for completion of requests
+    User::WaitForRequest(status6);
+    User::WaitForRequest(status7);
     
     //Restore OOM condition
     adaptationclitest.UnSetHeapFailure();
-    User::__DbgSetAllocFail(EFalse, RAllocator::ENone, 1);
     User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);
     TEST(status1.Int() == KErrNone);
     TEST(status2.Int() == KErrNone);
-    TEST(status3.Int() == KErrNone);
+    TEST(status3.Int() == KErrNoMemory);
     TEST(status4.Int() == KErrNone);
     TEST(status5.Int() == KErrNone);
-    //6th request will fail with KErrNoMemory if, above 5 requests are still queued and there is no reserved slot for
-    //6th one..otherwise, 6th request will be queued and processed
-    TEST(status6.Int() == KErrNoMemory || status6.Int() == KErrNone);
-    
+    TEST(status6.Int() == KErrNone);
+    TEST(status7.Int() == KErrCancel);    
+    adaptationclitest.UnSetHeapMark();
     adaptationclitest.Close();
+    thread.Kill(KErrNone);
+    CleanupStack::PopAndDestroy(&thread);
     __UHEAP_MARKEND;
     INFO_PRINTF1(_L("doTestForEmergencyCallOOM completed."));        
     }
@@ -302,13 +347,16 @@
     {
     INFO_PRINTF1(_L("doTestForSettingPriorityClient started."));
     __UHEAP_MARK;
+    RThread thread;
+    CleanupClosePushL(thread);
+    TESTL(KErrNone == StartAdaptationServer(thread));
     RTestSusAdaptationCli adaptationclitest1;
-    TInt err = adaptationclitest1.Connect();
+    TInt err = adaptationclitest1.Connect(KTestAdaptationServerName);
     INFO_PRINTF2(_L("adaptationclitest1.Connect() returned Error %d : Expected Error is KErrNone."),err);   
     TEST(err == KErrNone);
     
     RTestSusAdaptationCli adaptationclitest2;
-    err = adaptationclitest2.Connect();
+    err = adaptationclitest2.Connect(KTestAdaptationServerName);
     INFO_PRINTF2(_L("adaptationclitest2.Connect() returned Error %d : Expected Error is KErrNone."),err);   
     TEST(err == KErrNone);
        
@@ -323,7 +371,152 @@
     // Restore OOM condition
     adaptationclitest1.Close();
     adaptationclitest2.Close();
+    
+    thread.Kill(KErrNone);
+    CleanupStack::PopAndDestroy(&thread);
     __UHEAP_MARKEND;
     INFO_PRINTF1(_L("doTestForSettingPriorityClient completed."));
     }
 
+/**
+ * Multiple clients performing Emergency call during OOM situation
+ */
+void CSusAdaptionServerTest::doTestForMultipleClientinOOMcondition()
+    {
+    INFO_PRINTF1(_L("doTestForMultipleClientinOOMcondition started."));
+    __UHEAP_MARK;
+    RThread thread;
+    CleanupClosePushL(thread); 
+    
+    TESTL(KErrNone == StartAdaptationServer(thread));
+    RTestSusAdaptationCli adaptationclitest1;
+    TInt err = adaptationclitest1.Connect(KTestAdaptationServerName);
+    INFO_PRINTF2(_L("adaptationclitest1.Connect() returned Error %d : Expected Error is KErrNone."),err);   
+    TEST(err == KErrNone);
+    
+    RTestSusAdaptationCli adaptationclitest2;
+    err = adaptationclitest2.Connect(KTestAdaptationServerName);
+    INFO_PRINTF2(_L("adaptationclitest2.Connect() returned Error %d : Expected Error is KErrNone."),err);   
+    TEST(err == KErrNone);
+    
+    RTestSusAdaptationCli adaptationclitest3;
+    err = adaptationclitest3.Connect(KTestAdaptationServerName);
+    INFO_PRINTF2(_L("adaptationclitest3.Connect() returned Error %d : Expected Error is KErrNone."),err);   
+    TEST(err == KErrNone);
+       
+    err = adaptationclitest1.SetAsPriorityClient();
+    INFO_PRINTF2(_L("adaptationclitest1.SetAsPriorityClient() returned Error %d : Expected Error is KErrNone."),err);
+    TEST(err == KErrNone);
+    
+    err = adaptationclitest2.SetAsPriorityClient();
+    INFO_PRINTF2(_L("adaptationclitest2.SetAsPriorityClient() returned Error %d : Expected Error is KErrAlreadyExists."),err);
+    TEST(err == KErrAlreadyExists);
+    
+    err = adaptationclitest3.SetAsPriorityClient();
+    INFO_PRINTF2(_L("adaptationclitest3.SetAsPriorityClient() returned Error %d : Expected Error is KErrAlreadyExists."),err);
+    TEST(err == KErrAlreadyExists);
+    
+    TRequestStatus status1,status2,status3,status4,status5,status6;
+    // Simulate OOM condition
+    User::__DbgSetAllocFail(ETrue, RAllocator::EDeterministic, 1);
+    //Simulate OOM Condition on server side
+    adaptationclitest1.SetHeapFailure(1);
+    adaptationclitest1.SetHeapMark();
+    adaptationclitest1.ActivateRfForEmergencyCall(status1);
+    adaptationclitest2.ActivateRfForEmergencyCall(status2);
+    adaptationclitest3.ActivateRfForEmergencyCall(status3);
+    adaptationclitest1.DeactivateRfForEmergencyCall(status4);
+    adaptationclitest2.DeactivateRfForEmergencyCall(status5);
+    adaptationclitest3.DeactivateRfForEmergencyCall(status6);
+    
+    User::WaitForRequest(status1);
+    User::WaitForRequest(status2);
+    User::WaitForRequest(status3);
+    User::WaitForRequest(status4);
+    User::WaitForRequest(status5);
+    User::WaitForRequest(status6);    
+    // Restore OOM condition
+    adaptationclitest1.Close();
+    adaptationclitest2.Close();
+    adaptationclitest3.Close();
+    //Restore OOM condition
+    adaptationclitest1.UnSetHeapMark();
+    adaptationclitest1.UnSetHeapFailure();
+    User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);
+    //Priority client Performing Activate Rf returns KErrNone
+    TEST(status1.Int() == KErrNone);
+    //Normal clients performing Activate Rf fail with KErrNoMemory in OOM codition
+    TEST(status2.Int() == KErrNoMemory);
+    TEST(status3.Int() == KErrNoMemory);
+    //Priority client Performing Deactivate Rf returns KErrNone
+    TEST(status4.Int() == KErrNone);
+    //Normal clients peforming Deactivate Rf fail with KErrNoMemory in OOM codition
+    TEST(status5.Int() == KErrNoMemory);
+    TEST(status6.Int() == KErrNoMemory);
+    thread.Kill(KErrNone);
+    CleanupStack::PopAndDestroy(&thread);
+    __UHEAP_MARKEND;
+    INFO_PRINTF1(_L("doTestForMultipleClientinOOMcondition completed."));
+    }
+
+/**
+ * Tests for iterating heapfailure in ActivateRfForEmergencyCall and DeactivateRfForEmergencyCall.
+ */
+void CSusAdaptionServerTest::doTestForEmergencyCallOOMIterative()
+    {
+    INFO_PRINTF1(_L("doTestForEmergencyCallOOMIterative started."));
+    __UHEAP_MARK;
+    RThread thread;
+    CleanupClosePushL(thread);
+    TESTL(KErrNone == StartAdaptationServer(thread));
+    RTestSusAdaptationCli adaptationclitest;    
+    TInt err = adaptationclitest.Connect(KTestAdaptationServerName);
+    INFO_PRINTF2(_L("Connect() returned Error %d : Expected Error is KErrNone."),err);
+    TEST(err == KErrNone);    
+    err = adaptationclitest.SetAsPriorityClient();
+    INFO_PRINTF2(_L("SetAsPriorityClient() returned Error %d : Expected Error is KErrNone."),err);
+    TEST(err == KErrNone);
+    TRequestStatus status1,status2;
+    //simulate OOM at kernel
+    User::__DbgSetAllocFail(ETrue, RAllocator::EDeterministic, 1);
+    TInt maximumAllocation = 3;
+    //Iterate through the ActivateRfForEmergencyCall.
+    adaptationclitest.SetHeapMark();
+    for(TInt allocFailRate=1; allocFailRate <= 2*maximumAllocation; ++allocFailRate)
+        {
+        INFO_PRINTF2(_L("allocFailRateL %d:."), allocFailRate);
+        adaptationclitest.SetHeapFailure(allocFailRate);
+        adaptationclitest.ActivateRfForEmergencyCall(status1);
+        adaptationclitest.ActivateRfForEmergencyCall(status2);
+        User::WaitForRequest(status1);
+        User::WaitForRequest(status2);
+        TEST(status1.Int() == KErrNone);
+        TEST(status2.Int() == KErrNone);
+        }
+    
+    //Iterate through the DeactivateRfForEmergencyCall.    
+    for(TInt allocFailRate=1; allocFailRate < 2*maximumAllocation; allocFailRate++)
+        {
+        INFO_PRINTF2(_L("allocFailRateL %d:."), allocFailRate);
+        adaptationclitest.SetHeapFailure(allocFailRate);
+        adaptationclitest.DeactivateRfForEmergencyCall(status1);
+        adaptationclitest.DeactivateRfForEmergencyCall(status2);
+        User::WaitForRequest(status1);
+        User::WaitForRequest(status2);
+        TEST(status1.Int() == KErrNone);
+        TEST(status2.Int() == KErrNone);
+        }
+    adaptationclitest.UnSetHeapMark();
+    //Restore OOM condition
+    adaptationclitest.UnSetHeapFailure(); 
+    User::__DbgSetAllocFail(ETrue, RAllocator::ENone, 1);    
+    adaptationclitest.Close();
+    thread.Kill(KErrNone);
+    CleanupStack::PopAndDestroy(&thread);
+    __UHEAP_MARKEND;
+    INFO_PRINTF1(_L("doTestForEmergencyCallOOMIterative completed."));        
+    }
+
+#endif //TEST_SSM_SERVER
+
+
--- a/sysstatemgmt/systemstatereferenceplugins/clayer/group/bld.inf	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/clayer/group/bld.inf	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -47,8 +47,8 @@
 ../inc/securitynotification.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/securitynotification.h)
 ../inc/ssmpropertyobserver.h			SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/ssmpropertyobserver.h)
 ../inc/strtsecuritystatus.h				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/strtsecuritystatus.h)
-#ifdef SYMBIAN_OLD_EXPORT_LOCATION
-../inc/startupadaptationadapter.h		/epoc32/include/ssm/startupadaptationadapter.h
-#endif
+
+../inc/startupadaptationadapter.h		SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/startupadaptationadapter.h)
+
 ../inc/clayerswp.hrh 					/epoc32/include/ssm/clayerswp.hrh
 ../inc/clayerdlldatadefs.rh				SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(ssm/clayerdlldatadefs.rh)
--- a/sysstatemgmt/systemstatereferenceplugins/clayer/group/ssmclayersup.mmp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/clayer/group/ssmclayersup.mmp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -32,7 +32,6 @@
 USERINCLUDE		../inc
 USERINCLUDE 	../../localinc
 USERINCLUDE 	../../custcmd/inc
-USERINCLUDE	../../../../../../os/devicesrv/sysstatemgmt/systemstatereferenceplugins/custcmd/inc
 
 SOURCEPATH		../src
 SOURCE			ssmsecurityeventobserver.cpp
@@ -45,6 +44,9 @@
 SOURCEPATH		../../custcmd/src
 SOURCE			ssmsecuritychecknotifier.cpp
 
+SOURCEPATH		../../localsrc
+SOURCE			ssmpanic.cpp
+
 
 LIBRARY			euser.lib 
 LIBRARY			ssmuiproviderdll.lib
--- a/sysstatemgmt/systemstatereferenceplugins/clayer/inc/ssmsecuritynotecontroller.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/clayer/inc/ssmsecuritynotecontroller.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -15,7 +15,7 @@
 * Name        : strtsecuritynotecontroller.h
 * Part of     : System Startup / StrtSecObs
 * Declaration of CStrtSecurityNoteController class
-* Version     : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+* Version     : %version: 2 % << Don't touch! Updated by Synergy at check-out.
 * This material, including documentation and any related computer
 * programs, is protected by copyright controlled by Nokia.  All
 * rights are reserved.  Copying, including reproducing, storing,
@@ -43,6 +43,7 @@
  *  @released
 */
 
+
 class CSsmSecurityCheckNotifier;
 class CStrtSecNoteRequestQueue;
 
@@ -98,10 +99,16 @@
     /**
      * From CActive.
      * Handles an active object's request completion event.
-     * Never leaves.
      */
     virtual void RunL();
 
+	/**
+     * From CActive.
+     * Handles any leaves originating from the active object's RunL().
+     */
+        
+    virtual TInt RunError(TInt aError);
+
 private:
 
     /**
--- a/sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsecuritynotecontroller.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsecuritynotecontroller.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -14,7 +14,7 @@
 // Name        : strtsecuritynotecontroller.cpp
 // Part of     : System Startup / StrtSecObs
 // Implementation of CStrtSecurityNoteController class
-// Version     : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+// Version     : %version: 2 % << Don't touch! Updated by Synergy at check-out.
 // This material, including documentation and any related computer
 // programs, is protected by copyright controlled by Nokia.  All
 // rights are reserved.  Copying, including reproducing, storing,
@@ -33,6 +33,9 @@
 #include "ssmsecuritynotecontroller.h"
 #include "ssmsecuritychecknotifier.h"
 #include "ssmdebug.h"
+#include "ssmpanic.h"
+#include <ssm/ssmstatemanager.h>
+#include <ssm/startupreason.h>
 
 CStrtSecurityNoteController* CStrtSecurityNoteController::NewL()
     {
@@ -89,6 +92,36 @@
         SetActive();
         }
     }
+#ifdef _DEBUG
+TInt CStrtSecurityNoteController::RunError(TInt aError)
+#else
+TInt CStrtSecurityNoteController::RunError(TInt)
+#endif // _DEBUG
+    {
+    DEBUGPRINT2A("CStrtSecurityNoteController RunL completed with error %d", aError);
+#ifdef _DEBUG
+	PanicNow(KPanicSecurityNoteController, aError);
+#else
+    RSsmStateManager session;
+    TInt errorCode = session.Connect();
+    if ( KErrNone == errorCode )
+        {
+        TSsmStateTransition stateinfo( ESsmShutdown, KSsmAnySubState, EUnknownReset );
+        errorCode = session.RequestStateTransition( stateinfo );
+        if( KErrNone != errorCode )
+            {
+            PanicNow(KPanicSecurityNoteController, errorCode);
+            }
+        session.Close();
+        }
+	else
+		{
+        PanicNow(KPanicSecurityNoteController, errorCode);	
+		}
+#endif //_DEBUG
+
+    return KErrNone;
+    }
 
 CStrtSecurityNoteController::CStrtSecurityNoteController()
   : CActive( EPriorityStandard ),    
--- a/sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsimstatusobserver.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/clayer/src/ssmsimstatusobserver.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -155,10 +155,16 @@
  * 
  * @internalComponent
  */
+#ifdef _DEBUG
 TInt CSsmSimStatusObserver::RunError(TInt aError)
+#else 
+TInt CSsmSimStatusObserver::RunError(TInt)
+#endif // _DEBUG
 	{
 	DEBUGPRINT2A("CSsmSimStatusObserver RunError received error: %d", aError);
-	return aError;
+	//Errors are thrown if SWP transitions are not allowed.
+	//So, handles such errors gracefully.
+	return KErrNone;
 	}
 
 /**
--- a/sysstatemgmt/systemstatereferenceplugins/localinc/ssmpanic.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/localinc/ssmpanic.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -48,6 +48,7 @@
 _LIT(KPanicSsmUiSpecific, "CSsmUiSpecific");
 _LIT(KPanicCustomCmdDeviceSecurityCheck, "CCustomCmdDeviceSecurityCheck");
 _LIT(KPanicSecurityCheckNotifier, "CSsmSecurityCheckNotifier");
+_LIT(KPanicSecurityNoteController, "CStrtSecurityNoteController");
 
 
 /** Defines all possible panic codes within System State Management component
--- a/sysstatemgmt/systemstatereferenceplugins/test/tclayer/group/tclayer_server.mmp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/test/tclayer/group/tclayer_server.mmp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -141,4 +141,8 @@
 //Needed for security event observer
 SOURCE			ssmsecuritychecknotifier.cpp
 
+//Needed for security note controller
+SOURCEPATH		../../../localsrc
+SOURCE			ssmpanic.cpp
+
 SMPSAFE
Binary file sysstatemgmt/systemstatereferenceplugins/test/tintcustcmd/group/101F8762.txt has changed
Binary file sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/group/101F8762.txt has changed
--- a/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/inc/tcmd_step_publishstartupmode.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/inc/tcmd_step_publishstartupmode.h	Sat Feb 20 00:05:00 2010 +0200
@@ -25,12 +25,13 @@
 
 #include <test/testexecutestepbase.h>
 
-_LIT(KTCCustomCmdTestPublishStartupMode, "CCustomCmdTestPublishStartupMode");
+_LIT(KTestPublishStartupModeWithCap, "TestPublishStartupModeWithCap");
+_LIT(KTestPublishStartupModeWithoutCap,"TestPublishStartupModeWithoutCap");
 
 class CCustomCmdTestPublishStartupMode: public CTestStep
 	{
 public:
-	CCustomCmdTestPublishStartupMode();
+	CCustomCmdTestPublishStartupMode(const TDesC& aTestStepName);
 	~CCustomCmdTestPublishStartupMode();
 
 	//from CTestStep
@@ -48,6 +49,7 @@
     CActiveScheduler* iActiveScheduler;
     CAsyncCallBack* iAsyncStopScheduler;
     TRequestStatus iRequestStatus;
+    const TDesC& iTestStepName;
 	};
 
 #endif	// __TCMD_STEP_PUBLISHSTARTUPMODE_H__
--- a/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/scripts/ssrefpluginstest_custcmd_publishstartupmode.script	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/scripts/ssrefpluginstest_custcmd_publishstartupmode.script	Sat Feb 20 00:05:00 2010 +0200
@@ -19,11 +19,10 @@
 
 START_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0022
 //! @SYMTestCaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0022
-//! @SYMPREQ 			PREQ1871
 //! @SYMTestType		UT
 //! @SYMTestPriority		High
 //! @SYMTestStatus 		Implemented
-//! @SYMTestCaseDesc		Tests the behaviour of CCustomCmdPublishStartupMode.
+//! @SYMTestCaseDesc		Tests the behaviour of CCustomCmdPublishStartupMode with all the required capabilities (PowerMgmt,ProtServ & WriteDeviceData).
 //! 				Tests the cancel behaviour of CCustomCmdPublishStartupMode.
 //! @SYMTestActions		doTestCreateExecuteAndDestroyL() The test performs operations on a CCustomCmdPublishStartupMode object, namely calling the following methods:
 //! 					1.	NewL - Creating the object
@@ -37,6 +36,59 @@
 //! 					4.  	ExecuteCancel - Cancels the custom command
 //! 					5.  	Close - Closes the custom command
 //! @SYMTestExpectedResults 	Command should execute normally and should complete with KErrNone.
-RUN_TEST_STEP 100 tunitcustcmd_server CCustomCmdTestPublishStartupMode
+RUN_TEST_STEP 100 tunitcustcmd_server TestPublishStartupModeWithCap
 END_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0022
 
+RUN_PROGRAM 50 setcap.exe tunitcustcmd_server.exe 000024 tunitcustcmd_server_WithoutCap1.exe
+
+LOAD_SUITE tunitcustcmd_server_WithoutCap1
+
+START_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0032
+//! @SYMTestCaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0032
+//! @TaskID			bh1sosd4#32
+//! @SYMTestType		UT
+//! @SYMTestPriority		High
+//! @SYMTestStatus 		Implemented
+//! @SYMTestCaseDesc	Tests whether setting the Central Repository key 101f8762 fails without proper write capabilities (without ProtServ capability)	
+//! @SYMTestActions		doTestStepPreambleL() The test performs operations on a CRepository object, namely calling the following methods:
+//! 					1.	NewL - Creating the object
+//! 					2.	Set - Setting the Central Repository key
+//! @SYMTestExpectedResults 	Setting the Central Repository key 101f8762 should fail & complete with KErrPermissionDenied.
+RUN_TEST_STEP 100 tunitcustcmd_server_WithoutCap1 TestPublishStartupModeWithoutCap
+END_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0032
+
+RUN_PROGRAM 50 setcap.exe tunitcustcmd_server.exe 000120 tunitcustcmd_server_WithoutCap2.exe
+
+LOAD_SUITE tunitcustcmd_server_WithoutCap2
+
+START_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0033
+//! @SYMTestCaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0033
+//! @TaskID			bh1sosd4#32
+//! @SYMTestType		UT
+//! @SYMTestPriority		High
+//! @SYMTestStatus 		Implemented
+//! @SYMTestCaseDesc	Tests whether setting the Central repository key 101f8762 fails without write capabilities (without PowerMgmt capability)		
+//! @SYMTestActions		doTestStepPreambleL() The test performs operations on a CRepository object, namely calling the following methods:
+//! 					1.	NewL - Creating the object
+//! 					2.	Set - Setting the Central Repository key
+//! @SYMTestExpectedResults 	Setting the Central Repository key 101f8762 should fail & complete with KErrPermissionDenied.
+RUN_TEST_STEP 100 tunitcustcmd_server_WithoutCap2 TestPublishStartupModeWithoutCap
+END_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0033
+
+RUN_PROGRAM 50 setcap.exe tunitcustcmd_server.exe 000104 tunitcustcmd_server_WithoutCap3.exe
+
+LOAD_SUITE tunitcustcmd_server_WithoutCap3
+
+START_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0034
+//! @SYMTestCaseID 		DEVSRVS-SSREFPLUGINS-CUSTCMD-0034
+//! @TaskID			bh1sosd4#32
+//! @SYMTestType		UT
+//! @SYMTestPriority		High
+//! @SYMTestStatus 		Implemented
+//! @SYMTestCaseDesc	Tests whether setting the Central repository key 101f8762 fails without write capabilities (without WriteDeviceData capability)	
+//! @SYMTestActions		doTestStepPreambleL() The test performs operations on a CRepository object, namely calling the following methods:
+//! 					1.	NewL - Creating the object
+//! 					2.	Set - Setting the Central Repository key
+//! @SYMTestExpectedResults 	Setting the Central Repository key 101f8762 should fail & complete with KErrPermissionDenied.
+RUN_TEST_STEP 100 tunitcustcmd_server_WithoutCap3 TestPublishStartupModeWithoutCap
+END_TESTCASE 			DEVSRVS-SSREFPLUGINS-CUSTCMD-0034
\ No newline at end of file
--- a/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_server.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_server.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -126,10 +126,14 @@
 		{
 		testStep = new CCustomCmdTestCoopSysStateChange();
 		}
-	else if (aStepName == KTCCustomCmdTestPublishStartupMode)
+	else if (aStepName == KTestPublishStartupModeWithCap)
 		{
-		testStep = new CCustomCmdTestPublishStartupMode();
+		testStep = new CCustomCmdTestPublishStartupMode(KTestPublishStartupModeWithCap);
 		}
+	else if (aStepName == KTestPublishStartupModeWithoutCap)
+        {
+        testStep = new CCustomCmdTestPublishStartupMode(KTestPublishStartupModeWithoutCap);
+        }
 	else if (aStepName == KTCCustomCmdTestPublishSimOwnedAndChanged)
 	    {
 	    testStep = new CCustomCmdTestPublishSimOwnedAndChanged();
--- a/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_publishstartupmode.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/systemstatereferenceplugins/test/tunitcustcmd/src/tcmd_step_publishstartupmode.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -32,6 +32,7 @@
 #include <ssm/startupdomainpskeys.h>
 #include <ssm/starterdomaincrkeys.h>
 #include <e32property.h>
+#include <e32cmn.h>
 #include <centralrepository.h>
 
 //Exe name which defines startup PS keys
@@ -44,12 +45,19 @@
     delete iAsyncStopScheduler;
 	}
 
-CCustomCmdTestPublishStartupMode::CCustomCmdTestPublishStartupMode()
+CCustomCmdTestPublishStartupMode::CCustomCmdTestPublishStartupMode(const TDesC& aTestStepName):iTestStepName(aTestStepName)
 	{
-	SetTestStepName(KTCCustomCmdTestPublishStartupMode);
+    if (iTestStepName == KTestPublishStartupModeWithCap)
+        {
+        SetTestStepName(KTestPublishStartupModeWithCap);
+        }
+    else
+        {
+        SetTestStepName(KTestPublishStartupModeWithoutCap);
+        }
 	}
 
-//
+
 static TInt CallBackL(TAny* aCCustomCmdTestPublishStartupMode)
     {
     //Call back function to stop active scheduler
@@ -74,32 +82,35 @@
 
 TVerdict CCustomCmdTestPublishStartupMode::doTestStepPreambleL()
 	{
-	INFO_PRINTF1(_L("doTestStepPreambleL"));
-	//Create and install active scheduler
-	iActiveScheduler = new(ELeave) CActiveScheduler;
-	CActiveScheduler::Install (iActiveScheduler);
-
-   //Needed for calling callback for stopping active scheduler
-    iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle);
-
-	INFO_PRINTF1(_L("Define global startup mode property"));
-
-    RProcess process;
-	//Start the test exe which defines startup related property keys
-	TInt err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys());
-	INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err);
-	TEST(KErrNone == err);
-	User::LeaveIfError(err);
-	process.Resume();
-	
-	process.Rendezvous(iRequestStatus);
-	User::WaitForRequest(iRequestStatus);
-	TEST(KErrNone == iRequestStatus.Int());
-	
-	//Kill the define startup ps process
-	process.Kill(KErrNone);
-	process.Close();
-
+    INFO_PRINTF1(_L("doTestStepPreambleL"));
+    if (iTestStepName == KTestPublishStartupModeWithCap)
+        {
+        RProcess process;
+        CleanupClosePushL(process);
+        //Create and install active scheduler
+        iActiveScheduler = new(ELeave) CActiveScheduler;
+        CActiveScheduler::Install (iActiveScheduler);
+    
+        //Needed for calling callback for stopping active scheduler
+        iAsyncStopScheduler = new(ELeave) CAsyncCallBack(CActive::EPriorityIdle);
+    
+        INFO_PRINTF1(_L("Define global startup mode property"));
+    
+        //Start the test exe which defines startup related property keys
+        TInt err = process.Create(KExeToDefineStartUpPS, KStartUpPSKeys());
+        INFO_PRINTF2(_L("Define global startup mode property process created with %d"), err);
+        TEST(KErrNone == err);
+        User::LeaveIfError(err);
+        process.Resume();
+    
+        process.Rendezvous(iRequestStatus);
+        User::WaitForRequest(iRequestStatus);
+        TEST(KErrNone == iRequestStatus.Int());
+    
+        //Kill the define startup ps process
+        process.Kill(KErrNone);
+        CleanupStack::PopAndDestroy(&process);
+        }
 	return CTestStep::doTestStepPreambleL();
 	}
 
@@ -112,13 +123,30 @@
 	{
 	INFO_PRINTF1(_L("Entering test for publish startup mode custom command"));
 	__UHEAP_MARK;
-	
-	TRAPD(err, doTestCreateExecuteAndDestroyL());
-	TEST(err == KErrNone);
-	
-	TRAP(err, doTestFactoryCreateAndExecuteCancelL());
-	TEST(err == KErrNone);
-	
+	RProcess process(KCurrentProcessHandle);
+    if(!(process.HasCapability(ECapabilityPowerMgmt) && 
+       process.HasCapability(ECapabilityWriteDeviceData)&& 
+       process.HasCapability(ECapabilityProtServ)))
+		{
+		TUid KCentRepId = {0x101f8762}; 
+		CRepository* repository = NULL;
+		repository  = CRepository::NewL(KCentRepId);
+       
+		TInt ret = repository->Set(KStartupReason, ENormalStartup); 
+		delete repository;
+		INFO_PRINTF3(_L("Setting Central Repository key 101f8762 Return value = %d Expected value = %d"),ret, KErrPermissionDenied);
+		TEST(ret == KErrPermissionDenied);
+		}
+    else
+        {
+        TRAPD(err, doTestCreateExecuteAndDestroyL());
+        TEST(err == KErrNone);
+        
+        TRAP(err, doTestFactoryCreateAndExecuteCancelL());
+        TEST(err == KErrNone);
+        
+        
+        }
 	__UHEAP_MARKEND;
 	INFO_PRINTF1(_L("Leaving test for publish startup mode custom command"));
 	return TestStepResult();
@@ -138,8 +166,10 @@
     TUid KCentRepId = {0x101f8762}; 
     CRepository* repository = CRepository::NewL(KCentRepId);
     TInt ret = repository->Set(KStartupReason, ENormalStartup); 
-    delete repository;
-	
+    delete repository;  
+    INFO_PRINTF3(_L("Setting Central Repository key 101f8762 Return value = %d Expected value = %d"),ret, KErrNone);
+    TEST(ret == KErrNone);
+
     TInt startUpMode = -1;
     
     //Setting inital value of startUpMode as -1
--- a/sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/tsrc/public/basic/group/mt_rstartersession.mmp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* 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"
@@ -31,7 +31,7 @@
 
 USERINCLUDE     ../mt_rstartersession
 
-SYSTEMINCLUDE   /epoc32/include/digia/eunit
+SYSTEMINCLUDE    /epoc32/include/platform/digia/eunit
 
 OS_LAYER_SYSTEMINCLUDE
 
--- a/sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.cpp	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.cpp	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* 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"
@@ -162,45 +162,6 @@
     EUNIT_ASSERT_DESC( err == KErrNone, "Incorrect return value" );
     }
     
-void MT_RStarterSession::T_RStarterSession_AddItemInStartListLL(  )
-    {
-    TPtrC8 md5hash( KNullDesC8 );
-    TInt err = iRStarterSession.AddItemInStartListL(
-        KNullDesC,
-        EMonNone,
-        EExecutableType,
-        0,
-        md5hash );
-    EUNIT_PRINT( _L("AddItemInStartListL() err = %d"), err );
-    EUNIT_ASSERT_DESC( err == KErrPermissionDenied, "Incorrect return value. SID check has failed" );
-    }
-    
-void MT_RStarterSession::T_RStarterSession_AddItemInStartListL2L(  )
-    {
-    TInt err = iRStarterSession.AddItemInStartListL(
-        KNullDesC,
-        EMonNone,
-        EExecutableType,
-        0 );
-    EUNIT_PRINT( _L("AddItemInStartListL() err = %d"), err );
-    EUNIT_ASSERT_DESC( err == KErrPermissionDenied, "Incorrect return value. SID check has failed" );
-    }
-    
-void MT_RStarterSession::T_RStarterSession_RemoveItemFromStartListLL(  )
-    {
-    TInt err = iRStarterSession.RemoveItemFromStartListL( KNullDesC );
-    EUNIT_PRINT( _L("RemoveItemFromStartListL() err = %d"), err );
-    EUNIT_ASSERT_DESC( err == KErrPermissionDenied, "Incorrect return value. SID check has failed" );
-    }
-    
-void MT_RStarterSession::T_RStarterSession_SearchStartlistLL(  )
-    {
-    TInt err = iRStarterSession.SearchStartlistL( KNullDesC );
-    EUNIT_PRINT( _L("SearchStartlistL() err = %d"), err );
-    EUNIT_ASSERT_DESC( err == KErrPermissionDenied, "Incorrect return value. SID check has failed" );
-    }
-    
-
 //  TEST TABLE
 EUNIT_BEGIN_TEST_TABLE(
     MT_RStarterSession,
@@ -263,33 +224,6 @@
     "FUNCTIONALITY",
     SetupL, T_RStarterSession_EndSplashScreenL, Teardown)
     
-EUNIT_TEST(
-    "AddItemInStartListL - test9",
-    "RStarterSession",
-    "AddItemInStartListL - test9",
-    "FUNCTIONALITY",
-    SetupL, T_RStarterSession_AddItemInStartListLL, Teardown)
-    
-EUNIT_TEST(
-    "AddItemInStartListL - test10",
-    "RStarterSession",
-    "AddItemInStartListL - test10",
-    "FUNCTIONALITY",
-    SetupL, T_RStarterSession_AddItemInStartListL2L, Teardown)
-    
-EUNIT_TEST(
-    "RemoveItemFromStartListL - test11",
-    "RStarterSession",
-    "RemoveItemFromStartListL - test11",
-    "FUNCTIONALITY",
-    SetupL, T_RStarterSession_RemoveItemFromStartListLL, Teardown)
-    
-EUNIT_TEST(
-    "SearchStartlistL - test12",
-    "RStarterSession",
-    "SearchStartlistL - test12",
-    "FUNCTIONALITY",
-    SetupL, T_RStarterSession_SearchStartlistLL, Teardown)
 /*    
 EUNIT_TEST(
     "Shutdown - test3",
--- a/sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.h	Tue Feb 02 00:53:00 2010 +0200
+++ b/sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.h	Sat Feb 20 00:05:00 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
+* 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"
@@ -70,10 +70,6 @@
         void T_RStarterSession_ActivateRfForEmergencyCallL();
         void T_RStarterSession_DeactivateRfAfterEmergencyCallL();
         void T_RStarterSession_EndSplashScreenL();
-        void T_RStarterSession_AddItemInStartListLL();
-        void T_RStarterSession_AddItemInStartListL2L();
-        void T_RStarterSession_RemoveItemFromStartListLL();
-        void T_RStarterSession_SearchStartlistLL();
 
     private:    // Data